From 45ad7a24d219794a093ccea8ed7914889d86183d Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 19 Jun 2016 16:43:35 +0900 Subject: ensure that sbuild aliases line not duplicated --- src/Propellor/Property/Sbuild.hs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src') 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 -- cgit v1.2.3