diff options
author | Guido Guenther <agx@sigxcpu.org> | 2007-12-08 01:16:38 +0100 |
---|---|---|
committer | Guido Guenther <agx@sigxcpu.org> | 2007-12-08 01:16:38 +0100 |
commit | fc68807f68b1a151e11f4aa3aaba4e93c52a3e6b (patch) | |
tree | 3f17768147d50e2f345c015583f2bc37852f9ae1 | |
parent | 39bf93797c7ed6341d114af1421eee200bea42c8 (diff) | |
parent | 87a4c86a617c55f26f5d32c37e8fdc3ace1c7f84 (diff) |
Merge 0.4.9 into bpo-etch
Conflicts:
debian/changelog
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | debian/changelog | 32 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | debian/copyright | 2 | ||||
-rw-r--r-- | docs/manpages/git-buildpackage.sgml | 8 | ||||
-rw-r--r-- | gbp.conf | 1 | ||||
-rw-r--r-- | gbp/command_wrappers.py | 37 | ||||
-rw-r--r-- | gbp/config.py | 1 | ||||
-rw-r--r-- | gbp/deb_utils.py | 18 | ||||
-rw-r--r-- | gbp/git_utils.py | 4 | ||||
-rwxr-xr-x | git-buildpackage | 56 | ||||
-rwxr-xr-x | git-import-orig | 6 |
13 files changed, 122 insertions, 47 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1e82855 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +gbp/gbp_version.py @@ -1,5 +1,6 @@ - git-buildpackage: - allow to fetch and build from a signed tag even when it's in a remote repo + - add --git-overlay as discussed in #448357 - git-import-orig: - show untracked files using 'git-ls-files -o' after import - git-import-dsc: diff --git a/debian/changelog b/debian/changelog index 38ed404..0698817 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,35 @@ +git-buildpackage (0.4.9) unstable; urgency=low + + * fix "gpb gets confused by color enabled on branches..." - thanks to + Niv Sardi for the patch (Closes: #452921) + + -- Guido Guenther <agx@sigxcpu.org> Mon, 26 Nov 2007 17:22:48 +0100 + +git-buildpackage (0.4.8) unstable; urgency=low + + * git-buildpacakge: make sure we don't switch directories during build + (Closes: #451550) + * debian/control: use the now official Vcs-Git + + -- Guido Guenther <agx@sigxcpu.org> Mon, 19 Nov 2007 18:50:08 +0100 + +git-buildpackage (0.4.7) unstable; urgency=low + + * add tarball-dir option losely based on patch from Sjoerd Simons + (Closes: #448357) + * don't print a commit summary when importing into empty repos + (addresses parts of #449075) + + -- Guido Guenther <agx@sigxcpu.org> Mon, 05 Nov 2007 20:09:15 +0100 + +git-buildpackage (0.4.6) unstable; urgency=low + + * fix url (Closes: #448350) + * call gzip with "-n" (Closes: #449094) - thanks to Romain Francoise + * add .gitignore + + -- Guido Guenther <agx@sigxcpu.org> Sun, 04 Nov 2007 16:20:36 +0100 + git-buildpackage (0.4.5~bpo.1) etch-backports; urgency=low * etch backport diff --git a/debian/control b/debian/control index 2bbff71..26c4535 100644 --- a/debian/control +++ b/debian/control @@ -5,7 +5,7 @@ Maintainer: Guido Guenther <agx@sigxcpu.org> Build-Depends: cdbs, debhelper (>= 5), python-dev, python-support (>= 0.3), pychecker, gtk-doc-tools, sgml2x, docbook-utils, jade Standards-Version: 3.7.2 -XS-Vcs-Git: http://honk.sigxcpu.org/git/git-buildpackage.git/ +Vcs-Git: http://honk.sigxcpu.org/git/git-buildpackage.git/ Package: git-buildpackage Architecture: all diff --git a/debian/copyright b/debian/copyright index 8ebeb17..bbe9943 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,7 +1,7 @@ This package was debianized by Guido Guenther <agx@sigxcpu.org> on Tue, 12 Sep 2006 14:55:57 +0200. -It was downloaded from http://honk.sigxcpu.org/git/git-buildpackage/ +It was downloaded from http://honk.sigxcpu.org/git/git-buildpackage.git/ Upstream Author: Guido Günther <agx@sigxcpu.org> diff --git a/docs/manpages/git-buildpackage.sgml b/docs/manpages/git-buildpackage.sgml index 473ca1e..2f1d998 100644 --- a/docs/manpages/git-buildpackage.sgml +++ b/docs/manpages/git-buildpackage.sgml @@ -31,6 +31,7 @@ <arg><option>--git-posttag=</option><replaceable>command</replaceable></arg> <arg><option>--git-debian-tag=</option><replaceable>tag-format</replaceable></arg> <arg><option>--git-no-create-orig</option></arg> + <arg><option>--git-tarball-dir=</option><replaceable>directory</replaceable></arg> <arg><option>--git-export-dir=</option><replaceable>directory</replaceable></arg> <arg><option>--git-export=</option><replaceable>treeish</replaceable></arg> </cmdsynopsis> @@ -177,6 +178,13 @@ </listitem> </varlistentry> <varlistentry> + <term><option>--git-tarball-dir=</option><replaceable>directory</replaceable> + </term> + <listitem> + <para>Search for original tarballs in <replaceable>directory</replaceable> instead of generating them</para> + </listitem> + </varlistentry> + <varlistentry> <term><option>--git-export=</option><replaceable>treeish</replaceable> </term> <listitem> <para>Instead of exporting the current branch head export at @@ -24,6 +24,7 @@ #posttag = git-push git.example.com # use this for more svn-buildpackage like bahaviour: #export-dir = ../build-area/ +#tarball-dir = ../tarballs/ # Options only affecting git-import-orig [git-import-orig] diff --git a/gbp/command_wrappers.py b/gbp/command_wrappers.py index f275474..f025dfe 100644 --- a/gbp/command_wrappers.py +++ b/gbp/command_wrappers.py @@ -46,7 +46,7 @@ class Command(object): print >>sys.stderr, "Execution failed:", e retcode = 1 if retcode: - print >>sys.stderr,self.run_error + print >>sys.stderr, self.run_error return retcode def __call__(self, args=[]): @@ -54,6 +54,19 @@ class Command(object): raise CommandExecFailed +class RunAtCommand(Command): + """Run a command in a specific directory""" + def __call__(self, dir='.', *args): + curdir = os.path.abspath(os.path.curdir) + try: + os.chdir(dir) + Command.__call__(self, list(*args)) + os.chdir(curdir) + except Exception: + os.chdir(curdir) + raise + + class UnpackTarArchive(Command): """Wrap tar to Unpack a gzipped tar archive""" def __init__(self, archive, dir, filter=""): @@ -101,21 +114,6 @@ class DpkgSourceExtract(Command): Command.__call__(self, [dsc, output_dir]) -class GitLoadDirs(Command): - """Wrap git_load_dirs""" - def __init__(self, verbose=False): - Command.__init__(self, 'git_load_dirs') - if verbose: - self.args = [ '-v' ] - - def __call__(self, dir, summary, log=''): - self.dir = dir - self.run_error = "Couldn't import %s" % self.dir - args = ['-s', summary] - args += [ [], ['-L', log] ] [len(log) > 0] - Command.__call__(self, self.args + args + [dir]) - - class GitCommand(Command): "Mother/Father of all git commands" def __init__(self, cmd, args=[]): @@ -196,12 +194,13 @@ class GitRm(GitCommand): class GitCommitAll(GitCommand): """Wrap git-commit to commit all changes""" - def __init__(self): - GitCommand.__init__(self, 'commit', ['-a']) + def __init__(self, verbose=False): + args = ['-a'] + [ ['-q'], [] ][verbose] + GitCommand.__init__(self, cmd='commit', args=args) def __call__(self, msg=''): args = [ [], ['-m', msg] ][len(msg) > 0] - self.run_error = "Couldn't commit -a %s" % " ".join(args) + self.run_error = "Couldn't %s %s" % (self.cmd, " ".join(self.args + args)) GitCommand.__call__(self, args) diff --git a/gbp/config.py b/gbp/config.py index 21d5f21..e1e11a2 100644 --- a/gbp/config.py +++ b/gbp/config.py @@ -37,6 +37,7 @@ class GbpOptionParser(OptionParser): 'snapshot-number' : 'snapshot + 1', 'git-log' : '--no-merges', 'export-dir' : '', + 'tarball-dir' : '', } config_files = [ '/etc/git-buildpackage/gbp.conf', os.path.expanduser('~/.gbp.conf'), diff --git a/gbp/deb_utils.py b/gbp/deb_utils.py index 1ae8d10..e62de26 100644 --- a/gbp/deb_utils.py +++ b/gbp/deb_utils.py @@ -6,6 +6,7 @@ import email import commands import os +import shutil # When trying to parse a version-number from a dsc or changes file, these are # the valid characters. @@ -46,4 +47,19 @@ def has_orig(cp, dir): return False return True -# vim:et:ts=4:sw=4: +def copy_orig(cp, orig_dir, output_dir): + """copy orig.tar.gz from orig_dir to output_dir""" + orig_dir = os.path.abspath(orig_dir) + output_dir = os.path.abspath(output_dir) + + if orig_dir == output_dir: + return True + + try: + shutil.copyfile(os.path.join(orig_dir, orig_file(cp)), + os.path.join(output_dir, orig_file(cp))) + except IOError: + return False + return True + +# vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: diff --git a/gbp/git_utils.py b/gbp/git_utils.py index 9cfb0ec..2ad4235 100644 --- a/gbp/git_utils.py +++ b/gbp/git_utils.py @@ -41,7 +41,7 @@ class GitRepository(object): def has_branch(self, branch): """check if the repository has branch 'branch'""" self.__check_path() - for line in self.__git_getoutput('branch')[0]: + for line in self.__git_getoutput('branch', [ '--no-color' ])[0]: if line.split(' ', 1)[1].strip() == branch: return True return False @@ -57,7 +57,7 @@ class GitRepository(object): def get_branch(self): """on what branch is the current working copy""" self.__check_path() - for line in self.__git_getoutput('branch')[0]: + for line in self.__git_getoutput('branch', [ '--no-color' ])[0]: if line.startswith('*'): return line.split(' ', 1)[1].strip() diff --git a/git-buildpackage b/git-buildpackage index 147e98e..5d037cd 100755 --- a/git-buildpackage +++ b/git-buildpackage @@ -24,8 +24,8 @@ import errno import pipes import time from gbp.git_utils import (GitRepositoryError, GitRepository, build_tag) -from gbp.deb_utils import (parse_changelog, is_native, orig_file, has_orig) -from gbp.command_wrappers import (GitTag, Command, CommandExecFailed, RemoveTree) +from gbp.deb_utils import (parse_changelog, is_native, orig_file, has_orig, copy_orig) +from gbp.command_wrappers import (GitTag, Command, RunAtCommand, CommandExecFailed, RemoveTree) from gbp.config import GbpOptionParser from gbp.errors import GbpError @@ -51,9 +51,10 @@ def create_orig(cp, output_dir, treeish): "create an orig.tar.gz in output_dir" output = os.path.join(output_dir, orig_file(cp)) prefix = "%s-%s" % (cp['Source'], cp['Upstream-Version']) + gzip_opts = "-9 -n" pipe = pipes.Template() - pipe.append('gzip -c -9', '--') + pipe.append('gzip -c %s' % gzip_opts, '--') return git_archive_pipe(prefix, pipe, output, treeish) @@ -132,6 +133,8 @@ def main(argv): help="format string for upstream tags, default is '%(upstream-tag)s'") parser.add_config_file_option(option_name="export-dir", dest="export_dir", help="before building export into EXPORT_DIR") + parser.add_config_file_option(option_name="tarball-dir", dest="tarball_dir", + help="location to look for external tarballs") parser.add_option("--git-export", dest="treeish", default=default_tree, help="export treeish object TREEISH, default is '%s'" % default_tree) (options, args) = parser.parse_args(args) @@ -166,6 +169,11 @@ def main(argv): raise GbpError,"'%s' does not exist, not a debian package" % changelog output_dir = prepare_output_dir(options.export_dir) + if options.tarball_dir: + tarball_dir = options.tarball_dir + else: + tarball_dir = output_dir + if not repo.has_treeish(options.treeish): raise GbpError # git-ls-tree printed an error message already # Export to another build dir if requested: @@ -183,26 +191,35 @@ def main(argv): move_old_export(export_dir) os.rename(tmp_dir, export_dir) - # Build the orig.tar.gz if necessary: - if not is_native(cp) and not has_orig(cp, output_dir) and not options.no_create_orig: - # --upstream-branch was given on the command line, so use this: - if options.upstream_branch != GbpOptionParser.defaults['upstream-branch']: - upstream_tree = options.upstream_branch - else: - upstream_tree = build_tag(options.upstream_tag, cp['Upstream-Version']) - # fall back to the upstream-branch tip if the tag doesn't exist + # Get the orig.tar.gz if necessary: + if not is_native(cp): + if has_orig(cp, output_dir): + pass + elif options.tarball_dir: # separate tarball dir specified + print "Getting orig tarbball from %s" % tarball_dir + if not copy_orig(cp, tarball_dir, output_dir): + raise GbpError, "Cannot copy orig tarball from %s" % tarball_dir + elif not options.no_create_orig: + # --upstream-branch was given on the command line, so use this: + if options.upstream_branch != GbpOptionParser.defaults['upstream-branch']: + upstream_tree = options.upstream_branch + else: + upstream_tree = build_tag(options.upstream_tag, cp['Upstream-Version']) + # fall back to the upstream-branch tip if the tag doesn't exist + if not repo.has_treeish(upstream_tree): + upstream_tree = GbpOptionParser.defaults['upstream-branch'] + print "%s does not exist, creating from '%s'" % (orig_file(cp), upstream_tree) if not repo.has_treeish(upstream_tree): - upstream_tree = GbpOptionParser.defaults['upstream-branch'] - print "%s does not exist, creating from '%s'" % (orig_file(cp), upstream_tree) - if not repo.has_treeish(upstream_tree): - raise GbpError # git-ls-tree printed an error message already - if not create_orig(cp, output_dir, upstream_tree): - raise GbpError, "Cannot create upstream tarball at '%s'" % output_dir + raise GbpError # git-ls-tree printed an error message already + if not create_orig(cp, output_dir, upstream_tree): + raise GbpError, "Cannot create upstream tarball at '%s'" % output_dir if options.export_dir: - os.chdir(export_dir) + build_dir = export_dir + else: + build_dir = repo_dir - Command(options.builder, dpkg_args, shell=True)() + RunAtCommand(options.builder, dpkg_args, shell=True)(dir=build_dir) if options.tag: try: version = cp['Version'] @@ -225,7 +242,6 @@ def main(argv): if options.export_dir and not retval: RemoveTree(export_dir)() - os.chdir(repo_dir) return retval if __name__ == '__main__': diff --git a/git-import-orig b/git-import-orig index 145bc34..284bf0d 100755 --- a/git-import-orig +++ b/git-import-orig @@ -50,7 +50,7 @@ def unpack_orig(archive, tmpdir): return unpackArchive.dir -def import_source_tree(repo, orig_dir, version, filter): +def import_source_tree(repo, orig_dir, version, filter, verbose): """import source tree to the current branch""" try: old = set(repo.index_files()) @@ -60,7 +60,7 @@ def import_source_tree(repo, orig_dir, version, filter): if files: gbpc.GitRm()(files) if not repo.is_clean()[0]: - gbpc.GitCommitAll()(msg="Imported upstream version %s" % version) + gbpc.GitCommitAll(verbose=verbose)(msg="Imported upstream version %s" % version) else: raise GbpError, "Nothing to commit, nothing imported." except gbpc.CommandExecFailed: @@ -178,7 +178,7 @@ create it otherwise use --upstream-branch to specify it. else: print "Initial import of '%s'..." % archive - import_source_tree(repo, orig_dir, version, options.filter) + import_source_tree(repo, orig_dir, version, options.filter, verbose=not is_empty) gbpc.GitTag(options.sign_tags, options.keyid)(build_tag(options.upstream_tag, version), msg="Upstream version %s" % version) |