From 5541473c69a9cfc9564644d9757f3836ff99c3c3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 2 May 2018 17:08:04 -0400 Subject: update --- src/Propellor/Property/SiteSpecific/JoeySites.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Propellor/Property') diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs index d7f6196b..4d8ee240 100644 --- a/src/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs @@ -1074,7 +1074,7 @@ laptopSoftware = Apt.installed , "bsdgames", "nethack-console" , "xmonad", "libghc-xmonad-dev", "libghc-xmonad-contrib-dev" , "ttf-bitstream-vera" - , "mairix", "offlineimap", "mutt" + , "mairix", "offlineimap", "mutt", "slrn" , "mtr", "nmap", "whois", "wireshark", "tcpdump", "iftop" , "pmount", "tree", "pv" , "arbtt", "hledger", "bc" -- cgit v1.2.3 From 09191ed1fde898d69bf7f3862bd8400db84eff66 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 2 May 2018 10:35:48 -0700 Subject: make Schroot.overlaysInTmpfs revertable Useful when a build fails on a tmpfs (usually a package's test suite). Signed-off-by: Sean Whitton --- src/Propellor/Property/Schroot.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Propellor/Property') diff --git a/src/Propellor/Property/Schroot.hs b/src/Propellor/Property/Schroot.hs index bb20f6e6..2f399b7c 100644 --- a/src/Propellor/Property/Schroot.hs +++ b/src/Propellor/Property/Schroot.hs @@ -32,8 +32,8 @@ usesOverlays = isJust . fromInfoVal -- Implicitly sets 'useOverlays' info property. -- -- Shell script from . -overlaysInTmpfs :: Property (HasInfo + DebianLike) -overlaysInTmpfs = go `requires` installed +overlaysInTmpfs :: RevertableProperty (HasInfo + DebianLike) UnixLike +overlaysInTmpfs = (go `requires` installed) undo where f = "/etc/schroot/setup.d/04tmpfs" go :: Property (HasInfo + UnixLike) @@ -58,6 +58,7 @@ overlaysInTmpfs = go `requires` installed , "fi" ] `onChange` (f `File.mode` combineModes (readModes ++ executeModes)) + undo = File.notPresent f installed :: Property DebianLike installed = Apt.installed ["schroot"] -- cgit v1.2.3 From 94653981cab8a9e0640a8ce3eee54a186479c1e5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 3 May 2018 12:25:25 -0400 Subject: Update shim each time propellor is run in a container, to deal with library version changes. Surprised this didn't come up before, since propellor was run against progressively old versions of libraries when propelling eg, a chroot. It finally broke on an arm box, where libm got updated to a new version and propellor used a symbol from the new version. The comment says that propellor may be running from an existing shim in which case it's reused. That could be a nested chroot or other container, or perhaps propellor was deployed via a precompiled tarball which is built using a shim. The code used to use "checkAlreadyShimmed shim" which I don't see how it deals with either of those scenarios. Changed to "checkAlreadyShimmed propellorbin", which I think will deal with them, but I've not tested such scenarios. Added code to delete old versions of libraries out of the shim directory to avoid masses of old ones piling up over time. Property.Chroot sets up the shim directory and then bind mounts it into the chroot. To avoid deleting the source of a bind mount, made this only delete files in the shim directory, but not the shim directory itself. --- debian/changelog | 2 ++ src/Propellor/Property/Chroot.hs | 5 +---- src/Propellor/Shim.hs | 9 ++++++++- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src/Propellor/Property') diff --git a/debian/changelog b/debian/changelog index 4d077d35..39fd6cba 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,8 @@ propellor (5.3.6) UNRELEASED; urgency=medium * stack.yaml: Updated to lts-9.21. * Make Schroot.overlaysInTmpfs revertable Thanks, Sean Whitton + * Update shim each time propellor is run in a container, to deal with + library version changes. -- Joey Hess Mon, 23 Apr 2018 13:12:25 -0400 diff --git a/src/Propellor/Property/Chroot.hs b/src/Propellor/Property/Chroot.hs index 0dd1f05a..5d29538c 100644 --- a/src/Propellor/Property/Chroot.hs +++ b/src/Propellor/Property/Chroot.hs @@ -169,10 +169,7 @@ propellChroot :: Chroot -> ([String] -> IO (CreateProcess, IO ())) -> Bool -> Pr propellChroot c@(Chroot loc _ _ _) mkproc systemdonly = property (chrootDesc c "provisioned") $ do let d = localdir shimdir c let me = localdir "propellor" - shim <- liftIO $ ifM (doesDirectoryExist d) - ( pure (Shim.file me d) - , Shim.setup me Nothing d - ) + shim <- liftIO $ Shim.setup me Nothing d ifM (liftIO $ bindmount shim) ( chainprovision shim , return FailedChange diff --git a/src/Propellor/Shim.hs b/src/Propellor/Shim.hs index 811ae7f0..b8ebdf46 100644 --- a/src/Propellor/Shim.hs +++ b/src/Propellor/Shim.hs @@ -16,12 +16,19 @@ import System.Posix.Files -- | Sets up a shimmed version of the program, in a directory, and -- returns its path. -- +-- If the shim was already set up, it's refreshed, in case newer +-- versions of libraries are needed. +-- -- Propellor may be running from an existing shim, in which case it's -- simply reused. setup :: FilePath -> Maybe FilePath -> FilePath -> IO FilePath -setup propellorbin propellorbinpath dest = checkAlreadyShimmed shim $ do +setup propellorbin propellorbinpath dest = checkAlreadyShimmed propellorbin $ do createDirectoryIfMissing True dest + -- Remove all old libraries inside dest, but do not delete the + -- directory itself, since it may be bind-mounted inside a chroot. + mapM_ nukeFile =<< dirContentsRecursive dest + libs <- parseLdd <$> readProcess "ldd" [propellorbin] glibclibs <- glibcLibs let libs' = nub $ libs ++ glibclibs -- cgit v1.2.3