[Reportbug-commits] [SCM] Reportbug - reports bugs in the Debian distribution branch, master, updated. 4.9-120-g558dae3

Sandro Tosi morph at debian.org
Sun Aug 1 19:44:15 UTC 2010


The following commit has been merged in the master branch:
commit ff07c11e875c982dc242f3c4a898d1e84947e9ef
Author: Sandro Tosi <morph at debian.org>
Date:   Sat Jul 31 23:01:22 2010 +0200

    support globbing when attachments are allowed (so both command-line args and sub-menus); thanks to Josh Triplett for the report: Closes: #452648

diff --git a/bin/reportbug b/bin/reportbug
index 638ec32..a328251 100755
--- a/bin/reportbug
+++ b/bin/reportbug
@@ -36,6 +36,8 @@ import commands
 import rfc822
 import gettext
 import textwrap
+# for blogging of attachments file
+from glob import glob
 
 from reportbug import utils
 from reportbug import (
@@ -241,16 +243,18 @@ def handle_editing(filename, dmessage, options, sendto, attachments, package,
                     attachfile = ui.get_filename('Choose a file to attach: ')
                 if attachfile:
                     attachfile = os.path.expanduser(attachfile)
-                    if os.access(attachfile, os.R_OK) and os.path.isfile(attachfile):
-                        invalid = False
-                        inline = (x == 'i')
-                        (message, filename, attachments) = include_file_in_report(
-                            message, filename, attachments, package,
-                            attachfile, charset, inline=inline, draftpath=options.draftpath)
-                        if not inline:
-                            skip_editing = True
-                    else:
-                        ui.display_failure("Can't find %s to include!\n", attachfile)
+                    # loop over the globbed 'attachfile', you can specify wildcards now
+                    for attachf in glob(attachfile):
+                        if os.access(attachf, os.R_OK) and os.path.isfile(attachf):
+                            invalid = False
+                            inline = (x == 'i')
+                            (message, filename, attachments) = include_file_in_report(
+                                message, filename, attachments, package,
+                                attachf, charset, inline=inline, draftpath=options.draftpath)
+                            if not inline:
+                                skip_editing = True
+                        else:
+                            ui.display_failure("Can't find %s to include!\n", attachf)
                 else:
                     break
         elif x == 'd':
@@ -962,6 +966,12 @@ def main():
             sys.exit(1)
 
     if options.attachments:
+        # needed to support glob
+        for attachment in options.attachments:
+            # remove each element
+            options.attachments.remove(attachment)
+            # and replace it with its glob
+            options.attachments.extend(glob(attachment))
         any_missing = False
         for attachment in options.attachments:
             if not os.path.exists(os.path.expanduser(attachment)):
@@ -2039,11 +2049,12 @@ For more details, please see: http://www.debian.org/devel/wnpp/''')
                         force_prompt=True)
                     if patchfile:
                         attachfile = os.path.expanduser(patchfile)
-                        if os.path.exists(attachfile):
-                            attachments.append(attachfile)
-                            break
-                        else:
-                            ewrite('%s not found!', attachfile)
+                        # loop over the glob of 'attachfile', we support glob now
+                        for attachf in glob(attachfile):
+                            if os.path.exists(attachfile):
+                                attachments.append(attachfile)
+                            else:
+                                ewrite('%s not found!', attachfile)
                     else:
                         break
         if CCS:
diff --git a/debian/changelog b/debian/changelog
index 5995411..e9f56a9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,8 +6,11 @@ reportbug (4.12.5) UNRELEASED; urgency=low
   * reportbug/submit.py
     - fixed a typo: 'receive'/'received'; thanks to Joey Hess for the report;
       Closes: #588198
+  * bin/reportbug, man/reportbug.1
+    - support globbing when attachments are allowed (so both command-line args
+      and sub-menus); thanks to Josh Triplett for the report: Closes: #452648
 
- -- Sandro Tosi <morph at debian.org>  Sat, 31 Jul 2010 15:07:01 +0200
+ -- Sandro Tosi <morph at debian.org>  Sat, 31 Jul 2010 22:59:26 +0200
 
 reportbug (4.12.4) unstable; urgency=low
 
diff --git a/man/reportbug.1 b/man/reportbug.1
index 3e16f8f..927f3bf 100644
--- a/man/reportbug.1
+++ b/man/reportbug.1
@@ -45,6 +45,11 @@ file included; in some cases (usually text files), it is probably
 better to use \fB\-i/\-\-include\fP option.  (Please note that
 Debian's bug tracking system has limited support for MIME
 attachments.)
+
+This option supports also globbing (i.e. names with wildcards, like
+file.*) but remember to include them between single quotes (the
+previous example becomes: 'file.*') else the shell would expand it
+before calling reportbug leading to an error.
 .TP
 .B \-b, \-\-no\-query\-bts
 Don't check the Debian bug tracking system to see if this problem has

-- 
Reportbug - reports bugs in the Debian distribution



More information about the Reportbug-commits mailing list