summaryrefslogtreecommitdiff
path: root/src/Propellor/Property
diff options
context:
space:
mode:
authorSean Whitton2016-05-17 11:37:48 -0700
committerSean Whitton2016-05-17 11:37:48 -0700
commitccf2d4f42688197bf631f9fcca80fbd49d951a0c (patch)
tree414441b33f11225516752d765cfe014e99d29b30 /src/Propellor/Property
parent2f2f82c5bca2d4246f02567c8f6cf6291f381ce5 (diff)
tidy up utility fns
Diffstat (limited to 'src/Propellor/Property')
-rw-r--r--src/Propellor/Property/Sbuild.hs19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/Propellor/Property/Sbuild.hs b/src/Propellor/Property/Sbuild.hs
index 48499ca5..f9b766a1 100644
--- a/src/Propellor/Property/Sbuild.hs
+++ b/src/Propellor/Property/Sbuild.hs
@@ -47,6 +47,8 @@ module Propellor.Property.Sbuild (
updated,
updatedFor,
-- * Global sbuild configuration
+ installed,
+ keypairGenerated,
shareAptCache,
usableBy,
) where
@@ -171,13 +173,20 @@ keypairGenerated =
cmdProperty "sbuild-update" ["--keygen"] `assume` MadeChange
secKeyFile = "/var/lib/sbuild/apt-keys/sbuild-key.sec"
+-- ==== utility function ====
-schrootLoc :: Suite -> Architecture -> FilePath
-schrootLoc s a = "/srv/chroot" </> s ++ "-" ++ a
-
-schrootConfLoc :: Suite -> Architecture -> FilePath
-schrootConfLoc s a = "/etc/schroot/chroot.d" </> s ++ "-" ++ a ++ "-sbuild-propellor"
+schrootFromSystem :: System -> Maybe SbuildSchroot
+schrootFromSystem system@(System _ arch) =
+ extractSuite system
+ >>= \suite -> return $ SbuildSchroot suite arch
stdMirror :: System -> Apt.Url
stdMirror (System (Debian s) _) = "http://httpredir.debian.org/debian"
stdMirror (System (Buntish r) _) = "TODO"
+
+schrootRoot :: SbuildSchroot -> FilePath
+schrootRoot (SbuildSchroot s a) = "/srv/chroot" </> s ++ "-" ++ a
+
+schrootConf :: SbuildSchroot -> FilePath
+schrootConf (SbuildSchroot s a) =
+ "/etc/schroot/chroot.d" </> s ++ "-" ++ a ++ "-sbuild-propellor"