Merge #1103 Force the epoch on SRPM artifacts in the modulemd files uploaded to the CG build

This commit is contained in:
Matt Prahl
2018-12-13 00:10:34 +00:00
2 changed files with 15 additions and 1 deletions

View File

@@ -263,6 +263,12 @@ class KojiContentGenerator(object):
# Temporary dict with build_id as a key to find builds easily.
builds = {build['build_id']: build for build in builds}
# Create a mapping of build IDs to SRPM NEVRAs so that the for loop below can directly
# access these values when adding the `srpm_nevra` key to the returned RPMs
build_id_to_srpm_nevra = {
srpm["build_id"]: kobo.rpmlib.make_nvra(srpm, force_epoch=True)
for srpm in src_rpms.values()
}
# Handle the multicall result. For each build associated with the source RPM,
# store the exclusivearch and excludearch lists. For each RPM, store the 'license' and
# also other useful data from the Build associated with the RPM.
@@ -274,7 +280,7 @@ class KojiContentGenerator(object):
rpm["license"] = headers["license"]
rpm['srpm_name'] = build['name']
rpm['srpm_nevra'] = build['nvr']
rpm['srpm_nevra'] = build_id_to_srpm_nevra[rpm["build_id"]]
rpm['exclusivearch'] = build['exclusivearch']
rpm['excludearch'] = build['excludearch']

View File

@@ -342,6 +342,7 @@ class TestBuild:
{
'id': 1,
'arch': 'src',
'epoch': None,
'build_id': 875991,
'name': 'module-build-macros',
'release': '1.module_92011fe6',
@@ -350,6 +351,7 @@ class TestBuild:
{
'id': 2,
'arch': 'noarch',
'epoch': None,
'build_id': 875991,
'name': 'module-build-macros',
'release': '1.module_92011fe6',
@@ -358,6 +360,7 @@ class TestBuild:
{
'id': 3,
'arch': 'src',
'epoch': 3,
'build_id': 875636,
'name': 'ed',
'release': '2.module_bd6e0eb1',
@@ -366,6 +369,7 @@ class TestBuild:
{
'id': 4,
'arch': 'x86_64',
'epoch': 3,
'build_id': 875636,
'name': 'ed',
'release': '2.module_bd6e0eb1',
@@ -376,6 +380,7 @@ class TestBuild:
builds = [
{
'build_id': 875636,
'epoch': 3,
'name': 'ed',
'release': '2.module_bd6e0eb1',
'version': '1.14.1',
@@ -383,6 +388,7 @@ class TestBuild:
},
{
'build_id': 875991,
'epoch': None,
'name': 'module-build-macros',
'release': '1.module_92011fe6',
'version': '0.1',
@@ -403,9 +409,11 @@ class TestBuild:
for rpm in rpms:
# We want to mainly check the excludearch and exclusivearch code.
if rpm["name"] == "module-build-macros":
assert rpm["srpm_nevra"] == "module-build-macros-0:0.1-1.module_92011fe6.src"
assert rpm["excludearch"] == ["x86_64"]
assert rpm["license"] == "MIT"
else:
assert rpm["srpm_nevra"] == "ed-3:1.14.1-2.module_bd6e0eb1.src"
assert rpm["exclusivearch"] == ["x86_64"]
assert rpm["license"] == "GPL"