On 08/13/2014 06:05 PM, Mike McLean wrote:
> This much gets you halfway there, but it looks like the system is just
> going to choke later on having the sources under SOURCES instead of the
> git root dir.
> 
> I guess you could set up a source_cmd to move or link the sources
> around, but that's hardly a clean solution.
> 
> I wouldn't mind teaching koji to handle this layout, but it looks like
> it might be a little more involved than just the spec portion (unless
> I'm missing something). Did you have a solution for the SOURCES dir?

Actually not that complicated after all. I did add an option to turn the
support off in case it causes a problem (possible that someone could
have a SOURCES dir in their checkout for some other reason).

Anyway, here is where I'm at. Seems to be working.

diff --git a/builder/kojid b/builder/kojid
index b23e9ce..001bdf2 100755
--- a/builder/kojid
+++ b/builder/kojid
@@ -3417,6 +3417,9 @@ class BuildSRPMFromSCMTask(BaseBuildTask):
 
         # Find and verify that there is only one spec file.
         spec_files = glob.glob("%s/*.spec" % sourcedir)
+        if not spec_files and self.options.support_rpm_source_layout:
+            # also check SPECS dir
+            spec_files = glob.glob("%s/SPECS/*.spec" % sourcedir)
         if len(spec_files) == 0:
             raise koji.BuildError("No spec file found")
         elif len(spec_files) > 1:
@@ -3428,7 +3431,10 @@ class BuildSRPMFromSCMTask(BaseBuildTask):
 
         #build srpm
         self.logger.debug("Running srpm build")
-        broot.build_srpm(spec_file, sourcedir, scm.source_cmd)
+        sources_dir = "%s/SOURCES" % sourcedir
+        if not self.options.support_rpm_source_layout or not os.path.isdir(sources_dir):
+            sources_dir = sourcedir
+        broot.build_srpm(spec_file, sources_dir, scm.source_cmd)
 
         srpms = glob.glob('%s/*.src.rpm' % broot.resultdir())
         if len(srpms) == 0:
@@ -4065,6 +4071,7 @@ def get_options():
                 'createrepo_update': True,
                 'pkgurl': None,
                 'allowed_scms': '',
+                'support_rpm_source_layout': True,
                 'yum_proxy': None,
                 'maven_repo_ignore': '*.md5 *.sha1 maven-metadata*.xml _maven.repositories '
                                      'resolver-status.properties *.lastUpdated',
@@ -4083,7 +4090,7 @@ def get_options():
                 except ValueError:
                     quit("value for %s option must be a valid integer" % name)
             elif name in ['offline_retry', 'createrepo_skip_stat', 'createrepo_update',
-                          'keepalive', 'use_fast_upload',]:
+                          'keepalive', 'use_fast_upload', 'support_rpm_source_layout']:
                 defaults[name] = config.getboolean('kojid', name)
             elif name in ['plugin', 'plugins']:
                 defaults['plugin'] = value.split()
--
buildsys mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/buildsys

Reply via email to