[pacman-dev] makepkg program flow and linearity

Dan McGee dpmcgee at gmail.com
Wed Dec 20 19:45:37 EST 2006

I feel like I haven't wrote enough emails to the list today, so here
is another. :) I wrote out this little chart for my own good today and
noticed that the flow is relatively linear, but some of the checks for
options play some crazy tricks on how it flows. In some sense, the
operations I list below can all be split up without overlap (read: be
made into functions).

I'm wondering if we should think a little more about program flow now
that all these options such as 'don't check dependencies' and 'use
existing source' are present? There are some very long sections of
code all indented inside an if-block, and it makes changing things a
lot harder (ex. the generate integrity/check integrity/extract sources
block). What if before each definable section, we do the 'if'
statement instead, even if it means two sections in a row might have
the same if clause?

I don't know if that explanation made sense, so let me know.

makepkg program flow and steps:
determine fakeroot status (using -F)
source makepkg.conf
set correct options from $ARGLIST
check for sudo
convert relative $PKGDEST to absolute
if $CLEANCACHE clean cache
unset all variables we use
check if buildscript exists
source buildscript
check for no-nos in build script
enter fakeroot if necessary (calling makepkg again)
check runtime dependencies
check buildtime dependencies
retrieve sources
loop through $INTEGRITY_CHECK
  if $GENINTEG generate integrity checks
  else check integrity checks
extract sources
check file ownership, remove pkg/, use distcc, use ccache
if $LOGGING log build
remove info/doc files
move man pages if necessary
remove possibly empty /usr/share directory
compress man pages
strip binaries
remove libtool files
remove empty directories
get package meta info and make .PKGINFO
check for an install script
build a filelist
tar up the package
if $CLEANUP then cleanup
if $RMDEPS then remove installed dependencies
if $INSTALL then install with sudo or as root, etc.


More information about the pacman-dev mailing list