buildpackage-rpm: add option --git-ignore-untracked
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Wed, 30 May 2012 06:23:46 +0000 (09:23 +0300)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 7 Jan 2014 14:21:28 +0000 (16:21 +0200)
Adds a new commandline option to ignore untracked files, when running
git-buildpackage-rpm. When this option is given, the
git-buildpackage-rpm command fails if there are changes to tracked
files, but, succeeds if there are untracked files present. Normally it
fails in either case.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp-rpm.conf
gbp/config.py
gbp/scripts/buildpackage_rpm.py

index 99eac63215c60e32600e2ed46c0df8951311239c..15529f14b71b4ed5bff87e8568390a69bf83b8c4 100644 (file)
@@ -47,7 +47,9 @@
 #export-dir = ../build-area/
 # Special directory to look for pre-built orig source archives
 #tarball-dir = ../tarballs/
-# Build even if uncommited local changes are present
+# Build despite of unclean repository, i.e. untracked files are present
+#ignore-untracked = True
+# Ignore all local changes (i.e. build despite of modified files)
 #ignore-new = True
 # Commit-ish to build
 #export = HEAD
index ead640e72698e4f762585a00bf7018496a3d41cc..3df0fdd80d0f57c800636bfc2403a5557797b0ca 100644 (file)
@@ -541,6 +541,7 @@ class GbpOptionParserRpm(GbpOptionParser):
                        'pq-branch'              : 'development/%(branch)s',
                        'spec-file'              : 'auto',
                        'export-dir'             : 'rpmbuild',
+                       'ignore-untracked'       : 'False',
                        'rpmbuild-builddir'      : 'BUILD',
                        'rpmbuild-rpmdir'        : 'RPMS',
                        'rpmbuild-sourcedir'     : 'SOURCES',
@@ -563,6 +564,8 @@ class GbpOptionParserRpm(GbpOptionParser):
                         "format string for the patch-queue branch name, default is '%(pq-branch)s'",
                    'spec-file':
                         "Spec file to use, 'auto' makes gbp to guess, other values make the packaging-dir option to be ignored, default is '%(spec-file)s'",
+                   'ignore-untracked':
+                        "build with untracked files in the source tree, default is '%(ignore-untracked)s'",
                    'patch-export':
                         "Create patches between upstream and export-treeish, default is '%(patch-export)s'",
                    'pristine-tarball-name':
index 4ce85956acb6387df47ae539e7e37b0b5f109d9d..8f97bd8bd6ae681cc51e87274e8bb4f899a99a31 100755 (executable)
@@ -245,6 +245,7 @@ def parse_args(argv, prefix):
     parser.add_option_group(cmd_group)
     parser.add_option_group(export_group)
 
+    parser.add_boolean_config_file_option(option_name = "ignore-untracked", dest="ignore_untracked")
     parser.add_boolean_config_file_option(option_name = "ignore-new", dest="ignore_new")
     parser.add_option("--git-verbose", action="store_true", dest="verbose", default=False,
                       help="verbose command execution")
@@ -352,11 +353,11 @@ def main(argv):
         if not options.export_only:
             Command(options.cleaner, shell=True)()
         if not options.ignore_new:
-            (ret, out) = repo.is_clean()
+            (ret, out) = repo.is_clean(options.ignore_untracked)
             if not ret:
                 gbp.log.err("You have uncommitted changes in your source tree:")
                 gbp.log.err(out)
-                raise GbpError, "Use --git-ignore-new to ignore."
+                raise GbpError, "Use --git-ignore-new or --git-ignore-untracked to ignore."
 
         if not options.ignore_new and not options.ignore_branch:
             if branch != options.packaging_branch: