[openstack-glance/el6: 3/3] Use updated parallel install versions of epel package

Pádraig Brady pbrady at fedoraproject.org
Thu Nov 24 11:02:53 UTC 2011


commit e0dd5caa7e628d9b8cd95a84c8fdf4e1f1d4d6ee
Author: Pádraig Brady <P at draigBrady.com>
Date:   Thu Nov 24 10:49:22 2011 +0000

    Use updated parallel install versions of epel package
    
    Use sqlalchemy >= 0.6.3 and WebOb >= 1.0,
    and depend on the EPEL parallel installable
    versions of these packages to satisfy those requirements.

 openstack-glance-newdeps.patch |   32 ++++++++++++++++++++++++++++++++
 openstack-glance.spec          |   14 ++++++++++----
 2 files changed, 42 insertions(+), 4 deletions(-)
---
diff --git a/openstack-glance-newdeps.patch b/openstack-glance-newdeps.patch
new file mode 100644
index 0000000..d3d9930
--- /dev/null
+++ b/openstack-glance-newdeps.patch
@@ -0,0 +1,32 @@
+Delve into pkg_resources a little to get it to modify sys.path,
+so that our parallel installed egg takes precedence over the
+system default module versions.
+
+--- glance-2011.3.orig/glance/__init__.py	2011-09-21 21:46:35.000000000 +0100
++++ glance-2011.3/glance/__init__.py	2011-11-22 14:49:33.454505203 +0000
+@@ -14,3 +14,25 @@
+ #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ #    License for the specific language governing permissions and limitations
+ #    under the License.
++
++import sys
++import pkg_resources
++
++# If there is a conflicting non egg module,
++# i.e. an older standard system module installed,
++# then replace it with this requirement
++def replace_dist(requirement):
++    try:
++        return pkg_resources.require(requirement)
++    except pkg_resources.VersionConflict:
++        e = sys.exc_info()[1]
++        dist=e.args[0]
++        req=e.args[1]
++        if dist.key == req.key and not dist.location.endswith('.egg'):
++            del pkg_resources.working_set.by_key[dist.key]
++            # We assume there is no need to adjust sys.path
++            # and the associated pkg_resources.working_set.entries
++            return pkg_resources.require(requirement)
++
++print replace_dist("SQLALchemy >= 0.6.3")
++print replace_dist("WebOb >= 1.0")
diff --git a/openstack-glance.spec b/openstack-glance.spec
index 2a76875..87154bc 100644
--- a/openstack-glance.spec
+++ b/openstack-glance.spec
@@ -13,6 +13,7 @@ Source2:          openstack-glance-registry.init
 Source3:          openstack-glance.logrotate
 Patch0:           openstack-glance-docmod.patch
 Patch1:           openstack-glance-nonet.patch
+Patch2:           openstack-glance-newdeps.patch
 
 BuildArch:        noarch
 BuildRequires:    python2-devel
@@ -44,8 +45,9 @@ Group:            Applications/System
 Requires:         python-eventlet
 Requires:         python-kombu
 Requires:         python-routes
-Requires:         python-sqlalchemy
-Requires:         python-webob
+Requires:         python-sqlalchemy0.7
+Requires:         python-webob1.0
+Requires:         python-setuptools
 
 #
 # The image cache requires this http://pypi.python.org/pypi/xattr
@@ -77,8 +79,8 @@ BuildRequires:    python-daemon
 BuildRequires:    python-eventlet
 BuildRequires:    python-gflags
 BuildRequires:    python-routes
-BuildRequires:    python-sqlalchemy
-BuildRequires:    python-webob
+BuildRequires:    python-sqlalchemy0.7
+BuildRequires:    python-webob1.0
 
 %description      doc
 OpenStack Image Service (code-named Glance) provides discovery, registration,
@@ -90,6 +92,7 @@ This package contains documentation files for glance.
 %setup -q -n glance-%{version}
 %patch0 -p1 -b .docmod
 %patch1 -p1 -b .nonet
+%patch2 -p1 -b .newdeps
 
 sed -i 's|\(sql_connection = sqlite:///\)\(glance.sqlite\)|\1%{_sharedstatedir}/glance/\2|' etc/glance-registry.conf
 
@@ -190,6 +193,9 @@ fi
 %doc doc/build/html
 
 %changelog
+* Tue Nov 22 2011 Pádraig Brady <P at draigBrady.com> - 2011.3-3
+- Use updated parallel install versions of epel packages
+
 * Tue Nov 22 2011 Pádraig Brady <P at draigBrady.com> - 2011.3-2
 - Ensure the docs aren't built with the system glance module
 - Ensure we don't access the net when building docs


More information about the scm-commits mailing list