diff options
author | Ricardo Salveti de Araujo <ricardo.salveti@canonical.com> | 2011-04-13 03:33:14 -0300 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2011-07-23 15:51:21 +0200 |
commit | 0ecd9f70aef51e26c13a0fcc241a3dcb934aeaaf (patch) | |
tree | cae3c6bb8668ee71ad18041ed20bf498c068d1f5 | |
parent | 8ce3500b66827904504c4b62331520c898103828 (diff) |
git-buildpackage: Add upstream-tree option
to specify where the upstream tarball should be created from. The
default is to create the upstream tarball from the exact tag and fail
otherwise. To create the upstream tarball from the tip of the upstream
branch use 'branch'.
Based on a patch by Ricardo Salveti de Araujo
-rw-r--r-- | docs/manpages/git-buildpackage.sgml | 14 | ||||
-rw-r--r-- | gbp/config.py | 3 | ||||
-rwxr-xr-x | git-buildpackage | 13 |
3 files changed, 23 insertions, 7 deletions
diff --git a/docs/manpages/git-buildpackage.sgml b/docs/manpages/git-buildpackage.sgml index 78c7aca7..f79ad6a2 100644 --- a/docs/manpages/git-buildpackage.sgml +++ b/docs/manpages/git-buildpackage.sgml @@ -41,6 +41,7 @@ <arg><option>--git-debian-tag=</option><replaceable>tag-format</replaceable></arg> <arg><option>--git-force-create</option></arg> <arg><option>--git-no-create-orig</option></arg> + <arg><option>--git-upstream-tree=</option><replaceable>[tag|branch]</replaceable></arg> <arg><option>--git-tarball-dir=</option><replaceable>directory</replaceable></arg> <arg><option>--git-compression=</option><replaceable>type</replaceable></arg> <arg><option>--git-compression-level=</option><replaceable>level</replaceable></arg> @@ -307,6 +308,19 @@ </listitem> </varlistentry> <varlistentry> + <term><option>--git-upstream-tree=</option><replaceable>[tag|branch]</replaceable> + </term> + <listitem> + <para>How to find the upstream sources used to generate the tarball. + <replaceable>tag</replaceable> looks at a tag corresponding to the + version in the changelog. <replaceable>branch</replaceable> looks at + the upstream branch given via the <option>--git-upstream-branch</option> + option. This doesn't have any effect if <option>--git-pristine-tar</option> + is being used. + </para> + </listitem> + </varlistentry> + <varlistentry> <term><option>--git-tarball-dir=</option><replaceable>directory</replaceable> </term> <listitem> diff --git a/gbp/config.py b/gbp/config.py index d4ed4b49..be20784f 100644 --- a/gbp/config.py +++ b/gbp/config.py @@ -59,6 +59,7 @@ class GbpOptionParser(OptionParser): 'cleaner' : 'debuild -d clean', 'debian-branch' : 'master', 'upstream-branch' : 'upstream', + 'upstream-tree' : 'tag', 'pristine-tar' : 'False', 'filter-pristine-tar' : 'False', 'sign-tags' : 'False', @@ -114,6 +115,8 @@ class GbpOptionParser(OptionParser): "branch the Debian package is being developed on, default is '%(debian-branch)s'", 'upstream-branch': "upstream branch, default is '%(upstream-branch)s'", + 'upstream-tree': + "where to generate the upstream tarball from (tag or branch), default is '%(upstream-tree)s'", 'debian-tag': "format string for debian tags, default is '%(debian-tag)s'", 'upstream-tag': diff --git a/git-buildpackage b/git-buildpackage index 31fc6ce5..676129da 100755 --- a/git-buildpackage +++ b/git-buildpackage @@ -1,7 +1,7 @@ #!/usr/bin/python -u # vim: set fileencoding=utf-8 : # -# (C) 2006-2010 Guido Guenther <agx@sigxcpu.org> +# (C) 2006-2011 Guido Guenther <agx@sigxcpu.org> # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -209,14 +209,12 @@ def pristine_tar_build_orig(repo, cp, output_dir, options): def git_archive_build_orig(repo, cp, output_dir, options): """build orig using git-archive""" - # --upstream-branch was given on the command line, so use this: - if options.upstream_branch != GbpOptionParser.defaults['upstream-branch']: + if options.upstream_tree == 'tag': + upstream_tree = build_tag(options.upstream_tag, cp['Upstream-Version']) + elif options.upstream_tree == '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'] + raise GbpError, "Unknown value %s" % options.upstream_tree gbp.log.info("%s does not exist, creating from '%s'" % (du.orig_file(cp, options.comp_type), upstream_tree)) @@ -361,6 +359,7 @@ def parse_args(argv, prefix): tag_group.add_config_file_option(option_name="keyid", dest="keyid") tag_group.add_config_file_option(option_name="debian-tag", dest="debian_tag") tag_group.add_config_file_option(option_name="upstream-tag", dest="upstream_tag") + orig_group.add_config_file_option(option_name="upstream-tree", dest="upstream_tree") orig_group.add_boolean_config_file_option(option_name="pristine-tar", dest="pristine_tar") orig_group.add_config_file_option(option_name="force-create", dest="force_create", help="force creation of orig.tar.gz", action="store_true") |