diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-01 16:58:11 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-01 16:58:11 -0400 |
| commit | e6d24b49b87de312776bee71a2a6f009f7f397a9 (patch) | |
| tree | ceba3045f23ee1d3cf36bfe8e8ffa9cb090b9e54 /Propellor/Property/Apt.hs | |
| parent | 6a82cdc41c89cc249da4d941a32920ebfd14cb92 (diff) | |
various improvements
Diffstat (limited to 'Propellor/Property/Apt.hs')
| -rw-r--r-- | Propellor/Property/Apt.hs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/Propellor/Property/Apt.hs b/Propellor/Property/Apt.hs index c91415e1..9f2365e0 100644 --- a/Propellor/Property/Apt.hs +++ b/Propellor/Property/Apt.hs @@ -16,16 +16,14 @@ sourcesList = "/etc/apt/sources.list" type Url = String type Section = String -data Suite = Stable | Testing | Unstable | Experimental - deriving Show - -showSuite :: Suite -> String +showSuite :: DebianSuite -> String showSuite Stable = "stable" showSuite Testing = "testing" showSuite Unstable = "unstable" showSuite Experimental = "experimental" +showSuite (DebianRelease r) = r -debLine :: Suite -> Url -> [Section] -> Line +debLine :: DebianSuite -> Url -> [Section] -> Line debLine suite mirror sections = unwords $ ["deb", mirror, showSuite suite] ++ sections @@ -37,14 +35,14 @@ srcLine l = case words l of stdSections :: [Section] stdSections = ["main", "contrib", "non-free"] -debCdn :: Suite -> [Line] +debCdn :: DebianSuite -> [Line] debCdn suite = [l, srcLine l] where l = debLine suite "http://cdn.debian.net/debian" stdSections {- | Makes sources.list have a standard content using the mirror CDN, - - with a particular Suite. -} -stdSourcesList :: Suite -> Property + - with a particular DebianSuite. -} +stdSourcesList :: DebianSuite -> Property stdSourcesList suite = setSourcesList (debCdn suite) `describe` ("standard sources.list for " ++ show suite) @@ -81,6 +79,12 @@ removed ps = check (or <$> isInstalled' ps) go where go = runApt $ ["-y", "remove"] ++ ps +buildDep :: [Package] -> Property +buildDep ps = check (isInstallable ps) go + `describe` (unwords $ "apt build-dep":ps) + where + go = runApt $ ["-y", "build-dep"] ++ ps + isInstallable :: [Package] -> IO Bool isInstallable ps = do l <- isInstalled' ps |
