Fix fixup_stuff.sh package permissions fix

There are a number of different attempts to fix this issue, specifcally on RHEL6.
None of them actually get it right.
* This does not upgrade an OS installed package because we trust them to not make
  these sorts of permissions mistakes. Also we do not have nor want to figure out the
  right version that the OpenStack projects will require.
* This specfically targets the upstream package versions as we do not know how
  later versions behave.

This should address the following reviews:
* https://review.openstack.org/#/c/50540/
* https://review.openstack.org/#/c/51233/ (1238707)
* https://review.openstack.org/#/c/51651/ (1239747)
* https://review.openstack.org/#/c/51843/
* https://review.openstack.org/#/c/51838/
* https://review.openstack.org/#/c/52148/ (1236941)

Change-Id: I99906451dc25654628187b383e8893cce0e276bf
This commit is contained in:
Dean Troyer 2013-10-16 12:10:13 -05:00
parent 79ad861710
commit 65f1af6dd3

View File

@ -35,26 +35,36 @@ FILES=$TOP_DIR/files
# Python Packages # Python Packages
# --------------- # ---------------
# Pre-install affected packages so we can fix the permissions # get_package_path python-package # in import notation
pip_install prettytable function get_package_path() {
pip_install httplib2 local package=$1
echo $(python -c "import os; import $package; print(os.path.split(os.path.realpath($package.__file__))[0])")
}
SITE_DIRS=$(python -c "import site; import os; print os.linesep.join(site.getsitepackages())")
for dir in $SITE_DIRS; do # Pre-install affected packages so we can fix the permissions
# These can go away once we are confident that pip 1.4.1+ is available everywhere
# Fix prettytable 0.7.2 permissions # Fix prettytable 0.7.2 permissions
if [[ -r $dir/prettytable.py ]]; then # Don't specify --upgrade so we use the existing package if present
sudo chmod +r $dir/prettytable-0.7.2*/* pip_install prettytable
PACKAGE_DIR=$(get_package_path prettytable)
# Only fix version 0.7.2
dir=$(echo $PACKAGE_DIR/prettytable-0.7.2*)
if [[ -d $dir ]]; then
sudo chmod +r $dir/*
fi fi
# Fix httplib2 0.8 permissions # Fix httplib2 0.8 permissions
httplib_dir=httplib2-0.8.egg-info # Don't specify --upgrade so we use the existing package if present
if [[ -d $dir/$httplib_dir ]]; then pip_install httplib2
sudo chmod +r $dir/$httplib_dir/* PACKAGE_DIR=$(get_package_path httplib2)
# Only fix version 0.8
dir=$(echo $PACKAGE_DIR-0.8*)
if [[ -d $dir ]]; then
sudo chmod +r $dir/*
fi fi
done
# RHEL6 # RHEL6
# ----- # -----