| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
#Requirements for this script to work: |
| 4 |
#* Make sure that the user who uses the chroot is in group 'src', or change |
| 5 |
# the ${GROUP} variable to a group that contains the user. |
| 6 |
#* Add any path of the host system that you want to access inside the chroot |
| 7 |
# to the /etc/schroot/default/fstab file. This is important in particular if |
| 8 |
# your homedir is not in /home. |
| 9 |
#* Add this to your /etc/fstab: |
| 10 |
# tmpfs /var/lib/schroot/mount tmpfs defaults,size=3G 0 0 |
| 11 |
# tmpfs /var/lib/schroot/unpack tmpfs defaults,size=3G 0 0 |
| 12 |
|
| 13 |
#Configuration |
| 14 |
: ${ARCH:=amd64} |
| 15 |
: ${DIST_RELEASE:=wheezy} |
| 16 |
: ${VARIANT:=} |
| 17 |
: ${CONF_DIR:=/etc/schroot/chroot.d} |
| 18 |
: ${CHROOT_DIR:=/srv/chroot} |
| 19 |
: ${ALTERNATIVE_EDITOR:=/usr/bin/vim.basic} |
| 20 |
: ${CHROOT_FINAL_HOOK:=/bin/true} |
| 21 |
: ${GROUP:=src} |
| 22 |
# Additional Variables taken from the environmen |
| 23 |
# DATA_DIR |
| 24 |
# CHROOT_EXTRA_DEBIAN_PACKAGES |
| 25 |
|
| 26 |
# make the appended variant name more readable |
| 27 |
[ -n "$VARIANT" ] && VARIANT="-${VARIANT#-}" |
| 28 |
|
| 29 |
#Automatically generated variables |
| 30 |
CHROOTNAME=$DIST_RELEASE-$ARCH$VARIANT |
| 31 |
CHNAME=building_$CHROOTNAME |
| 32 |
TEMP_CHROOT_CONF=$CONF_DIR/$CHNAME.conf |
| 33 |
FINAL_CHROOT_CONF=$CHROOTNAME.conf |
| 34 |
ROOT=`pwd` |
| 35 |
CHDIR=$ROOT/$CHNAME |
| 36 |
USER=`whoami` |
| 37 |
COMP_FILENAME=$CHROOTNAME.tar.gz |
| 38 |
COMP_FILEPATH=$ROOT/$COMP_FILENAME |
| 39 |
TEMP_DATA_DIR=`mktemp -d` |
| 40 |
ACTUAL_DATA_DIR=$DATA_DIR |
| 41 |
ACTUAL_DATA_DIR=${ACTUAL_DATA_DIR:-$TEMP_DATA_DIR} |
| 42 |
SHA1_LIST=' |
| 43 |
cabal-install-1.18.0.2.tar.gz 2d1f7a48d17b1e02a1e67584a889b2ff4176a773 |
| 44 |
cabal-install-1.22.4.0.tar.gz b98eea96d321cdeed83a201c192dac116e786ec2 |
| 45 |
ghc-7.6.3-i386-unknown-linux.tar.bz2 f042b4171a2d4745137f2e425e6949c185f8ea14 |
| 46 |
ghc-7.6.3-x86_64-unknown-linux.tar.bz2 46ec3f3352ff57fba0dcbc8d9c20f7bcb6924b77 |
| 47 |
ghc-7.8.4-i386-unknown-linux-deb7.tar.bz2 4f523f854c37a43b738359506a89a37a9fa9fc5f |
| 48 |
ghc-7.8.4-x86_64-unknown-linux-deb7.tar.bz2 3f68321b064e5c1ffcb05838b85bcc00aa2315b4 |
| 49 |
' |
| 50 |
|
| 51 |
# export all variables needed in the schroot |
| 52 |
export ARCH SHA1_LIST |
| 53 |
|
| 54 |
# Use gzip --rsyncable if available, to speed up transfers of generated files |
| 55 |
# The environment variable GZIP is read automatically by 'gzip', |
| 56 |
# see ENVIRONMENT in gzip(1). |
| 57 |
gzip --rsyncable </dev/null >/dev/null 2>&1 && export GZIP="--rsyncable" |
| 58 |
|
| 59 |
#Runnability checks |
| 60 |
if [ $USER != 'root' ] |
| 61 |
then |
| 62 |
echo "This script requires root permissions to run" |
| 63 |
exit |
| 64 |
fi |
| 65 |
|
| 66 |
if [ -f $TEMP_CHROOT_CONF ] |
| 67 |
then |
| 68 |
echo "The configuration file name for the temporary chroot" |
| 69 |
echo " $TEMP_CHROOT_CONF" |
| 70 |
echo "already exists." |
| 71 |
echo "Remove it or change the CHNAME value in the script." |
| 72 |
exit |
| 73 |
fi |
| 74 |
|
| 75 |
#Create configuration dir and files if they do not exist |
| 76 |
if [ ! -d $ACTUAL_DATA_DIR ] |
| 77 |
then |
| 78 |
mkdir $ACTUAL_DATA_DIR |
| 79 |
echo "The data directory" |
| 80 |
echo " $ACTUAL_DATA_DIR" |
| 81 |
echo "has been created." |
| 82 |
fi |
| 83 |
|
| 84 |
if [ ! -f $ACTUAL_DATA_DIR/final.schroot.conf.in ] |
| 85 |
then |
| 86 |
cat <<END >$ACTUAL_DATA_DIR/final.schroot.conf.in |
| 87 |
[${CHROOTNAME}] |
| 88 |
description=Debian ${DIST_RELEASE} ${ARCH} |
| 89 |
groups=${GROUP} |
| 90 |
source-root-groups=root |
| 91 |
type=file |
| 92 |
file=${CHROOT_DIR}/${COMP_FILENAME} |
| 93 |
END |
| 94 |
echo "The file" |
| 95 |
echo " $ACTUAL_DATA_DIR/final.schroot.conf.in" |
| 96 |
echo "has been created with default configurations." |
| 97 |
fi |
| 98 |
|
| 99 |
if [ ! -f $ACTUAL_DATA_DIR/temp.schroot.conf.in ] |
| 100 |
then |
| 101 |
cat <<END >$ACTUAL_DATA_DIR/temp.schroot.conf.in |
| 102 |
[${CHNAME}] |
| 103 |
description=Debian ${DIST_RELEASE}${VARIANT} ${ARCH} |
| 104 |
directory=${CHDIR} |
| 105 |
groups=${GROUP} |
| 106 |
users=root |
| 107 |
type=directory |
| 108 |
END |
| 109 |
echo "The file" |
| 110 |
echo " $ACTUAL_DATA_DIR/temp.schroot.conf.in" |
| 111 |
echo "has been created with default configurations." |
| 112 |
fi |
| 113 |
|
| 114 |
#Stop on errors |
| 115 |
set -e |
| 116 |
|
| 117 |
#Cleanup |
| 118 |
rm -rf $CHDIR |
| 119 |
mkdir $CHDIR |
| 120 |
|
| 121 |
#Install tools for building chroots |
| 122 |
apt-get install -y schroot debootstrap |
| 123 |
|
| 124 |
shopt -s expand_aliases |
| 125 |
alias in_chroot='schroot -c $CHNAME -d / ' |
| 126 |
function subst_variables { |
| 127 |
sed \ |
| 128 |
-e "s/\${ARCH}/$ARCH/" \ |
| 129 |
-e "s*\${CHDIR}*$CHDIR*" \ |
| 130 |
-e "s/\${CHNAME}/$CHNAME/" \ |
| 131 |
-e "s/\${CHROOTNAME}/$CHROOTNAME/" \ |
| 132 |
-e "s*\${CHROOT_DIR}*$CHROOT_DIR*" \ |
| 133 |
-e "s/\${COMP_FILENAME}/$COMP_FILENAME/" \ |
| 134 |
-e "s/\${DIST_RELEASE}/$DIST_RELEASE/" $@ |
| 135 |
} |
| 136 |
|
| 137 |
#Generate chroot configurations |
| 138 |
cat $ACTUAL_DATA_DIR/temp.schroot.conf.in | subst_variables > $TEMP_CHROOT_CONF |
| 139 |
cat $ACTUAL_DATA_DIR/final.schroot.conf.in | subst_variables > $FINAL_CHROOT_CONF |
| 140 |
|
| 141 |
#Install the base system |
| 142 |
debootstrap --arch $ARCH $DIST_RELEASE $CHDIR |
| 143 |
|
| 144 |
APT_INSTALL="apt-get install -y --no-install-recommends" |
| 145 |
|
| 146 |
if [ $DIST_RELEASE = squeeze ] |
| 147 |
then |
| 148 |
echo "deb http://backports.debian.org/debian-backports" \ |
| 149 |
"$DIST_RELEASE-backports main contrib non-free" \ |
| 150 |
> $CHDIR/etc/apt/sources.list.d/backports.list |
| 151 |
fi |
| 152 |
|
| 153 |
#Install all the packages |
| 154 |
in_chroot -- \ |
| 155 |
apt-get update |
| 156 |
|
| 157 |
|
| 158 |
# Functions for downloading and checking Haskell core components. |
| 159 |
# The functions run commands within the schroot. |
| 160 |
|
| 161 |
# arguments : file_name expected_sha1 |
| 162 |
function verify_sha1 { |
| 163 |
local SUM="$( in_chroot -- sha1sum "$1" | awk '{print $1;exit}' )" |
| 164 |
if [ "$SUM" != "$2" ] ; then |
| 165 |
echo "ERROR: The SHA1 sum $SUM of $1 doesn't match $2." >&2 |
| 166 |
return 1 |
| 167 |
else |
| 168 |
echo "SHA1 of $1 verified correct." |
| 169 |
fi |
| 170 |
} |
| 171 |
|
| 172 |
# arguments: URL |
| 173 |
function lookup_sha1 { |
| 174 |
grep -o "${1##*/}"'\s\+[0-9a-fA-F]*' <<<"$SHA1_LIST" | awk '{print $2;exit}' |
| 175 |
} |
| 176 |
|
| 177 |
# arguments : file_name URL |
| 178 |
function download { |
| 179 |
local FNAME="$1" |
| 180 |
local URL="$2" |
| 181 |
in_chroot -- wget --no-check-certificate --output-document="$FNAME" "$URL" |
| 182 |
verify_sha1 "$FNAME" "$( lookup_sha1 "$URL" )" |
| 183 |
} |
| 184 |
|
| 185 |
function install_ghc { |
| 186 |
local GHC_ARCH=$ARCH |
| 187 |
local TDIR=$( schroot -c $CHNAME -d / -- mktemp -d ) |
| 188 |
[ -n "$TDIR" ] |
| 189 |
if [ "$ARCH" == "amd64" ] ; then |
| 190 |
download "$TDIR"/ghc.tar.bz2 \ |
| 191 |
http://www.haskell.org/ghc/dist/${GHC_VERSION}/ghc-${GHC_VERSION}-x86_64-unknown-linux${GHC_VARIANT}.tar.bz2 |
| 192 |
elif [ "$ARCH" == "i386" ] ; then |
| 193 |
download "$TDIR"/ghc.tar.bz2 \ |
| 194 |
http://www.haskell.org/ghc/dist/${GHC_VERSION}/ghc-${GHC_VERSION}-i386-unknown-linux${GHC_VARIANT}.tar.bz2 |
| 195 |
else |
| 196 |
echo "Don't know what GHC to download for architecture $ARCH" >&2 |
| 197 |
return 1 |
| 198 |
fi |
| 199 |
schroot -c $CHNAME -d "$TDIR" -- \ |
| 200 |
tar xjf ghc.tar.bz2 |
| 201 |
schroot -c $CHNAME -d "$TDIR/ghc-${GHC_VERSION}" -- \ |
| 202 |
./configure --prefix=/usr/local |
| 203 |
schroot -c $CHNAME -d "$TDIR/ghc-${GHC_VERSION}" -- \ |
| 204 |
make install |
| 205 |
schroot -c $CHNAME -d "/" -- \ |
| 206 |
rm -rf "$TDIR" |
| 207 |
} |
| 208 |
|
| 209 |
function install_cabal { |
| 210 |
local TDIR=$( schroot -c $CHNAME -d / -- mktemp -d ) |
| 211 |
[ -n "$TDIR" ] |
| 212 |
download "$TDIR"/cabal-install.tar.gz \ |
| 213 |
http://www.haskell.org/cabal/release/cabal-install-${CABAL_INSTALL_VERSION}/cabal-install-${CABAL_INSTALL_VERSION}.tar.gz |
| 214 |
schroot -c $CHNAME -d "$TDIR" -- \ |
| 215 |
tar xzf cabal-install.tar.gz |
| 216 |
schroot -c $CHNAME -d "$TDIR/cabal-install-${CABAL_INSTALL_VERSION}" -- \ |
| 217 |
bash -c 'EXTRA_CONFIGURE_OPTS="--enable-library-profiling" ./bootstrap.sh --global' |
| 218 |
schroot -c $CHNAME -d "/" -- \ |
| 219 |
rm -rf "$TDIR" |
| 220 |
} |
| 221 |
|
| 222 |
|
| 223 |
case ${DIST_RELEASE}${VARIANT} in |
| 224 |
|
| 225 |
squeeze) |
| 226 |
|
| 227 |
GHC_VERSION="7.6.3" |
| 228 |
GHC_VARIANT="" |
| 229 |
CABAL_INSTALL_VERSION="1.18.0.2" |
| 230 |
CABAL_LIB_VERSION=">=1.18.0 && <1.19" |
| 231 |
export GHC_VERSION GHC_VARIANT CABAL_INSTALL_VERSION |
| 232 |
|
| 233 |
# do not install libghc6-network-dev, since it's too old, and just |
| 234 |
# confuses the dependencies |
| 235 |
in_chroot -- \ |
| 236 |
$APT_INSTALL \ |
| 237 |
autoconf automake \ |
| 238 |
zlib1g-dev \ |
| 239 |
libgmp3-dev \ |
| 240 |
libcurl4-gnutls-dev \ |
| 241 |
libpcre3-dev \ |
| 242 |
happy \ |
| 243 |
hscolour pandoc \ |
| 244 |
graphviz qemu-utils \ |
| 245 |
python-docutils \ |
| 246 |
python-pyparsing \ |
| 247 |
python-pyinotify \ |
| 248 |
python-pycurl \ |
| 249 |
python-ipaddr \ |
| 250 |
python-yaml \ |
| 251 |
python-paramiko |
| 252 |
|
| 253 |
in_chroot -- \ |
| 254 |
$APT_INSTALL python-setuptools python-dev build-essential |
| 255 |
|
| 256 |
in_chroot -- \ |
| 257 |
easy_install \ |
| 258 |
unittest2==0.5.1 \ |
| 259 |
logilab-astng==0.24.1 \ |
| 260 |
logilab-common==0.58.3 \ |
| 261 |
pylint==0.26.0 |
| 262 |
|
| 263 |
in_chroot -- \ |
| 264 |
easy_install \ |
| 265 |
sphinx==1.1.3 \ |
| 266 |
pep8==1.3.3 \ |
| 267 |
coverage==3.4 \ |
| 268 |
bitarray==0.8.0 |
| 269 |
|
| 270 |
install_ghc |
| 271 |
|
| 272 |
install_cabal |
| 273 |
|
| 274 |
in_chroot -- \ |
| 275 |
cabal update |
| 276 |
|
| 277 |
# sinec we're using Cabal >=1.16, we can use the parallel install option |
| 278 |
in_chroot -- \ |
| 279 |
cabal install --global -j --enable-library-profiling \ |
| 280 |
attoparsec-0.11.1.0 \ |
| 281 |
base64-bytestring-1.0.0.1 \ |
| 282 |
blaze-builder-0.3.3.2 \ |
| 283 |
case-insensitive-1.1.0.3 \ |
| 284 |
Crypto-4.2.5.1 \ |
| 285 |
curl-1.3.8 \ |
| 286 |
happy \ |
| 287 |
hashable-1.2.1.0 \ |
| 288 |
hinotify-0.3.6 \ |
| 289 |
hscolour-1.20.3 \ |
| 290 |
hslogger-1.2.3 \ |
| 291 |
json-0.7 \ |
| 292 |
lifted-base-0.2.2.0 \ |
| 293 |
lens-4.0.4 \ |
| 294 |
MonadCatchIO-transformers-0.3.0.0 \ |
| 295 |
network-2.4.1.2 \ |
| 296 |
parallel-3.2.0.4 \ |
| 297 |
parsec-3.1.3 \ |
| 298 |
regex-pcre-0.94.4 \ |
| 299 |
temporary-1.2.0.1 \ |
| 300 |
vector-0.10.9.1 \ |
| 301 |
zlib-0.5.4.1 \ |
| 302 |
\ |
| 303 |
'hlint>=1.9.12' \ |
| 304 |
HUnit-1.2.5.2 \ |
| 305 |
QuickCheck-2.6 \ |
| 306 |
test-framework-0.8.0.3 \ |
| 307 |
test-framework-hunit-0.3.0.1 \ |
| 308 |
test-framework-quickcheck2-0.3.0.2 \ |
| 309 |
\ |
| 310 |
snap-server-0.9.4.0 \ |
| 311 |
PSQueue-1.1 \ |
| 312 |
\ |
| 313 |
"Cabal $CABAL_LIB_VERSION" \ |
| 314 |
cabal-file-th-0.2.3 \ |
| 315 |
shelltestrunner |
| 316 |
|
| 317 |
#Install selected packages from backports |
| 318 |
in_chroot -- \ |
| 319 |
$APT_INSTALL -t squeeze-backports \ |
| 320 |
git \ |
| 321 |
git-email \ |
| 322 |
vim \ |
| 323 |
exuberant-ctags |
| 324 |
|
| 325 |
;; |
| 326 |
|
| 327 |
wheezy) |
| 328 |
|
| 329 |
in_chroot -- \ |
| 330 |
$APT_INSTALL \ |
| 331 |
autoconf automake ghc ghc-haddock libghc-network-dev \ |
| 332 |
libghc-test-framework{,-hunit,-quickcheck2}-dev \ |
| 333 |
libghc-json-dev libghc-curl-dev libghc-hinotify-dev \ |
| 334 |
libghc-parallel-dev libghc-utf8-string-dev \ |
| 335 |
libghc-hslogger-dev libghc-crypto-dev \ |
| 336 |
libghc-regex-pcre-dev libghc-attoparsec-dev \ |
| 337 |
libghc-vector-dev libghc-temporary-dev \ |
| 338 |
libghc-snap-server-dev libpcre3 libpcre3-dev happy hscolour pandoc \ |
| 339 |
libghc-zlib-dev libghc-psqueue-dev \ |
| 340 |
cabal-install \ |
| 341 |
python-setuptools python-sphinx python-epydoc graphviz python-pyparsing \ |
| 342 |
python-pycurl python-paramiko \ |
| 343 |
python-bitarray python-ipaddr python-yaml qemu-utils python-coverage pep8 \ |
| 344 |
shelltestrunner python-dev openssh-client vim git git-email exuberant-ctags |
| 345 |
|
| 346 |
# We need version 0.9.4 of pyinotify because the packaged version, 0.9.3, is |
| 347 |
# incompatibile with the packaged version of python-epydoc 3.0.1. |
| 348 |
# Reason: a logger class in pyinotify calculates its superclasses at |
| 349 |
# runtime, which clashes with python-epydoc's static analysis phase. |
| 350 |
# |
| 351 |
# Problem introduced in: |
| 352 |
# https://github.com/seb-m/pyinotify/commit/2c7e8f8959d2f8528e0d90847df360 |
| 353 |
# and "fixed" in: |
| 354 |
# https://github.com/seb-m/pyinotify/commit/98c5f41a6e2e90827a63ff1b878596 |
| 355 |
|
| 356 |
in_chroot -- \ |
| 357 |
easy_install \ |
| 358 |
logilab-astng==0.24.1 \ |
| 359 |
logilab-common==0.58.3 \ |
| 360 |
pylint==0.26.0 \ |
| 361 |
pep8==1.3.3 |
| 362 |
|
| 363 |
in_chroot -- \ |
| 364 |
easy_install pyinotify==0.9.4 |
| 365 |
|
| 366 |
in_chroot -- \ |
| 367 |
cabal update |
| 368 |
|
| 369 |
in_chroot -- \ |
| 370 |
cabal install --global \ |
| 371 |
'base64-bytestring>=1' \ |
| 372 |
lens-3.10.2 \ |
| 373 |
'lifted-base>=0.1.2' \ |
| 374 |
'hlint>=1.9.12' |
| 375 |
;; |
| 376 |
|
| 377 |
jessie) |
| 378 |
|
| 379 |
in_chroot -- \ |
| 380 |
$APT_INSTALL \ |
| 381 |
autoconf automake ghc ghc-haddock libghc-network-dev \ |
| 382 |
libghc-test-framework{,-hunit,-quickcheck2}-dev \ |
| 383 |
libghc-json-dev libghc-curl-dev libghc-hinotify-dev \ |
| 384 |
libghc-parallel-dev libghc-utf8-string-dev \ |
| 385 |
libghc-hslogger-dev libghc-crypto-dev \ |
| 386 |
libghc-regex-pcre-dev libghc-attoparsec-dev \ |
| 387 |
libghc-vector-dev libghc-temporary-dev \ |
| 388 |
libghc-snap-server-dev libpcre3 libpcre3-dev happy hscolour pandoc \ |
| 389 |
libghc-zlib-dev libghc-psqueue-dev \ |
| 390 |
libghc-base64-bytestring-dev libghc-lens-dev libghc-lifted-base-dev \ |
| 391 |
libghc-cabal-dev \ |
| 392 |
cabal-install \ |
| 393 |
python-setuptools python-sphinx python-epydoc graphviz python-pyparsing \ |
| 394 |
python-pycurl python-pyinotify python-paramiko \ |
| 395 |
python-bitarray python-ipaddr python-yaml qemu-utils python-coverage pep8 \ |
| 396 |
shelltestrunner python-dev pylint openssh-client \ |
| 397 |
vim git git-email exuberant-ctags |
| 398 |
|
| 399 |
in_chroot -- \ |
| 400 |
cabal update |
| 401 |
|
| 402 |
in_chroot -- \ |
| 403 |
cabal install --global \ |
| 404 |
'hlint>=1.9.12' |
| 405 |
;; |
| 406 |
|
| 407 |
jessie-ghc78) |
| 408 |
|
| 409 |
GHC_VERSION="7.8.4" |
| 410 |
GHC_VARIANT="-deb7" |
| 411 |
CABAL_INSTALL_VERSION="1.22.4.0" |
| 412 |
# the version of the Cabal library below must match the version used by |
| 413 |
# CABAL_INSTALL_VERSION, see the dependencies of cabal-install |
| 414 |
CABAL_LIB_VERSION=">=1.22.2 && <1.23" |
| 415 |
export GHC_VERSION GHC_VARIANT CABAL_INSTALL_VERSION |
| 416 |
|
| 417 |
in_chroot -- \ |
| 418 |
$APT_INSTALL \ |
| 419 |
autoconf automake \ |
| 420 |
zlib1g-dev \ |
| 421 |
libgmp3-dev \ |
| 422 |
libcurl4-openssl-dev \ |
| 423 |
libpcre3-dev \ |
| 424 |
happy \ |
| 425 |
hlint hscolour pandoc \ |
| 426 |
graphviz qemu-utils \ |
| 427 |
python-docutils \ |
| 428 |
python-pyparsing \ |
| 429 |
python-pyinotify \ |
| 430 |
python-pycurl \ |
| 431 |
python-ipaddr \ |
| 432 |
python-yaml \ |
| 433 |
python-paramiko \ |
| 434 |
git \ |
| 435 |
git-email \ |
| 436 |
vim |
| 437 |
|
| 438 |
in_chroot -- \ |
| 439 |
$APT_INSTALL python-setuptools python-dev build-essential |
| 440 |
|
| 441 |
in_chroot -- \ |
| 442 |
easy_install \ |
| 443 |
logilab-astng==0.24.1 \ |
| 444 |
logilab-common==0.58.3 \ |
| 445 |
pylint==0.26.0 |
| 446 |
|
| 447 |
in_chroot -- \ |
| 448 |
easy_install \ |
| 449 |
sphinx==1.1.3 \ |
| 450 |
pep8==1.3.3 \ |
| 451 |
coverage==3.4 \ |
| 452 |
bitarray==0.8.0 |
| 453 |
|
| 454 |
install_ghc |
| 455 |
|
| 456 |
install_cabal |
| 457 |
|
| 458 |
in_chroot -- \ |
| 459 |
cabal update |
| 460 |
|
| 461 |
# since we're using Cabal >=1.16, we can use the parallel install option |
| 462 |
in_chroot -- \ |
| 463 |
cabal install --global -j --enable-library-profiling \ |
| 464 |
attoparsec==0.12.1.6 \ |
| 465 |
base64-bytestring==1.0.0.1 \ |
| 466 |
blaze-builder==0.4.0.1 \ |
| 467 |
case-insensitive==1.2.0.4 \ |
| 468 |
Crypto==4.2.5.1 \ |
| 469 |
curl==1.3.8 \ |
| 470 |
happy==1.19.5 \ |
| 471 |
hashable==1.2.3.2 \ |
| 472 |
hinotify==0.3.7 \ |
| 473 |
hscolour==1.23 \ |
| 474 |
hslogger==1.2.8 \ |
| 475 |
json==0.9.1 \ |
| 476 |
lifted-base==0.2.3.6 \ |
| 477 |
lens==4.9.1 \ |
| 478 |
MonadCatchIO-transformers==0.3.1.3 \ |
| 479 |
network==2.6.0.2 \ |
| 480 |
parallel==3.2.0.6 \ |
| 481 |
parsec==3.1.7 \ |
| 482 |
regex-pcre==0.94.4 \ |
| 483 |
temporary==1.2.0.3 \ |
| 484 |
vector==0.10.12.3 \ |
| 485 |
zlib==0.5.4.2 \ |
| 486 |
\ |
| 487 |
hlint==1.9.20 \ |
| 488 |
HUnit==1.2.5.2 \ |
| 489 |
QuickCheck==2.8.1 \ |
| 490 |
test-framework==0.8.1.1 \ |
| 491 |
test-framework-hunit==0.3.0.1 \ |
| 492 |
test-framework-quickcheck2==0.3.0.3 \ |
| 493 |
\ |
| 494 |
snap-server==0.9.5.1 \ |
| 495 |
\ |
| 496 |
"Cabal $CABAL_LIB_VERSION" \ |
| 497 |
cabal-file-th==0.2.3 \ |
| 498 |
shelltestrunner==1.3.5 |
| 499 |
;; |
| 500 |
|
| 501 |
precise) |
| 502 |
# ghc, git-email and other dependencies are hosted in the universe |
| 503 |
# repository, which is not enabled by default. |
| 504 |
echo "Adding universe repository..." |
| 505 |
cat > $CHDIR/etc/apt/sources.list.d/universe.list <<EOF |
| 506 |
deb http://archive.ubuntu.com/ubuntu precise universe |
| 507 |
EOF |
| 508 |
in_chroot -- \ |
| 509 |
apt-get update |
| 510 |
|
| 511 |
echo "Installing packages" |
| 512 |
in_chroot -- \ |
| 513 |
$APT_INSTALL \ |
| 514 |
autoconf automake ghc ghc-haddock \ |
| 515 |
libghc-curl-dev libghc-hinotify-dev \ |
| 516 |
libghc-parallel-dev libghc-utf8-string-dev \ |
| 517 |
libghc-crypto-dev \ |
| 518 |
libghc-attoparsec-dev \ |
| 519 |
libghc-vector-dev libghc-temporary-dev libghc-psqueue-dev \ |
| 520 |
libghc-cabal-dev \ |
| 521 |
cabal-install \ |
| 522 |
libpcre3 libpcre3-dev happy hscolour pandoc \ |
| 523 |
python-setuptools python-sphinx python-epydoc graphviz python-pyparsing \ |
| 524 |
python-pyinotify python-pycurl python-paramiko \ |
| 525 |
python-bitarray python-ipaddr python-yaml qemu-utils python-coverage pep8 \ |
| 526 |
python-dev pylint openssh-client vim git git-email exuberant-ctags \ |
| 527 |
build-essential |
| 528 |
|
| 529 |
in_chroot -- \ |
| 530 |
easy_install \ |
| 531 |
logilab-astng==0.24.1 \ |
| 532 |
logilab-common==0.58.3 \ |
| 533 |
pylint==0.26.0 \ |
| 534 |
pep8==1.3.3 |
| 535 |
|
| 536 |
in_chroot -- \ |
| 537 |
cabal update |
| 538 |
|
| 539 |
# Precise has network-2.4.0.0, which breaks, see |
| 540 |
# https://github.com/haskell/network/issues/60 |
| 541 |
in_chroot -- \ |
| 542 |
cabal install --global \ |
| 543 |
'base64-bytestring>=1' \ |
| 544 |
hslogger-1.2.3 \ |
| 545 |
'hlint>=1.9.12' \ |
| 546 |
json-0.7 \ |
| 547 |
lens-3.10.2 \ |
| 548 |
'lifted-base>=0.1.2' \ |
| 549 |
'network>=2.4.0.1' \ |
| 550 |
'regex-pcre>=0.94.4' \ |
| 551 |
parsec-3.1.3 \ |
| 552 |
shelltestrunner \ |
| 553 |
'snap-server>=0.8.1' \ |
| 554 |
test-framework-0.8.0.3 \ |
| 555 |
test-framework-hunit-0.3.0.1 \ |
| 556 |
test-framework-quickcheck2-0.3.0.2 \ |
| 557 |
'transformers>=0.3.0.0' |
| 558 |
;; |
| 559 |
|
| 560 |
*) |
| 561 |
in_chroot -- \ |
| 562 |
$APT_INSTALL \ |
| 563 |
autoconf automake ghc ghc-haddock libghc-network-dev \ |
| 564 |
libghc-test-framework{,-hunit,-quickcheck2}-dev \ |
| 565 |
libghc-json-dev libghc-curl-dev libghc-hinotify-dev \ |
| 566 |
libghc-parallel-dev libghc-utf8-string-dev \ |
| 567 |
libghc-hslogger-dev libghc-crypto-dev \ |
| 568 |
libghc-regex-pcre-dev libghc-attoparsec-dev \ |
| 569 |
libghc-vector-dev libghc-temporary-dev libghc-psqueue-dev \ |
| 570 |
libghc-snap-server-dev libpcre3 libpcre3-dev happy hscolour pandoc \ |
| 571 |
libghc-lens-dev libghc-lifted-base-dev \ |
| 572 |
libghc-cabal-dev \ |
| 573 |
cabal-install \ |
| 574 |
libghc-base64-bytestring-dev \ |
| 575 |
python-setuptools python-sphinx python-epydoc graphviz python-pyparsing \ |
| 576 |
python-pyinotify python-pycurl python-paramiko \ |
| 577 |
python-bitarray python-ipaddr python-yaml qemu-utils python-coverage pep8 \ |
| 578 |
shelltestrunner python-dev pylint openssh-client \ |
| 579 |
vim git git-email exuberant-ctags \ |
| 580 |
build-essential |
| 581 |
|
| 582 |
in_chroot -- \ |
| 583 |
cabal update |
| 584 |
|
| 585 |
in_chroot -- \ |
| 586 |
cabal install --global \ |
| 587 |
'hlint>=1.9.12' |
| 588 |
;; |
| 589 |
esac |
| 590 |
|
| 591 |
# print what packages and versions are installed: |
| 592 |
in_chroot -- \ |
| 593 |
cabal list --installed --simple-output |
| 594 |
|
| 595 |
in_chroot -- \ |
| 596 |
$APT_INSTALL sudo fakeroot rsync locales less socat |
| 597 |
|
| 598 |
# Configure the locale |
| 599 |
case $DIST_RELEASE in |
| 600 |
precise) |
| 601 |
in_chroot -- \ |
| 602 |
$APT_INSTALL language-pack-en |
| 603 |
;; |
| 604 |
*) |
| 605 |
echo "en_US.UTF-8 UTF-8" >> $CHDIR/etc/locale.gen |
| 606 |
|
| 607 |
in_chroot -- \ |
| 608 |
locale-gen |
| 609 |
;; |
| 610 |
esac |
| 611 |
|
| 612 |
in_chroot -- \ |
| 613 |
$APT_INSTALL lvm2 ssh bridge-utils iproute iputils-arping \ |
| 614 |
ndisc6 python-openssl openssl \ |
| 615 |
fping qemu-utils |
| 616 |
|
| 617 |
in_chroot -- \ |
| 618 |
easy_install psutil |
| 619 |
|
| 620 |
in_chroot -- \ |
| 621 |
easy_install jsonpointer \ |
| 622 |
jsonpointer \ |
| 623 |
jsonpatch |
| 624 |
|
| 625 |
in_chroot -- \ |
| 626 |
$APT_INSTALL \ |
| 627 |
python-epydoc debhelper quilt |
| 628 |
|
| 629 |
# extra debian packages |
| 630 |
|
| 631 |
for package in $CHROOT_EXTRA_DEBIAN_PACKAGES |
| 632 |
do in_chroot -- \ |
| 633 |
$APT_INSTALL $package |
| 634 |
done |
| 635 |
|
| 636 |
#Set default editor |
| 637 |
in_chroot -- \ |
| 638 |
update-alternatives --set editor $ALTERNATIVE_EDITOR |
| 639 |
|
| 640 |
# Final user hook |
| 641 |
|
| 642 |
in_chroot -- $CHROOT_FINAL_HOOK |
| 643 |
|
| 644 |
rm -f $COMP_FILEPATH |
| 645 |
echo "Creating compressed schroot image..." |
| 646 |
cd $CHDIR |
| 647 |
tar czf $COMP_FILEPATH ./* |
| 648 |
cd $ROOT |
| 649 |
|
| 650 |
rm -rf $CHDIR |
| 651 |
rm -f $TEMP_CHROOT_CONF |
| 652 |
rm -rf $TEMP_DATA_DIR |
| 653 |
|
| 654 |
echo "Chroot created. In order to run it:" |
| 655 |
echo " * sudo cp $FINAL_CHROOT_CONF $CONF_DIR/$FINAL_CHROOT_CONF" |
| 656 |
echo " * sudo mkdir -p $CHROOT_DIR" |
| 657 |
echo " * sudo cp $COMP_FILEPATH $CHROOT_DIR/$COMP_FILENAME" |
| 658 |
echo "Then run \"schroot -c $CHROOTNAME\"" |