diff options
author | Guido Guenther <agx@sigxcpu.org> | 2006-12-13 22:53:43 +0100 |
---|---|---|
committer | Guido Guenther <agx@bogon.sigxcpu.org> | 2006-12-13 22:53:43 +0100 |
commit | 1a01b38ee1bd96b4c2452494ff68e1b8bb2609f1 (patch) | |
tree | 4e3116aa18f91b70715427b7dc75a462061f80ff | |
parent | 7ed62009c463a3401bfa3733b1ebcea6ce889e84 (diff) | |
download | git-buildpackage-1a01b38ee1bd96b4c2452494ff68e1b8bb2609f1.tar.gz git-buildpackage-1a01b38ee1bd96b4c2452494ff68e1b8bb2609f1.tar.bz2 git-buildpackage-1a01b38ee1bd96b4c2452494ff68e1b8bb2609f1.zip |
minor fixes all over the place
-rw-r--r-- | debian/changelog | 9 | ||||
-rwxr-xr-x | git-buildpackage | 32 | ||||
-rwxr-xr-x | git-import-dsc | 45 | ||||
-rwxr-xr-x | git-import-orig | 26 |
4 files changed, 62 insertions, 50 deletions
diff --git a/debian/changelog b/debian/changelog index abc0dd44..1ead3d9b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +git-buildpackage (0.2.19) experimental; urgency=low + + * UNRELEASED + * depend on a git-core that has git-archive + * s/keyid/GPG keyid/ + * minor fixes all over the place + + -- Guido Guenther <agx@sigxcpu.org> Wed, 13 Dec 2006 22:39:42 +0100 + git-buildpackage (0.2.18) experimental; urgency=low * git-buildpackage: detect the branch we're on and bail out if it's not the diff --git a/git-buildpackage b/git-buildpackage index 012defcb..a3188325 100755 --- a/git-buildpackage +++ b/git-buildpackage @@ -16,30 +16,32 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# run commands to build a debian package out of a git repository +"""run commands to build a debian package out of a git repository""" -import sys,os,commands,re,pipes -import optparse +import sys,os,os.path,pipes from git_buildpackage import GitTag, Command, CommandExecFailed from git_buildpackage.git_utils import * from git_buildpackage.deb_utils import * from git_buildpackage.config import GBPOptionParser -output_dir='../' +output_dir = '../' def create_orig(cp, dir, branch): "create an orig.tar.gz" - output='%s%s' % (dir, orig_file(cp)) - pipe=pipes.Template() + output = os.path.join(dir, orig_file(cp)) + pipe = pipes.Template() pipe.prepend('git-archive --format=tar --prefix=%s-%s/ %s' % (cp['Source'], cp['Upstream-Version'], branch), '.-') pipe.append('gzip -c -9', '--') try: - pipe.copy('',output) + ret = pipe.copy('', output) + if ret: + print >>sys.stderr, "Error creating %s: %d" % (output, ret) + return False except OSError, err: - print("Error creating %s: %s" % (output, err[0])) + print >>sys.stderr, "Error creating %s: %s" % (output, err[0]) return False except: - print("Error creating %s" % (output,)) + print >>sys.stderr, "Error creating %s" % (output,) return False return True @@ -51,7 +53,7 @@ def main(argv): if "--help" in dpkg_args: args.append('--help') - parser=GBPOptionParser(command=os.path.basename(argv[0]), prefix='git-') + parser = GBPOptionParser(command=os.path.basename(argv[0]), prefix='git-') parser.add_option("--git-ignore-new", action="store_true", dest="ignore_new", default=False, help="build with uncommited changes in the source tree") @@ -80,7 +82,7 @@ def main(argv): try: if not options.ignore_new: - Command(options.build_cmd,['clean'])() + Command(options.build_cmd, ['clean'])() (ret, out) = is_repository_clean('.') if not ret: print >>sys.stderr, "You have uncommitted changes in your source tree:" @@ -89,9 +91,9 @@ def main(argv): return 1 branch=get_repository_branch('.') if branch != options.debian_branch and not options.ignore_new: - print >>sys.stderr, "You are not on branch '%s' but on '%s'" % (options.debian_branch, branch) - print >>sys.stderr, "Use --git-ignore-new to ignore or --git-debian-branch to set the branch name." - return 1 + print >>sys.stderr, "You are not on branch '%s' but on '%s'" % (options.debian_branch, branch) + print >>sys.stderr, "Use --git-ignore-new to ignore or --git-debian-branch to set the branch name." + return 1 cp = parse_changelog('debian/changelog') if not is_native(cp) and not has_orig(cp, output_dir): @@ -99,7 +101,7 @@ def main(argv): if not create_orig(cp, output_dir, options.upstream_branch): return 1 - Command(options.build_cmd,[ '-i.git', '-I.git' ]+dpkg_args)() + Command(options.build_cmd, [ '-i.git', '-I.git' ] + dpkg_args)() if options.tag: try: version=cp['Version'] diff --git a/git-import-dsc b/git-import-dsc index 8c11a64b..ba185d90 100755 --- a/git-import-dsc +++ b/git-import-dsc @@ -1,7 +1,6 @@ #!/usr/bin/python # -*- coding: utf-8 -*- # -# make a git archive out of a Debian source package # # (C) 2006 Guido Guenther <agx@sigxcpu.org> # This program is free software; you can redistribute it and/or modify @@ -17,6 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +"""make a git archive out of a Debian source package""" import sys import re @@ -29,20 +29,20 @@ from git_buildpackage.git_utils import * from git_buildpackage.deb_utils import * from git_buildpackage.config import GBPOptionParser -gitAdd=GitAdd() -gitCommitAll=GitCommitAll() +gitAdd = GitAdd() +gitCommitAll = GitCommitAll() class DscPackage(object): """Parse the dsc file for verions, package names, etc""" - pkgre=re.compile('Source:\s+(?P<pkg>.+)\s*') - versionre=re.compile("Version:\s(\d+\:)?(?P<version>[%s]+)\s*$" % (debian_version_chars,)) - tarre=re.compile('^\s\w+\s\d+\s+(?P<tar>[^_]+_[^_]+(\.orig)?\.tar\.(gz|bz2))') + pkgre = re.compile('Source:\s+(?P<pkg>.+)\s*') + versionre = re.compile("Version:\s(\d+\:)?(?P<version>[%s]+)\s*$" % (debian_version_chars,)) + tarre = re.compile('^\s\w+\s\d+\s+(?P<tar>[^_]+_[^_]+(\.orig)?\.tar\.(gz|bz2))') def __init__(self, dscfile): - self.dscfile=os.path.abspath(dscfile) - f=file(self.dscfile) + self.dscfile = os.path.abspath(dscfile) + f = file(self.dscfile) for line in f: - m=self.versionre.match(line) + m = self.versionre.match(line) if m: if '-' in m.group('version'): self.debian_version = m.group('version').split("-")[-1] @@ -53,26 +53,24 @@ class DscPackage(object): else: print "Debian Native Package" self.native = True # Debian native package - self.upstream_version=m.group('version') + self.upstream_version = m.group('version') print "Version:", self.upstream_version continue - m=self.pkgre.match(line) + m = self.pkgre.match(line) if m: self.pkg = m.group('pkg') continue - m=self.tarre.match(line) + m = self.tarre.match(line) if m: - fromdir=os.path.dirname(dscfile) - if len(fromdir): - fromdir+='/' - self.tgz = fromdir+m.group('tar') + fromdir = os.path.dirname(dscfile) + self.tgz = os.path.join(fromdir, m.group('tar')) continue f.close() def import_upstream(src, dirs, upstream_branch, tagger): try: - unpackTGZ=UnpackTGZ(src.tgz, dirs['tmp']) + unpackTGZ = UnpackTGZ(src.tgz, dirs['tmp']) unpackTGZ() except CommandExecFailed: print >>sys.stderr,"Unpacking of %s failed" % (src.tgz,) @@ -80,7 +78,7 @@ def import_upstream(src, dirs, upstream_branch, tagger): return 1 try: - dirs['git']=glob.glob('%s/*' % (unpackTGZ.dir, ))[0] + dirs['git'] = glob.glob('%s/*' % (unpackTGZ.dir, ))[0] os.chdir(dirs['git']) GitInitDB()() gitAdd(['.']) @@ -131,22 +129,23 @@ def main(argv): if options.verbose: Command.verbose = True - gitTag=GitTag(options.sign_tags, options.keyid) + gitTag = GitTag(options.sign_tags, options.keyid) if len(args) != 1: parser.print_help() return 1 else: - src=DscPackage(args[0]) + src = DscPackage(args[0]) - dirs['tmp']=os.path.abspath(tempfile.mkdtemp(dir='.')) + dirs['tmp'] = os.path.abspath(tempfile.mkdtemp(dir='.')) if import_upstream(src, dirs, options.upstream_branch, gitTag): return 1 os.chdir(dirs['top']) if not src.native: - dirs['unpack']=dirs['tmp']+'/unpack' + dirs['unpack'] = os.path.join(dirs['tmp'], 'unpack') os.mkdir(dirs['unpack']) - dirs['dpkg-src']="%s/%s-%s-%s" % (dirs['unpack'], src.pkg, src.upstream_version, src.debian_version) + dirs['dpkg-src'] = os.path.join(dirs['unpack'], + "%s-%s-%s" % (src.pkg, src.upstream_version, src.debian_version)) if apply_debian_patch(src, dirs, gitTag): return 1 os.chdir(dirs['top']) diff --git a/git-import-orig b/git-import-orig index d06e59f7..2edbd59b 100755 --- a/git-import-orig +++ b/git-import-orig @@ -16,7 +16,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# Import a new upstream version +"""Import a new upstream version""" import sys import os @@ -33,8 +33,9 @@ def cleanupTmpTree(tree): def unpackOrig(tgz): + """unpack a .orig.tar.gz""" try: - unpackTGZ=UnpackTGZ(tgz, tempfile.mkdtemp(dir='../')) + unpackTGZ = UnpackTGZ(tgz, tempfile.mkdtemp(dir='../')) unpackTGZ() except CommandExecFailed: print "Unpacking of %s failed" % (tgz,) @@ -44,13 +45,14 @@ def unpackOrig(tgz): def get_version(tgz): - origre=re.compile('^[a-z\d-]+_(?P<version>[a-z\d\.\~\-]+)\.orig\.tar\.gz') - m=origre.match(os.path.basename(tgz)) + """get the version from the filename of a .orig.tar.gz""" + origre = re.compile('^[a-z\d-]+_(?P<version>[a-z\d\.\~\-]+)\.orig\.tar\.gz') + m = origre.match(os.path.basename(tgz)) if m: return m.group('version') def main(argv): - parser=GBPOptionParser(command=os.path.basename(argv[0]), prefix='', + parser = GBPOptionParser(command=os.path.basename(argv[0]), prefix='', usage='%prog [-u version] /path/to/upstream-version.tar.gz') parser.add_option("-u", "--upstreamversion", dest="version", @@ -69,10 +71,10 @@ def main(argv): help="GPG keyid to sign tags with") (options, args) = parser.parse_args(argv[1:]) - gitCheckoutUpstream=GitCheckoutBranch(options.upstream) - gitCheckoutMaster=GitCheckoutBranch(options.debian) - gitShowBranch=GitShowBranch() - gitPullUpstream=GitPull('.', options.upstream) + gitCheckoutUpstream = GitCheckoutBranch(options.upstream) + gitCheckoutMaster = GitCheckoutBranch(options.debian) + gitShowBranch = GitShowBranch() + gitPullUpstream = GitPull('.', options.upstream) if options.verbose: Command.verbose = True @@ -81,7 +83,7 @@ def main(argv): parser.print_help() return 1 else: - tgz=args[0] + tgz = args[0] if not is_repository('.'): print >>sys.stderr,"%s is not a git repository" % (os.path.abspath('.'),) @@ -90,7 +92,7 @@ def main(argv): if options.version: version = options.version else: - version=get_version(tgz) + version = get_version(tgz) if version: print "Upstream version is %s" % (version,) else: @@ -104,7 +106,7 @@ def main(argv): print >>sys.stderr, out return 1 - tmpdir=unpackOrig(tgz) + tmpdir = unpackOrig(tgz) if not tmpdir: return 1 else: |