diff options
| author | Sean Whitton <spwhitton@spwhitton.name> | 2016-09-05 13:40:07 -0700 |
|---|---|---|
| committer | Sean Whitton <spwhitton@spwhitton.name> | 2016-09-05 13:40:07 -0700 |
| commit | 889ece4ab70023908c57505ada560d44989bbecd (patch) | |
| tree | 059fc0e554b267dfc36f6d77d11228234258f54f /src | |
| parent | 25ba5821b4ad0d747701dd5efa70f151238b7f75 (diff) | |
factor out code to check host arch
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Property/Sbuild.hs | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/src/Propellor/Property/Sbuild.hs b/src/Propellor/Property/Sbuild.hs index 55e764f9..4768bd7d 100644 --- a/src/Propellor/Property/Sbuild.hs +++ b/src/Propellor/Property/Sbuild.hs @@ -183,20 +183,17 @@ built s@(SbuildSchroot suite arch) mirror = -- In order to avoid more than one schroot getting the same aliases, we -- only do this if the arch of the chroot equals the host arch. aliasesLine :: Property UnixLike - aliasesLine = property' "maybe set aliases line" $ \w -> do - maybeOS <- getOS - case maybeOS of - Nothing -> return NoChange - Just (System _ hostArch) -> - if suite == "unstable" && hostArch == arch - then ensureProperty w $ - ConfFile.containsIniSetting - (schrootConf s) - ( show s ++ "-sbuild" - , "aliases" - , aliases - ) - else return NoChange + aliasesLine = property' "maybe set aliases line" $ \w -> + sidHostArchSchroot s >>= \isSidHostArchSchroot -> + if isSidHostArchSchroot + then ensureProperty w $ + ConfFile.containsIniSetting + (schrootConf s) + ( show s ++ "-sbuild" + , "aliases" + , aliases + ) + else return NoChange -- If the user has indicated that this host should use -- union-type=overlay schroots, we need to ensure that we have rebooted @@ -490,3 +487,19 @@ schrootConf (SbuildSchroot s a) = schrootPiupartsConf :: SbuildSchroot -> FilePath schrootPiupartsConf (SbuildSchroot s a) = "/etc/schroot/chroot.d" </> s ++ "-" ++ architectureToDebianArchString a ++ "-piuparts-propellor" + +-- Determine whether a schroot is +-- +-- (i) Debian sid, and +-- (ii) the same architecture as the host. +-- +-- This is the "sid host arch schroot". It is considered the default schroot +-- for sbuild builds, so we add useful aliases that work well with the suggested +-- ~/.sbuildrc given in the haddock +sidHostArchSchroot :: SbuildSchroot -> Propellor Bool +sidHostArchSchroot (SbuildSchroot suite arch) = do + maybeOS <- getOS + case maybeOS of + Nothing -> return False + Just (System _ hostArch) -> + return $ suite == "unstable" && hostArch == arch |
