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

Maintainer | Sean Whitton <spwhitton@spwhitton.name>
Safe Haskell | None
Language | Haskell2010

Propellor.Property.Sbuild

Contents

- Creating and updating sbuild schroots
- Properties for use inside sbuild schroots
- Global sbuild configuration

Description

Build and maintain schroots for use with sbuild.

For convenience we set up several enhancements, such as ccache and eatmydata. This means we have to make several assumptions:

1. you want to build for a Debian release strictly newer than squeeze, or for a Buntish release newer than or equal to trusty
2. if you want to build for Debian stretch or newer, you have sbuild 0.70.0 or newer

The latter is due to the migration from GnuPG v1 to GnuPG v2.1 in Debian stretch, which older sbuild can't handle.

Suggested usage in `config.hs`:

     mybox = host "mybox.example.com" $ props
     	& osDebian (Stable "buster") X86_64
     	& Apt.useLocalCacher
     	& sidSchrootBuilt
     	& Sbuild.usableBy (User "spwhitton")
     	& Schroot.overlaysInTmpfs
       where
     	sidSchrootBuilt = Sbuild.built Sbuild.UseCcache $ props
     		& osDebian Unstable X86_32
     		& Sbuild.osDebianStandard
     		& Sbuild.update `period` Weekly (Just 1)
     		& Chroot.useHostProxy mybox

If you are using sbuild older than 0.70.0, you also need:

     & Sbuild.keypairGenerated

To take advantage of the piuparts and autopkgtest support, add to your `~/.sbuildrc` (assumes sbuild 0.71.0 or newer):

     $piuparts_opts = [
         '--no-eatmydata',
         '--schroot',
         '%r-%a-sbuild',
         '--fail-if-inadequate',
         ];

     $autopkgtest_root_args = "";
     $autopkgtest_opts = ["--", "schroot", "%r-%a-sbuild"];

On Debian jessie hosts, you should ensure that sbuild and autopkgtest come from the same suite. This is because the autopkgtest binary changed its name between jessie and stretch. If you have not installed backports of sbuild or autopkgtest, you don't need to do anything. But if you have installed either package from jessie-backports (with Propellor or otherwise), you should install the other from jessie-backports, too.

Synopsis

- data UseCcache
  - = UseCcache
  - | NoCcache
- built :: UseCcache -> Props metatypes -> RevertableProperty (HasInfo + DebianLike) Linux
- update :: Property DebianLike
- osDebianStandard :: Property Debian
- keypairGenerated :: Property DebianLike
- keypairInsecurelyGenerated :: Property DebianLike
- usableBy :: User -> Property DebianLike
- userConfig :: User -> Property DebianLike

# Creating and updating sbuild schroots

data UseCcache Source #

Whether an sbuild schroot should use ccache during builds

ccache is generally useful but it breaks building some packages. This data types allows you to toggle it on and off for particular schroots.

Constructors

UseCcache |
NoCcache |

built :: UseCcache -> Props metatypes -> RevertableProperty (HasInfo + DebianLike) Linux Source #

Build and configure a schroot for use with sbuild

The second parameter should specify, at a minimum, the operating system for the schroot. This is usually done using a property like `osDebian`

# Properties for use inside sbuild schroots

update :: Property DebianLike Source #

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

This replaces use of sbuild-update(1).

osDebianStandard :: Property Debian Source #

Properties that will be wanted in almost any Debian schroot, but not in schroots for other operating systems.

# Global sbuild configuration

keypairGenerated :: Property DebianLike Source #

Generate the apt keys needed by sbuild

You only need this if you are using sbuild older than 0.70.0.

keypairInsecurelyGenerated :: Property DebianLike Source #

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

Note that any running rngd will be killed; if you are using rngd, you should arrange for it to be restarted after this property has been ensured. E.g.

     & Sbuild.keypairInsecurelyGenerated
     	`onChange` Systemd.started "my-rngd-service"

Useful on throwaway build VMs.

You only need this if you are using sbuild older than 0.70.0.

usableBy :: User -> Property DebianLike Source #

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

userConfig :: User -> Property DebianLike Source #

Maintain recommended ~/.sbuildrc for a user, and adds them to the sbuild group

You probably want a custom ~/.sbuildrc on your workstation, but this property is handy for quickly setting up build boxes.

On Debian jessie hosts, you should ensure that sbuild and autopkgtest come from the same suite. This is because the autopkgtest binary changed its name between jessie and stretch. If you have not installed backports of sbuild or autopkgtest, you don't need to do anything. But if you have installed either package from jessie-backports (with Propellor or otherwise), you should install the other from jessie-backports, too.