Fix reporting when package version is unset

When a package tracks a stable branch rather than release, the spec file
doesn't contain a specific version number and so the status tool usually
reports it as "{{ py2rpmversion() }}" which gets converted to a Version
object that uses version 0.0. This causes the report to make it appear
like this packages need to be upgraded, but in reality no changes are
needed because they automatically track the branch. This change detects
versions like this and reports them as "ok" instead of "needs upgrade".

Change-Id: Ia1191c6c0938e78d8824cb8d893d561ddd99de4a
This commit is contained in:
Colleen Murphy 2019-03-12 13:22:41 +01:00
parent d4dc71da24
commit 9d04d1583c

View File

@ -137,6 +137,8 @@ def find_rpm_packaging_pkg_version(pkg_project_spec):
# check the Version field
m = re.search('^Version:\s*(?P<version>.*)\s*$', l)
if m:
if m.group('version') == '{{ py2rpmversion() }}':
return 'version unset'
return version.parse(m.group('version'))
# no version in spec found
print('ERROR: no version in %s found' % pkg_project_spec)
@ -158,7 +160,9 @@ def _pretty_table(release, projects, include_obs):
tb.field_names = fn
for p_name, x in projects.items():
if x.rpm_packaging_pkg == version.parse('0'):
if x.rpm_packaging_pkg == 'version unset':
comment = 'ok'
elif x.rpm_packaging_pkg == version.parse('0'):
comment = 'unpackaged'
elif x.rpm_packaging_pkg < x.release:
comment = 'needs upgrade'