1{-# LANGUAGE NoImplicitPrelude #-}
2{-# LANGUAGE OverloadedStrings #-}
3{-# LANGUAGE RecordWildCards #-}
4-- | Take an existing build plan and bump all packages to the newest version in
5-- the same major version number.
6module Stackage2.UpdateBuildPlan
7 ( updateBuildConstraints
11import qualified Data.Map as Map
12import Distribution.Version (anyVersion, earlierVersion,
14import Stackage2.BuildConstraints
15import Stackage2.BuildPlan
16import Stackage2.Prelude
18updateBuildPlan :: BuildPlan -> IO BuildPlan
19updateBuildPlan = newBuildPlan . updateBuildConstraints
21updateBuildConstraints :: BuildPlan -> BuildConstraints
22updateBuildConstraints BuildPlan {..} =
25 bcSystemInfo = bpSystemInfo
26 bcPackages = Map.keysSet bpPackages
28 bcPackageConstraints name = PackageConstraints
29 { pcVersionRange = addBumpRange (maybe anyVersion pcVersionRange moldPC)
30 , pcMaintainer = moldPC >>= pcMaintainer
31 , pcTests = maybe ExpectSuccess pcTests moldPC
32 , pcHaddocks = maybe ExpectSuccess pcHaddocks moldPC
33 , pcBuildBenchmarks = maybe True pcBuildBenchmarks moldPC
34 , pcFlagOverrides = maybe mempty pcFlagOverrides moldPC
37 moldBP = lookup name bpPackages
38 moldPC = ppConstraints <$> moldBP
40 addBumpRange oldRange =
43 Just bp -> intersectVersionRanges oldRange
44 $ bumpRange $ ppVersion bp
46 bumpRange version = intersectVersionRanges
47 (orLaterVersion version)
48 (earlierVersion $ bumpVersion version)
49 bumpVersion (Version (x:y:_) _) = Version [x, y + 1] []
50 bumpVersion (Version [x] _) = Version [x, 1] []
51 bumpVersion (Version [] _) = assert False $ Version [1, 0] []
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list