[PATCH] Allow spec file to be in a different path than /

Thomas alphacc at gmail.com
Wed Aug 6 15:42:25 UTC 2014


This should allow people to build from git repositories that have a
different structure than Fedora (they still need some magic with
source_cmd). The patch is not too intrusive and can be set per
repository.

Let me know if it can be considered for inclusion. I am happy to rework it.

---
diff --git a/builder/kojid b/builder/kojid
index b3d0d1c..89f9474 100755
--- a/builder/kojid
+++ b/builder/kojid
@@ -3292,7 +3292,7 @@ class BuildSRPMFromSCMTask(BaseBuildTask):
         self.patch_scm_source(sourcedir, logfile, opts)

         # Find and verify that there is only one spec file.
-        spec_files = glob.glob("%s/*.spec" % sourcedir)
+        spec_files = glob.glob("%s/%s*.spec" % (sourcedir, scm.spec_path))
         if len(spec_files) == 0:
             raise koji.BuildError("No spec file found")
         elif len(spec_files) > 1:
diff --git a/koji/daemon.py b/koji/daemon.py
index 205f62e..68af212 100644
--- a/koji/daemon.py
+++ b/koji/daemon.py
@@ -200,6 +200,7 @@ class SCM(object):
         - use_common (defaults to True, may be set by assert_allowed())
         - source_cmd (defaults to ['make', 'sources'], may be set by
assert_allowed())
         - scmtype
+        - spec_path

         The exact format of each attribute is SCM-specific, but the
structure of the url
         must conform to the template above, or an error will be raised.
@@ -220,6 +221,7 @@ class SCM(object):
         self.revision = fragment
         self.use_common = True
         self.source_cmd = ['make', 'sources']
+        self.spec_path = '/'

         for scmtype, schemes in SCM.types.items():
             if self.scheme in schemes:
@@ -311,6 +313,10 @@ class SCM(object):
                         else:
                             # there was nothing after the trailing :,
so they don't want to run a source_cmd at all
                             self.source_cmd = None
+                    # check if spec path is defined
+                    if len(scm_tuple) >= 5:
+                        if scm_tuple[4]:
+                            self.spec_path = scm_tuple[4] + '/'
                     break
             else:
                 self.logger.warn('Ignoring incorrectly formatted SCM
host:repository: %s' % allowed_scm)


More information about the buildsys mailing list