]> git.apps.os.sepia.ceph.com Git - autobuild-ceph.git/commitdiff
bootstrap: copy from teuthology wip-bootstrap 47/head
authorSage Weil <sage@redhat.com>
Tue, 2 Jun 2015 04:48:11 +0000 (00:48 -0400)
committerSage Weil <sage@redhat.com>
Tue, 2 Jun 2015 04:48:11 +0000 (00:48 -0400)
Drop some dependencies (libevent, mysql) and skip setup.py (which we
don't have).

Drop system-site-packages

Create virtualenv/bin -> bin symlink

Signed-off-by: Sage Weil <sage@redhat.com>
bootstrap

index bf43d0d36feaac1874f6e5b84a0e8aa97a80ab6b..54b6866ead27ef19a37d179add08bc69e9253449 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -1,19 +1,99 @@
 #!/bin/sh
 set -e
 
-for package in python-dev python-pip python-virtualenv; do
-    if [ "$(dpkg --status -- $package|sed -n 's/^Status: //p')" != "install ok installed" ]; then
-       # add a space after old values
-       missing="${missing:+$missing }$package"
+case "$(uname -s)" in
+Linux)
+    case "$(lsb_release --id --short)" in
+    Ubuntu|Debian)
+        # Note that we install the system version of python-libvirt here
+        # instead of relying on PyPI for that particular module. THe reason for
+        # this is that Ubuntu Precise ships libvirt 0.9.8, and PyPI's
+        # python-libvirt packages require libvirt >= 1.0.2.
+        # Some options for resolving this situation would be choosing some or
+        # all of the following:
+        #   A) Removing support for Precise,
+        #   B) Removing support for downburst,
+        #   C) Adding "Precise" conditionals somewhere, eg. conditionalizing
+        #   this bootstrap script to only use the python-libvirt package on
+        #   Ubuntu Precise.
+        for package in python-dev python-pip python-virtualenv; do
+            if [ "$(dpkg --status -- $package|sed -n 's/^Status: //p')" != "install ok installed" ]; then
+                # add a space after old values
+                missing="${missing:+$missing }$package"
+            fi
+        done
+        if [ -n "$missing" ]; then
+            echo "$0: missing required packages, please install them:" 1>&2
+            echo "sudo apt-get install $missing"
+            exit 1
+        fi
+        ;;
+    Fedora)
+        for package in python-pip python-virtualenv; do
+           if [ "$(rpm -q $package)" == "package $package is not installed" ]; then
+               missing="${missing:+$missing }$package"
+           fi
+       done
+       if [ -n "$missing" ]; then
+            echo "$0: missing required packages, please install them:" 1>&2
+            echo "sudo yum install $missing"
+            exit 1
+       fi
+       ;;
+    "openSUSE project"|"SUSE LINUX")
+        for package in python-pip python-virtualenv; do
+            if [ "$(rpm -q $package)" == "package $package is not installed" ]; then
+                missing="${missing:+$missing }$package"
+            fi
+        done
+        if [ -n "$missing" ]; then
+            echo "$0: missing required packages, please install them:" 1>&2
+            echo "sudo zypper install $missing"
+            exit 1
+        fi
+        ;;
+    *)
+        echo "This script does not support your Linux distribution yet. Patches encouraged!"
+        exit 1
+        ;;
+    esac
+    ;;
+Darwin)
+    if ! which brew > /dev/null; then
+        echo "You need Homebrew: http://brew.sh/"
+        exit 1
     fi
-done
-if [ -n "$missing" ]; then
-    aptdcon --install $missing
-fi
+    for keg in python; do
+        if brew list $keg >/dev/null 2>&1; then
+            echo "Found $keg"
+        else
+            brew install $keg
+        fi
+    done
+    ;;
+*)
+    echo "This script does not support your OS yet. Patches encouraged!"
+    exit 1
+    ;;
+esac
+
+if [ -z "$NO_CLOBBER" ] || [ ! -e ./virtualenv ]; then
+    if ! which virtualenv > /dev/null; then
+        pip install virtualenv
+    fi
+
+    virtualenv --setuptools virtualenv
 
-virtualenv virtualenv
-virtualenv/bin/pip install -q -r requirements.txt
+    # avoid pip bugs
+    ./virtualenv/bin/pip install --upgrade pip
 
-if [ ! -e bin ]; then
-    ln -s virtualenv/bin bin
+    # work-around change in pip 1.5
+    ./virtualenv/bin/pip install setuptools --no-use-wheel --upgrade
 fi
+
+./virtualenv/bin/pip install -r requirements.txt
+
+#./virtualenv/bin/python setup.py develop 
+
+ln -sf virtualenv/bin bin
+