Skip to content

Commit

Permalink
Use newer stack on travis
Browse files Browse the repository at this point in the history
  • Loading branch information
phadej committed Oct 19, 2016
1 parent 6d65b50 commit 20af025
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ addons:
before_install:
- mkdir -p ~/.local/bin
- export PATH=~/.local/bin:$PATH
- travis_retry curl -L https://github.com/commercialhaskell/stack/releases/download/v0.1.3.1/stack-0.1.3.1-x86_64-linux.gz | gunzip > ~/.local/bin/stack
- travis_retry curl -L https://github.com/commercialhaskell/stack/releases/download/v1.2.0/stack-1.2.0-linux-x86_64-static.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
- chmod a+x ~/.local/bin/stack

install:
Expand Down
19 changes: 7 additions & 12 deletions Distribution/PackDeps.hs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ addPackage m entry =
case Map.lookup package' m of
Nothing -> go package' version
Just PackInfo { piVersion = oldv } ->
-- in 01-index.tar there are entries with some version
-- in 01-index.tar there are entries with the same versions
if version >= oldv
then go package' version
else m
Expand Down Expand Up @@ -129,18 +129,13 @@ data PackInfo = PackInfo
piRevision :: PackInfo -> Int
piRevision = fromMaybe 0 . fmap diRevision . piDesc

-- We should compare revisions as well,
-- but we don't do that, as it would force `piDesc` and make `packdeps`
-- executable increadibly slow (parse all cabal files on Hackage)
-- Instead we rely on the fact that newer revisions are always later in
-- 01-index.tar
maxVersion :: PackInfo -> PackInfo -> PackInfo
maxVersion pi1 pi2 = case cmp pi1 pi2 of
LT -> pi2
EQ -> pi2
GT -> pi1
where
-- compare first on version, then on revision
-- But we don't do this, as it would force `piDesc`, and makes `packdeps`
-- increadibly slow
-- Instead we rely on the fact that newer revision are always later in
-- 01-index.tar
cmp = (compare `on` piVersion) -- <> (compare `on` piRevision)
maxVersion pi1 pi2 = if piVersion pi1 <= piVersion pi2 then pi2 else pi1

-- | The newest version of every package.
type Newest = Map.Map String PackInfo
Expand Down

0 comments on commit 20af025

Please sign in to comment.