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 Stackage.UpdateBuildPlan
7 ( updateBuildConstraints
11import qualified Data.Map as Map
12import Distribution.Version (anyVersion, earlierVersion,
14import Stackage.BuildConstraints
15import Stackage.BuildPlan
16import Stackage.Prelude
18updateBuildPlan :: Map PackageName PackagePlan -> BuildPlan -> IO BuildPlan
19updateBuildPlan packagesOrig
20 = newBuildPlan packagesOrig . updateBuildConstraints
22updateBuildConstraints :: BuildPlan -> BuildConstraints
23updateBuildConstraints BuildPlan {..} =
26 bcSystemInfo = bpSystemInfo
27 bcPackages = Map.keysSet bpPackages
28 bcGithubUsers = bpGithubUsers
30 bcPackageConstraints name = PackageConstraints
31 { pcVersionRange = addBumpRange (maybe anyVersion pcVersionRange moldPC)
32 , pcMaintainer = moldPC >>= pcMaintainer
33 , pcTests = maybe ExpectSuccess pcTests moldPC
34 , pcHaddocks = maybe ExpectSuccess pcHaddocks moldPC
35 , pcBuildBenchmarks = maybe True pcBuildBenchmarks moldPC
36 , pcFlagOverrides = maybe mempty pcFlagOverrides moldPC
37 , pcEnableLibProfile = maybe False pcEnableLibProfile moldPC
40 moldBP = lookup name bpPackages
41 moldPC = ppConstraints <$> moldBP
43 addBumpRange oldRange =
46 Just bp -> intersectVersionRanges oldRange
47 $ bumpRange $ ppVersion bp
49 bumpRange version = intersectVersionRanges
50 (orLaterVersion version)
51 (earlierVersion $ bumpVersion version)
52 bumpVersion (Version (x:y:_) _) = Version [x, y + 1] []
53 bumpVersion (Version [x] _) = Version [x, 1] []
54 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