diff options
| author | Sean Whitton <spwhitton@spwhitton.name> | 2016-05-20 07:57:18 +0900 |
|---|---|---|
| committer | Sean Whitton <spwhitton@spwhitton.name> | 2016-05-20 07:57:18 +0900 |
| commit | d96ad0a71c95066980fd65cb9d8cc0b662c669e3 (patch) | |
| tree | 93e5f84ddd3231b19db357d7a456632bfabe0725 /src | |
| parent | fb527146c7f48231dc6d430179d06d4b9ffa96fe (diff) | |
ispartial check from Debootstrap.hs
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Property/Sbuild.hs | 13 |
1 files changed, 11 insertions, 2 deletions
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 |
