diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-09-14 20:23:08 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-09-14 20:23:08 -0400 |
| commit | e5c398a0f6dfc65d56c2dcdf2e8bbf031579ef38 (patch) | |
| tree | c76125aaf059f4acaab6a32c3cfc223e5294c787 /src/Propellor/Property/DiskImage.hs | |
| parent | 0f9f05ae9e65182daa9bfc98a9932e2e1382e9b5 (diff) | |
| parent | fb7b1826870c8a0e01f88da74ff2fd98a0626d5b (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor/Property/DiskImage.hs')
| -rw-r--r-- | src/Propellor/Property/DiskImage.hs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs index 35082eec..8d35991e 100644 --- a/src/Propellor/Property/DiskImage.hs +++ b/src/Propellor/Property/DiskImage.hs @@ -119,7 +119,7 @@ imageBuiltFrom img chrootdir tabletype partspec final = mkimg <!> rmimg liftIO $ unmountBelow chrootdir szm <- M.mapKeys (toSysDir chrootdir) . M.map toPartSize <$> liftIO (dirSizes chrootdir) - let calcsz = \mnts -> maybe defSz fudge . getMountSz szm mnts + let calcsz mnts = maybe defSz fudge . getMountSz szm mnts -- tie the knot! let (mnts, t) = fitChrootSize tabletype partspec (map (calcsz mnts) mnts) ensureProperty $ @@ -131,8 +131,7 @@ imageBuiltFrom img chrootdir tabletype partspec final = mkimg <!> rmimg rmimg = File.notPresent img partitionsPopulated :: FilePath -> [MountPoint] -> [FilePath] -> Property NoInfo -partitionsPopulated chrootdir mnts devs = property desc $ - mconcat $ map (uncurry go) (zip mnts devs) +partitionsPopulated chrootdir mnts devs = property desc $ mconcat $ zipWith go mnts devs where desc = "partitions populated from " ++ chrootdir @@ -200,8 +199,7 @@ getMountSz _ _ Nothing = Nothing getMountSz szm l (Just mntpt) = fmap (`reducePartSize` childsz) (M.lookup mntpt szm) where - childsz = mconcat $ catMaybes $ - map (getMountSz szm l) (filter (isChild mntpt) l) + childsz = mconcat $ mapMaybe (getMountSz szm l) (filter (isChild mntpt) l) isChild :: FilePath -> MountPoint -> Bool isChild mntpt (Just d) @@ -274,7 +272,7 @@ extended :: PartSpec -> PartSpec extended s = adjustp s $ \p -> p { partType = Extended } adjustp :: PartSpec -> (Partition -> Partition) -> PartSpec -adjustp (mp, p) f = (mp, \sz -> f (p sz)) +adjustp (mp, p) f = (mp, f . p) -- | The constructor for each Partition is passed the size of the files -- from the chroot that will be put in that partition. @@ -282,7 +280,7 @@ fitChrootSize :: TableType -> [PartSpec] -> [PartSize] -> ([MountPoint], PartTab fitChrootSize tt l basesizes = (mounts, parttable) where (mounts, sizers) = unzip l - parttable = PartTable tt (map (uncurry id) (zip sizers basesizes)) + parttable = PartTable tt (zipWith id sizers basesizes) -- | A pair of properties. The first property is satisfied within the -- chroot, and is typically used to download the boot loader. |
