summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Keating <jkeating@redhat.com>2010-07-08 17:34:51 -0700
committerJesse Keating <jkeating@redhat.com>2010-07-08 17:34:51 -0700
commit54f7fb5c3ae3db0e5de68192147c7b809704d154 (patch)
treedd9180ba09536505b5a07808fe5055e07f1e4feb
parent6d97784ab1ccfcb29cd2cc2926a50e2ac5532cbe (diff)
downloadfedora-packager-54f7fb5c3ae3db0e5de68192147c7b809704d154.tar.gz
fedora-packager-54f7fb5c3ae3db0e5de68192147c7b809704d154.tar.xz
fedora-packager-54f7fb5c3ae3db0e5de68192147c7b809704d154.zip
Handle importing an srpm into an empty repo
In the case of a fresh module created upstream, we don't have a spec file to use for information, so we have to make a git repo outside of the module.
-rwxr-xr-xsrc/fedpkg.py2
-rw-r--r--src/pyfedpkg/__init__.py5
2 files changed, 3 insertions, 4 deletions
diff --git a/src/fedpkg.py b/src/fedpkg.py
index 5458efd..a81665c 100755
--- a/src/fedpkg.py
+++ b/src/fedpkg.py
@@ -459,8 +459,8 @@ def import_srpm(args):
sys.exit(0)
if not args.create:
try:
+ uploadfiles = pyfedpkg.import_srpm(args.srpm, path=args.path)
mymodule = pyfedpkg.PackageModule(args.path)
- uploadfiles = pyfedpkg.import_srpm(mymodule.repo, args.srpm)
mymodule.upload(uploadfiles, replace=True)
except pyfedpkg.FedpkgError, e:
log.error('Could import srpm: %s' % e)
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py
index 920c85e..709e922 100644
--- a/src/pyfedpkg/__init__.py
+++ b/src/pyfedpkg/__init__.py
@@ -356,11 +356,9 @@ def get_latest_commit(module):
# Return the hash sum
return output.split()[0]
-def import_srpm(repo, srpm, path=os.getcwd()):
+def import_srpm(srpm, path=os.getcwd()):
"""Import the contents of an srpm into a repo.
- repo: a git repo object to use for the import
-
srpm: File to import contents from
path: optional path to work in, defaults to cwd.
@@ -378,6 +376,7 @@ def import_srpm(repo, srpm, path=os.getcwd()):
if not os.path.exists(srpm):
raise FedpkgError('File not found.')
# bail if we're dirty
+ repo = git.Repo(path)
if repo.is_dirty():
raise FedpkgError('There are uncommitted changes in your repo')
# Get the details of the srpm