summaryrefslogtreecommitdiff
path: root/HACKING/mksource.md
blob: 01d759d095e6e59aaae06c9dd71fb53da937077b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
This is the internal libremakepkg program flow for a PKGBUILD with mksource().

<pre>
Given:
  * a PKGBUILD with a mksource() function and a repo.parabola.nu URL in source()
  * /etc/makepkg.d/librefetch.conf is sourced by makepkg.conf
  * the checksum has be generated with: `librefetch -g`, and added to mksha256sums()
  * mk*sums() is populated with a checksum for each mksource() (use: `librefetch -g`)
  * *sums() is populated with 'SKIP' for each source() (add it before publishing the PKGBUILD)

/usr/bin/libremakepkg
  -> msg 'Starting pre-build activities...'
  -> msg 'Downloading sources...'
  -> /usr/lib/libretools/chroot/makechrootpkg.sh::download_sources()

/usr/lib/libretools/chroot/makechrootpkg.sh::download_sources()
  -> /usr/bin/makepkg --allsource (w/ special ENV and in-chroot makepkg.conf)

/usr/bin/makepkg --allsource ($SOURCEONLY == 2):
  -> msg "Making package:"
  -> /usr/share/makepkg/source.sh::download_sources('allarch')

/usr/share/makepkg/source.sh::download_sources():
  -> msg "Retrieving sources..."
  -> (/usr/bin/librefetch is download agent)

/usr/bin/librefetch::doit()
  -> 'download' mode ($src == PKGBUILD::source() , $inmirror == true)
    -> if found
      -> return to /usr/bin/makepkg
    -> if not found
      -> 'create' mode
      -> /tmp/<SPECIAL>/makepkg -p /tmp/<SPECIAL>/PKGBUILD

/tmp/<SPECIAL>/makepkg (SOURCEONLY == 0):
  -> msg "Making source:"
  -> msg "Checking source dependencies..."
  -> /tmp/<SPECIAL>/source.sh::download_sources('allarch')

/tmp/<SPECIAL>/source.sh::download_sources():
  -> msg "Retrieving sources..."
  -> (/usr/bin/librefetch is download agent)

/usr/bin/librefetch::doit()
  -> 'download' mode ($src == PKGBUILD::mksource() , $inmirror == false)
  -> return to /tmp/<SPECIAL>/makepkg

/tmp/<SPECIAL>/makepkg (post-return from /usr/bin/librefetch):
  -> NOTE: all standard PKGBUILD functions are stubbed out,
             with the only purpose to run the real PKGBUILD::mksource()
           the standard functions in the real PKGBUILD will run later in the chroot
  -> msg "Validating source files"
  -> msg "Extracting sources..."
  -> msg "Starting prepare()"
  -> msg "Starting build()"
    -> msg "Starting mksource()"
    -> PKGBUILD::mksource()
  -> msg "Starting check()"
  -> msg "Starting package()"
  -> msg "Creating package"
  -> msg "Finished making:"

NOTE: here we rewind back to /usr/lib/libretools/chroot/makechrootpkg.sh::download_sources()
      to get/create the source-ball signature

/usr/bin/librefetch::doit()
  -> 'download' mode
    -> if not found
      -> 'create' mode ($src == PKGBUILD::source() , $inmirror == true)
        -> /usr/bin/librefetch::create_signature()

/usr/bin/librefetch::create_signature()
  -> msg "Signing package..."
  -> /usr/share/makepkg/integrity.sh::check_source_integrity()
    -> /usr/share/makepkg/integrity/verify_checksum.sh
      -> msg "Validating source files"
    -> /usr/share/makepkg/integrity/verify_signature.sh
      -> msg "Verifying source file signatures with gpg"

NOTE: here we rewind back to /tmp/<SPECIAL>/makepkg

/tmp/<SPECIAL>/makepkg:
  -> msg "Source package created:"
  -> exit

NOTE: then we rewind back to /usr/lib/libretools/chroot/makechrootpkg.sh::download_sources()
      which returns to /usr/bin/libremakepkg

/usr/bin/libremakepkg:
  -> msg "Starting to build the package"
  -> NOTE: build package in the normal way
</pre>