[PATCH] Add filter option for download-build

Mark Hamzy hamzy at us.ibm.com
Tue Jun 17 21:20:59 UTC 2014


Add a filter option to the download-build command to skip any file
not matching the supplied glob filter.

Example:
koji download-build --debuginfo --filter '*-debuginfo-*' python-2.7.5-9.fc20

---
 cli/koji | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/cli/koji b/cli/koji
index 19727da..82b1088 100755
--- a/cli/koji
+++ b/cli/koji
@@ -5897,6 +5897,7 @@ def anon_handle_download_build(options, session, args):
                       help=_("URL under which Koji files are accessible"))
     parser.add_option("-q", "--quiet", action="store_true", help=_("Do not display progress meter"),
                       default=options.quiet)
+    parser.add_option("--filter", dest="filter", help=_("Only download files matching, via glob, the supplied filter"))
     (suboptions, args) = parser.parse_args(args)
     if len(args) < 1:
         parser.error(_("Please specify a package N-V-R or build ID"))
@@ -5989,6 +5990,13 @@ def anon_handle_download_build(options, session, args):
         pg = progress.TextMeter()
     
     for url, relpath in urls:
+        if suboptions.filter:
+            match = fnmatch.fnmatch(relpath, suboptions.filter)
+            if not match:
+                if options.debug:
+                    print "Skipping %s, filtered out by %s" % (relpath, suboptions.filter)
+                continue
+
         file = grabber.urlopen(url, progress_obj=pg, text=relpath)
 
         if '/' in relpath:
-- 
1.9.3



More information about the buildsys mailing list