summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-01-13 20:52:55 +0100
committerGuido Günther <agx@sigxcpu.org>2011-01-13 20:54:07 +0100
commitebc67f3a739c996ba7b869445c8ae4ab91b1ce09 (patch)
treeeeabb46144371e4cdad3ce8b4b4e024f2d3e597f
parent244c1d2a2213dd17966187e539d5214b5df500b0 (diff)
downloadgit-buildpackage-ebc67f3a739c996ba7b869445c8ae4ab91b1ce09.tar.gz
git-buildpackage-ebc67f3a739c996ba7b869445c8ae4ab91b1ce09.tar.bz2
git-buildpackage-ebc67f3a739c996ba7b869445c8ae4ab91b1ce09.zip
gbp-create-remote-repo: get repository name from debian/changelog
if possible.
-rwxr-xr-xgbp-create-remote-repo16
1 files changed, 13 insertions, 3 deletions
diff --git a/gbp-create-remote-repo b/gbp-create-remote-repo
index 5316a6a7..10ff9d65 100755
--- a/gbp-create-remote-repo
+++ b/gbp-create-remote-repo
@@ -26,6 +26,7 @@ import os, os.path
import urlparse
import subprocess
import tty, termios
+import gbp.deb as du
from gbp.command_wrappers import (CommandExecFailed, PristineTar, GitCommand,
GitFetch)
from gbp.config import (GbpOptionParser, GbpOptionGroup)
@@ -93,6 +94,7 @@ def push_branches(remote, branches):
def main(argv):
retval = 0
+ changelog = 'debian/changelog'
parser = GbpOptionParser(command=os.path.basename(argv[0]), prefix='',
usage='%prog [options] - create a remote repository')
@@ -126,10 +128,18 @@ def main(argv):
if repo.has_branch(PristineTar.branch) and options.pristine_tar:
branches += [ PristineTar.branch ]
- pkg = os.path.basename (os.path.abspath(os.path.curdir))
- pkg = os.path.splitext(pkg)[0]
- remote = parse_remote(options.remote_url, pkg)
+ try:
+ cp = du.parse_changelog(filename=changelog)
+ pkg = cp['Source']
+ except gbp.deb.NoChangelogError:
+ pkg = None
+
+ if not pkg:
+ gbp.log.warn("Couldn't parse changelog, will use directory name.")
+ pkg = os.path.basename(os.path.abspath(os.path.curdir))
+ pkg = os.path.splitext(pkg)[0]
+ remote = parse_remote(options.remote_url, pkg)
gbp.log.info("Shall I create a repository for '%(pkg)s' at '%(url)s' now? (y/n)?" % remote)
if not read_yn():
raise GbpError, "Aborted."