diff options
| author | Joey Hess <joey@kitenet.net> | 2014-10-10 11:27:54 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-10-10 11:27:54 -0400 |
| commit | 79ee61d958cdea43aec9ce7e63cbe88254641472 (patch) | |
| tree | 3e37882a29c8b6ff7637533153456bec0737a662 /src | |
| parent | 1e22e178b4080e70efc262e42943e615abfdb3b9 (diff) | |
stable suite changes
* Avoid encoding the current stable suite in propellor's code,
since that poses a difficult transition around the release,
and can easily be wrong if an older version of propellor is used.
Instead, the os property for a stable system includes the suite name
to use, eg Stable "wheezy".
* stdSourcesList uses the stable suite name, to avoid unwanted
immediate upgrades to the next stable release.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Property/Apt.hs | 32 | ||||
| -rw-r--r-- | src/Propellor/Property/Obnam.hs | 6 | ||||
| -rw-r--r-- | src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs | 5 | ||||
| -rw-r--r-- | src/Propellor/Types/OS.hs | 11 |
4 files changed, 30 insertions, 24 deletions
diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index 7e02a335..d82eaed3 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -20,14 +20,14 @@ type Section = String type SourcesGenerator = DebianSuite -> [Line] showSuite :: DebianSuite -> String -showSuite Stable = "stable" +showSuite (Stable s) = s showSuite Testing = "testing" showSuite Unstable = "unstable" showSuite Experimental = "experimental" -showSuite (DebianRelease r) = r -backportSuite :: String -backportSuite = showSuite stableRelease ++ "-backports" +backportSuite :: DebianSuite -> Maybe String +backportSuite (Stable s) = Just (s ++ "-backports") +backportSuite _ = Nothing debLine :: String -> Url -> [Section] -> Line debLine suite mirror sections = unwords $ @@ -42,12 +42,17 @@ stdSections :: [Section] stdSections = ["main", "contrib", "non-free"] binandsrc :: String -> SourcesGenerator -binandsrc url suite - | isStable suite = [l, srcLine l, bl, srcLine bl] - | otherwise = [l, srcLine l] +binandsrc url suite = catMaybes + [ Just l + , Just $ srcLine l + , bl + , srcLine <$> bl + ] where l = debLine (showSuite suite) url stdSections - bl = debLine backportSuite url stdSections + bl = do + bs <- backportSuite suite + return $ debLine bs url stdSections debCdn :: SourcesGenerator debCdn = binandsrc "http://cdn.debian.net/debian" @@ -128,13 +133,14 @@ installed' params ps = robustly $ check (isInstallable ps) go installedBackport :: [Package] -> Property installedBackport ps = trivial $ withOS desc $ \o -> case o of Nothing -> error "cannot install backports; os not declared" - (Just (System (Debian suite) _)) - | isStable suite -> - ensureProperty $ runApt $ - ["install", "-t", backportSuite, "-y"] ++ ps - _ -> error $ "backports not supported on " ++ show o + (Just (System (Debian suite) _)) -> case backportSuite suite of + Nothing -> notsupported o + Just bs -> ensureProperty $ runApt $ + ["install", "-t", bs, "-y"] ++ ps + _ -> notsupported o where desc = (unwords $ "apt installed backport":ps) + notsupported o = error $ "backports not supported on " ++ show o -- | Minimal install of package, without recommends. installedMin :: [Package] -> Property diff --git a/src/Propellor/Property/Obnam.hs b/src/Propellor/Property/Obnam.hs index b5c6d776..1e7c2c25 100644 --- a/src/Propellor/Property/Obnam.hs +++ b/src/Propellor/Property/Obnam.hs @@ -105,12 +105,12 @@ installed = Apt.installed ["obnam"] latestVersion :: Property latestVersion = withOS "obnam latest version" $ \o -> case o of (Just (System (Debian suite) _)) | isStable suite -> ensureProperty $ - Apt.setSourcesListD stablesources "obnam" + Apt.setSourcesListD (stablesources suite) "obnam" `requires` toProp (Apt.trustsKey key) _ -> noChange where - stablesources = - [ "deb http://code.liw.fi/debian " ++ Apt.showSuite stableRelease ++ " main" + stablesources suite = + [ "deb http://code.liw.fi/debian " ++ Apt.showSuite suite ++ " main" ] -- gpg key used by the code.liw.fi repository. key = Apt.AptKey "obnam" $ unlines diff --git a/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs b/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs index 1d4ea4b4..056578a1 100644 --- a/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs +++ b/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs @@ -109,8 +109,8 @@ androidAutoBuilderContainer dockerImage crontimes timeout = -- Android is cross-built in a Debian i386 container, using the Android NDK. androidContainer :: (System -> Docker.Image) -> Docker.ContainerName -> Property -> FilePath -> Host androidContainer dockerImage name setupgitannexdir gitannexdir = Docker.container name - (dockerImage $ System (Debian Stable) "i386") - & os (System (Debian Stable) "i386") + (dockerImage osver) + & os osver & Apt.stdSourcesList & Apt.installed ["systemd"] & User.accountFor builduser @@ -131,6 +131,7 @@ androidContainer dockerImage name setupgitannexdir gitannexdir = Docker.containe chrootsetup = scriptProperty [ "cd " ++ gitannexdir ++ " && ./standalone/android/buildchroot-inchroot" ] + osver = System (Debian (Stable "wheezy")) "i386" -- armel builder has a companion container using amd64 that -- runs the build first to get TH splices. They need diff --git a/src/Propellor/Types/OS.hs b/src/Propellor/Types/OS.hs index 23cc8a29..2529e7d8 100644 --- a/src/Propellor/Types/OS.hs +++ b/src/Propellor/Types/OS.hs @@ -13,15 +13,14 @@ data Distribution | Ubuntu Release deriving (Show, Eq) -data DebianSuite = Experimental | Unstable | Testing | Stable | DebianRelease Release +-- | Debian has several rolling suites, and a number of stable releases, +-- such as Stable "wheezy". +data DebianSuite = Experimental | Unstable | Testing | Stable Release deriving (Show, Eq) --- | The release that currently corresponds to stable. -stableRelease :: DebianSuite -stableRelease = DebianRelease "wheezy" - isStable :: DebianSuite -> Bool -isStable s = s == Stable || s == stableRelease +isStable (Stable _) = True +isStable _ = False type Release = String type Architecture = String |
