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 :: BuildPlan -> IO BuildPlan
19updateBuildPlan = newBuildPlan . updateBuildConstraints
21updateBuildConstraints :: BuildPlan -> BuildConstraints
22updateBuildConstraints BuildPlan {..} =
25 bcSystemInfo = bpSystemInfo
26 bcPackages = Map.keysSet bpPackages
27 bcGithubUsers = bpGithubUsers
29 bcPackageConstraints name = PackageConstraints
30 { pcVersionRange = addBumpRange (maybe anyVersion pcVersionRange moldPC)
31 , pcMaintainer = moldPC >>= pcMaintainer
32 , pcTests = maybe ExpectSuccess pcTests moldPC
33 , pcHaddocks = maybe ExpectSuccess pcHaddocks moldPC
34 , pcBuildBenchmarks = maybe True pcBuildBenchmarks moldPC
35 , pcFlagOverrides = maybe mempty pcFlagOverrides moldPC
38 moldBP = lookup name bpPackages
39 moldPC = ppConstraints <$> moldBP
41 addBumpRange oldRange =
44 Just bp -> intersectVersionRanges oldRange
45 $ bumpRange $ ppVersion bp
47 bumpRange version = intersectVersionRanges
48 (orLaterVersion version)
49 (earlierVersion $ bumpVersion version)
50 bumpVersion (Version (x:y:_) _) = Version [x, y + 1] []
51 bumpVersion (Version [x] _) = Version [x, 1] []
52 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