repoman: add --if-modified option to check less
authorZac Medico <zmedico@gentoo.org>
Thu, 11 Aug 2011 03:00:11 +0000 (20:00 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 11 Aug 2011 03:00:11 +0000 (20:00 -0700)
This is useful if you want to do a repo-level or category-level commit
but you only want to run checks for the packages that have uncommitted
modifications.

bin/repoman
man/repoman.1

index f1fbc2444cd00c633890da89b41264bcc6c35cb6..e806b3125cf69e007fbc9032efa76fb8c96933a7 100755 (executable)
@@ -209,6 +209,10 @@ def ParseArgs(argv, qahelp):
        parser.add_option('-x', '--xmlparse', dest='xml_parse', action='store_true',
                default=False, help='forces the metadata.xml parse check to be carried out')
 
+       parser.add_option(
+               '--if-modified', type='choice', choices=('y', 'n'), default='n',
+               help='only check packages that have uncommitted modifications')
+
        parser.add_option('-i', '--ignore-arches', dest='ignore_arches', action='store_true',
                default=False, help='ignore arch-specific failures (where arch != host)')
 
@@ -1068,6 +1072,17 @@ for x in scanlist:
        if repolevel < 2:
                checkdir_relative = os.path.join(catdir, checkdir_relative)
        checkdir_relative = os.path.join(".", checkdir_relative)
+
+       if vcs and options.if_modified == "y":
+               checkdir_modified = False
+               checkdir_pattern = checkdir_relative.rstrip(os.sep) + os.sep
+               for f in chain(mychanged, mynew):
+                       if f.startswith(checkdir_pattern):
+                               checkdir_modified = True
+                               break
+               if not checkdir_modified:
+                       continue
+
        generated_manifest = False
 
        if options.mode == "manifest" or \
index 9aa71805d99a76b2a0c15672d369e5723e52c6f5..8d06ae42542ac083009d7fc167f7e8e3d5da0401 100644 (file)
@@ -41,6 +41,9 @@ Forces the metadata.xml parse check to be carried out
 \fB-v\fR, \fB--verbose\fR
 Displays every package name while checking
 .TP
+\fB\-\-if\-modified=<y|n>\fR
+Only check packages that have uncommitted modifications
+.TP
 \fB\-i\fR, \fB\-\-ignore\-arches\fR
 Ignore arch-specific failures (where arch != host)
 .TP