summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Sbuild.hs
diff options
context:
space:
mode:
authorSean Whitton2016-05-20 07:57:18 +0900
committerSean Whitton2016-05-20 07:57:18 +0900
commitd96ad0a71c95066980fd65cb9d8cc0b662c669e3 (patch)
tree93e5f84ddd3231b19db357d7a456632bfabe0725 /src/Propellor/Property/Sbuild.hs
parentfb527146c7f48231dc6d430179d06d4b9ffa96fe (diff)
ispartial check from Debootstrap.hs
Diffstat (limited to 'src/Propellor/Property/Sbuild.hs')
-rw-r--r--src/Propellor/Property/Sbuild.hs13
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