[crux-devel] pkgutils reloaded

Alan Mizrahi alan+crux at mizrahi.com.ve
Fri Apr 22 10:29:19 UTC 2016

You are aboard a transatlantic flight on a packed A380, and the chicken 
served for lunch was tainted.  Of course, none of the pilots wanted the 
pasta, so there is no one left to guide the plane anymore!

Fortunately, the last act of bravery from the last pilot was to start 
the autopilot computer before colapsing, and as everybody knows, the 
autopilot software of Airbus is based on CRUX (tm).

But not all is roses: the engineers forgot to run revdep before the last 
update, so the computer is running but the software has to be rebuilt 
urgently, before the plane goes down!

As the only passenger familiar with CRUX [1], suddenly the lives of 
everybody on the plane are in your hands!

You locate the port and fire up pkgmk, but after 4 minutes the build 
process fails.  You quickly find out it built correctly, but the last 
"rm -r $PKG/usr/share/info" command failed.  You comment that line, and 
run pkgmk again.

As everybody knows, pkgmk has to start the build process from the 
beginning, taking up 4 more minutes of valuable time.

If only pkgmk had a "--pack-only" option, you could have used it to just 
generate the package without rebuilding, start the autopilot and become 
a hero.  Of course, this option would be much better if pkgmk 
automatically kept the work directory whenever the build fails.

Fear no more, as this patch [2] for pkgutils implements both features, 
and some more.

This allow you to save time and CPU cycles for long builds that fail, by 
finishing the build process manually, and then creating the package 
easily, instead of starting from scratch, or creating the package by hand.

1. set PKGMK_KEEP_WORK="failed" in /etc/pkgmk.conf, or use 
2. pkgmk
3. Oops, something went wrong. Fix it manually. Make sure everything is 
in $PKG.
4. pkgmk --pack-only

Here are all the changes implemented by this patch:
1. creates missing source, package and work directories automatically
2. prevents the creation of empty packages
3. detects number of CPUs and sets MAKEFLAGS accordingly
4. makes command-line options take priority over pkgmk.conf options
5. adds a DEBUG variable to build debug versions of packages easily:
    sudo -u pkgmk DEBUG=1 fakeroot pkgmk
6. adds an option to keep work directory only if the build fails:
    /etc/pkgmk.conf: PKGMK_KEEP_WORK="failed"
7. adds --pack-only, to just pack files in $PKG without building

I think 2 and 4 could be considered bugs.
And we should also make curl the default download program (instead of wget).

Any opinions on these changes?

I also made a patch for prt-get, but I haven't the story for that one yet ;)



[1] I admit this part is a bit far fetched, since CRUX is widely 
popular, but I like the drama.

[2] http://www.mizrahi.com.ve/crux/pkgs/pkgutils/pkgutils-alan-8.patch

More information about the crux-devel mailing list