Merge branch 'stable-2.9' into stable-2.10
[ganeti-local] / devel / build_chroot
index 22aba5e..f34ef19 100755 (executable)
@@ -111,125 +111,178 @@ debootstrap --arch $ARCH $DIST_RELEASE $CHDIR
 
 APT_INSTALL="apt-get install -y --no-install-recommends"
 
-echo "deb http://backports.debian.org/debian-backports" \
-     "$DIST_RELEASE-backports main contrib non-free" \
-     > $CHDIR/etc/apt/sources.list.d/backports.list
+if [ DIST_RELEASE = squeeze ]
+then
+  echo "deb http://backports.debian.org/debian-backports" \
+       "$DIST_RELEASE-backports main contrib non-free" \
+       > $CHDIR/etc/apt/sources.list.d/backports.list
+fi
 
 #Install all the packages
 in_chroot -- \
   apt-get update
 
+case $DIST_RELEASE in
+
+  squeeze)
+
+    # do not install libghc6-network-dev, since it's too old, and just
+    # confuses the dependencies
+    in_chroot -- \
+      $APT_INSTALL \
+        autoconf automake \
+        ghc cabal-install \
+        libghc6-curl-dev \
+        libghc6-parallel-dev \
+        libghc6-text-dev \
+        libghc6-vector-dev \
+        libpcre3-dev \
+        hlint hscolour pandoc \
+        graphviz qemu-utils \
+        python-docutils \
+        python-simplejson \
+        python-pyparsing \
+        python-pyinotify \
+        python-pycurl \
+        python-ipaddr \
+        python-yaml \
+        python-paramiko
+
+    in_chroot -- \
+      $APT_INSTALL python-setuptools python-dev build-essential
+
+    in_chroot -- \
+      easy_install \
+        logilab-astng==0.24.1 \
+        logilab-common==0.58.3 \
+        mock==1.0.1 \
+        pylint==0.26.0
+
+    in_chroot -- \
+      easy_install \
+        sphinx==1.1.3 \
+        pep8==1.3.3 \
+        coverage==3.4 \
+        bitarray==0.8.0
+
+    in_chroot -- \
+      cabal update
+
+    in_chroot -- \
+      cabal install --global \
+    blaze-builder==0.3.1.1 \
+        network==2.3 \
+        regex-pcre==0.94.4 \
+        hinotify==0.3.2 \
+        hslogger==1.1.4 \
+        quickcheck==2.5.1.1 \
+        attoparsec==0.10.1.1 \
+        crypto==4.2.4 \
+        MonadCatchIO-transformers==0.2.2.0 \
+        mtl==2.0.1.0 \
+        hashable==1.1.2.0 \
+        case-insensitive==0.3 \
+        parsec==3.0.1 \
+        snap-server==0.8.1 \
+        json==0.4.4
+
+    in_chroot -- \
+      cabal install --global \
+        hunit==1.2.5.2 \
+        happy==1.18.10 \
+        hlint==1.8.43 \
+        hscolour==1.20.3 \
+        temporary==1.1.2.3 \
+        test-framework==0.6.1 \
+        test-framework-hunit==0.2.7 \
+        test-framework-quickcheck2==0.2.12.3
+
+    in_chroot -- \
+      cabal install --global cabal-file-th
+
+    in_chroot -- \
+      cabal install --global shelltestrunner
+
+    #Install selected packages from backports
+    in_chroot -- \
+      $APT_INSTALL -t squeeze-backports \
+        git \
+        git-email \
+        vim
+
+;;
+
+  wheezy)
+
+    in_chroot -- \
+      $APT_INSTALL \
+      autoconf automake ghc ghc-haddock libghc-network-dev \
+      libghc-test-framework{,-hunit,-quickcheck2}-dev \
+      libghc-json-dev libghc-curl-dev libghc-hinotify-dev \
+      libghc-parallel-dev libghc-utf8-string-dev \
+      libghc-hslogger-dev libghc-crypto-dev \
+      libghc-regex-pcre-dev libghc-attoparsec-dev \
+      libghc-vector-dev libghc-temporary-dev \
+      libghc-snap-server-dev libpcre3 libpcre3-dev hscolour hlint pandoc \
+      python-setuptools python-sphinx python-epydoc graphviz python-pyparsing \
+      python-simplejson python-pycurl python-paramiko \
+      python-bitarray python-ipaddr python-yaml qemu-utils python-coverage pep8 \
+      shelltestrunner python-dev pylint openssh-client vim git git-email
+
+    # We need version 0.9.4 of pyinotify because the packaged version, 0.9.3, is
+    # incompatibile with the packaged version of python-epydoc 3.0.1.
+    # Reason: a logger class in pyinotify calculates its superclasses at
+    # runtime, which clashes with python-epydoc's static analysis phase.
+    #
+    # Problem introduced in:
+    #   https://github.com/seb-m/pyinotify/commit/2c7e8f8959d2f8528e0d90847df360
+    # and "fixed" in:
+    #   https://github.com/seb-m/pyinotify/commit/98c5f41a6e2e90827a63ff1b878596
+
+    in_chroot -- \
+      easy_install pyinotify==0.9.4
+
+;;
+
+  *)
+
+    in_chroot -- \
+      $APT_INSTALL \
+      autoconf automake ghc ghc-haddock libghc-network-dev \
+      libghc-test-framework{,-hunit,-quickcheck2}-dev \
+      libghc-json-dev libghc-curl-dev libghc-hinotify-dev \
+      libghc-parallel-dev libghc-utf8-string-dev \
+      libghc-hslogger-dev libghc-crypto-dev \
+      libghc-regex-pcre-dev libghc-attoparsec-dev \
+      libghc-vector-dev libghc-temporary-dev \
+      libghc-snap-server-dev libpcre3 libpcre3-dev hscolour hlint pandoc \
+      python-setuptools python-sphinx python-epydoc graphviz python-pyparsing \
+      python-simplejson python-pyinotify python-pycurl python-paramiko \
+      python-bitarray python-ipaddr python-yaml qemu-utils python-coverage pep8 \
+      shelltestrunner python-dev pylint openssh-client vim git git-email
+
+;;
+esac
 
-# do not install libghc6-network-dev, since it's too old, and just
-# confuses the dependencies
-in_chroot -- \
-  $APT_INSTALL \
-    autoconf automake \
-    ghc cabal-install \
-    libghc6-curl-dev \
-    libghc6-parallel-dev \
-    libghc6-text-dev \
-    libghc6-vector-dev \
-    libpcre3-dev \
-    hlint hscolour pandoc \
-    graphviz socat qemu-utils \
-    python-docutils \
-    python-simplejson \
-    python-pyparsing \
-    python-pyinotify \
-    python-pycurl \
-    python-ipaddr \
-    python-yaml \
-    python-paramiko
-
-in_chroot -- \
-  $APT_INSTALL python-setuptools python-dev build-essential
-
-in_chroot -- \
-  easy_install \
-    logilab-astng==0.20.1 \
-    logilab-common==0.50.3 \
-    mock==1.0.1 \
-    pylint==0.25.1
-
-in_chroot -- \
-  easy_install \
-    sphinx==1.1.3 \
-    pep8==1.2 \
-    coverage==3.4 \
-    bitarray==0.8.0
-
-in_chroot -- \
-  cabal update
-
-in_chroot -- \
-  cabal install --global \
-    network==2.3 \
-    regex-pcre==0.94.4 \
-    hinotify==0.3.2 \
-    hslogger==1.1.4 \
-    quickcheck==2.5.1.1 \
-    attoparsec==0.10.1.1 \
-    crypto==4.2.4 \
-    MonadCatchIO-transformers==0.2.2.0 \
-    mtl==2.0.1.0 \
-    hashable==1.1.2.0 \
-    case-insensitive==0.3 \
-    parsec==3.0.1 \
-    snap-server==0.8.1 \
-    json==0.4.4
-
-in_chroot -- \
-  cabal install --global \
-    hunit==1.2.5.2 \
-    happy==1.18.10 \
-    hlint==1.8.34 \
-    hscolour==1.20.3 \
-    temporary==1.1.2.3 \
-    test-framework==0.6.1 \
-    test-framework-hunit==0.2.7 \
-    test-framework-quickcheck2==0.2.12.3
-
-in_chroot -- \
-  cabal install --global cabal-file-th
-
-in_chroot -- \
-  cabal install --global shelltestrunner
+echo "en_US.UTF-8 UTF-8" >> $CHDIR/etc/locale.gen
 
-#Install selected packages from backports
 in_chroot -- \
-  $APT_INSTALL -t squeeze-backports \
-    git \
-    git-email \
-    vim
-
-in_chroot -- \
-  $APT_INSTALL sudo fakeroot rsync locales less
-
-echo "en_US.UTF-8 UTF-8" >> $CHDIR/etc/locale.gen
+  $APT_INSTALL sudo fakeroot rsync locales less socat
 
 in_chroot -- \
   locale-gen
 
 in_chroot -- \
   $APT_INSTALL lvm2 ssh bridge-utils iproute iputils-arping \
-               ndisc6 python python-pyopenssl openssl \
-               python-mock \
-               socat fping
-
-in_chroot -- \
-  $APT_INSTALL qemu-utils
+               ndisc6 python-openssl openssl \
+               python-mock fping qemu-utils
 
 in_chroot -- \
   easy_install affinity
 
-#Python development tools
 in_chroot -- \
-  $APT_INSTALL pandoc python-epydoc
-
-#Tools for creating debian packages
-in_chroot -- \
-  $APT_INSTALL debhelper quilt
+  $APT_INSTALL \
+  python-epydoc debhelper quilt
 
 # extra debian packages
 
@@ -259,5 +312,4 @@ rm -rf $TEMP_DATA_DIR
 echo "Chroot created. In order to run it:"
 echo " * Copy the file $FINAL_CHROOT_CONF to $CONF_DIR/$FINAL_CHROOT_CONF"
 echo " * Copy the file $COMP_FILEPATH to $CHROOT_DIR/$COMP_FILENAME"
-
 echo "Then run \"schroot -c $CHROOTNAME\""