summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton2018-05-17 00:22:01 -0700
committerJoey Hess2018-05-17 10:33:26 -0400
commitaf5a78b9f6dd4c605a03129a584493c9f47e8b90 (patch)
tree4169dcb6b10acb3ea7b45308217b330258aee1ab
parentc7bd6483fa39b42eddb646b827f8617f7cfd3c3d (diff)
Apt.installedBackport replaced with Apt.backportInstalled
Apt.installedBackport would do this: apt-get install -t stretch-backports foo bar Apt.backportInstalled does this: apt-get install foo/stretch-backports bar/stretch-backports The Apt.installedBackport behaviour can install the dependencies of foo and bar from stretch-backports even when the versions in stretch will satisfy the dependencies of the backports of foo and bar. So this property can result in very many more backports being installed on the host when intended. But the number of installed backports should always be minimised. Worse, whether this happens is highly dependent on the system state, and the order in which other properties get ensured. For example, & Apt.installed ["dgit"] & Apt.installedBackport ["dgit"] will install only dgit from stretch-backports, but unless debhelper and devscripts happen to already be installed, & Apt.installedBackport ["dgit"] & Apt.installed ["dgit"] will install dgit, debhelper, devscripts and maybe more from backports. This is surprising, difficult to debug, and breaks the expectation that when the order in which properties are ensured is not specified with connectives like `requires` and `before`, ensuring them in any order will produce the same result. Property renamed because user configs should not silently break, as they would if they did not list dependencies that must be installed from stable-backports. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--debian/changelog7
-rw-r--r--src/Propellor/Property/Apt.hs11
-rw-r--r--src/Propellor/Property/Borg.hs2
3 files changed, 15 insertions, 5 deletions
diff --git a/debian/changelog b/debian/changelog
index 517ef350..ada411ff 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,12 @@
-propellor (5.3.7) UNRELEASED; urgency=medium
+propellor (5.4.0) UNRELEASED; urgency=medium
* Restic.installed: stop trying to install a backport on jessie, because no
such backport exists.
+ * Apt.installedBackport replaced with Apt.backportInstalled, which take the
+ same parameters but has different behaviour. (API change)
+ The new property will fail in cases where the old property would install
+ dependencies of the requested backports from stable-backports even though
+ the versions in stable satisfy the requested backports' dependencies.
-- Sean Whitton <spwhitton@spwhitton.name> Thu, 17 May 2018 00:12:42 -0700
diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs
index 5080b1e2..064221f9 100644
--- a/src/Propellor/Property/Apt.hs
+++ b/src/Propellor/Property/Apt.hs
@@ -247,12 +247,17 @@ installed' params ps = robustly $ check (not <$> isInstalled' ps) go
where
go = runApt (params ++ ["install"] ++ ps)
-installedBackport :: [Package] -> Property Debian
-installedBackport ps = withOS desc $ \w o -> case o of
+-- | Install packages from the stable-backports suite.
+--
+-- If installing the backport requires installing versions of a package's
+-- dependencies from stable-backports too, you will need to include those
+-- dependencies in the list of packages passed to this function.
+backportInstalled :: [Package] -> Property Debian
+backportInstalled ps = withOS desc $ \w o -> case o of
(Just (System (Debian _ suite) _)) -> case backportSuite suite of
Nothing -> unsupportedOS'
Just bs -> ensureProperty w $
- runApt (["install", "-t", bs, "-y"] ++ ps)
+ runApt (["install", "-y"] ++ ((++ '/':bs) <$> ps))
`changesFile` dpkgStatus
_ -> unsupportedOS'
where
diff --git a/src/Propellor/Property/Borg.hs b/src/Propellor/Property/Borg.hs
index 49259206..dab07985 100644
--- a/src/Propellor/Property/Borg.hs
+++ b/src/Propellor/Property/Borg.hs
@@ -57,7 +57,7 @@ runBorgEnv (BorgRepoUsing os _) = map go os
installed :: Property DebianLike
installed = withOS desc $ \w o -> case o of
(Just (System (Debian _ (Stable "jessie")) _)) -> ensureProperty w $
- Apt.installedBackport ["borgbackup"]
+ Apt.backportInstalled ["borgbackup", "python3-msgpack"]
_ -> ensureProperty w $
Apt.installed ["borgbackup"]
where