Bug#526110: Template scripts should be able to add attachements

2014-01-02 Thread Michael Stapelberg
Hi,

Michael Stapelberg stapelb...@debian.org writes:
 Michael Biebl bi...@debian.org writes:
 On Wed, Apr 29, 2009 at 12:01:39PM +0200, Joachim Breitner wrote:
 I’m considering to add a /usr/share/bug/$package/script file to one of
 my package that would attach (possibly after getting permission from the
 user) a configuration file. Currently, I’m only able to include it in
 the mail body, which I find unpleasant. In my case, it might even be
 problematic, as spaces and tabs are important, and the editor might
 break that.
 
 Therefore, I’d like to be able to tell reportbug to attach a specific
 file. This would avoid such issues and also make the bug reports much
 easier to read.

 I'm in a similar situation. I want to attach larger amounts of data to a
 bug report. Doing that in the mail body makes the bug report almost
 unreadable. So I would very much welcome also if reportbug offered the
 ability to add information to bug reports as attachments via a
 bug-script.
 I wrote a patch which adds support for this (see attachment).

 Sandro, you seem to be the current reportbug maintainer. Is there any
 chance we can get a relatively quick upload of a new version of
 reportbug (6.4.5) with this patch applied? Is there anything I can do to
 help? We’d really like to change our bugscript to use this mechanism
 ASAP — the reports are really inconvenient to handle because of the mail
 body length, but at the same time, the information itself is really
 valuable.
Friendly ping. My last message was nearly a month ago. Any chance that
we can get a new upload with this patch merged? As stated previously,
it’s fairly urgent for us :). Thanks!

-- 
Best regards,
Michael


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#526110: Template scripts should be able to add attachements

2013-12-08 Thread Michael Stapelberg
control: tags -1 + patch

Hi Michael, Joachim, Sandro,

Michael Biebl bi...@debian.org writes:
 On Wed, Apr 29, 2009 at 12:01:39PM +0200, Joachim Breitner wrote:
 I’m considering to add a /usr/share/bug/$package/script file to one of
 my package that would attach (possibly after getting permission from the
 user) a configuration file. Currently, I’m only able to include it in
 the mail body, which I find unpleasant. In my case, it might even be
 problematic, as spaces and tabs are important, and the editor might
 break that.
 
 Therefore, I’d like to be able to tell reportbug to attach a specific
 file. This would avoid such issues and also make the bug reports much
 easier to read.

 I'm in a similar situation. I want to attach larger amounts of data to a
 bug report. Doing that in the mail body makes the bug report almost
 unreadable. So I would very much welcome also if reportbug offered the
 ability to add information to bug reports as attachments via a
 bug-script.
I wrote a patch which adds support for this (see attachment).

Sandro, you seem to be the current reportbug maintainer. Is there any
chance we can get a relatively quick upload of a new version of
reportbug (6.4.5) with this patch applied? Is there anything I can do to
help? We’d really like to change our bugscript to use this mechanism
ASAP — the reports are really inconvenient to handle because of the mail
body length, but at the same time, the information itself is really
valuable.

-- 
Best regards,
Michael
From 7c8e88aff06801b50602c02b45cefbb6cc5fd1b3 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg stapelb...@debian.org
Date: Sun, 8 Dec 2013 17:05:27 +0100
Subject: [PATCH] implement support for attachments in bugscripts

Similar to headers and pseudo-headers, you can use
-- BEGIN ATTACHMENTS -- and -- END ATTACHMENTS --, with file names in
between, to make reportbug attach these files to the report.
---
 bin/reportbug   |  6 +-
 reportbug/utils.py  | 10 +-
 test/data/bugscript |  5 -
 test/test_utils.py  |  3 ++-
 4 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/bin/reportbug b/bin/reportbug
index 774eaad..9da01be 100755
--- a/bin/reportbug
+++ b/bin/reportbug
@@ -2030,7 +2030,7 @@ For more details, please see: http://www.debian.org/devel/wnpp/''')
 
 # we get the return code of the script, headers and pseudo- set
 # by the script, and last the text output of the script
-(rc, bugscript_hdrs, bugscript_pseudo, text) = \
+(rc, bugscript_hdrs, bugscript_pseudo, text, bugscript_attachments) = \
  utils.exec_and_parse_bugscript(handler, bugexec)
 
 if rc and not notatty:
@@ -2046,6 +2046,10 @@ For more details, please see: http://www.debian.org/devel/wnpp/''')
 headers.extend(bugscript_hdrs.split('\n'))
 if bugscript_pseudo:
 pseudos.append(bugscript_pseudo.strip())
+# add attachments only if no MUA is used, using attachments with a
+# MUA is not yet supported by reportbug.
+if bugscript_attachments and not mua:
+attachments += bugscript_attachments
 addinfo = None
 if not self.options.noconf:
 addinfo = u\n-- Package-specific info:\n+text
diff --git a/reportbug/utils.py b/reportbug/utils.py
index 01f7062..c2a1a82 100644
--- a/reportbug/utils.py
+++ b/reportbug/utils.py
@@ -1181,7 +1181,9 @@ def exec_and_parse_bugscript(handler, bugscript):
 
 isheaders = False
 ispseudoheaders = False
+isattachments = False
 headers = pseudoheaders = text = ''
+attachments = []
 fp = open(filename)
 for line in fp.readlines():
 # we identify the blocks for headers and pseudo-h
@@ -1193,15 +1195,21 @@ def exec_and_parse_bugscript(handler, bugscript):
 ispseudoheaders = True
 elif line == '-- END PSEUDOHEADERS --\n':
 ispseudoheaders = False
+elif line == '-- BEGIN ATTACHMENTS --\n':
+isattachments = True
+elif line == '-- END ATTACHMENTS --\n':
+isattachments = False
 else:
 if isheaders:
 headers += line
 elif ispseudoheaders:
 pseudoheaders += line
+elif isattachments:
+attachments.append(line.strip())
 else:
 text += line
 fp.close()
 cleanup_temp_file(filename)
 
 text = text.decode('utf-8', 'replace')
-return (rc, headers, pseudoheaders, text)
+return (rc, headers, pseudoheaders, text, attachments)
diff --git a/test/data/bugscript b/test/data/bugscript
index 425ad97..0b35f95 100755
--- a/test/data/bugscript
+++ b/test/data/bugscript
@@ -16,4 +16,7 @@ echo python
 echo -- BEGIN HEADERS --
 echo X-Test: this is a test
 echo X-Dummy-Reportbug-Header: dummy
-echo -- END HEADERS --
\ No newline at end of file
+echo -- END HEADERS --
+echo -- BEGIN ATTACHMENTS --
+echo 

Bug#526110: Template scripts should be able to add attachements

2013-09-11 Thread Michael Biebl
Hi,

On Wed, Apr 29, 2009 at 12:01:39PM +0200, Joachim Breitner wrote:
 I’m considering to add a /usr/share/bug/$package/script file to one of
 my package that would attach (possibly after getting permission from the
 user) a configuration file. Currently, I’m only able to include it in
 the mail body, which I find unpleasant. In my case, it might even be
 problematic, as spaces and tabs are important, and the editor might
 break that.
 
 Therefore, I’d like to be able to tell reportbug to attach a specific
 file. This would avoid such issues and also make the bug reports much
 easier to read.

I'm in a similar situation. I want to attach larger amounts of data to a
bug report. Doing that in the mail body makes the bug report almost
unreadable. So I would very much welcome also if reportbug offered the
ability to add information to bug reports as attachments via a
bug-script.

Thanks for considering,
Michael


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#526110: Template scripts should be able to add attachements

2009-04-29 Thread Joachim Breitner
Package: reportbug
Version: 4.1
Severity: wishlist

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

I’m considering to add a /usr/share/bug/$package/script file to one of
my package that would attach (possibly after getting permission from the
user) a configuration file. Currently, I’m only able to include it in
the mail body, which I find unpleasant. In my case, it might even be
problematic, as spaces and tabs are important, and the editor might
break that.

Therefore, I’d like to be able to tell reportbug to attach a specific
file. This would avoid such issues and also make the bug reports much
easier to read.

I’m sure other packages would benefit as well, most notably
xserver-xorg.

As for a possible implementaion, I could imagine either specific
keywords in the output of the script (e.g. [ATTACH filename]), or
outputting a list of filenames on another file descriptor, e.g. fd4. 

A simple, but not as powerful, solution would be to mention the files to
attach in the /usr/share/bug/$package/control file. 

Thanks,
Joachim


- -- Package-specific info:
** Environment settings:
EDITOR=vim
DEBEMAIL=nome...@debian.org
EMAIL=m...@joachim-breitner.de
DEBFULLNAME=Joachim Breitner

** /home/jojo/.reportbugrc:
reportbug_version 2.61
mode expert
ui text
realname Joachim Breitner
email nome...@debian.org
sign gpg

- -- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.29-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages reportbug depends on:
ii  apt   0.7.21 Advanced front-end for dpkg
ii  python2.5.4-2An interactive high-level object-o
ii  python-reportbug  4.1Python modules for interacting wit

reportbug recommends no packages.

Versions of packages reportbug suggests:
pn  debconf-utils none (no description available)
pn  debsums   none (no description available)
pn  dlocate   none (no description available)
ii  exim4 4.69-9 metapackage to ease Exim MTA (v4) 
ii  exim4-daemon-light [mail-tran 4.69-9 lightweight Exim MTA (v4) daemon
ii  file  5.00-1 Determines file type using magic
ii  gnupg 1.4.9-4GNU privacy guard - a free PGP rep
ii  python-gnome2-extras  2.25.3-2   Extra Python bindings for the GNOM
ii  python-gtk2   2.14.1-2   Python bindings for the GTK+ widge
pn  python-urwid  none (no description available)
pn  python-vtenone (no description available)

- -- no debconf information

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkn4JYMACgkQ9ijrk0dDIGztBQCfRwepDSGwZr2aFUXMh/CvNEcY
j+YAnihNYbxhPjdS534dAjV3AakwS5md
=iv6V
-END PGP SIGNATURE-



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org