PR#4013: let tag.extra override tag arches for noarch
Merges #4013 https://pagure.io/koji/pull-request/4013 Fixes: #3809 https://pagure.io/koji/issue/3809 RFE: Exclude i686 builders for naorch builds
This commit is contained in:
commit
65758fea93
1 changed files with 26 additions and 8 deletions
|
|
@ -1332,11 +1332,13 @@ class BuildTask(BaseTaskHandler):
|
|||
|
||||
def getSRPMFromSRPM(self, src, build_tag, repo_id):
|
||||
# rebuild srpm in mock, so it gets correct disttag, rpm version, etc.
|
||||
taskarch = self.choose_taskarch('noarch', None, build_tag)
|
||||
task_id = self.session.host.subtask(method='rebuildSRPM',
|
||||
arglist=[src, build_tag, {
|
||||
'repo_id': repo_id,
|
||||
'scratch': self.opts.get('scratch')}],
|
||||
label='srpm',
|
||||
arch=taskarch,
|
||||
parent=self.id)
|
||||
# wait for subtask to finish
|
||||
result = self.wait(task_id)[task_id]
|
||||
|
|
@ -1349,11 +1351,13 @@ class BuildTask(BaseTaskHandler):
|
|||
|
||||
def getSRPMFromSCM(self, url, build_tag, repo_id):
|
||||
# TODO - allow different ways to get the srpm
|
||||
taskarch = self.choose_taskarch('noarch', None, build_tag)
|
||||
task_id = self.session.host.subtask(method='buildSRPMFromSCM',
|
||||
arglist=[url, build_tag, {
|
||||
'repo_id': repo_id,
|
||||
'scratch': self.opts.get('scratch')}],
|
||||
label='srpm',
|
||||
arch=taskarch,
|
||||
parent=self.id)
|
||||
# wait for subtask to finish
|
||||
result = self.wait(task_id)[task_id]
|
||||
|
|
@ -1432,27 +1436,41 @@ class BuildTask(BaseTaskHandler):
|
|||
# For noarch, attempt to honor ExcludeArch/ExclusiveArch
|
||||
# see https://pagure.io/koji/issue/19
|
||||
|
||||
h = self.readSRPMHeader(srpm)
|
||||
exclusivearch = koji.get_header_field(h, 'exclusivearch')
|
||||
excludearch = koji.get_header_field(h, 'excludearch')
|
||||
if srpm is None:
|
||||
exclusivearch = []
|
||||
excludearch = []
|
||||
else:
|
||||
h = self.readSRPMHeader(srpm)
|
||||
exclusivearch = koji.get_header_field(h, 'exclusivearch')
|
||||
excludearch = koji.get_header_field(h, 'excludearch')
|
||||
|
||||
if exclusivearch or excludearch:
|
||||
buildconfig = self.session.getBuildConfig(build_tag, event=self.event_id)
|
||||
noarch_arches = buildconfig.get('extra', {}).get('noarch_arches')
|
||||
|
||||
if exclusivearch or excludearch or noarch_arches:
|
||||
# if one of the tag arches is filtered out, then we can't use a
|
||||
# noarch task
|
||||
buildconfig = self.session.getBuildConfig(build_tag, event=self.event_id)
|
||||
arches = buildconfig['arches']
|
||||
tag_arches = [koji.canonArch(a) for a in arches.split()]
|
||||
exclusivearch = [koji.canonArch(a) for a in exclusivearch]
|
||||
excludearch = [koji.canonArch(a) for a in excludearch]
|
||||
archlist = list(tag_arches)
|
||||
# tag.extra overrides tag arches for noarch
|
||||
if noarch_arches:
|
||||
archlist = [koji.canonArch(a) for a in noarch_arches.split()]
|
||||
archlist = [a for a in archlist if a in tag_arches]
|
||||
else:
|
||||
archlist = list(tag_arches)
|
||||
if exclusivearch:
|
||||
archlist = [a for a in archlist if a in exclusivearch]
|
||||
if excludearch:
|
||||
archlist = [a for a in archlist if a not in excludearch]
|
||||
self.logger.info('Filtering arches for noarch subtask. Choices: %r', archlist)
|
||||
if not archlist:
|
||||
raise koji.BuildError("No valid arches were found. tag %r, "
|
||||
"exclusive %r, exclude %r" % (tag_arches,
|
||||
raise koji.BuildError("No valid arches were found. tag %r, extra %r,"
|
||||
"exclusive %r, exclude %r" % (tag_arches, noarch_arches,
|
||||
exclusivearch, excludearch))
|
||||
self.logger.debug('tag: %r, extra: %r, exclusive: %r, exclude: %r',
|
||||
tag_arches, noarch_arches, exclusivearch, excludearch)
|
||||
if set(archlist) != set(tag_arches):
|
||||
return random.choice(archlist)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue