[PATCH] add gitbuildurl function
Dan HorĂ¡k
dan at danny.cz
Mon May 28 13:15:04 UTC 2012
gitbuildurl returns the SCM URL used to build a specified N-V-R, it's useful
for secondary arches where they can send the URL retrieved from primary koji
to secondary koji with something like
s390-koji build f18 $(koji gitbuildurl foo-1-1.fc18)
---
src/pyrpkg/__init__.py | 11 ++++++++---
src/pyrpkg/cli.py | 18 ++++++++++++++++++
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/src/pyrpkg/__init__.py b/src/pyrpkg/__init__.py
index bd0e70a..f21a8e8 100644
--- a/src/pyrpkg/__init__.py
+++ b/src/pyrpkg/__init__.py
@@ -1098,8 +1098,8 @@ class Commands(object):
(branch, module))
return output.split()[0]
- def gitbuildhash(self, build):
- """Determine the git hash used to produce a particular N-V-R"""
+ def gitbuildurl(self, build):
+ """Determine the SCM URL used to produce a particular N-V-R"""
# Get the build data from the nvr
self.log.debug('Getting task data from the build system')
@@ -1111,9 +1111,14 @@ class Commands(object):
taskinfo = self.anon_kojisession.getTaskRequest(bdata['task_id'])
# taskinfo is a list of items, first item is the task url.
# second is the build target.
+ return taskinfo[0]
+
+ def gitbuildhash(self, build):
+ """Determine the git hash used to produce a particular N-V-R"""
+
# See if the build target starts with cvs or git
hash = None
- buildsource = taskinfo[0]
+ buildsource = self.gitbuildurl(build)
if buildsource.startswith('cvs://'):
# snag everyting after the last # mark
cvstag = buildsource.rsplit('#')[-1]
diff --git a/src/pyrpkg/cli.py b/src/pyrpkg/cli.py
index 54cad63..572d566 100755
--- a/src/pyrpkg/cli.py
+++ b/src/pyrpkg/cli.py
@@ -156,6 +156,7 @@ class cliClient(object):
self.register_diff()
self.register_gimmespec()
self.register_gitbuildhash()
+ self.register_gitbuildurl()
self.register_giturl()
self.register_import_srpm()
self.register_install()
@@ -461,6 +462,20 @@ defined, packages will be built sequentially.""" %
build to query.')
gitbuildhash_parser.set_defaults(command = self.gitbuildhash)
+ def register_gitbuildurl(self):
+ """Register the gitbuildurl target"""
+
+ gitbuildurl_parser = self.subparsers.add_parser('gitbuildurl',
+ help = 'Print the SCM URL used '
+ 'to build the provided n-v-r',
+ description = 'This will show you \
+ the URL string used to \
+ build the provided build n-v-r')
+ gitbuildurl_parser.add_argument('build',
+ help='name-version-release of the \
+ build to query.')
+ gitbuildurl_parser.set_defaults(command = self.gitbuildurl)
+
def register_giturl(self):
"""Register the giturl target"""
@@ -1001,6 +1016,9 @@ defined, packages will be built sequentially.""" %
def gitbuildhash(self):
print(self.cmd.gitbuildhash(self.args.build))
+ def gitbuildurl(self):
+ print(self.cmd.gitbuildurl(self.args.build))
+
def giturl(self):
print(self.cmd.giturl())
--
1.7.7.6
More information about the buildsys
mailing list