summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJesse Keating <jkeating@redhat.com>2010-02-05 20:16:06 -0800
committerJesse Keating <jkeating@redhat.com>2010-02-05 20:16:06 -0800
commit0c02a163f36c4b9354f882fc6f2b258576227019 (patch)
tree62d10a37482bf7370e1aaf6df65c83fba8da2cd9 /src
parent95611aaf1d43c230130b5404f63fc80ed14bddd5 (diff)
downloadfedora-packager-0c02a163f36c4b9354f882fc6f2b258576227019.tar.gz
fedora-packager-0c02a163f36c4b9354f882fc6f2b258576227019.tar.xz
fedora-packager-0c02a163f36c4b9354f882fc6f2b258576227019.zip
Handle chain builds
More stuff stolen from /usr/bin/koji here, but oh well.
Diffstat (limited to 'src')
-rw-r--r--src/pyfedpkg/__init__.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py
index fbecb8e..b2bf964 100644
--- a/src/pyfedpkg/__init__.py
+++ b/src/pyfedpkg/__init__.py
@@ -292,7 +292,7 @@ class PackageModule:
raise FedpkgError('%s is not a valid repo' % path)
def build(self, skip_tag=False, scratch=False, background=False,
- url=None):
+ url=None, chain=None):
"""Initiate a build of the module. Available options are:
skip_tag: Skip the tag action after the build
@@ -301,6 +301,10 @@ class PackageModule:
background: Perform the build with a low priority
+ url: A url to an uploaded srpm to build from
+
+ chain: A chain build set
+
This function submits the task to koji and returns the taskID
It is up to the client to wait or watch the task.
@@ -335,6 +339,12 @@ class PackageModule:
build_target['dest_tag_name'])
if dest_tag['locked'] and not scratch:
raise FedpkgError('Destination tag %s is locked' % dest_tag['name'])
+ # If we're chain building, make sure inheritance works
+ if chain:
+ ancestors = self.kojisession.getFullInheritance(build_target['build_tag'])
+ if dest_tag['id'] not in [build_target['build_tag']] + [ancestor['parent_id'] for ancestor in ancestors]:
+ raise FedpkgError('Packages in destination tag %(dest_tag_name)s \
+ are not inherited by build tag %(build_tag_name)s' % build_target)
# define our dictionary for options
opts = {}
# Set a placeholder for the build priority
@@ -349,8 +359,15 @@ class PackageModule:
log.debug('Building %s for %s with options %s and a priority of %s' %
(url, self.target, opts, priority))
# Now submit the task and get the task_id to return
- task_id = self.kojisession.build(url, self.target, opts,
- priority=priority)
+ # Handle the chain build version
+ if chain:
+ chain[-1].append(url)
+ task_id = self.kojisession.chainBuild(chain, self.target, opts,
+ priority=priority)
+ # Now handle the normal build
+ else:
+ task_id = self.kojisession.build(url, self.target, opts,
+ priority=priority)
log.info('Created task: %s' % task_id)
log.info('Task info: %s/taskinfo?taskID=%s' % (self.kojiweburl,
task_id))