propellor-3.1.1: property-based host configuration management in haskell

MaintainerSean Whitton <spwhitton@spwhitton.name>
Safe HaskellNone
LanguageHaskell98

Propellor.Property.Sbuild

Contents

Description

Build and maintain schroots for use with sbuild.

Suggested usage in config.hs:

 & Apt.installed ["piuparts", "autopkgtest"]
 & Sbuild.builtFor (System (Debian Unstable) X86_32)
 & Sbuild.piupartsConfFor (System (Debian Unstable) X86_32)
 & Sbuild.updatedFor (System (Debian Unstable) X86_32) `period` Weekly 1
 & Sbuild.usableBy (User "spwhitton")
 & Sbuild.shareAptCache
 & Schroot.overlaysInTmpfs

In ~/.sbuildrc:

 $run_piuparts = 1;
 $piuparts_opts = [
     '--schroot',
     'unstable-i386-piuparts',
     '--fail-if-inadequate',
     '--fail-on-broken-symlinks',
     ];

 $external_commands = {
   'post-build-commands' => [
     [
       'adt-run',
       '--changes', '%c',
       '---',
       'schroot', 'unstable-i386-sbuild;',

       # if adt-run's exit code is 8 then the package had no tests but
       # this isn't a failure, so catch it
       'adtexit=$?;',
       'if', 'test', '$adtexit', '=', '8;', 'then',
       'exit', '0;', 'else', 'exit', '$adtexit;', 'fi'
     ],
   ],
 };

We use sbuild-createchroot(1) to create a chroot to the specification of sbuild-setup(7). This differs from the approach taken by picca's Sbuild.hs, which uses Debootstrap to construct the chroot. This is because we don't want to run propellor inside the chroot in order to keep the sbuild environment as standard as possible.

Synopsis

Creating and updating sbuild schroots

data SbuildSchroot Source #

An sbuild schroot, such as would be listed by schroot -l

Parts of the sbuild toolchain cannot distinguish between schroots with both the same suite and the same architecture, so neither do we

Constructors

SbuildSchroot Suite Architecture 

built :: SbuildSchroot -> Url -> RevertableProperty DebianLike UnixLike Source #

Build and configure a schroot for use with sbuild

updated :: SbuildSchroot -> Property DebianLike Source #

Ensure that an sbuild schroot's packages and apt indexes are updated

piupartsConf :: SbuildSchroot -> Url -> Property DebianLike Source #

Create a corresponding schroot config file for use with piuparts

This is useful because:

  • piuparts will clear out the apt cache which makes shareAptCache much less useful
  • piuparts itself invokes eatmydata, so the command-prefix setting in our regular schroot config would force the user to pass --no-eatmydata to piuparts in their ~/.sbuildrc, which is inconvenient.

To make use of this new schroot config, you can put something like this in your ~/.sbuildrc:

 $run_piuparts = 1;
 $piuparts_opts = [
     '--schroot',
     'unstable-i386-piuparts',
     '--fail-if-inadequate',
     '--fail-on-broken-symlinks',
     ];

builtFor :: System -> RevertableProperty DebianLike UnixLike Source #

Build and configure a schroot for use with sbuild using a distribution's standard mirror

This function is a convenience wrapper around built, allowing the user to identify the schroot and distribution using the System type

updatedFor :: System -> Property DebianLike Source #

Ensure that an sbuild schroot's packages and apt indexes are updated

This function is a convenience wrapper around updated, allowing the user to identify the schroot using the System type

piupartsConfFor :: System -> Property DebianLike Source #

Create a corresponding schroot config file for use with piuparts

This function is a convenience wrapper around piupartsConf, allowing the user to identify the schroot using the System type. See that function's documentation for why you might want to use this property, and sample config.

Global sbuild configuration

installed :: Property DebianLike Source #

Ensure that sbuild is installed

keypairGenerated :: Property DebianLike Source #

Generate the apt keys needed by sbuild

keypairInsecurelyGenerated :: Property DebianLike Source #

Generate the apt keys needed by sbuild using a low-quality source of randomness

Useful on throwaway build VMs.

shareAptCache :: Property DebianLike Source #

Bind-mount varcacheaptarchives in all sbuild chroots so that the host system and the chroot share the apt cache

This speeds up builds by avoiding unnecessary downloads of build dependencies.

usableBy :: User -> Property DebianLike Source #

Add an user to the sbuild group in order to use sbuild