summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog2
-rw-r--r--src/Propellor/Property/Apt.hs16
2 files changed, 16 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index 22987327..a96df510 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ propellor (5.10.2) UNRELEASED; urgency=medium
Thanks, Robin Munn
* Bootstrap: Add haskell-type-errors package on Arch Linux.
Thanks, Robin Munn
+ * Apt.buildDepIn: Run build-dep command in a temporary directory,
+ since it may sometimes not clean up all the files it creates.
-- Joey Hess <id@joeyh.name> Sun, 16 Feb 2020 12:37:10 -0400
diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs
index 4faf0984..2e7ccb04 100644
--- a/src/Propellor/Property/Apt.hs
+++ b/src/Propellor/Property/Apt.hs
@@ -16,6 +16,7 @@ import qualified Propellor.Property.File as File
import qualified Propellor.Property.Service as Service
import Propellor.Property.File (Line)
import Propellor.Types.Info
+import Utility.SafeCommand
data HostMirror = HostMirror Url
deriving (Eq, Show, Typeable)
@@ -308,11 +309,22 @@ buildDep ps = robustly $ go
-- in the specifed directory, with a dummy package also
-- installed so that autoRemove won't remove them.
buildDepIn :: FilePath -> Property DebianLike
-buildDepIn dir = cmdPropertyEnv "sh" ["-c", cmd] noninteractiveEnv
+buildDepIn dir = go
`changesFile` dpkgStatus
`requires` installedMin ["devscripts", "equivs"]
where
- cmd = "cd '" ++ dir ++ "' && mk-build-deps debian/control --install --tool 'apt-get -y --no-install-recommends' --remove"
+ -- mk-build-deps may leave files behind sometimes, eg on failure,
+ -- so run it in a temp directory, passing the path to the control
+ -- file
+ go :: UncheckedProperty DebianLike
+ go = unchecked $ property ("build-dep in " ++ dir) $ liftIO $
+ withTmpDir "build-dep" $ \tmpdir -> do
+ cmdResult <$> boolSystem' "mk-build-deps"
+ [ File $ dir </> "debian" </> "control"
+ , Param "--install"
+ , Param "--tool"
+ , Param "apt-get -y --no-install-recommends"
+ ] (\p -> p { cwd = Just tmpdir })
-- | The name of a package, a glob to match the names of packages, or a regexp
-- surrounded by slashes to match the names of packages. See