Saturday, 25 August 2012

HOWTO: Things to remember about cowbuilder

Here are a few things to remember about cowbuilder:

If you run cowbuilder through sudo, and you want to build a source package whose result should be available to the user who initiated the build, then

  • you should have "BUILDRESULTUID=the_user's_id" in ~/.pbuilderrc, and
  • you might want to invoke cowbuilder with

'sudo cowbuilder --build the_pack_to_build.dsc --buildresult destination_dir_for_build_results'

If you want to login into a chroot environment in which you'd like to see part of your directory alongside the unpacked source tree of your package, then invoke cowbuilder with

sudo cowbuilder --login --bindmounts /path/to/the/dir/you/want

Your base.cow directory can be updated/changed manually with

sudo cowbuilder --login --save-after-login

You can update the base.cow directory with

sudo cowbuilder --update

 That's about it.

Also, noteworthy tip: ccache might not work correctly in the cowbuilder chroot.

1 comment:

mirabilos said...

Good catch about BUILDRESULT, but I usually just put the cowbuilding user into a group and chgrp and chmod g+sw it.

In my multi-{arch,distro} cowbuilder ~/.pbuilderrc – https://www.mirbsd.org/cvs.cgi/contrib/hosted/tg/deb/pbuilderrc?rev=HEAD – I have hardcoded BUILDRESULTUID and BUILDRESULTGID, but it’s probably possible to use something like $SUDO_UID and $SUDO_GID if set (after all, pbuilder runs this file using GNU bash).

I also put some notes into https://www.freewrt.org/~tg/dp/0-NOTE.txt and https://www.freewrt.org/~tg/dp/files/ like wrapper scripts around cowbuilder that use eatmydata, for things like updating (eW cowbuilder --update), logging in with and without saving, building packages with and without source and just arch:any (for porter uploads) and mention things like you want™ to create the pbuilder user ($BUILDUSERID, $BUILDUSERNAME) also *outside* the chroot, touch /CurrentlyBuilding and pimp debconf to avoid man-db updates inside, that building apr wants /dev/shm (oh well, /run/shm now probably?) bind-mounted, and other things out of the life of a “human” Debian-Ports build “dæmon” (who prefers cowbuilder over sbuild any time of the night).

If I can help with cowbuilder, ping me on IRC (Freenode, mirabilos).