From d96ad0a71c95066980fd65cb9d8cc0b662c669e3 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 20 May 2016 07:57:18 +0900 Subject: ispartial check from Debootstrap.hs --- src/Propellor/Property/Sbuild.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/Propellor/Property') diff --git a/src/Propellor/Property/Sbuild.hs b/src/Propellor/Property/Sbuild.hs index bd3c9056..92e76e08 100644 --- a/src/Propellor/Property/Sbuild.hs +++ b/src/Propellor/Property/Sbuild.hs @@ -110,7 +110,7 @@ built s@(SbuildSchroot suite arch) mirror = deleted where go :: Property DebianLike - go = check (not <$> doesDirectoryExist (schrootRoot s)) $ + go = check (unpopulated (schrootRoot s) <||> ispartial) $ property' ("built sbuild schroot for " ++ show s) make make w = do de <- liftIO standardPathEnv @@ -128,7 +128,7 @@ built s@(SbuildSchroot suite arch) mirror = `before` commandPrefix , return FailedChange ) - deleted = check (doesDirectoryExist (schrootRoot s)) $ + deleted = check (not <$> unpopulated (schrootRoot s)) $ property ("no sbuild schroot for " ++ show s) $ do liftIO $ removeChroot $ schrootRoot s makeChange $ nukeFile (schrootConf s) @@ -143,6 +143,15 @@ built s@(SbuildSchroot suite arch) mirror = commandPrefix = File.containsLine (schrootConf s) "command-prefix=/var/cache/ccache-sbuild/sbuild-setup,eatmydata" + -- A failed debootstrap run will leave a debootstrap directory; + -- recover by deleting it and trying again. + ispartial = ifM (doesDirectoryExist (schrootRoot s "debootstrap")) + ( do + removeChroot $ schrootRoot s + return True + , return False + ) + -- | 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