build_srpm: Wait until after running the sources command to check for

alt_sources_dir

In the RPM layout, it's possible that the SOURCES directory might be
completely empty save for the lookaside payload. In this case a SOURCES
directory wouldn't exist in SCM, and wouldn't be created until the
sources command is run.
This commit is contained in:
Brian Stinson 2019-05-02 22:23:12 -05:00 committed by Mike McLean
parent f2eaa6cc56
commit af1efed6fa

View file

@ -555,11 +555,6 @@ class BuildRoot(object):
def build_srpm(self, specfile, sourcedir, source_cmd):
self.session.host.setBuildRootState(self.id,'BUILDING')
alt_sources_dir = "%s/SOURCES" % sourcedir
if self.options.support_rpm_source_layout and os.path.isdir(alt_sources_dir):
sources_dir = alt_sources_dir
else:
sources_dir = sourcedir
if source_cmd:
# call the command defined by source_cmd in the chroot so any required files not stored in
# the SCM can be retrieved
@ -571,6 +566,12 @@ class BuildRoot(object):
self.expire()
raise koji.BuildError("error retrieving sources, %s" % self._mockResult(rv))
alt_sources_dir = "%s/SOURCES" % sourcedir
if self.options.support_rpm_source_layout and os.path.isdir(alt_sources_dir):
sources_dir = alt_sources_dir
else:
sources_dir = sourcedir
args = ['--no-clean', '--buildsrpm', '--spec', specfile, '--sources', sources_dir,
'--target', 'noarch']