Skip to content

build using cabal sandbox on ghc-8.0.1 #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 61 additions & 37 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,82 @@
# This file has been generated -- see https://github.com/hvr/multi-ghc-travis
language: c

sudo: false

cache:
directories:
- $HOME/.cabsnap
- $HOME/.cabal/packages

before_cache:
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar

matrix:
include:
- env: CABALVER=1.18 GHCVER=7.8.4 NETWORK=-fnetwork HANS=+hans
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
- env: CABALVER=1.18 GHCVER=7.8.4 NETWORK=-f-network HANS=+hans
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
- env: CABALVER=1.18 GHCVER=7.8.4 NETWORK=-fnetwork HANS=-hans
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
- env: CABALVER=1.18 GHCVER=7.8.4 NETWORK=-f-network HANS=-hans
- env: CABALVER=1.18 GHCVER=7.8.4 NETWORK=-fnetwork HANS=+hans
compiler: ": #GHC 7.8.4"
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
- env: CABALVER=1.22 GHCVER=7.10.2 NETWORK=-fnetwork HANS=+hans
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2],sources: [hvr-ghc]}}
- env: CABALVER=1.22 GHCVER=7.10.2 NETWORK=-f-network HANS=+hans
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2],sources: [hvr-ghc]}}
- env: CABALVER=1.22 GHCVER=7.10.2 NETWORK=-fnetwork HANS=-hans
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2],sources: [hvr-ghc]}}
- env: CABALVER=1.22 GHCVER=7.10.2 NETWORK=-f-network HANS=-hans
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2],sources: [hvr-ghc]}}
- env: CABALVER=head GHCVER=head NETWORK=-fnetwork HANS=+hans
addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}}
- env: CABALVER=head GHCVER=head NETWORK=-f-network HANS=+hans
addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}}
- env: CABALVER=head GHCVER=head NETWORK=-fnetwork HANS=-hans
addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}}
- env: CABALVER=head GHCVER=head NETWORK=-f-network HANS=-hans
addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}}

allow_failures:
- env: CABALVER=head GHCVER=head NETWORK=-fnetwork HANS=+hans
- env: CABALVER=head GHCVER=head NETWORK=-f-network HANS=+hans
- env: CABALVER=head GHCVER=head NETWORK=-fnetwork HANS=-hans
- env: CABALVER=head GHCVER=head NETWORK=-f-network HANS=-hans
compiler: ": #GHC 7.10.2"
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}}
- env: CABALVER=1.24 GHCVER=8.0.1 NETWORK=-fnetwork HANS=+hans
compiler: ": #GHC 8.0.1"
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}}

before_install:
- unset CC
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH

install:
- cabal sandbox init
- cabal update
- cabal install --only-dependencies --enable-tests $NETWORK -f$HANS --constraint="tls $HANS"
- cabal configure --enable-tests $NETWORK -f$HANS --constraint="tls $HANS"
- cabal --version
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
- if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
then
zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
$HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
fi
- travis_retry cabal update -v
- sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
- cabal install --only-dependencies --enable-tests $NETWORK -f$HANS --constraint="tls $HANS" --constraint="haskell-tor $HANS" --dry -v > installplan.txt
- sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt

# check whether current requested install-plan matches cached package-db snapshot
- if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;
then
echo "cabal build-cache HIT";
rm -rfv .ghc;
cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
else
echo "cabal build-cache MISS";
rm -rf $HOME/.cabsnap;
mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
cabal install --only-dependencies --enable-tests $NETWORK -f$HANS --constraint="tls $HANS" --constraint="haskell-tor $HANS";
fi

# snapshot package-db on cache miss
- if [ ! -d $HOME/.cabsnap ];
then
echo "snapshotting package-db to build-cache";
mkdir $HOME/.cabsnap;
cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
fi

# Here starts the actual work to be performed for the package under test;
# any command which exits with a non-zero exit code causes the build to fail.
script:
- cabal build
- cabal check
- if [ -f configure.ac ]; then autoreconf -i; fi
- cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging
- cabal build # this builds all libraries and executables (including tests/benchmarks)
- cabal test
- cabal check
- cabal sdist # tests that a source-distribution can be generated

# Check that the resulting source distribution can be built & installed.
# If there are no other `.tar.gz` files in `dist`, this can be even simpler:
# `cabal install --force-reinstalls dist/*-*.tar.gz`
- SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
(cd dist && cabal install --force-reinstalls $NETWORK -f$HANS --constraint="tls $HANS" "$SRC_TGZ" --enable-tests )

(cd dist && cabal install --force-reinstalls "$SRC_TGZ")

# EOF
46 changes: 46 additions & 0 deletions cabal.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
constraints: array ==0.5.1.1,
base ==4.*,
ghc-prim <= 0.5.0.0,
rts ==1.0,
integer-gmp <= 1.0.0.1,
asn1-encoding <= 0.9.4,
asn1-types <= 0.3.2,
bytestring <= 0.10.8.1,
deepseq <= 1.4.2.0,
hourglass <= 0.2.10,
memory <= 0.13,
async <= 2.1.0,
stm <= 2.4.4.1,
attoparsec <= 0.13.0.2,
containers <= 0.5.7.1,
scientific <= 0.3.4.9,
binary <= 0.8.3.0,
hashable <= 1.2.4.0,
text <= 1.2.2.1,
vector <= 0.11.0.0,
primitive <= 0.6.1.0,
transformers <= 0.5.2.0,
base64-bytestring <= 1.0.0.1,
cereal <= 0.5.3.0,
cryptonite <= 0.19,
fingertree <= 0.1.1.0,
hans <= 2.6.0.0,
BoundedChan <= 1.0.3.0,
heaps <= 0.3.3,
monadLib <= 3.7.3,
psqueues <= 0.2.2.2,
random <= 1.1,
time <= 1.6.0.1,
unix <= 2.7.2.0,
network <= 2.6.3.1,
pretty-hex <= 1.0,
pure-zlib <= 0.4,
tls <= 1.3.8,
data-default-class <= 0.1.2.0,
mtl <= 2.2.1,
x509 <= 1.6.3,
asn1-parse <= 0.9.4,
pem <= 0.2.2,
x509-store <= 1.6.1,
x509-validation <= 1.6.3,
byteable <= 0.1.1
114 changes: 57 additions & 57 deletions haskell-tor.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ category: Network
build-type: Simple
extra-source-files: README.md
cabal-version: >=1.10
tested-with: GHC == 7.10.2, GHC == 7.8.4
tested-with: GHC == 7.10.2, GHC == 7.8.4, GHC == 8.0.1

source-repository head
type: git
Expand All @@ -38,28 +38,28 @@ library
hs-source-dirs: src

build-depends:
array >= 0.5 && < 0.7,
asn1-encoding >= 0.9 && < 0.11,
asn1-types >= 0.3 && < 0.5,
async >= 2.0.2 && < 2.2,
attoparsec >= 0.13 && < 0.15,
base >= 4.7 && < 5.0,
base64-bytestring >= 1.0 && < 1.2,
binary >= 0.7.1 && < 0.9,
bytestring >= 0.10 && < 0.11,
cereal >= 0.4 && < 0.6,
containers >= 0.5 && < 0.7,
cryptonite >= 0.6 && < 0.10,
fingertree >= 0.1 && < 0.3,
hourglass >= 0.2.9 && < 0.4,
memory >= 0.7 && < 0.11,
monadLib >= 3.7 && < 3.9,
pretty-hex >= 1.0 && < 1.2,
pure-zlib >= 0.4 && < 0.5,
time >= 1.4 && < 1.6,
tls >= 1.3.2 && < 1.5,
x509 >= 1.6 && < 1.8,
x509-store >= 1.6 && < 1.8
array,
asn1-encoding,
asn1-types,
async,
attoparsec,
base == 4.*,
base64-bytestring,
binary,
bytestring,
cereal,
containers,
cryptonite,
fingertree,
hourglass,
memory,
monadLib,
pretty-hex,
pure-zlib,
time,
tls,
x509,
x509-store

other-modules:
Crypto.Hash.Easy,
Expand Down Expand Up @@ -94,10 +94,10 @@ library
Tor.State.Routers

if flag(network) && !os(HaLVM)
build-depends: network >= 2.5 && < 2.7
build-depends: network
exposed-modules: Tor.NetworkStack.System
if flag(hans)
build-depends: hans >= 2.6 && < 2.8
build-depends: hans
exposed-modules: Tor.NetworkStack.Hans

executable haskell-tor
Expand All @@ -107,25 +107,25 @@ executable haskell-tor
ghc-options: -Wall
hs-source-dirs: exe
build-depends:
asn1-encoding >= 0.8 && < 0.10,
asn1-types >= 0.2 && < 0.4,
base >= 4.7 && < 5.0,
base64-bytestring >= 1.0 && < 1.2,
bytestring >= 0.10 && < 0.11,
cryptonite >= 0.6 && < 0.10,
haskell-tor >= 0.1 && < 0.3,
hourglass >= 0.2.9 && < 0.4,
memory >= 0.7 && < 0.11,
time >= 1.4 && < 1.6,
tls >= 1.3.2 && < 1.5,
x509 >= 1.6 && < 1.8
asn1-encoding,
asn1-types,
base ==4.*,
base64-bytestring,
bytestring,
cryptonite,
haskell-tor,
hourglass,
memory,
time,
tls,
x509
if flag(hans)
build-depends: hans >= 2.6 && < 2.8
build-depends: hans
if flag(network) && !os(HaLVM)
build-depends: network >= 2.5 && < 2.7
build-depends: network
if os(HaLVM)
build-depends: HALVMCore >= 2.0 && < 2.4,
XenDevice >= 2.0 && < 2.4
build-depends: HALVMCore,
XenDevice
if (!flag(hans) && !flag(network)) || (!flag(hans) && os(HaLVM))
buildable: False

Expand All @@ -144,19 +144,19 @@ test-suite test-tor
Test.TorCell
ghc-options: -fno-warn-orphans
build-depends:
asn1-types >= 0.2 && < 0.4,
base >= 4.7 && < 5.0,
binary >= 0.7 && < 0.9,
bytestring >= 0.10 && < 0.11,
cryptonite >= 0.6 && < 0.10,
haskell-tor >= 0.1 && < 0.3,
hourglass >= 0.2.9 && < 0.4,
HUnit >= 1.2 && < 1.4,
QuickCheck >= 2.7 && < 2.9,
memory >= 0.7 && < 0.11,
pretty-hex >= 1.0 && < 1.4,
test-framework >= 0.8 && < 0.10,
test-framework-hunit >= 0.3 && < 0.5,
test-framework-quickcheck2 >= 0.3 && < 0.5,
time >= 1.4 && < 1.6,
x509 >= 1.6 && < 1.8
asn1-types,
base ==4.*,
binary,
bytestring,
cryptonite,
haskell-tor,
hourglass,
HUnit,
QuickCheck,
memory,
pretty-hex,
test-framework,
test-framework-hunit,
test-framework-quickcheck2,
time,
x509
2 changes: 1 addition & 1 deletion src/Tor/Circuit.hs
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ computeTAPValues :: PrivateNumber -> PublicNumber ->
computeTAPValues b ga = (L.toStrict kh, (encsf, fhash), (encsb, bhash))
where
SharedKey k0 = getShared oakley2 b ga
(kh, rest1) = L.splitAt 20 (kdfTor (i2ospOf_ 128 k0))
(kh, rest1) = L.splitAt 20 (kdfTor (i2ospOf_ 128 (os2ip k0)))
(df, rest2) = L.splitAt 20 rest1
(db, rest3) = L.splitAt 20 rest2
(kf, rest4) = L.splitAt 16 rest3
Expand Down