builder: py2 fixes

Relates: https://pagure.io/koji/issue/1905
This commit is contained in:
Tomas Kopecek 2020-05-18 17:09:48 +02:00 committed by Mike McLean
parent 47696c8895
commit 8cd79f48e7
2 changed files with 12 additions and 10 deletions

View file

@ -4991,24 +4991,22 @@ class BuildSRPMFromSCMTask(BaseBuildTask):
elif len(spec_files) > 1: elif len(spec_files) > 1:
# If there are multiple spec files, check whether one of them # If there are multiple spec files, check whether one of them
# matches the SCM repo name # matches the SCM repo name
scm_spec_options = [ scm_spec_options = (
"%s/%s.spec".format( "%s/%s.spec" % (sourcedir, os.path.basename(sourcedir)),
sourcedir, os.path.basename(sourcedir)), "%s/SPECS/%s.spec" % (sourcedir, os.path.basename(sourcedir)),
)
"%s/SPECS/%s.spec".format(
sourcedir, os.path.basename(sourcedir))
]
spec_file = None
for scm_spec in scm_spec_options: for scm_spec in scm_spec_options:
if scm_spec in specs: if scm_spec in spec_files:
# We have a match, so use this one. # We have a match, so use this one.
spec_file = scm_spec spec_file = scm_spec
break break
if not spec_file: if not spec_file:
# We didn't find an exact match, so throw an error # We didn't find an exact match, so throw an error
raise koji.BuildError( raise koji.BuildError("Multiple spec files found but none is matching "
"Multiple spec files found: %s" % spec_files) "SCM checkout dir name: %s" % spec_files)
else: else:
spec_file = spec_files[0] spec_file = spec_files[0]

View file

@ -1224,6 +1224,10 @@ a host, but allow from it otherwise
The explicit block syntax was added in version 1.13.0. The explicit block syntax was added in version 1.13.0.
SCM checkout can contain multiple spec files (checkouted or created by
``source_cmd``). In such case spec file named same as a checkout directory will
be selected.
Add the host to the createrepo channel Add the host to the createrepo channel
-------------------------------------- --------------------------------------