Purging of the build dir should be configurable via a config file
authorGuido Günther <agx@sigxcpu.org>
Fri, 22 Mar 2013 17:14:33 +0000 (18:14 +0100)
committerGuido Günther <agx@sigxcpu.org>
Fri, 22 Mar 2013 17:34:01 +0000 (18:34 +0100)
so introdice --git[-no]-purge which is consistent with the other
boolean options and deprecate --git-dont-purge.

Closes: #702200

docs/chapters/building.sgml
docs/manpages/git-buildpackage.sgml
gbp/config.py
gbp/scripts/buildpackage.py

index 5005416..159f476 100644 (file)
@@ -68,7 +68,7 @@ export-dir=../build-area
 #export-dir=/home/debian-packages/build-area
 </programlisting>
     &git-buildpackage; will cleanup the build-area after a successful build. If
-    you want to keep the build tree use <replaceable>--git-dont-purge</replaceable>.
+    you want to keep the build tree use <replaceable>--git-no-purge</replaceable>.
     </para>
     </sect1>
     <sect1 id="gbp.building.hooks">
index 3e640d4..d528f3d 100644 (file)
@@ -53,6 +53,7 @@
       <arg><option>--git-export=</option><replaceable>treeish</replaceable></arg>
       <arg><option>--git-[no-]pristine-tar</option></arg>
       <arg><option>--git-[no-]pristine-tar-commit</option></arg>
+      <arg><option>--git-[no-]-purge</option></arg>
       <arg><option>--git-dont-purge</option></arg>
       <arg><option>--git-tag-only</option></arg>
       <arg><option>--git-retag</option></arg>
         </listitem>
       </varlistentry>
       <varlistentry>
+        <term><option>--git[-no]-purge</option>
+        </term>
+        <listitem>
+         <para>Purge (remove) temporary build directory after build</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
         <term><option>--git-dont-purge</option>
         </term>
         <listitem>
-         <para>retain exported build directory after build</para>
+         <para>Deprecated, use --git-no-purge instead.</para>
         </listitem>
       </varlistentry>
       <varlistentry>
index cec593b..ec75765 100644 (file)
@@ -131,6 +131,7 @@ class GbpOptionParser(OptionParser):
                  'remote-config': '',
                  'allow-unauthenticated': 'False',
                  'symlink-orig': 'True',
+                 'purge': 'True',
              }
     help = {
              'debian-branch':
@@ -262,7 +263,9 @@ class GbpOptionParser(OptionParser):
              'symlink-orig':
                   ("Whether to creat a symlink from the upstream tarball "
                    "to the orig.tar.gz if needed, default is "
-                   "'%(symlink-orig)s'")
+                   "'%(symlink-orig)s'"),
+              'purge':
+                  "Purge exported package build directory. Default is '%(purge)s'",
            }
 
     def_config_files = [ '/etc/git-buildpackage/gbp.conf',
index 09d4082..c021b86 100755 (executable)
@@ -1,6 +1,6 @@
 # vim: set fileencoding=utf-8 :
 #
-# (C) 2006-2011 Guido Guenther <agx@sigxcpu.org>
+# (C) 2006-2013 Guido Günther <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
@@ -425,8 +425,9 @@ def parse_args(argv, prefix):
                       help="before building the package export the source into EXPORT_DIR, default is '%(export-dir)s'")
     export_group.add_config_file_option("export", dest="export",
                       help="export treeish object TREEISH, default is '%(export)s'", metavar="TREEISH")
-    export_group.add_option("--git-dont-purge", action="store_false", dest="purge", default=True,
-                      help="retain exported package build directory")
+    export_group.add_boolean_config_file_option(option_name="purge", dest="purge")
+    export_group.add_option("--git-dont-purge", action="store_true", dest="dont_purge", default=False,
+                            help="deprecated, use --git-no-purge instead")
     export_group.add_boolean_config_file_option(option_name="overlay", dest="overlay")
     options, args = parser.parse_args(args)
 
@@ -440,6 +441,11 @@ def parse_args(argv, prefix):
         gbp.log.err("Overlay must be used with --git-export-dir")
         return None, None, None
 
+    # --git-dont-purge is deprecated:
+    if options.dont_purge:
+        gbp.log.warning("--git-dont-purge is depreceted, use --git-no-purge instead")
+        options.purge = False
+
     return options, args, dpkg_args