diff options
| author | Sean Whitton <spwhitton@spwhitton.name> | 2017-07-15 09:13:08 -0700 |
|---|---|---|
| committer | Sean Whitton <spwhitton@spwhitton.name> | 2017-07-15 09:13:08 -0700 |
| commit | f173da0c9e7e7221aa77cfa3247ebfb941204e05 (patch) | |
| tree | d3d1d13f528561bff9cb66b5dd50b8eebfc1e1c3 /src/Propellor/Property | |
| parent | 1fe45d18e676e930a383d24dad314d8b30612bff (diff) | |
sbuild properties set up an apt cache or use existing apt proxy
Diffstat (limited to 'src/Propellor/Property')
| -rw-r--r-- | src/Propellor/Property/Sbuild.hs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Propellor/Property/Sbuild.hs b/src/Propellor/Property/Sbuild.hs index 12720592..08246d27 100644 --- a/src/Propellor/Property/Sbuild.hs +++ b/src/Propellor/Property/Sbuild.hs @@ -84,6 +84,7 @@ module Propellor.Property.Sbuild ( ) where import Propellor.Base +import Propellor.Types.Info import Propellor.Property.Debootstrap (extractSuite) import Propellor.Property.Chroot.Util import qualified Propellor.Property.Apt as Apt @@ -177,6 +178,8 @@ built s@(SbuildSchroot suite arch) mirror cc = enhancedConf = combineProperties ("enhanced schroot conf for " ++ val s) $ props & aliasesLine + -- set up an apt proxy/cacher + & proxyCacher -- enable ccache and eatmydata for speed & ConfFile.containsIniSetting (schrootConf s) ( val s ++ "-sbuild" @@ -184,6 +187,21 @@ built s@(SbuildSchroot suite arch) mirror cc = , intercalate "," commandPrefix ) + proxyCacher :: Property DebianLike + proxyCacher = property' "set schroot apt proxy" $ \w -> do + proxyInfo <- getProxyInfo + ensureProperty w $ case proxyInfo of + Just (Apt.HostAptProxy u) -> setChrootProxy u + Nothing -> (Apt.serviceInstalledRunning "apt-cacher-ng" + `before` setChrootProxy "http://localhost:3142") + where + getProxyInfo :: Propellor (Maybe Apt.HostAptProxy) + getProxyInfo = fromInfoVal <$> askInfo + setChrootProxy :: Apt.Url -> Property DebianLike + setChrootProxy u = tightenTargets $ File.hasContent + (schrootRoot s </> "etc/apt/apt.conf.d/20proxy") + [ "Acquire::HTTP::Proxy \"" ++ u ++ "\";" ] + -- if we're building a sid chroot, add useful aliases -- In order to avoid more than one schroot getting the same aliases, we -- only do this if the arch of the chroot equals the host arch. |
