diff options
-rwxr-xr-x | src/fedpkg.py | 13 | ||||
-rw-r--r-- | src/pyfedpkg/__init__.py | 8 |
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 |