Anvil not creating RPM 'Conflicts' terms in spec files
Use RPM 'Conflicts' dependencies to express Python version constraints in which versions are excluded using '!=' syntax. Change-Id: I2f7cc87e6c3ba449d15cc37baa350f3db235f1c2 Co-Authored-By: Sam Gasper <sgasper@cray.com> Closes-bug: #1422442
This commit is contained in:
parent
8582b9b090
commit
7a6b074e27
@ -93,9 +93,10 @@ class Helper(object):
|
|||||||
|
|
||||||
def _convert_names_to_rpm(self, python_names, only_name):
|
def _convert_names_to_rpm(self, python_names, only_name):
|
||||||
if not python_names:
|
if not python_names:
|
||||||
return {}
|
return {}, {}
|
||||||
cmdline = self._start_cmdline() + ["--convert"] + python_names
|
cmdline = self._start_cmdline() + ["--convert"] + python_names
|
||||||
result = collections.defaultdict(set)
|
result = collections.defaultdict(set)
|
||||||
|
conflicts = collections.defaultdict(set)
|
||||||
current_source = None
|
current_source = None
|
||||||
for line in sh.execute(cmdline)[0].splitlines():
|
for line in sh.execute(cmdline)[0].splitlines():
|
||||||
# NOTE(harlowja): format is "Requires: rpm-name <=> X" or when
|
# NOTE(harlowja): format is "Requires: rpm-name <=> X" or when
|
||||||
@ -109,6 +110,9 @@ class Helper(object):
|
|||||||
if positions:
|
if positions:
|
||||||
line = line[0:positions[0]]
|
line = line[0:positions[0]]
|
||||||
result[current_source].add(line.strip())
|
result[current_source].add(line.strip())
|
||||||
|
elif line.startswith("Conflicts:"):
|
||||||
|
line = line[len("Conflicts:"):]
|
||||||
|
conflicts[current_source].add(line.strip())
|
||||||
elif line.startswith("# Source:"):
|
elif line.startswith("# Source:"):
|
||||||
current_source = line[len("# Source:"):].strip()
|
current_source = line[len("# Source:"):].strip()
|
||||||
|
|
||||||
@ -120,10 +124,10 @@ class Helper(object):
|
|||||||
if extra_names:
|
if extra_names:
|
||||||
raise AssertionError("Extra python names were found during conversion: %s"
|
raise AssertionError("Extra python names were found during conversion: %s"
|
||||||
% ', '.join(sorted(extra_names)))
|
% ', '.join(sorted(extra_names)))
|
||||||
return result
|
return result, conflicts
|
||||||
|
|
||||||
def names_to_rpm_names(self, python_names):
|
def names_to_rpm_names(self, python_names):
|
||||||
mapping = self._convert_names_to_rpm(python_names, only_name=True)
|
mapping = self._convert_names_to_rpm(python_names, only_name=True)[0]
|
||||||
result = {}
|
result = {}
|
||||||
for k, v in six.iteritems(mapping):
|
for k, v in six.iteritems(mapping):
|
||||||
assert len(v) == 1, ('There should be exactly one RPM name for '
|
assert len(v) == 1, ('There should be exactly one RPM name for '
|
||||||
@ -132,11 +136,13 @@ class Helper(object):
|
|||||||
result[k] = v.pop()
|
result[k] = v.pop()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def names_to_rpm_requires(self, python_names):
|
def names_to_rpm_deps(self, python_names):
|
||||||
mapping = self._convert_names_to_rpm(python_names, only_name=False)
|
# Given a set of packages in Python namespace, return the equivalent
|
||||||
return [req
|
# Requires and Conflicts in RPM namespace.
|
||||||
for value in six.itervalues(mapping)
|
requires, conflicts = self._convert_names_to_rpm(python_names, only_name=False)
|
||||||
for req in value]
|
requires_list = [req for value in six.itervalues(requires) for req in value]
|
||||||
|
conflicts_list = [req for value in six.itervalues(conflicts) for req in value]
|
||||||
|
return requires_list, conflicts_list
|
||||||
|
|
||||||
def build_all_srpms(self, package_files, tracewriter, jobs):
|
def build_all_srpms(self, package_files, tracewriter, jobs):
|
||||||
(_fn, content) = utils.load_template(sh.joinpths("packaging", "makefiles"), "source.mk")
|
(_fn, content) = utils.load_template(sh.joinpths("packaging", "makefiles"), "source.mk")
|
||||||
|
@ -632,7 +632,9 @@ class YumDependencyHandler(base.DependencyHandler):
|
|||||||
|
|
||||||
def _write_spec_file(self, instance, rpm_name, template_name, params):
|
def _write_spec_file(self, instance, rpm_name, template_name, params):
|
||||||
requires_what = params.get('requires', [])
|
requires_what = params.get('requires', [])
|
||||||
|
conflicts_what = params.get('conflicts', [])
|
||||||
test_requires_what = params.get('test_requires', [])
|
test_requires_what = params.get('test_requires', [])
|
||||||
|
test_conflicts_what = params.get('test_conflicts', [])
|
||||||
egg_info = getattr(instance, 'egg_info', None)
|
egg_info = getattr(instance, 'egg_info', None)
|
||||||
if egg_info:
|
if egg_info:
|
||||||
|
|
||||||
@ -640,15 +642,21 @@ class YumDependencyHandler(base.DependencyHandler):
|
|||||||
try:
|
try:
|
||||||
requires_python = [str(req) for req in egg_info[key]]
|
requires_python = [str(req) for req in egg_info[key]]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return []
|
return [], []
|
||||||
else:
|
else:
|
||||||
return self.py2rpm_helper.names_to_rpm_requires(requires_python)
|
return self.py2rpm_helper.names_to_rpm_deps(requires_python)
|
||||||
|
|
||||||
requires_what.extend(ei_names('dependencies'))
|
rpm_requires, rpm_conflicts = ei_names('dependencies')
|
||||||
test_requires_what.extend(ei_names('test_dependencies'))
|
requires_what.extend(rpm_requires)
|
||||||
|
conflicts_what.extend(rpm_conflicts)
|
||||||
|
rpm_test_requires, rpm_test_conflicts = ei_names('test_dependencies')
|
||||||
|
test_requires_what.extend(rpm_test_requires)
|
||||||
|
test_conflicts_what.extend(rpm_test_conflicts)
|
||||||
|
|
||||||
params["requires"] = requires_what
|
params["requires"] = requires_what
|
||||||
|
params["conflicts"] = conflicts_what
|
||||||
params["test_requires"] = test_requires_what
|
params["test_requires"] = test_requires_what
|
||||||
|
params["test_conflicts"] = test_conflicts_what
|
||||||
params["epoch"] = self.OPENSTACK_EPOCH
|
params["epoch"] = self.OPENSTACK_EPOCH
|
||||||
params["part_fn"] = lambda filename: sh.joinpths(
|
params["part_fn"] = lambda filename: sh.joinpths(
|
||||||
settings.TEMPLATE_DIR,
|
settings.TEMPLATE_DIR,
|
||||||
|
@ -96,6 +96,10 @@ Group: Applications/System
|
|||||||
Requires: ${i}
|
Requires: ${i}
|
||||||
#end for
|
#end for
|
||||||
|
|
||||||
|
#for $i in $conflicts
|
||||||
|
Conflicts: ${i}
|
||||||
|
#end for
|
||||||
|
|
||||||
%description -n python-ceilometer
|
%description -n python-ceilometer
|
||||||
OpenStack ceilometer provides services to measure and
|
OpenStack ceilometer provides services to measure and
|
||||||
collect metrics from OpenStack components.
|
collect metrics from OpenStack components.
|
||||||
|
@ -77,6 +77,10 @@ Requires: sudo
|
|||||||
Requires: ${i}
|
Requires: ${i}
|
||||||
#end for
|
#end for
|
||||||
|
|
||||||
|
#for $i in $conflicts
|
||||||
|
Conflicts: ${i}
|
||||||
|
#end for
|
||||||
|
|
||||||
|
|
||||||
%description -n python-cinder
|
%description -n python-cinder
|
||||||
OpenStack Volume (codename Cinder) provides services to manage and
|
OpenStack Volume (codename Cinder) provides services to manage and
|
||||||
|
@ -75,6 +75,10 @@ Group: Applications/System
|
|||||||
Requires: ${i}
|
Requires: ${i}
|
||||||
#end for
|
#end for
|
||||||
|
|
||||||
|
#for $i in $conflicts
|
||||||
|
Conflicts: ${i}
|
||||||
|
#end for
|
||||||
|
|
||||||
%description -n python-glance
|
%description -n python-glance
|
||||||
OpenStack Image Service (code-named Glance) provides discovery,
|
OpenStack Image Service (code-named Glance) provides discovery,
|
||||||
registration, and delivery services for virtual disk images.
|
registration, and delivery services for virtual disk images.
|
||||||
|
@ -128,6 +128,10 @@ Requires: ${i}
|
|||||||
Requires(pre): shadow-utils
|
Requires(pre): shadow-utils
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
#for $i in $conflicts
|
||||||
|
Conflicts: ${i}
|
||||||
|
#end for
|
||||||
|
|
||||||
%description common
|
%description common
|
||||||
Components common to all OpenStack Heat services
|
Components common to all OpenStack Heat services
|
||||||
|
|
||||||
|
@ -95,6 +95,10 @@ Group: Applications/System
|
|||||||
Requires: ${i}
|
Requires: ${i}
|
||||||
#end for
|
#end for
|
||||||
|
|
||||||
|
#for $i in $conflicts
|
||||||
|
Conflicts: ${i}
|
||||||
|
#end for
|
||||||
|
|
||||||
%description -n python-%{python_name}
|
%description -n python-%{python_name}
|
||||||
This package contains the %{name} Python library.
|
This package contains the %{name} Python library.
|
||||||
|
|
||||||
|
@ -105,6 +105,10 @@ Group: Development/Languages/Python
|
|||||||
Requires: ${i}
|
Requires: ${i}
|
||||||
#end for
|
#end for
|
||||||
|
|
||||||
|
#for $i in $conflicts
|
||||||
|
Conflicts: ${i}
|
||||||
|
#end for
|
||||||
|
|
||||||
%description -n python-keystone
|
%description -n python-keystone
|
||||||
Keystone is a Python implementation of the OpenStack
|
Keystone is a Python implementation of the OpenStack
|
||||||
(http://www.openstack.org) identity service API.
|
(http://www.openstack.org) identity service API.
|
||||||
|
@ -134,6 +134,9 @@ Requires: sudo
|
|||||||
Requires: ${i}
|
Requires: ${i}
|
||||||
#end for
|
#end for
|
||||||
|
|
||||||
|
#for $i in $conflicts
|
||||||
|
Conflicts: ${i}
|
||||||
|
#end for
|
||||||
|
|
||||||
%description -n python-neutron
|
%description -n python-neutron
|
||||||
Neutron provides an API to dynamically request and configure virtual
|
Neutron provides an API to dynamically request and configure virtual
|
||||||
|
@ -348,6 +348,10 @@ Requires: sudo
|
|||||||
Requires: ${i}
|
Requires: ${i}
|
||||||
#end for
|
#end for
|
||||||
|
|
||||||
|
#for $i in $conflicts
|
||||||
|
Conflicts: ${i}
|
||||||
|
#end for
|
||||||
|
|
||||||
%description -n python-nova
|
%description -n python-nova
|
||||||
OpenStack Compute (codename Nova) is open source software designed to
|
OpenStack Compute (codename Nova) is open source software designed to
|
||||||
provision and manage large networks of virtual machines, creating a
|
provision and manage large networks of virtual machines, creating a
|
||||||
|
@ -87,6 +87,10 @@ Group: Development/Languages/Python
|
|||||||
Requires: ${i}
|
Requires: ${i}
|
||||||
#end for
|
#end for
|
||||||
|
|
||||||
|
#for $i in $conflicts
|
||||||
|
Conflicts: ${i}
|
||||||
|
#end for
|
||||||
|
|
||||||
%description -n python-trove
|
%description -n python-trove
|
||||||
Trove is Database as a Service for Openstack. It's designed to run
|
Trove is Database as a Service for Openstack. It's designed to run
|
||||||
entirely on OpenStack, with the goal of allowing users to quickly and
|
entirely on OpenStack, with the goal of allowing users to quickly and
|
||||||
|
@ -55,6 +55,10 @@ BuildRequires: make
|
|||||||
Requires: ${i}
|
Requires: ${i}
|
||||||
#end for
|
#end for
|
||||||
|
|
||||||
|
#for $i in $conflicts
|
||||||
|
Conflicts: ${i}
|
||||||
|
#end for
|
||||||
|
|
||||||
%description
|
%description
|
||||||
This is a client for the OpenStack $apiname API. There's a Python API
|
This is a client for the OpenStack $apiname API. There's a Python API
|
||||||
(the ${clientname}client module), and a command-line script (${clientname}).
|
(the ${clientname}client module), and a command-line script (${clientname}).
|
||||||
|
@ -72,6 +72,10 @@ BuildRequires: python-scss
|
|||||||
Requires: ${i}
|
Requires: ${i}
|
||||||
#end for
|
#end for
|
||||||
|
|
||||||
|
#for $i in $conflicts
|
||||||
|
Conflicts: ${i}
|
||||||
|
#end for
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Horizon is a Django application for providing Openstack UI components.
|
Horizon is a Django application for providing Openstack UI components.
|
||||||
It allows performing site administrator (viewing account resource usage,
|
It allows performing site administrator (viewing account resource usage,
|
||||||
|
Loading…
Reference in New Issue
Block a user