From 73fcd794e4258342740646ad0016a731f26e6951 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 2 Apr 2014 20:26:38 -0400 Subject: propellor spin --- Propellor/Property/Apt.hs | 20 +++++++++++++++----- Propellor/Property/SiteSpecific/GitAnnexBuilder.hs | 6 ++++-- 2 files changed, 19 insertions(+), 7 deletions(-) (limited to 'Propellor/Property') diff --git a/Propellor/Property/Apt.hs b/Propellor/Property/Apt.hs index 0b8b8ab9..867e6bb7 100644 --- a/Propellor/Property/Apt.hs +++ b/Propellor/Property/Apt.hs @@ -60,9 +60,10 @@ setSourcesList :: [Line] -> Property setSourcesList ls = sourcesList `File.hasContent` ls `onChange` update runApt :: [String] -> Property -runApt ps = cmdProperty' "apt-get" ps env - where - env = +runApt ps = cmdProperty' "apt-get" ps noninteractiveEnv + +noninteractiveEnv :: [(String, String)] +noninteractiveEnv = [ ("DEBIAN_FRONTEND", "noninteractive") , ("APT_LISTCHANGES_FRONTEND", "none") ] @@ -95,8 +96,17 @@ buildDep ps = robustly go where go = runApt $ ["-y", "build-dep"] ++ ps -{- Package installation may fail becuse the archive has changed. - - Run an update in that case and retry. -} +-- | Installs the build deps for the source package unpacked +-- in the specifed directory, with a dummy package also +-- installed so that autoRemove won't remove them. +buildDepIn :: FilePath -> Property +buildDepIn dir = go `requires` installed ["devscripts"] + where + go = cmdProperty' "sh" ["-c", "cd '" ++ dir ++ "' && mk-build-deps debian/control --install --remove"] + noninteractiveEnv + +-- | Package installation may fail becuse the archive has changed. +-- Run an update in that case and retry. -} robustly :: Property -> Property robustly p = Property (propertyDesc p) $ do r <- ensureProperty p diff --git a/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs b/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs index 7b823ed6..f4e13149 100644 --- a/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs +++ b/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs @@ -17,8 +17,7 @@ builder arch crontimes rsyncupload = combineProperties "gitannexbuilder" [ Apt.stdSourcesList Unstable , Apt.buildDep ["git-annex"] , Apt.installed ["git", "rsync", "moreutils", "ca-certificates", - "liblockfile-simple-perl", "cabal-install", "vim", "less", - "libghc-fdo-notify-dev"] + "liblockfile-simple-perl", "cabal-install", "vim", "less"] , serviceRunning "cron" `requires` Apt.installed ["cron"] , User.accountFor builduser , check (lacksdir builddir) $ userScriptProperty builduser @@ -31,6 +30,9 @@ builder arch crontimes rsyncupload = combineProperties "gitannexbuilder" [ "cd " ++ builddir , "git clone git://git-annex.branchable.com/ build" ] + , Property "git-annex source build deps installed" $ do + d <- homedir + ensureProperty $ Apt.buildDepIn (d builddir "build") , Cron.niceJob "gitannexbuilder" crontimes builduser ("~/" ++ builddir) "git pull ; ./autobuild" -- The builduser account does not have a password set, -- instead use the password privdata to hold the rsync server -- cgit v1.2.3