summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Sbuild.hs
diff options
context:
space:
mode:
authorSean Whitton2016-06-19 16:43:35 +0900
committerSean Whitton2016-06-19 16:43:35 +0900
commit45ad7a24d219794a093ccea8ed7914889d86183d (patch)
tree4de4c5919577841511063863881c7fd11b392c48 /src/Propellor/Property/Sbuild.hs
parent0375288f012cf17b3f709f1e98bde24c3d1f97a7 (diff)
ensure that sbuild aliases line not duplicated
Diffstat (limited to 'src/Propellor/Property/Sbuild.hs')
-rw-r--r--src/Propellor/Property/Sbuild.hs18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/Propellor/Property/Sbuild.hs b/src/Propellor/Property/Sbuild.hs
index 50825a0c..0ef85dcf 100644
--- a/src/Propellor/Property/Sbuild.hs
+++ b/src/Propellor/Property/Sbuild.hs
@@ -154,11 +154,19 @@ built s@(SbuildSchroot suite arch) mirror =
makeChange $ nukeFile (schrootConf s)
-- if we're building a sid chroot, add useful aliases
+ -- 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 = if suite == "unstable"
- then File.containsLine (schrootConf s)
- "aliases=UNRELEASED,sid,rc-buggy,experimental"
- else doNothing
+ 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 $
+ schrootConf s `File.containsLine` aliases
+ else return NoChange
+
-- enable ccache and eatmydata for speed
commandPrefix = File.containsLine (schrootConf s)
"command-prefix=/var/cache/ccache-sbuild/sbuild-setup,eatmydata"
@@ -172,6 +180,8 @@ built s@(SbuildSchroot suite arch) mirror =
, return False
)
+ aliases = "aliases=UNRELEASED,sid,rc-buggy,experimental"
+
-- | Ensure that an sbuild schroot's packages and apt indexes are updated
--
-- This function is a convenience wrapper around 'Sbuild.updated', allowing the