Add package patches to RPMs
This commit adds all patches mentioned in components configuration to RPMs, so that they are applied during build (on %prep stage). Package patches were ignored since we started building RPMs from custom specs (commit:da861bc). Change-Id: Idca0e7cf1c67d12ff27cc5374cfbf0ce6e5d6a3b Fixes: bug #1190429
This commit is contained in:
parent
5cd537f9cc
commit
957a1fe018
@ -63,18 +63,24 @@ class PkgInstallComponent(base.Component):
|
|||||||
fetcher.download()
|
fetcher.download()
|
||||||
return uris
|
return uris
|
||||||
|
|
||||||
def patch(self, section):
|
def list_patches(self, section):
|
||||||
what_patches = self.get_option('patches', section)
|
what_patches = self.get_option('patches', section)
|
||||||
(_from_uri, target_dir) = self._get_download_location()
|
|
||||||
if not what_patches:
|
if not what_patches:
|
||||||
what_patches = []
|
what_patches = []
|
||||||
canon_what_patches = []
|
canon_what_patches = []
|
||||||
for path in what_patches:
|
for path in what_patches:
|
||||||
if sh.isdir(path):
|
if sh.isdir(path):
|
||||||
canon_what_patches.extend(sorted(sh.listdir(path, files_only=True)))
|
patches = sorted(fn for fn in sh.listdir(path, files_only=True)
|
||||||
|
if fn.endswith('patch'))
|
||||||
|
canon_what_patches.extend(patches)
|
||||||
elif sh.isfile(path):
|
elif sh.isfile(path):
|
||||||
canon_what_patches.append(path)
|
canon_what_patches.append(path)
|
||||||
|
return canon_what_patches
|
||||||
|
|
||||||
|
def patch(self, section):
|
||||||
|
canon_what_patches = self.list_patches(section)
|
||||||
if canon_what_patches:
|
if canon_what_patches:
|
||||||
|
(_from_uri, target_dir) = self._get_download_location()
|
||||||
patcher.apply_patches(canon_what_patches, target_dir)
|
patcher.apply_patches(canon_what_patches, target_dir)
|
||||||
|
|
||||||
def config_params(self, config_fn):
|
def config_params(self, config_fn):
|
||||||
|
@ -287,8 +287,7 @@ class YumDependencyHandler(base.DependencyHandler):
|
|||||||
quiet=True)
|
quiet=True)
|
||||||
p_bar.update(i + 1)
|
p_bar.update(i + 1)
|
||||||
|
|
||||||
def _write_spec_file(self, instance, app_dir, rpm_name, template_name,
|
def _write_spec_file(self, instance, rpm_name, template_name, params):
|
||||||
params):
|
|
||||||
requires_what = []
|
requires_what = []
|
||||||
try:
|
try:
|
||||||
requires_what.extend(instance.egg_info['dependencies'])
|
requires_what.extend(instance.egg_info['dependencies'])
|
||||||
@ -337,13 +336,19 @@ class YumDependencyHandler(base.DependencyHandler):
|
|||||||
for filename in sh.listdir(other_sources_dir, files_only=True):
|
for filename in sh.listdir(other_sources_dir, files_only=True):
|
||||||
sh.copy(filename, self.rpm_sources_dir)
|
sh.copy(filename, self.rpm_sources_dir)
|
||||||
|
|
||||||
def _build_from_spec(self, instance, spec_filename):
|
def _copy_patches(self, patches):
|
||||||
app_dir = instance.get_option('app_dir')
|
for filename in patches:
|
||||||
if sh.isfile(sh.joinpths(app_dir, "setup.py")):
|
sh.copy(filename, self.rpm_sources_dir)
|
||||||
self._write_python_tarball(app_dir)
|
|
||||||
|
def _build_from_spec(self, instance, spec_filename, patches=None):
|
||||||
|
pkg_dir = instance.get_option('app_dir')
|
||||||
|
if sh.isfile(sh.joinpths(pkg_dir, "setup.py")):
|
||||||
|
self._write_python_tarball(pkg_dir)
|
||||||
else:
|
else:
|
||||||
self._write_git_tarball(app_dir, spec_filename)
|
self._write_git_tarball(pkg_dir, spec_filename)
|
||||||
self._copy_sources(instance)
|
self._copy_sources(instance)
|
||||||
|
if patches:
|
||||||
|
self._copy_patches(patches)
|
||||||
self._copy_startup_scripts(spec_filename)
|
self._copy_startup_scripts(spec_filename)
|
||||||
cmdline = [
|
cmdline = [
|
||||||
self.rpmbuild_executable,
|
self.rpmbuild_executable,
|
||||||
@ -415,6 +420,8 @@ class YumDependencyHandler(base.DependencyHandler):
|
|||||||
|
|
||||||
def _build_openstack_package(self, instance):
|
def _build_openstack_package(self, instance):
|
||||||
params = self._package_parameters(instance)
|
params = self._package_parameters(instance)
|
||||||
|
patches = instance.list_patches("package")
|
||||||
|
params['patches'] = [sh.basename(fn) for fn in patches]
|
||||||
(rpm_name, template_name) = self._get_template_and_rpm_name(instance)
|
(rpm_name, template_name) = self._get_template_and_rpm_name(instance)
|
||||||
try:
|
try:
|
||||||
egg_name = instance.egg_info['name']
|
egg_name = instance.egg_info['name']
|
||||||
@ -429,17 +436,21 @@ class YumDependencyHandler(base.DependencyHandler):
|
|||||||
params["apiname"] = self.API_NAMES.get(client_name,
|
params["apiname"] = self.API_NAMES.get(client_name,
|
||||||
client_name.title())
|
client_name.title())
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
spec_filename = None
|
||||||
|
if template_name:
|
||||||
spec_filename = sh.joinpths(settings.TEMPLATE_DIR,
|
spec_filename = sh.joinpths(settings.TEMPLATE_DIR,
|
||||||
self.SPEC_TEMPLATE_DIR, template_name)
|
self.SPEC_TEMPLATE_DIR,
|
||||||
if not sh.isfile(spec_filename):
|
template_name)
|
||||||
|
if not spec_filename or not sh.isfile(spec_filename):
|
||||||
rpm_name = None
|
rpm_name = None
|
||||||
app_dir = instance.get_option('app_dir')
|
|
||||||
if rpm_name:
|
if rpm_name:
|
||||||
template_name = template_name or "%s.spec" % rpm_name
|
if not template_name:
|
||||||
spec_filename = self._write_spec_file(instance, app_dir, rpm_name,
|
template_name = "%s.spec" % rpm_name
|
||||||
|
spec_filename = self._write_spec_file(instance, rpm_name,
|
||||||
template_name, params)
|
template_name, params)
|
||||||
self._build_from_spec(instance, spec_filename)
|
self._build_from_spec(instance, spec_filename, patches)
|
||||||
else:
|
else:
|
||||||
|
app_dir = instance.get_option('app_dir')
|
||||||
cmdline = self.py2rpm_start_cmdline() + ["--", app_dir]
|
cmdline = self.py2rpm_start_cmdline() + ["--", app_dir]
|
||||||
sh.execute_save_output(cmdline,
|
sh.execute_save_output(cmdline,
|
||||||
cwd=app_dir,
|
cwd=app_dir,
|
||||||
|
@ -7,7 +7,6 @@ Epoch: $epoch
|
|||||||
Version: %{os_version}$version_suffix
|
Version: %{os_version}$version_suffix
|
||||||
Release: $release%{?dist}
|
Release: $release%{?dist}
|
||||||
|
|
||||||
#raw
|
|
||||||
License: GPLv3
|
License: GPLv3
|
||||||
URL: https://github.com/kanaka/noVNC
|
URL: https://github.com/kanaka/noVNC
|
||||||
Source0: novnc-%{os_version}.tar.gz
|
Source0: novnc-%{os_version}.tar.gz
|
||||||
@ -15,6 +14,11 @@ Source1: openstack-nova-novncproxy.init
|
|||||||
Source2: nova-novncproxy.1
|
Source2: nova-novncproxy.1
|
||||||
Source3: novnc_server.1
|
Source3: novnc_server.1
|
||||||
|
|
||||||
|
#for $idx, $fn in enumerate($patches)
|
||||||
|
Patch$idx: $fn
|
||||||
|
#end for
|
||||||
|
|
||||||
|
#raw
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
BuildRequires: python2-devel
|
BuildRequires: python2-devel
|
||||||
|
|
||||||
@ -39,6 +43,11 @@ OpenStack Nova noVNC server that proxies VNC traffic over Websockets.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n %{name}-%{os_version}
|
%setup -q -n %{name}-%{os_version}
|
||||||
|
#end raw
|
||||||
|
#for $idx, $fn in enumerate($patches)
|
||||||
|
%patch$idx -p1
|
||||||
|
#end for
|
||||||
|
#raw
|
||||||
|
|
||||||
# call the websockify executable
|
# call the websockify executable
|
||||||
sed -i 's/wsproxy\.py/websockify/' utils/launch.sh
|
sed -i 's/wsproxy\.py/websockify/' utils/launch.sh
|
||||||
|
@ -31,6 +31,9 @@ Source11: openstack-cinder-scheduler.init
|
|||||||
Source12: openstack-cinder-volume.init
|
Source12: openstack-cinder-volume.init
|
||||||
Source13: openstack-cinder-all.init
|
Source13: openstack-cinder-all.init
|
||||||
|
|
||||||
|
#for $idx, $fn in enumerate($patches)
|
||||||
|
Patch$idx: $fn
|
||||||
|
#end for
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
BuildRequires: python-setuptools
|
BuildRequires: python-setuptools
|
||||||
@ -94,9 +97,12 @@ access block storage volumes for use by Virtual Machine instances.
|
|||||||
This package contains documentation files for cinder.
|
This package contains documentation files for cinder.
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
#raw
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n cinder-%{os_version}
|
%setup -q -n cinder-%{os_version}
|
||||||
|
#for $idx, $fn in enumerate($patches)
|
||||||
|
%patch$idx -p1
|
||||||
|
#end for
|
||||||
|
#raw
|
||||||
|
|
||||||
# Ensure we don't access the net when building docs
|
# Ensure we don't access the net when building docs
|
||||||
sed -i "/'sphinx.ext.intersphinx',/d" doc/source/conf.py
|
sed -i "/'sphinx.ext.intersphinx',/d" doc/source/conf.py
|
||||||
|
@ -27,6 +27,10 @@ Source2: openstack-glance-registry.init
|
|||||||
Source3: openstack-glance-scrubber.init
|
Source3: openstack-glance-scrubber.init
|
||||||
Source4: openstack-glance.logrotate
|
Source4: openstack-glance.logrotate
|
||||||
|
|
||||||
|
#for $idx, $fn in enumerate($patches)
|
||||||
|
Patch$idx: $fn
|
||||||
|
#end for
|
||||||
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
@ -88,6 +92,12 @@ This package contains documentation files for glance.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n %{python_name}-%{os_version}
|
%setup -q -n %{python_name}-%{os_version}
|
||||||
|
#end raw
|
||||||
|
#for $idx, $fn in enumerate($patches)
|
||||||
|
%patch$idx -p1
|
||||||
|
#end for
|
||||||
|
|
||||||
|
#raw
|
||||||
sed '/pysendfile/d' tools/pip-requires
|
sed '/pysendfile/d' tools/pip-requires
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,6 +24,10 @@ Group: Applications/System
|
|||||||
Source0: %{python_name}-%{os_version}.tar.gz
|
Source0: %{python_name}-%{os_version}.tar.gz
|
||||||
Source1: openstack-keystone-all.init
|
Source1: openstack-keystone-all.init
|
||||||
|
|
||||||
|
#for $idx, $fn in enumerate($patches)
|
||||||
|
Patch$idx: $fn
|
||||||
|
#end for
|
||||||
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
@ -73,10 +77,12 @@ Keystone is a Python implementation of the OpenStack
|
|||||||
|
|
||||||
This package contains the Keystone Python library.
|
This package contains the Keystone Python library.
|
||||||
|
|
||||||
#raw
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n %{python_name}-%{os_version}
|
%setup -q -n %{python_name}-%{os_version}
|
||||||
|
#for $idx, $fn in enumerate($patches)
|
||||||
|
%patch$idx -p1
|
||||||
|
#end for
|
||||||
|
#raw
|
||||||
|
|
||||||
%build
|
%build
|
||||||
python setup.py build
|
python setup.py build
|
||||||
|
@ -45,6 +45,10 @@ Source51: nova.logrotate
|
|||||||
Source52: nova-polkit.pkla
|
Source52: nova-polkit.pkla
|
||||||
Source53: nova-sudoers
|
Source53: nova-sudoers
|
||||||
|
|
||||||
|
#for $idx, $fn in enumerate($patches)
|
||||||
|
Patch$idx: $fn
|
||||||
|
#end for
|
||||||
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
@ -324,9 +328,12 @@ protocol, and the Redis KVS.
|
|||||||
This package contains documentation files for %{name}.
|
This package contains documentation files for %{name}.
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
#raw
|
|
||||||
%prep
|
%prep
|
||||||
%setup0 -q -n %{python_name}-%{os_version}
|
%setup0 -q -n %{python_name}-%{os_version}
|
||||||
|
#for $idx, $fn in enumerate($patches)
|
||||||
|
%patch$idx -p1
|
||||||
|
#end for
|
||||||
|
#raw
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%{__python} setup.py build
|
%{__python} setup.py build
|
||||||
|
@ -41,6 +41,10 @@ Source17: quantum-ovs-cleanup.init
|
|||||||
Source18: quantum-hyperv-agent.init
|
Source18: quantum-hyperv-agent.init
|
||||||
Source19: quantum-rpc-zmq-receiver.init
|
Source19: quantum-rpc-zmq-receiver.init
|
||||||
|
|
||||||
|
#for $idx, $fn in enumerate($patches)
|
||||||
|
Patch$idx: $fn
|
||||||
|
#end for
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
BuildRequires: python-devel
|
BuildRequires: python-devel
|
||||||
@ -275,9 +279,12 @@ networks.
|
|||||||
This package contains the quantum plugin that implements virtual
|
This package contains the quantum plugin that implements virtual
|
||||||
networks using multiple other quantum plugins.
|
networks using multiple other quantum plugins.
|
||||||
|
|
||||||
#raw
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n quantum-%{os_version}
|
%setup -q -n quantum-%{os_version}
|
||||||
|
#for $idx, $fn in enumerate($patches)
|
||||||
|
%patch$idx -p1
|
||||||
|
#end for
|
||||||
|
#raw
|
||||||
|
|
||||||
find quantum -name \*.py -exec sed -i '/\/usr\/bin\/env python/d' {} \;
|
find quantum -name \*.py -exec sed -i '/\/usr\/bin\/env python/d' {} \;
|
||||||
|
|
||||||
|
@ -26,6 +26,10 @@ Vendor: OpenStack Foundation
|
|||||||
URL: http://www.openstack.org
|
URL: http://www.openstack.org
|
||||||
Source0: %{name}-%{os_version}.tar.gz
|
Source0: %{name}-%{os_version}.tar.gz
|
||||||
|
|
||||||
|
#for $idx, $fn in enumerate($patches)
|
||||||
|
Patch$idx: $fn
|
||||||
|
#end for
|
||||||
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
@ -44,7 +48,6 @@ Requires: ${i}
|
|||||||
This is a client for the OpenStack $apiname API. There is a Python API (the
|
This is a client for the OpenStack $apiname API. There is a Python API (the
|
||||||
${clientname}client module), and a command-line script (${clientname}).
|
${clientname}client module), and a command-line script (${clientname}).
|
||||||
|
|
||||||
#raw
|
|
||||||
%if 0%{?enable_doc}
|
%if 0%{?enable_doc}
|
||||||
%package doc
|
%package doc
|
||||||
Summary: Documentation for %{name}
|
Summary: Documentation for %{name}
|
||||||
@ -59,6 +62,10 @@ Documentation for %{name}.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
#for $idx, $fn in enumerate($patches)
|
||||||
|
%patch$idx -p1
|
||||||
|
#end for
|
||||||
|
#raw
|
||||||
if [ ! -f HACKING* ]; then
|
if [ ! -f HACKING* ]; then
|
||||||
touch HACKING
|
touch HACKING
|
||||||
fi
|
fi
|
||||||
|
@ -22,6 +22,10 @@ Source0: horizon-%{os_version}.tar.gz
|
|||||||
Source1: openstack-dashboard.conf
|
Source1: openstack-dashboard.conf
|
||||||
Source2: openstack-dashboard-httpd-2.4.conf
|
Source2: openstack-dashboard-httpd-2.4.conf
|
||||||
|
|
||||||
|
#for $idx, $fn in enumerate($patches)
|
||||||
|
Patch$idx: $fn
|
||||||
|
#end for
|
||||||
|
|
||||||
# additional provides to be consistent with other django packages
|
# additional provides to be consistent with other django packages
|
||||||
Provides: django-horizon = %{epoch}:%{version}-%{release}
|
Provides: django-horizon = %{epoch}:%{version}-%{release}
|
||||||
|
|
||||||
@ -77,9 +81,12 @@ BuildRequires: python-swiftclient
|
|||||||
Documentation for the Django Horizon application for talking with Openstack
|
Documentation for the Django Horizon application for talking with Openstack
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
#raw
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n horizon-%{os_version}
|
%setup -q -n horizon-%{os_version}
|
||||||
|
#for $idx, $fn in enumerate($patches)
|
||||||
|
%patch$idx -p1
|
||||||
|
#end for
|
||||||
|
#raw
|
||||||
|
|
||||||
# Don't access the net while building docs
|
# Don't access the net while building docs
|
||||||
sed -i '/sphinx.ext.intersphinx/d' doc/source/conf.py
|
sed -i '/sphinx.ext.intersphinx/d' doc/source/conf.py
|
||||||
|
Loading…
Reference in New Issue
Block a user