23 |
23 |
TEMP_DATA_DIR=`mktemp -d`
|
24 |
24 |
ACTUAL_DATA_DIR=$DATA_DIR
|
25 |
25 |
ACTUAL_DATA_DIR=${ACTUAL_DATA_DIR:-$TEMP_DATA_DIR}
|
|
26 |
GHC_VERSION="7.6.3"
|
|
27 |
CABAL_INSTALL_VERSION="1.18.0.2"
|
|
28 |
SHA1_LIST='
|
|
29 |
cabal-install-1.18.0.2.tar.gz 2d1f7a48d17b1e02a1e67584a889b2ff4176a773
|
|
30 |
ghc-7.6.3-i386-unknown-linux.tar.bz2 f042b4171a2d4745137f2e425e6949c185f8ea14
|
|
31 |
ghc-7.6.3-x86_64-unknown-linux.tar.bz2 46ec3f3352ff57fba0dcbc8d9c20f7bcb6924b77
|
|
32 |
'
|
|
33 |
|
|
34 |
# export all variables needed in the schroot
|
|
35 |
export ARCH GHC_VERSION CABAL_INSTALL_VERSION SHA1_LIST
|
26 |
36 |
|
27 |
37 |
# Use gzip --rsyncable if available, to speed up transfers of generated files
|
28 |
38 |
# The environment variable GZIP is read automatically by 'gzip',
|
... | ... | |
127 |
137 |
in_chroot -- \
|
128 |
138 |
apt-get update
|
129 |
139 |
|
|
140 |
# arguments : file_name expected_sha1
|
|
141 |
function verify_sha1 {
|
|
142 |
local SUM="$( sha1sum "$1" | awk '{print $1;exit}' )"
|
|
143 |
if [ "$SUM" != "$2" ] ; then
|
|
144 |
echo "ERROR: The SHA1 sum $SUM of $1 doesn't match $2." >&2
|
|
145 |
return 1
|
|
146 |
else
|
|
147 |
echo "SHA1 of $1 verified correct."
|
|
148 |
fi
|
|
149 |
}
|
|
150 |
export -f verify_sha1
|
|
151 |
|
|
152 |
# arguments: URL
|
|
153 |
function lookup_sha1 {
|
|
154 |
grep -o "${1##*/}"'\s\+[0-9a-fA-F]*' <<<"$SHA1_LIST" | awk '{print $2;exit}'
|
|
155 |
}
|
|
156 |
export -f lookup_sha1
|
|
157 |
|
|
158 |
# arguments : file_name URL
|
|
159 |
function download {
|
|
160 |
local FNAME="$1"
|
|
161 |
local URL="$2"
|
|
162 |
wget --output-document="$FNAME" "$URL"
|
|
163 |
verify_sha1 "$FNAME" "$( lookup_sha1 "$URL" )"
|
|
164 |
}
|
|
165 |
export -f download
|
|
166 |
|
|
167 |
function install_ghc {
|
|
168 |
set -e
|
|
169 |
local TDIR=$( mktemp -d ) ;
|
|
170 |
pushd "$TDIR"
|
|
171 |
{
|
|
172 |
local GHC_ARCH=$ARCH
|
|
173 |
if [ "$ARCH" == "amd64" ] ; then
|
|
174 |
download ghc.tar.bz2 \
|
|
175 |
http://www.haskell.org/ghc/dist/${GHC_VERSION}/ghc-${GHC_VERSION}-x86_64-unknown-linux.tar.bz2
|
|
176 |
elif [ "$ARCH" == "i386" ] ; then
|
|
177 |
download ghc.tar.bz2 \
|
|
178 |
http://www.haskell.org/ghc/dist/${GHC_VERSION}/ghc-${GHC_VERSION}-i386-unknown-linux.tar.bz2
|
|
179 |
else
|
|
180 |
echo "Don't know what GHC to download for architecture $ARCH" >&2
|
|
181 |
return 1
|
|
182 |
fi
|
|
183 |
tar xjf ghc.tar.bz2
|
|
184 |
cd ghc-${GHC_VERSION}
|
|
185 |
./configure --prefix=/usr/local
|
|
186 |
make install
|
|
187 |
}
|
|
188 |
popd
|
|
189 |
[ -d "$TDIR" ] && rm -rf "$TDIR"
|
|
190 |
}
|
|
191 |
# export everything so that the function can be called in a sub-shell
|
|
192 |
export -f install_ghc
|
|
193 |
|
|
194 |
function install_cabal {
|
|
195 |
set -e
|
|
196 |
local TDIR=$( mktemp -d )
|
|
197 |
pushd "$TDIR"
|
|
198 |
{
|
|
199 |
download cabal-install.tar.gz \
|
|
200 |
http://www.haskell.org/cabal/release/cabal-install-${CABAL_INSTALL_VERSION}/cabal-install-${CABAL_INSTALL_VERSION}.tar.gz
|
|
201 |
tar xzf cabal-install.tar.gz
|
|
202 |
cd cabal-install-${CABAL_INSTALL_VERSION}
|
|
203 |
./bootstrap.sh --global
|
|
204 |
}
|
|
205 |
popd
|
|
206 |
[ -d "$TDIR" ] && rm -rf "$TDIR"
|
|
207 |
}
|
|
208 |
# export everything so that the function can be called in a sub-shell
|
|
209 |
export -f install_cabal
|
|
210 |
|
130 |
211 |
case $DIST_RELEASE in
|
131 |
212 |
|
132 |
213 |
squeeze)
|
... | ... | |
136 |
217 |
in_chroot -- \
|
137 |
218 |
$APT_INSTALL \
|
138 |
219 |
autoconf automake \
|
139 |
|
ghc cabal-install \
|
140 |
|
libghc6-curl-dev \
|
141 |
|
libghc6-parallel-dev \
|
142 |
|
libghc6-text-dev \
|
143 |
|
libghc6-vector-dev \
|
|
220 |
zlib1g-dev \
|
|
221 |
libgmp3-dev \
|
|
222 |
libcurl4-gnutls-dev \
|
144 |
223 |
libpcre3-dev \
|
145 |
|
libghc6-zlib-dev \
|
|
224 |
happy \
|
146 |
225 |
hlint hscolour pandoc \
|
147 |
226 |
graphviz qemu-utils \
|
148 |
227 |
python-docutils \
|
... | ... | |
171 |
250 |
coverage==3.4 \
|
172 |
251 |
bitarray==0.8.0
|
173 |
252 |
|
174 |
|
in_chroot -- \
|
175 |
|
cabal update
|
176 |
|
|
177 |
|
in_chroot -- \
|
178 |
|
cabal install --global \
|
179 |
|
blaze-builder==0.3.1.1 \
|
180 |
|
network==2.3 \
|
181 |
|
regex-pcre==0.94.4 \
|
182 |
|
hinotify==0.3.2 \
|
183 |
|
hslogger==1.1.4 \
|
184 |
|
quickcheck==2.5.1.1 \
|
185 |
|
attoparsec==0.10.1.1 \
|
186 |
|
crypto==4.2.4 \
|
187 |
|
MonadCatchIO-transformers==0.2.2.0 \
|
188 |
|
mtl==2.0.1.0 \
|
189 |
|
hashable==1.1.2.0 \
|
190 |
|
case-insensitive==0.3 \
|
191 |
|
parsec==3.0.1 \
|
192 |
|
snap-server==0.8.1 \
|
193 |
|
json==0.4.4 \
|
194 |
|
lifted-base==0.2.1.1
|
195 |
|
|
196 |
|
in_chroot -- \
|
197 |
|
cabal install --global \
|
198 |
|
hunit==1.2.5.2 \
|
199 |
|
happy==1.18.10 \
|
200 |
|
hlint==1.8.43 \
|
201 |
|
hscolour==1.20.3 \
|
202 |
|
temporary==1.1.2.3 \
|
203 |
|
test-framework==0.6.1 \
|
204 |
|
test-framework-hunit==0.2.7 \
|
205 |
|
test-framework-quickcheck2==0.2.12.3
|
|
253 |
in_chroot -p -- \
|
|
254 |
bash -c install_ghc
|
206 |
255 |
|
207 |
|
in_chroot -- \
|
208 |
|
cabal install --global cabal-file-th
|
|
256 |
in_chroot -p -- \
|
|
257 |
bash -c install_cabal
|
209 |
258 |
|
210 |
259 |
in_chroot -- \
|
211 |
|
cabal install --global shelltestrunner
|
|
260 |
cabal update
|
212 |
261 |
|
213 |
262 |
in_chroot -- \
|
214 |
|
cabal install --global base64-bytestring
|
|
263 |
cabal install --global \
|
|
264 |
attoparsec-0.11.1.0 \
|
|
265 |
base64-bytestring-1.0.0.1 \
|
|
266 |
blaze-builder-0.3.3.2 \
|
|
267 |
case-insensitive-1.1.0.3 \
|
|
268 |
Crypto-4.2.5.1 \
|
|
269 |
curl-1.3.8 \
|
|
270 |
happy \
|
|
271 |
hashable-1.2.1.0 \
|
|
272 |
hinotify-0.3.6 \
|
|
273 |
hscolour-1.20.3 \
|
|
274 |
hslogger-1.2.3 \
|
|
275 |
json-0.7 \
|
|
276 |
lifted-base-0.2.2.0 \
|
|
277 |
MonadCatchIO-transformers-0.3.0.0 \
|
|
278 |
network-2.4.1.2 \
|
|
279 |
parallel-3.2.0.4 \
|
|
280 |
parsec-3.1.3 \
|
|
281 |
regex-pcre-0.94.4 \
|
|
282 |
temporary-1.2.0.1 \
|
|
283 |
vector-0.10.9.1 \
|
|
284 |
zlib-0.5.4.1 \
|
|
285 |
\
|
|
286 |
hlint-1.8.57 \
|
|
287 |
HUnit-1.2.5.2 \
|
|
288 |
QuickCheck-2.6 \
|
|
289 |
test-framework-0.8.0.3 \
|
|
290 |
test-framework-hunit-0.3.0.1 \
|
|
291 |
test-framework-quickcheck2-0.3.0.2 \
|
|
292 |
\
|
|
293 |
snap-server-0.9.4.0 \
|
|
294 |
\
|
|
295 |
cabal-file-th-0.2.3 \
|
|
296 |
shelltestrunner
|
215 |
297 |
|
216 |
298 |
#Install selected packages from backports
|
217 |
299 |
in_chroot -- \
|
... | ... | |
234 |
316 |
libghc-regex-pcre-dev libghc-attoparsec-dev \
|
235 |
317 |
libghc-vector-dev libghc-temporary-dev \
|
236 |
318 |
libghc-snap-server-dev libpcre3 libpcre3-dev hscolour hlint pandoc \
|
237 |
|
libghc6-zlib-dev \
|
238 |
|
cabal-install\
|
|
319 |
libghc-zlib-dev \
|
|
320 |
cabal-install \
|
239 |
321 |
python-setuptools python-sphinx python-epydoc graphviz python-pyparsing \
|
240 |
322 |
python-simplejson python-pycurl python-paramiko \
|
241 |
323 |
python-bitarray python-ipaddr python-yaml qemu-utils python-coverage pep8 \
|
... | ... | |
327 |
409 |
;;
|
328 |
410 |
esac
|
329 |
411 |
|
|
412 |
# print what packages and versions are installed:
|
|
413 |
in_chroot -- \
|
|
414 |
cabal list --installed --simple-output
|
|
415 |
|
330 |
416 |
in_chroot -- \
|
331 |
417 |
$APT_INSTALL sudo fakeroot rsync locales less socat
|
332 |
418 |
|