tag 519297 +patch
thanks

On 01/-10/-28163 08:59 PM,  wrote:
> severity 519297 wishlist
> retitle 519297 should allow for forced tarball creation via --git-create-orig
> thanks
> 
> On Wed, Mar 11, 2009 at 01:53:22PM -0400, Eric Cooper wrote:
>> git-buildpackage seems to use an existing .orig.tar.gz file rather
>> than checking one out with pristine-tar.  In my case, I'm the upstream
>> maintainer as well, so I happened to have an older tarball around.  I
>> had used "pristine-tar commit" with the correct, newer tarball, but gbp
>> didn't use that one, and I accidentally uploaded a package with the wrong 
>> .orig.tar.gz as a result.
> This isn't related to pristine-tar. Gbp won't bother to create new
> tar.gz if one with the correct version exists. So I guess you're looking
> for a --git-create-orig option (whish doesn't exist yet)? 

The attached patch adds a --git-force-create option which, if present,
will unconditionally create/overwrite an .orig.tar.gz. In my tests, it
worked fine with either --git-pristine-tar or --git-upstream-branch.

I felt --git-create-orig didn't really fit because the functionality is
 not quite the inverse of --git-no-create-orig.

I was affected by this after removing files from the dfsg branch because
I thought --git-upstream-branch would pick my change up.


Regards,
Christian
From 2c4cff5bd796d3a53b7de4857830535da22c1fab Mon Sep 17 00:00:00 2001
From: Christian Kastner <[email protected]>
Date: Thu, 10 Jun 2010 18:30:50 +0200
Subject: [PATCH] Add option --git-force-create to force tarball creation

Closes: #519297
---
 docs/manpages/git-buildpackage.sgml |    8 ++++++++
 gbp/config.py                       |    1 +
 git-buildpackage                    |    6 ++++--
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/docs/manpages/git-buildpackage.sgml b/docs/manpages/git-buildpackage.sgml
index 5d3d723..a17c217 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-postbuild=</option><replaceable>command</replaceable></arg>
       <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-tarball-dir=</option><replaceable>directory</replaceable></arg>
       <arg><option>--git-compression=</option><replaceable>type</replaceable></arg>
@@ -190,6 +191,13 @@
         </listitem>
       </varlistentry>
       <varlistentry>
+        <term><option>--git-force-create</option>
+        </term>
+        <listitem>
+	  <para>Force creation of an orig.tar.gz (overwriting a pre-existing one if present)</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
         <term><option>--git-no-create-orig</option>
         </term>
         <listitem>
diff --git a/gbp/config.py b/gbp/config.py
index 8c4bf36..29d3bdc 100644
--- a/gbp/config.py
+++ b/gbp/config.py
@@ -32,6 +32,7 @@ class GbpOptionParser(OptionParser):
                  'pristine-tar'    : 'False',
                  'filter-pristine-tar' : 'False',
                  'sign-tags'       : 'False',
+                 'force-create'    : 'False',
                  'no-create-orig'  : 'False',
                  'keyid'           : '',
                  'posttag'         : '',
diff --git a/git-buildpackage b/git-buildpackage
index 7f2b2d4..d0ae238 100755
--- a/git-buildpackage
+++ b/git-buildpackage
@@ -218,6 +218,8 @@ def main(argv):
     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_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")
     orig_group.add_config_file_option(option_name="no-create-orig", dest="no_create_orig",
                       help="don't create orig.tar.gz", action="store_true")
     orig_group.add_config_file_option(option_name="tarball-dir", dest="tarball_dir",
@@ -311,8 +313,8 @@ def main(argv):
                         print "Orig tarball '%s' not found at '%s'" % (orig_file, tarball_dir)
                     else:
                         print "Orig tarball '%s' found at '%s'" % (orig_file, tarball_dir)
-                # build an orig unless the user forbidds it
-                if not options.no_create_orig and not du.has_orig(cp, options.comp_type, output_dir):
+                # build an orig unless the user forbids it, always build (and overwrite pre-existing) if user forces it
+                if options.force_create or (not options.no_create_orig and not du.has_orig(cp, options.comp_type, output_dir)):
                     if not pristine_tar_build_orig(repo, cp, output_dir, options):
                         git_archive_build_orig(repo, cp, output_dir, options)
 
-- 
1.6.5

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to