--- /dev/null
+--- cinder-2013.1-orig/cinder/__init__.py 2012-11-22 04:22:19.000000000 -0500
++++ cinder-2013.1/cinder/__init__.py 2012-12-20 12:57:42.337489999 -0500
+@@ -31,6 +31,36 @@
+ .. moduleauthor:: Andy Smith <andy@anarkystic.com>
+ """
+
++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)
++
++replace_dist("WebOb >= 1.0")
++replace_dist("SQLAlchemy >= 0.6.3")
++replace_dist("Routes >= 1.12.3")
++
++replace_dist("PasteDeploy >= 1.5.0")
++# This hack is needed because replace_dist() results in
++# the standard paste module path being at the start of __path__.
++# TODO: See can we get pkg_resources to do the right thing directly
++import paste
++paste.__path__.insert(0, paste.__path__.pop(-1))
++
+ import gettext
+
+
+--- cinder-2013.1-orig/bin/cinder-manage 2012-11-22 04:22:19.000000000 -0500
++++ cinder-2013.1/bin/cinder-manage 2012-12-20 12:58:01.014504835 -0500
+@@ -60,9 +60,6 @@
+ import sys
+ import uuid
+
+-from sqlalchemy import create_engine, MetaData, Table
+-from sqlalchemy.ext.declarative import declarative_base
+-from sqlalchemy.orm import sessionmaker
+
+
+ # If ../cinder/__init__.py exists, add ../ to Python search path, so that
+@@ -86,6 +83,10 @@
+ from cinder import utils
+ from cinder import version
+
++from sqlalchemy import create_engine, MetaData, Table
++from sqlalchemy.orm import sessionmaker
++from sqlalchemy.ext.declarative import declarative_base
++
+ FLAGS = flags.FLAGS
+
+
+--- cinder-2013.1-orig/cinder/db/sqlalchemy/migration.py 2012-11-22 04:22:19.000000000 -0500
++++ cinder-2013.1/cinder/db/sqlalchemy/migration.py 2012-12-20 12:57:44.821491814 -0500
+@@ -57,7 +57,12 @@
+
+
+ # NOTE(jkoelker) Delay importing migrate until we are patched
+-from migrate import exceptions as versioning_exceptions
++try:
++ # Try the more specific path first (migrate <= 0.6)
++ from migrate.versioning import exceptions as versioning_exceptions
++except ImportError:
++ # Use the newer path (migrate >= 0.7)
++ from migrate import exceptions as versioning_exceptions
+ from migrate.versioning import api as versioning_api
+ from migrate.versioning.repository import Repository
+
--- /dev/null
+%global with_doc %{!?_without_doc:1}%{?_without_doc:0}
+
+Name: openstack-cinder
+Version: 2013.1
+Release: 0.4.g3%{?dist}
+Summary: OpenStack Volume service
+
+Group: Applications/System
+License: ASL 2.0
+URL: http://www.openstack.org/software/openstack-storage/
+Source0: https://launchpad.net/cinder/grizzly/grizzly-3/+download/cinder-2013.1.g3.tar.gz
+Source1: cinder.conf
+Source2: cinder.logrotate
+Source3: cinder-tgt.conf
+
+Source10: openstack-cinder-api.init
+Source100: openstack-cinder-api.upstart
+Source11: openstack-cinder-scheduler.init
+Source110: openstack-cinder-scheduler.upstart
+Source12: openstack-cinder-volume.init
+Source120: openstack-cinder-volume.upstart
+
+Source20: cinder-sudoers
+
+#
+# patches_base=grizzly-3
+#
+Patch0001: 0001-Ensure-we-don-t-access-the-net-when-building-docs.patch
+
+# This is EPEL specific and not upstream
+Patch100: openstack-cinder-newdeps.patch
+
+BuildArch: noarch
+BuildRequires: intltool
+BuildRequires: python-sphinx10
+BuildRequires: python-setuptools
+BuildRequires: python-netaddr
+BuildRequires: openstack-utils
+# These are required to build due to the requirements check added
+BuildRequires: python-paste-deploy1.5
+BuildRequires: python-routes1.12
+BuildRequires: python-sqlalchemy0.7
+BuildRequires: python-webob1.0
+
+Requires: openstack-utils
+Requires: python-cinder = %{version}-%{release}
+
+# as convenience
+Requires: python-cinderclient
+
+Requires(post): chkconfig
+Requires(postun): initscripts
+Requires(preun): chkconfig
+Requires(pre): shadow-utils
+
+Requires: lvm2
+Requires: scsi-target-utils
+
+%description
+OpenStack Volume (codename Cinder) provides services to manage and
+access block storage volumes for use by Virtual Machine instances.
+
+
+%package -n python-cinder
+Summary: OpenStack Volume Python libraries
+Group: Applications/System
+
+Requires: sudo
+
+Requires: MySQL-python
+
+Requires: python-paramiko
+
+Requires: python-qpid
+Requires: python-kombu
+Requires: python-amqplib
+
+Requires: python-eventlet
+Requires: python-greenlet
+Requires: python-iso8601
+Requires: python-netaddr
+Requires: python-lxml
+Requires: python-anyjson
+Requires: python-cheetah
+Requires: python-stevedore
+
+Requires: python-sqlalchemy0.7
+Requires: python-migrate
+
+Requires: python-paste-deploy1.5
+Requires: python-routes1.12
+Requires: python-webob1.0
+
+Requires: python-glanceclient >= 1:0
+
+%description -n python-cinder
+OpenStack Volume (codename Cinder) provides services to manage and
+access block storage volumes for use by Virtual Machine instances.
+
+This package contains the cinder Python library.
+
+%if 0%{?with_doc}
+%package doc
+Summary: Documentation for OpenStack Volume
+Group: Documentation
+
+Requires: %{name} = %{version}-%{release}
+
+BuildRequires: graphviz
+
+# Required to build module documents
+BuildRequires: python-eventlet
+BuildRequires: python-routes1.12
+BuildRequires: python-sqlalchemy0.7
+BuildRequires: python-webob1.0
+# while not strictly required, quiets the build down when building docs.
+BuildRequires: python-migrate, python-iso8601
+
+%description doc
+OpenStack Volume (codename Cinder) provides services to manage and
+access block storage volumes for use by Virtual Machine instances.
+
+This package contains documentation files for cinder.
+%endif
+
+%prep
+%setup -q -n cinder-%{version}.g3
+
+%patch0001 -p1
+
+# Apply EPEL patch
+%patch100 -p1
+
+find . \( -name .gitignore -o -name .placeholder \) -delete
+
+find cinder -name \*.py -exec sed -i '/\/usr\/bin\/env python/{d;q}' {} +
+
+# TODO: Have the following handle multi line entries
+sed -i '/setup_requires/d; /install_requires/d; /dependency_links/d' setup.py
+
+%build
+
+# Move authtoken configuration out of paste.ini
+openstack-config --del etc/cinder/api-paste.ini filter:authtoken admin_tenant_name
+openstack-config --del etc/cinder/api-paste.ini filter:authtoken admin_user
+openstack-config --del etc/cinder/api-paste.ini filter:authtoken admin_password
+openstack-config --del etc/cinder/api-paste.ini filter:authtoken auth_host
+openstack-config --del etc/cinder/api-paste.ini filter:authtoken auth_port
+openstack-config --del etc/cinder/api-paste.ini filter:authtoken auth_protocol
+
+%{__python} setup.py build
+
+%install
+%{__python} setup.py install -O1 --skip-build --root %{buildroot}
+
+# docs generation requires everything to be installed first
+export PYTHONPATH="$( pwd ):$PYTHONPATH"
+
+pushd doc
+
+%if 0%{?with_doc}
+SPHINX_DEBUG=1 sphinx-1.0-build -b html source build/html
+# Fix hidden-file-or-dir warnings
+rm -fr build/html/.doctrees build/html/.buildinfo
+%endif
+
+# Create dir link to avoid a sphinx-build exception
+mkdir -p build/man/.doctrees/
+ln -s . build/man/.doctrees/man
+SPHINX_DEBUG=1 sphinx-1.0-build -b man -c source source/man build/man
+mkdir -p %{buildroot}%{_mandir}/man1
+install -p -D -m 644 build/man/*.1 %{buildroot}%{_mandir}/man1/
+
+popd
+
+# Setup directories
+install -d -m 755 %{buildroot}%{_sharedstatedir}/cinder
+install -d -m 755 %{buildroot}%{_sharedstatedir}/cinder/tmp
+install -d -m 755 %{buildroot}%{_localstatedir}/log/cinder
+
+# Install config files
+install -d -m 755 %{buildroot}%{_sysconfdir}/cinder
+install -p -D -m 640 %{SOURCE1} %{buildroot}%{_sysconfdir}/cinder/cinder.conf
+install -d -m 755 %{buildroot}%{_sysconfdir}/cinder/volumes
+install -p -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/tgt/conf.d/cinder.conf
+install -p -D -m 640 etc/cinder/rootwrap.conf %{buildroot}%{_sysconfdir}/cinder/rootwrap.conf
+install -p -D -m 640 etc/cinder/api-paste.ini %{buildroot}%{_sysconfdir}/cinder/api-paste.ini
+install -p -D -m 640 etc/cinder/policy.json %{buildroot}%{_sysconfdir}/cinder/policy.json
+
+# Install initscripts for services
+install -p -D -m 755 %{SOURCE10} %{buildroot}%{_initrddir}/openstack-cinder-api
+install -p -D -m 755 %{SOURCE11} %{buildroot}%{_initrddir}/openstack-cinder-scheduler
+install -p -D -m 755 %{SOURCE12} %{buildroot}%{_initrddir}/openstack-cinder-volume
+
+# Install sudoers
+install -p -D -m 440 %{SOURCE20} %{buildroot}%{_sysconfdir}/sudoers.d/cinder
+
+# Install logrotate
+install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-cinder
+
+# Install pid directory
+install -d -m 755 %{buildroot}%{_localstatedir}/run/cinder
+
+# Install upstart jobs examples
+install -d -m 755 %{buildroot}%{_datadir}/cinder
+install -p -m 644 %{SOURCE100} %{buildroot}%{_datadir}/cinder/
+install -p -m 644 %{SOURCE110} %{buildroot}%{_datadir}/cinder/
+install -p -m 644 %{SOURCE120} %{buildroot}%{_datadir}/cinder/
+
+# Install rootwrap files in /usr/share/cinder/rootwrap
+mkdir -p %{buildroot}%{_datarootdir}/cinder/rootwrap/
+install -p -D -m 644 etc/cinder/rootwrap.d/* %{buildroot}%{_datarootdir}/cinder/rootwrap/
+
+# Remove unneeded in production stuff
+rm -f %{buildroot}%{_bindir}/cinder-debug
+rm -fr %{buildroot}%{python_sitelib}/cinder/tests/
+rm -fr %{buildroot}%{python_sitelib}/run_tests.*
+rm -f %{buildroot}/usr/share/doc/cinder/README*
+
+%pre
+getent group cinder >/dev/null || groupadd -r cinder --gid 165
+if ! getent passwd cinder >/dev/null; then
+ useradd -u 165 -r -g cinder -G cinder,nobody -d %{_sharedstatedir}/cinder -s /sbin/nologin -c "OpenStack Cinder Daemons" cinder
+fi
+exit 0
+
+%post
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ for svc in volume api scheduler; do
+ /sbin/chkconfig --add openstack-cinder-$svc
+ done
+fi
+
+%preun
+if [ $1 -eq 0 ] ; then
+ for svc in volume api scheduler; do
+ /sbin/service openstack-cinder-${svc} stop > /dev/null 2>&1
+ /sbin/chkconfig --del openstack-cinder-${svc}
+ done
+fi
+
+%postun
+if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ for svc in volume api scheduler; do
+ /sbin/service openstack-cinder-${svc} condrestart > /dev/null 2>&1 || :
+ done
+fi
+
+%files
+%doc LICENSE
+
+%dir %{_sysconfdir}/cinder
+%config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/cinder.conf
+%config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/api-paste.ini
+%config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/rootwrap.conf
+%config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/policy.json
+%config(noreplace) %{_sysconfdir}/logrotate.d/openstack-cinder
+%config(noreplace) %{_sysconfdir}/sudoers.d/cinder
+%config(noreplace) %{_sysconfdir}/tgt/conf.d/cinder.conf
+
+%dir %attr(0755, cinder, root) %{_localstatedir}/log/cinder
+%dir %attr(0755, cinder, root) %{_localstatedir}/run/cinder
+%dir %attr(0755, cinder, root) %{_sysconfdir}/cinder/volumes
+
+%{_bindir}/cinder-*
+%{_initrddir}/openstack-cinder-*
+%{_datarootdir}/cinder
+%{_mandir}/man1/cinder*.1.gz
+
+%defattr(-, cinder, cinder, -)
+%dir %{_sharedstatedir}/cinder
+%dir %{_sharedstatedir}/cinder/tmp
+
+%files -n python-cinder
+%doc LICENSE
+%{python_sitelib}/cinder
+%{python_sitelib}/cinder-%{version}*.egg-info
+
+%if 0%{?with_doc}
+%files doc
+%doc doc/build/html
+%endif
+
+%changelog
+* Tue Mar 05 2013 Pádraig Brady <P@draigBrady.com> - 2013.1.0.4.g3
+- Add dependency on python-stevedore
+
+* Wed Feb 27 2013 Eric Harney <eharney@redhat.com> - 2013.1-0.2.g3
+- Update to Grizzly milestone 3
+
+* Thu Jan 10 2013 Eric Harney <eharney@redhat.com> - 2013.1-0.1.g2
+- Update to Grizzly milestone 2
+
+* Thu Dec 20 2012 Eric Harney <eharney@redhat.com> - 2013.1-0.1.g1
+- Update to Grizzly milestone 1
+
+* Mon Dec 03 2012 Eric Harney <eharney@redhat.com> - 2012.2.1-1
+- Update to Folsom stable release 1
+
+* Wed Nov 14 2012 Eric Harney <eharney@redhat.com> - 2012.2-4
+- Remove unused dependency on python-daemon
+
+* Wed Oct 31 2012 Pádraig Brady <P@draigBrady.com> - 2012.2-3
+- Adjust to be compatible with python-migrate-0.6
+
+* Wed Oct 24 2012 Pádraig Brady <P@draigBrady.com> - 2012.2-2
+- Initial Folsom release