diff options
| author | Sean Whitton <spwhitton@spwhitton.name> | 2017-02-04 11:32:34 -0700 |
|---|---|---|
| committer | Sean Whitton <spwhitton@spwhitton.name> | 2017-02-04 11:32:34 -0700 |
| commit | 3829c41dc936b742be6aaae885f771b560f3a96f (patch) | |
| tree | 46854161d0b937cf7c0adbbfaac8b806ab769ab2 | |
| parent | eae8fe777c141b34ec586e9af5bde278a33cc0c3 (diff) | |
factor out suitePinBlock
| -rw-r--r-- | src/Propellor/Property/Apt.hs | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index fef4a700..61596914 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -116,12 +116,7 @@ suiteAvailablePinned s pin = available <!> unavailable where available :: Property Debian available = tightenTargets $ combineProperties (desc True) $ props - & File.hasContent prefFile - [ "Explanation: This file added by propellor" - , "Package: *" - , "Pin: release " ++ suitePin s - , "Pin-Priority: " ++ show pin - ] + & File.hasContent prefFile (suitePinBlock "*" s pin) & setSourcesFile unavailable :: Property Debian @@ -281,12 +276,7 @@ pinnedTo' p (suite, pin) = (tightenTargets $ prefFile `File.hasContent` prefs) <!> (tightenTargets $ File.notPresent prefFile) where - prefs = - [ "Explanation: This file added by propellor" - , "Package: " ++ p - , "Pin: release " ++ suitePin suite - , "Pin-Priority: " ++ show pin - ] + prefs = suitePinBlock p suite pin prefFile = "/etc/apt/preferences.d/10propellor_" ++ File.configFileName p <.> "pref" @@ -454,5 +444,13 @@ suitePin s = prefix s ++ showSuite s prefix (Stable _) = "n=" prefix _ = "a=" +suitePinBlock :: AptPrefPackage -> DebianSuite -> PinPriority +suitePinBlock p suite pin = + [ "Explanation: This file added by propellor" + , "Package: " ++ p + , "Pin: release " ++ suitePin suite + , "Pin-Priority: " ++ show pin + ] + dpkgStatus :: FilePath dpkgStatus = "/var/lib/dpkg/status" |
