Dean Troyer | 9acc12a | 2013-08-09 15:09:31 -0500 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # **fixup_stuff.sh** |
| 4 | |
| 5 | # fixup_stuff.sh |
| 6 | # |
| 7 | # All distro and package specific hacks go in here |
Adam Spiers | cb96159 | 2013-10-05 12:11:07 +0100 | [diff] [blame] | 8 | # |
Dean Troyer | 9acc12a | 2013-08-09 15:09:31 -0500 | [diff] [blame] | 9 | # - prettytable 0.7.2 permissions are 600 in the package and |
| 10 | # pip 1.4 doesn't fix it (1.3 did) |
Adam Spiers | cb96159 | 2013-10-05 12:11:07 +0100 | [diff] [blame] | 11 | # |
Dean Troyer | 9acc12a | 2013-08-09 15:09:31 -0500 | [diff] [blame] | 12 | # - httplib2 0.8 permissions are 600 in the package and |
| 13 | # pip 1.4 doesn't fix it (1.3 did) |
Adam Spiers | cb96159 | 2013-10-05 12:11:07 +0100 | [diff] [blame] | 14 | # |
Dean Troyer | 49ba224 | 2013-08-09 19:51:20 -0500 | [diff] [blame] | 15 | # - RHEL6: |
Adam Spiers | cb96159 | 2013-10-05 12:11:07 +0100 | [diff] [blame] | 16 | # |
Dean Troyer | 49ba224 | 2013-08-09 19:51:20 -0500 | [diff] [blame] | 17 | # - set selinux not enforcing |
| 18 | # - (re)start messagebus daemon |
| 19 | # - remove distro packages python-crypto and python-lxml |
| 20 | # - pre-install hgtools to work around a bug in RHEL6 distribute |
| 21 | # - install nose 1.1 from EPEL |
| 22 | |
Adam Spiers | c85ade7 | 2013-10-01 00:35:16 +0100 | [diff] [blame] | 23 | set -o errexit |
| 24 | set -o xtrace |
Dean Troyer | 9acc12a | 2013-08-09 15:09:31 -0500 | [diff] [blame] | 25 | |
| 26 | # Keep track of the current directory |
| 27 | TOOLS_DIR=$(cd $(dirname "$0") && pwd) |
Dean Troyer | 49ba224 | 2013-08-09 19:51:20 -0500 | [diff] [blame] | 28 | TOP_DIR=$(cd $TOOLS_DIR/..; pwd) |
Dean Troyer | 9acc12a | 2013-08-09 15:09:31 -0500 | [diff] [blame] | 29 | |
| 30 | # Change dir to top of devstack |
| 31 | cd $TOP_DIR |
| 32 | |
| 33 | # Import common functions |
| 34 | source $TOP_DIR/functions |
| 35 | |
| 36 | FILES=$TOP_DIR/files |
| 37 | |
Dean Troyer | 49ba224 | 2013-08-09 19:51:20 -0500 | [diff] [blame] | 38 | |
| 39 | # Python Packages |
| 40 | # --------------- |
| 41 | |
Dean Troyer | 65f1af6 | 2013-10-16 12:10:13 -0500 | [diff] [blame] | 42 | # get_package_path python-package # in import notation |
| 43 | function get_package_path() { |
| 44 | local package=$1 |
| 45 | echo $(python -c "import os; import $package; print(os.path.split(os.path.realpath($package.__file__))[0])") |
| 46 | } |
| 47 | |
| 48 | |
Dean Troyer | 9acc12a | 2013-08-09 15:09:31 -0500 | [diff] [blame] | 49 | # Pre-install affected packages so we can fix the permissions |
Dean Troyer | 65f1af6 | 2013-10-16 12:10:13 -0500 | [diff] [blame] | 50 | # These can go away once we are confident that pip 1.4.1+ is available everywhere |
| 51 | |
| 52 | # Fix prettytable 0.7.2 permissions |
| 53 | # Don't specify --upgrade so we use the existing package if present |
Aaron Rosen | 1e4551d | 2013-09-16 13:58:08 -0700 | [diff] [blame] | 54 | pip_install prettytable |
Dean Troyer | 65f1af6 | 2013-10-16 12:10:13 -0500 | [diff] [blame] | 55 | PACKAGE_DIR=$(get_package_path prettytable) |
| 56 | # Only fix version 0.7.2 |
| 57 | dir=$(echo $PACKAGE_DIR/prettytable-0.7.2*) |
| 58 | if [[ -d $dir ]]; then |
| 59 | sudo chmod +r $dir/* |
| 60 | fi |
| 61 | |
| 62 | # Fix httplib2 0.8 permissions |
| 63 | # Don't specify --upgrade so we use the existing package if present |
Aaron Rosen | 1e4551d | 2013-09-16 13:58:08 -0700 | [diff] [blame] | 64 | pip_install httplib2 |
Dean Troyer | 65f1af6 | 2013-10-16 12:10:13 -0500 | [diff] [blame] | 65 | PACKAGE_DIR=$(get_package_path httplib2) |
| 66 | # Only fix version 0.8 |
| 67 | dir=$(echo $PACKAGE_DIR-0.8*) |
| 68 | if [[ -d $dir ]]; then |
| 69 | sudo chmod +r $dir/* |
| 70 | fi |
Dean Troyer | 49ba224 | 2013-08-09 19:51:20 -0500 | [diff] [blame] | 71 | |
| 72 | |
| 73 | # RHEL6 |
| 74 | # ----- |
| 75 | |
| 76 | if [[ $DISTRO =~ (rhel6) ]]; then |
| 77 | |
| 78 | # Disable selinux to avoid configuring to allow Apache access |
Gonéri Le Bouder | 394c11c | 2013-11-05 10:35:55 +0100 | [diff] [blame^] | 79 | # to Horizon files (LP#1175444) |
Dean Troyer | 49ba224 | 2013-08-09 19:51:20 -0500 | [diff] [blame] | 80 | if selinuxenabled; then |
| 81 | sudo setenforce 0 |
| 82 | fi |
| 83 | |
| 84 | # If the ``dbus`` package was installed by DevStack dependencies the |
| 85 | # uuid may not be generated because the service was never started (PR#598200), |
| 86 | # causing Nova to stop later on complaining that ``/var/lib/dbus/machine-id`` |
| 87 | # does not exist. |
| 88 | sudo service messagebus restart |
| 89 | |
| 90 | # The following workarounds break xenserver |
| 91 | if [ "$VIRT_DRIVER" != 'xenserver' ]; then |
| 92 | # An old version of ``python-crypto`` (2.0.1) may be installed on a |
| 93 | # fresh system via Anaconda and the dependency chain |
| 94 | # ``cas`` -> ``python-paramiko`` -> ``python-crypto``. |
| 95 | # ``pip uninstall pycrypto`` will remove the packaged ``.egg-info`` |
Adam Spiers | cb96159 | 2013-10-05 12:11:07 +0100 | [diff] [blame] | 96 | # file but leave most of the actual library files behind in |
Dean Troyer | 49ba224 | 2013-08-09 19:51:20 -0500 | [diff] [blame] | 97 | # ``/usr/lib64/python2.6/Crypto``. Later ``pip install pycrypto`` |
| 98 | # will install over the packaged files resulting |
| 99 | # in a useless mess of old, rpm-packaged files and pip-installed files. |
| 100 | # Remove the package so that ``pip install python-crypto`` installs |
| 101 | # cleanly. |
| 102 | # Note: other RPM packages may require ``python-crypto`` as well. |
| 103 | # For example, RHEL6 does not install ``python-paramiko packages``. |
| 104 | uninstall_package python-crypto |
| 105 | |
| 106 | # A similar situation occurs with ``python-lxml``, which is required by |
| 107 | # ``ipa-client``, an auditing package we don't care about. The |
| 108 | # build-dependencies needed for ``pip install lxml`` (``gcc``, |
| 109 | # ``libxml2-dev`` and ``libxslt-dev``) are present in |
| 110 | # ``files/rpms/general``. |
| 111 | uninstall_package python-lxml |
| 112 | fi |
| 113 | |
| 114 | # ``setup.py`` contains a ``setup_requires`` package that is supposed |
| 115 | # to be transient. However, RHEL6 distribute has a bug where |
| 116 | # ``setup_requires`` registers entry points that are not cleaned |
| 117 | # out properly after the setup-phase resulting in installation failures |
| 118 | # (bz#924038). Pre-install the problem package so the ``setup_requires`` |
| 119 | # dependency is satisfied and it will not be installed transiently. |
| 120 | # Note we do this before the track-depends in ``stack.sh``. |
| 121 | pip_install hgtools |
| 122 | |
| 123 | |
| 124 | # RHEL6's version of ``python-nose`` is incompatible with Tempest. |
| 125 | # Install nose 1.1 (Tempest-compatible) from EPEL |
| 126 | install_package python-nose1.1 |
| 127 | # Add a symlink for the new nosetests to allow tox for Tempest to |
| 128 | # work unmolested. |
| 129 | sudo ln -sf /usr/bin/nosetests1.1 /usr/local/bin/nosetests |
| 130 | |
| 131 | fi |