Skip to content

Commit

Permalink
Use hackage-security-0.6
Browse files Browse the repository at this point in the history
Also in CI setup, install hackage-repo-tool using `cabal new-install`.
And remove slightly confusing cabal.project.travis file.
  • Loading branch information
phadej committed Nov 30, 2019
1 parent 0741375 commit 0165f0a
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 64 deletions.
10 changes: 8 additions & 2 deletions cabal-install/Distribution/Client/Security/HTTP.hs
Expand Up @@ -35,7 +35,6 @@ import Hackage.Security.Client
import Hackage.Security.Client.Repository.HttpLib
import Hackage.Security.Util.Checked
import Hackage.Security.Util.Pretty
import qualified Hackage.Security.Util.Lens as Lens

{-------------------------------------------------------------------------------
'HttpLib' implementation
Expand Down Expand Up @@ -142,7 +141,14 @@ mkReqHeaders reqHeaders mRange = concat [
finalize (name, strs) = [HTTP.Header name (intercalate ", " (reverse strs))]

insert :: Eq a => a -> [b] -> [(a, [b])] -> [(a, [b])]
insert x y = Lens.modify (Lens.lookupM x) (++ y)
insert x y = modifyAssocList x (++ y)

-- modify the first maching element
modifyAssocList :: Eq a => a -> (b -> b) -> [(a, b)] -> [(a, b)]
modifyAssocList a f = go where
go [] = []
go (p@(a', b) : xs) | a == a' = (a', f b) : xs
| otherwise = p : go xs

{-------------------------------------------------------------------------------
Custom exceptions
Expand Down
4 changes: 2 additions & 2 deletions cabal-install/bootstrap.sh
Expand Up @@ -260,8 +260,8 @@ EDIT_DISTANCE_VER="0.2.2.1"; EDIT_DISTANCE_VER_REGEXP="0\.2\.2\.?"
# 0.2.2.*
ED25519_VER="0.0.5.0"; ED25519_VER_REGEXP="0\.0\.?"
# 0.0.*
HACKAGE_SECURITY_VER="0.5.3.0"; HACKAGE_SECURITY_VER_REGEXP="0\.5\.((2\.[2-9]|[3-9])|3)"
# >= 0.5.2 && < 0.6
HACKAGE_SECURITY_VER="0.6.0.0"; HACKAGE_SECURITY_VER_REGEXP="0\.6\."
# >= 0.7.0.0 && < 0.7
TAR_VER="0.5.1.0"; TAR_VER_REGEXP="0\.5\.([1-9]|1[0-9]|0\.[3-9]|0\.1[0-9])\.?"
# >= 0.5.0.3 && < 0.6
DIGEST_VER="0.0.1.2"; DIGEST_REGEXP="0\.0\.(1\.[2-9]|[2-9]\.?)"
Expand Down
2 changes: 1 addition & 1 deletion cabal-install/cabal-install.cabal
Expand Up @@ -336,7 +336,7 @@ executable cabal
time >= 1.5.0.1 && < 1.10,
transformers >= 0.4.2.0 && < 0.6,
zlib >= 0.5.3 && < 0.7,
hackage-security >= 0.5.2.2 && < 0.6,
hackage-security >= 0.6.0.0 && < 0.7,
text >= 1.2.3 && < 1.3,
parsec >= 3.1.13.0 && < 3.2

Expand Down
2 changes: 1 addition & 1 deletion cabal-install/cabal-install.cabal.pp
Expand Up @@ -43,7 +43,7 @@
time >= 1.5.0.1 && < 1.10,
transformers >= 0.4.2.0 && < 0.6,
zlib >= 0.5.3 && < 0.7,
hackage-security >= 0.5.2.2 && < 0.6,
hackage-security >= 0.6.0.0 && < 0.7,
text >= 1.2.3 && < 1.3,
parsec >= 3.1.13.0 && < 3.2
Expand Down
20 changes: 0 additions & 20 deletions cabal.project.travis

This file was deleted.

24 changes: 0 additions & 24 deletions cabal.project.travis.libonly

This file was deleted.

2 changes: 0 additions & 2 deletions travis-common.sh
@@ -1,6 +1,5 @@
set -e

HACKAGE_REPO_TOOL_VERSION="0.1.1.1"
CABAL_VERSION="3.1.0.0"
CABAL_INSTALL_VERSION="3.1.0.0"

Expand All @@ -16,7 +15,6 @@ CABAL_BDIR="${TRAVIS_BUILD_DIR}/dist-newstyle/build/$ARCH/ghc-$GHCVER/Cabal-${CA
CABAL_TESTSUITE_BDIR="${TRAVIS_BUILD_DIR}/dist-newstyle/build/$ARCH/ghc-$GHCVER/cabal-testsuite-${CABAL_VERSION}"
CABAL_INSTALL_BDIR="${TRAVIS_BUILD_DIR}/dist-newstyle/build/$ARCH/ghc-$GHCVER/cabal-install-${CABAL_INSTALL_VERSION}"
SOLVER_BENCHMARKS_BDIR="${TRAVIS_BUILD_DIR}/dist-newstyle/build/$ARCH/ghc-$GHCVER/solver-benchmarks-${CABAL_VERSION}"
HACKAGE_REPO_TOOL_BDIR="${TRAVIS_BUILD_DIR}/dist-newstyle/build/$ARCH/ghc-$GHCVER/hackage-repo-tool-${HACKAGE_REPO_TOOL_VERSION}/x/hackage-repo-tool"
CABAL_INSTALL_EXE=${CABAL_INSTALL_BDIR}/x/cabal/build/cabal/cabal

# ---------------------------------------------------------------------
Expand Down
16 changes: 4 additions & 12 deletions travis-script.sh
Expand Up @@ -73,26 +73,18 @@ timed cabal update
# Install executables if necessary
# ---------------------------------------------------------------------

#if ! command -v happy; then
timed cabal install $jobs happy
#fi
timed cabal install $jobs happy

# ---------------------------------------------------------------------
# Setup our local project
# ---------------------------------------------------------------------

make cabal-install-monolithic
if [ "x$CABAL_LIB_ONLY" = "xYES" ]; then
cp cabal.project.travis.libonly cabal.project
cp cabal.project.libonly cabal.project
fi
cp cabal.project.local.travis cabal.project.local

# hackage-repo-tool is a bit touchy to install on GHC 8.0, so instead we
# do it via new-build. See also cabal.project.local.travis. The downside of
# doing it this way is that the build product cannot be cached, but
# hackage-repo-tool is a relatively small package so it's good.
timed cabal unpack hackage-repo-tool-${HACKAGE_REPO_TOOL_VERSION}

# ---------------------------------------------------------------------
# Cabal
# ---------------------------------------------------------------------
Expand Down Expand Up @@ -167,7 +159,7 @@ fi
# test suites are baked into the cabal binary
timed cabal new-build $jobs $CABAL_INSTALL_FLAGS cabal-install:cabal

timed cabal new-build $jobs hackage-repo-tool
timed cabal new-install $jobs hackage-repo-tool --overwrite-policy=always

if [ "x$SKIP_TESTS" = "xYES" ]; then
exit 1;
Expand All @@ -177,7 +169,7 @@ fi
timed ${CABAL_INSTALL_EXE} update

# Big tests
(cd cabal-testsuite && timed ${CABAL_TESTSUITE_BDIR}/build/cabal-tests/cabal-tests --builddir=${CABAL_TESTSUITE_BDIR} -j3 --skip-setup-tests --with-cabal ${CABAL_INSTALL_EXE} --with-hackage-repo-tool ${HACKAGE_REPO_TOOL_BDIR}/build/hackage-repo-tool/hackage-repo-tool $TEST_OPTIONS) || exit $?
(cd cabal-testsuite && timed ${CABAL_TESTSUITE_BDIR}/build/cabal-tests/cabal-tests --builddir=${CABAL_TESTSUITE_BDIR} -j3 --skip-setup-tests --with-cabal ${CABAL_INSTALL_EXE} --with-hackage-repo-tool hackage-repo-tool $TEST_OPTIONS) || exit $?

# Cabal check
# TODO: remove -main-is and re-enable me.
Expand Down

0 comments on commit 0165f0a

Please sign in to comment.