summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Keating <jkeating@redhat.com>2010-08-11 19:53:05 -0700
committerJesse Keating <jkeating@redhat.com>2010-08-11 22:09:06 -0700
commit07cf37678bcaf3691991d1f15e7d35b9241e9225 (patch)
tree7db78939d92ae9a4452f018332cfea5e3458b17c
parent512c8644c854c6be1f761154d88740c0e90546ca (diff)
downloadfedora-packager-07cf37678bcaf3691991d1f15e7d35b9241e9225.tar.gz
fedora-packager-07cf37678bcaf3691991d1f15e7d35b9241e9225.tar.xz
fedora-packager-07cf37678bcaf3691991d1f15e7d35b9241e9225.zip
Add a giturl command
This prints out the url that would be passed to koji to do the build.
-rwxr-xr-xsrc/fedpkg.py13
-rw-r--r--src/pyfedpkg/__init__.py8
2 files changed, 21 insertions, 0 deletions
diff --git a/src/fedpkg.py b/src/fedpkg.py
index 2219a38..656464e 100755
--- a/src/fedpkg.py
+++ b/src/fedpkg.py
@@ -460,6 +460,14 @@ def gimmespec(args):
log.error('Could not get spec file: %s' % e)
sys.exit(1)
+def giturl(args):
+ try:
+ mymodule = pyfedpkg.PackageModule(args.path)
+ print(mymodule.giturl())
+ except pyfedpkg.FedpkgError, e:
+ log.error('Could not get the giturl: %s' % e)
+ sys.exit(1)
+
def import_srpm(args):
# See if we need to create a module from scratch, and do so
if args.create:
@@ -871,6 +879,11 @@ packages will be built sequentially.
help = 'print spec file name')
parser_gimmespec.set_defaults(command = gimmespec)
+ # giturl
+ parser_giturl = subparsers.add_parser('giturl',
+ help = 'print the url for building')
+ parser_giturl.set_defaults(command = giturl)
+
# Import content into a module
parser_import_srpm = subparsers.add_parser('import',
help = 'Import content into a module')
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py
index 8ab50e4..0e78f53 100644
--- a/src/pyfedpkg/__init__.py
+++ b/src/pyfedpkg/__init__.py
@@ -1112,6 +1112,14 @@ class PackageModule:
return f
raise FedpkgError('No spec file found.')
+ def giturl(self):
+ """Return the git url that would be used for building"""
+
+ # Get the commit hash
+ commit = self.repo.iter_commits().next().sha
+ url = ANONGITURL % {'module': self.module} + '?#%s' % commit
+ return url
+
def koji_upload(self, file, path, callback=None):
"""Upload a file to koji