Browse Source

This commit was generated by cvs2svn to compensate for changes in r3,

which included commits to RCS files with non-trunk default branches.
suites/jessie-proposed-backports
Chris Lawrence 18 years ago
commit
49443b5041
  1. 80
      README.developers
  2. 50
      TODO
  3. 0
      build-stamp
  4. 84
      checkbuildd.py
  5. 197
      checkversions.py
  6. 2455
      debian/changelog
  7. 26
      debian/control
  8. 6
      debian/control.greportbug
  9. 26
      debian/copyright
  10. 4
      debian/dirs
  11. 2
      debian/docs
  12. 1
      debian/files
  13. 2
      debian/greportbug.menu
  14. 8
      debian/install-sed
  15. 2
      debian/menu
  16. 28
      debian/postinst
  17. 14
      debian/prerm
  18. 3
      debian/reportbug.postinst.debhelper
  19. 3
      debian/reportbug.postrm.debhelper
  20. 1
      debian/reportbug/DEBIAN/conffiles
  21. 24
      debian/reportbug/DEBIAN/control
  22. 25
      debian/reportbug/DEBIAN/md5sums
  23. 31
      debian/reportbug/DEBIAN/postinst
  24. 5
      debian/reportbug/DEBIAN/postrm
  25. 14
      debian/reportbug/DEBIAN/prerm
  26. 107
      debian/reportbug/etc/reportbug.conf
  27. 220
      debian/reportbug/usr/bin/querybts
  28. 1775
      debian/reportbug/usr/bin/reportbug
  29. 2
      debian/reportbug/usr/lib/menu/reportbug
  30. 14
      debian/reportbug/usr/share/bug/reportbug/presubj
  31. 24
      debian/reportbug/usr/share/bug/reportbug/script
  32. 80
      debian/reportbug/usr/share/doc/reportbug/README.developers
  33. 50
      debian/reportbug/usr/share/doc/reportbug/TODO
  34. BIN
      debian/reportbug/usr/share/doc/reportbug/changelog.gz
  35. 26
      debian/reportbug/usr/share/doc/reportbug/copyright
  36. BIN
      debian/reportbug/usr/share/man/man1/querybts.1.gz
  37. BIN
      debian/reportbug/usr/share/man/man1/reportbug.1.gz
  38. 84
      debian/reportbug/usr/share/reportbug/checkbuildd.py
  39. 197
      debian/reportbug/usr/share/reportbug/checkversions.py
  40. 675
      debian/reportbug/usr/share/reportbug/debianbts.py
  41. 62
      debian/reportbug/usr/share/reportbug/handle_bugscript
  42. 54
      debian/reportbug/usr/share/reportbug/hiermatch.py
  43. 62
      debian/reportbug/usr/share/reportbug/rbtempfile.py
  44. 27
      debian/reportbug/usr/share/reportbug/reportbug.el
  45. 843
      debian/reportbug/usr/share/reportbug/reportbug.py
  46. 50
      debian/reportbug/usr/share/reportbug/reportbug_exceptions.py
  47. 239
      debian/reportbug/usr/share/reportbug/reportbug_ui_gnome.py
  48. 283
      debian/reportbug/usr/share/reportbug/reportbug_ui_newt.py
  49. 822
      debian/reportbug/usr/share/reportbug/reportbug_ui_text.py
  50. 157
      debian/reportbug/usr/share/reportbug/urlutils.py
  51. 89
      debian/rules
  52. 675
      debianbts.py
  53. 62
      handle_bugscript
  54. 54
      hiermatch.py
  55. 0
      install-stamp
  56. 14
      presubj
  57. 220
      querybts
  58. 97
      querybts.1
  59. 62
      rbtempfile.py
  60. 1775
      reportbug
  61. 445
      reportbug.1
  62. 107
      reportbug.conf
  63. 27
      reportbug.el
  64. 843
      reportbug.py
  65. 50
      reportbug_exceptions.py
  66. 239
      reportbug_ui_gnome.py
  67. 283
      reportbug_ui_newt.py
  68. 822
      reportbug_ui_text.py
  69. 24
      script
  70. 1
      sed-script
  71. 48
      test_hiermatch.py
  72. 1110
      urllib2.py
  73. 157
      urlutils.py

80
README.developers

@ -0,0 +1,80 @@
This file is lifted, almost verbatim, from "bug".
BUG'S Features for Developers
=============================
Bug allows maintainers to control the bug reporting process by placing
files in special places.
Template Information & Interaction with the user
================================================
If /usr/share/bug/$package is executable, then bug executes it and
takes what comes out from the file descriptor 3 and puts it in the bug
template.
The maintainer can then ask questions to the user or run whatever
information gathering script he likes, and echo all the content to fd 3.
e.g.:
read -p 'color? '
echo "Color: $REPLY" >&3
...
system-information-tool >&3
If /usr/share/bug/$package is a directory, then
/usr/share/bug/$package/script is executed.
While the script is executed, the following shell functions are
available:
getkey - asks for a key
yesno <prompt> "yep"|"nop" - ask for a yes/no answer (with i18n)
leaves response as yep or nop
in REPLY. The second argument is
the default.
If the file /usr/share/bug/$package/presubj exists, its content is
shown to the user before asking him for the bug's subject.
Note: It's your responsibility to check if the information included
in the template can put the user in any security risk.
Package redirection
===================
The package maintainer can control to which packages are the bug reports
submitted to (i.e. the Package: field of the report). This will be mainly
used to redirect bugs in packages coming from a single source to where the
maintainer likes to have them.
This is done by having this line in /usr/share/bug/$package/control
Submit-As: $new-package
Note that bug will not check if the $new-package exists as a valid package.
BTS selection
=============
Packages not distributed by Debian can take advantage of this utility too.
They just need to add a "send-to" header to the control file
/usr/share/bug/$package/control.
Send-To: bugs.myproject.com
`bug' will add `submit@' `quiet@' or `maintonly@' to form the address the
bug report mail is send to.
(Note: you probably should use dpkg's support for Origin and Bugs tags
in lieu of this support.)
Nicolás Lichtmaier.-
nick@debian.org
Addendum: Languages other than SH
=================================
The script in /usr/share/bug/reportbug/script is an example of a bug
handling script written in Python. You can also write bug handlers in
many other languages that allow direct access to file descriptors,
including Perl and C/C++.

50
TODO

@ -0,0 +1,50 @@
reportbug now has public CVS read access at:
http://phys251.phy.olemiss.edu/cgi-bin/viewcvs.cgi/reportbug
--
Silly TODO list (in no particular order):
1. Interface abstraction and multiple interfaces. The menus in
reportbug can be handled by a set of UI functions in a Python
module. reportbug_ui_text is there; reportbug_ui_newt is coming,
but its menu implementation leaves something to be desired... a new
menu may have to be designed from scratch, or we may have to
reimplement the nice newt dialogs in slang (boo, hiss). Robin
Putters has done quite a lot of work on a GNOME interface.
I'm not sure UI abstration is actually the way to go any more.
More thinking required here.
2. debconf: probably not; we have per-user configuration, which is
better 99.9% of the time.
3. BTS management interface for developers. You should be able to
view the list of bug reports for a package, construct a list of
actions, and produce one giant email to control@bugs.debian.org to
do that. Forwarding and merging, which both can be major PITAs,
will be helpful. (See #157283)
4. i18n/l10n. Python includes gettext support; however, the
Python-2.x interface is much better so reportbug will be using that
when 2.1 makes it in. (i18n/l10n with reportbug may not make much
sense, since the reports have to be in English for most maintainers
to understand them... unless we figure out some way to get bug
reports translated for maintainers.)
5. Iterators (2.3): Use enumerate instead of range where possible.
6. Convert BTS code to use the mbox-format reports if available, as
they should be easier to parse.
7. Convert the modules to a proper package and stick it in the Python
search path (per #157079). Reform the names. Rename
"reportbug.py" to something sensible.
8. Allow followups from the command line using a specific bug number,
rather than requiring people to go through the browser. Coupled
with --query-only, this should allow me to drop querybts completely.
9. Allow a --body option with a filename; this would prefill the
"body" section of the report. Might be useful for frontends.

0
build-stamp

84
checkbuildd.py

@ -0,0 +1,84 @@
#
# checkbuildd.py - Check buildd.debian.org for successful past builds
#
# Written by Chris Lawrence <lawrencc@debian.org>
# (C) 2002 Chris Lawrence
#
# This program is freely distributable per the following license:
#
## Permission to use, copy, modify, and distribute this software and its
## documentation for any purpose and without fee is hereby granted,
## provided that the above copyright notice appears in all copies and that
## both that copyright notice and this permission notice appear in
## supporting documentation.
##
## I DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL I
## BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
## DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
## WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
#
# Version ##VERSION##; see changelog for revision history
import sgmllib, os, commands
from urlutils import open_url
from reportbug_exceptions import *
BUILDD_URL = 'http://buildd.debian.org/build.php?arch=%s&pkg=%s'
# This is easy; just look for succeeded in an em block...
class BuilddParser(sgmllib.SGMLParser):
def __init__(self):
sgmllib.SGMLParser.__init__(self)
self.versions = {}
self.savedata = None
self.found_succeeded = False
# --- Formatter interface, taking care of 'savedata' mode;
# shouldn't need to be overridden
def handle_data(self, data):
if self.savedata is not None:
self.savedata = self.savedata + data
# --- Hooks to save data; shouldn't need to be overridden
def save_bgn(self):
self.savedata = ''
def save_end(self, mode=0):
data = self.savedata
self.savedata = None
if not mode and data is not None: data = ' '.join(data.split())
return data
def start_em(self, attrs):
self.save_bgn()
def end_em(self):
data = self.save_end()
if data and 'successful' in data:
self.found_succeeded=True
def archname():
return commands.getoutput('dpkg --print-architecture')
def check_built(src_package, arch=None, http_proxy=None):
if not arch:
arch = archname()
try:
page = open_url(BUILDD_URL % (arch, src_package), http_proxy)
except NoNetwork:
return {}
if not page:
return {}
parser = BuilddParser()
parser.feed(page.read())
parser.close()
page.close()
return parser.found_succeeded

197
checkversions.py

@ -0,0 +1,197 @@
#
# checkversions.py - Find if the installed version of a package is the latest
#
# Written by Chris Lawrence <lawrencc@debian.org>
# (C) 2002-03 Chris Lawrence
#
# This program is freely distributable per the following license:
#
## Permission to use, copy, modify, and distribute this software and its
## documentation for any purpose and without fee is hereby granted,
## provided that the above copyright notice appears in all copies and that
## both that copyright notice and this permission notice appear in
## supporting documentation.
##
## I DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL I
## BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
## DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
## WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
#
# Version ##VERSION##; see changelog for revision history
import sgmllib, os, re, sys, urllib2
from urlutils import open_url
from reportbug_exceptions import *
PACKAGES_URL = 'http://packages.debian.org/%s'
INCOMING_URL = 'http://incoming.debian.org/'
# The format is a table. We take the rows that have two complete columns
# only...
class PackagesParser(sgmllib.SGMLParser):
def __init__(self):
sgmllib.SGMLParser.__init__(self)
self.versions = {}
self.savedata = None
self.row = None
# --- Formatter interface, taking care of 'savedata' mode;
# shouldn't need to be overridden
def handle_data(self, data):
if self.savedata is not None:
self.savedata = self.savedata + data
# --- Hooks to save data; shouldn't need to be overridden
def save_bgn(self):
self.savedata = ''
def save_end(self, mode=0):
data = self.savedata
self.savedata = None
if not mode and data is not None: data = ' '.join(data.split())
return data
def start_tr(self, attrs):
if self.row is not None:
self.end_tr()
self.row = []
def end_tr(self):
if self.savedata:
self.end_td()
if self.row:
dist = self.row[0].strip()
if dist:
version = self.row[1].strip().split()[1]
self.versions[dist] = version
self.row = None
def start_td(self, attrs):
if self.savedata:
self.end_td()
if self.row is not None:
self.save_bgn()
def end_td(self):
if self.row is not None:
self.row.append(self.save_end())
class IncomingParser(sgmllib.SGMLParser):
def __init__(self, package):
sgmllib.SGMLParser.__init__(self)
self.found = []
self.savedata = None
self.package = re.compile(re.escape(package)+r'_([^_]+)_[^.]+.deb')
def start_a(self, attrs):
for attrib, value in attrs:
if attrib.lower() != 'href':
continue
mob = self.package.match(value)
if mob:
self.found.append(mob.group(1))
def compare_versions(current, upstream):
"""Return 1 if upstream is newer than current, -1 if current is
newer than upstream, and 0 if the same."""
if not upstream: return 0
rc = os.system('dpkg --compare-versions %s lt %s' % (current, upstream))
rc2 = os.system('dpkg --compare-versions %s gt %s' % (current, upstream))
if not rc:
return 1
elif not rc2:
return -1
return 0
def later_version(a, b):
if compare_versions(a, b) > 0:
return b
return a
def get_versions_available(package, dists=None, http_proxy=None):
if not dists:
dists = ('stable', 'testing', 'unstable')
try:
page = open_url(PACKAGES_URL % package, http_proxy)
except NoNetwork:
return {}
except urllib2.HTTPError, x:
print >> sys.stderr, "Warning:", x
return {}
if not page:
return {}
parser = PackagesParser()
parser.feed(page.read())
parser.close()
page.close()
versions = {}
for dist in dists:
if dist in parser.versions:
versions[dist] = parser.versions[dist]
return versions
def get_incoming_version(package, http_proxy=None):
try:
page = open_url(INCOMING_URL, http_proxy)
except NoNetwork:
return None
except urllib2.HTTPError, x:
print >> sys.stderr, "Warning:", x
return None
if not page:
return None
parser = IncomingParser(package)
parser.feed(page.read())
parser.close()
page.close()
if parser.found:
return reduce(later_version, parser.found, '0')
return None
def check_available(package, version, dists=None, check_incoming=1,
http_proxy=None):
avail = {}
if check_incoming:
iv = get_incoming_version(package, http_proxy)
if iv:
avail['incoming'] = iv
avail.update(get_versions_available(package, dists, http_proxy))
new = {}
newer = 0
for dist in avail:
if dist == 'incoming':
if ':' in version:
ver = version.split(':', 1)[1]
else:
ver = version
comparison = compare_versions(ver, avail[dist])
else:
comparison = compare_versions(version, avail[dist])
if comparison > 0:
new[dist] = avail[dist]
elif comparison < 0:
newer += 1
if newer and newer == len(avail):
return new, True
return new, False
if __name__=='__main__':
print check_available('mozilla-browser', '2:1.5-3')
print check_available('reportbug', '2.39')

2455
debian/changelog

File diff suppressed because it is too large

26
debian/control

@ -0,0 +1,26 @@
Source: reportbug
Section: utils
Priority: standard
Maintainer: Chris Lawrence <lawrencc@debian.org>
Standards-Version: 3.6.1
Build-Depends-Indep: debhelper (>> 4), python2.3 (>= 2.3-4)
Package: reportbug
Architecture: all
Depends: python2.3, python2.3-iconvcodec
Suggests: postfix | exim4 | mail-transport-agent, gnupg | pgp, debconf-utils (>> 1.1.0), debsums, file (>> 1.30)
Description: Reports bugs in the Debian distribution
reportbug is a tool designed to make the reporting of bugs in Debian
and derived distributions relatively painless. Its features include:
.
* Integration with the mutt, af, and mh/nmh mail readers.
* Access to outstanding bug reports to make it easier to identify
whether problems have already been reported.
* Automatic checking for newer versions of packages.
* Optional automatic verification of integrity of packages via debsums.
* Support for following-up on outstanding reports.
* Optional PGP/GnuPG integration.
.
reportbug is designed to be used on systems with an installed mail
transport agent, like exim or sendmail; however, you can edit the
configuration file and send reports using any available mail server.

6
debian/control.greportbug

@ -0,0 +1,6 @@
Package: greportbug
Architecture: all
Depends: python-gtk (>= 0.6.1-1), reportbug (= ${Source-Version})
Description: Gtk+ interface to report bugs in Debian
greportbug provides a Gtk+ interface for users under X to report bugs
in the Debian distribution.

26
debian/copyright

@ -0,0 +1,26 @@
This package was written by Chris Lawrence <lawrencc@debian.org> on
Fri, 14 May 1999 01:07:35 -0500.
Copyright:
# reportbug -- Report bugs in the Debian GNU/Linux distribution
# Written by Chris Lawrence <lawrencc@debian.org>
# (C) 1999-2004 Chris Lawrence
#
# This program is freely distributable per the following license:
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appears in all copies and that
# both that copyright notice and this permission notice appear in
# supporting documentation.
#
# I DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL I
# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
The "handle_bugscript" script is subject to the GNU General Public
License. See /usr/share/common-licenses/GPL.

4
debian/dirs

@ -0,0 +1,4 @@
etc
usr/bin
usr/share/reportbug
usr/share/bug/reportbug

2
debian/docs

@ -0,0 +1,2 @@
README.developers
TODO

1
debian/files

@ -0,0 +1 @@
reportbug_2.42_all.deb utils standard

2
debian/greportbug.menu

@ -0,0 +1,2 @@
?package(greportbug):needs=x11 section=Apps/System\
title="greportbug" command="/usr/bin/greportbug"

8
debian/install-sed

@ -0,0 +1,8 @@
#!/bin/bash
dir=$1
shift
for filename in $@; do
sed -f sed-script < $filename > `pwd`/debian/reportbug/$dir/$filename
done

2
debian/menu

@ -0,0 +1,2 @@
?package(reportbug):needs=text section=Apps/System\
title="reportbug" command="/usr/bin/reportbug" hints="Bug reporting"

28
debian/postinst

@ -0,0 +1,28 @@
#! /bin/sh -e
#
# postinst script for Debian python packages.
# Written 1998 by Gregor Hoffleit <flight@debian.org>.
#
#DEBHELPER#
PACKAGE=reportbug
DIRLIST="/usr/share/reportbug"
PYTHON=python2.3
case "$1" in
configure|abort-upgrade|abort-remove|abort-deconfigure)
for i in $DIRLIST ; do
/usr/bin/$PYTHON -O /usr/lib/$PYTHON/compileall.py -q $i
/usr/bin/$PYTHON /usr/lib/$PYTHON/compileall.py -q $i
done
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0

14
debian/prerm

@ -0,0 +1,14 @@
#! /bin/sh -e
#
# sample prerm script for Debian python packages.
# Written 1998 by Gregor Hoffleit <flight@debian.org>.
#
#DEBHELPER#
PACKAGE=reportbug
dpkg --listfiles $PACKAGE |
awk '$0~/\.py$/ {print $0"c\n" $0"o"}' |
xargs rm -f >&2

3
debian/reportbug.postinst.debhelper

@ -0,0 +1,3 @@
# Automatically added by dh_installmenu
if [ "$1" = "configure" ] && [ -x /usr/bin/update-menus ]; then update-menus ; fi
# End automatically added section

3
debian/reportbug.postrm.debhelper

@ -0,0 +1,3 @@
# Automatically added by dh_installmenu
if [ -x "`which update-menus 2>/dev/null`" ]; then update-menus ; fi
# End automatically added section

1
debian/reportbug/DEBIAN/conffiles

@ -0,0 +1 @@
/etc/reportbug.conf

24
debian/reportbug/DEBIAN/control

@ -0,0 +1,24 @@
Package: reportbug
Version: 2.42
Section: utils
Priority: standard
Architecture: all
Depends: python2.3, python2.3-iconvcodec
Suggests: postfix | exim4 | mail-transport-agent, gnupg | pgp, debconf-utils (>> 1.1.0), debsums, file (>> 1.30)
Installed-Size: 328
Maintainer: Chris Lawrence <lawrencc@debian.org>
Description: Reports bugs in the Debian distribution
reportbug is a tool designed to make the reporting of bugs in Debian
and derived distributions relatively painless. Its features include:
.
* Integration with the mutt, af, and mh/nmh mail readers.
* Access to outstanding bug reports to make it easier to identify
whether problems have already been reported.
* Automatic checking for newer versions of packages.
* Optional automatic verification of integrity of packages via debsums.
* Support for following-up on outstanding reports.
* Optional PGP/GnuPG integration.
.
reportbug is designed to be used on systems with an installed mail
transport agent, like exim or sendmail; however, you can edit the
configuration file and send reports using any available mail server.

25
debian/reportbug/DEBIAN/md5sums

@ -0,0 +1,25 @@
4b18ad5e6d04834fe96235d8353c93af etc/reportbug.conf
e397f8796c1c043db86eb6091d90144e usr/bin/reportbug
ac6585a521c8404016501db363794c33 usr/bin/querybts
832f62caaf594f0ccf5fe6d874128aa8 usr/share/reportbug/checkbuildd.py
04440b3eeb3efa7e70c51f63306b446d usr/share/reportbug/checkversions.py
1a89f4215c407e05526c4b5ac1e1c3c7 usr/share/reportbug/debianbts.py
bbef7bfb5597e14e88d966e282dffbc6 usr/share/reportbug/hiermatch.py
2a5bf492e53f113f58b03d883312b5d6 usr/share/reportbug/rbtempfile.py
2d52709b92d90ab621a1081a8c6a46c0 usr/share/reportbug/reportbug.py
99ad8971d312f623359ed0b4a764ac06 usr/share/reportbug/reportbug_exceptions.py
9ce755c81259798744682364548b36d7 usr/share/reportbug/reportbug_ui_gnome.py
be50dd63309475fc719f37cd4d21bc67 usr/share/reportbug/reportbug_ui_newt.py
a5abd761da47b644656c3bfa65ee69e2 usr/share/reportbug/reportbug_ui_text.py
d03fa7668e646abbd70e3792971da488 usr/share/reportbug/urlutils.py
2db35c6f1b888547ddb7421dbe2dfe51 usr/share/reportbug/handle_bugscript
7699868e5386246a68d3fe8b8d0cf28c usr/share/reportbug/reportbug.el
337c726c138ff0019594efd2ac460e63 usr/share/bug/reportbug/presubj
f291daf8c79cd056eba8f3c6b0a22520 usr/share/bug/reportbug/script
e322bae7cca9885ea1a61b5e0494a942 usr/share/doc/reportbug/README.developers
bfc7b66019398069e2f951093af7cb14 usr/share/doc/reportbug/TODO
7d9c0bf479312a0c9d8d872e8d1210ec usr/share/doc/reportbug/copyright
61688990682d370bffa1138dfe5bc908 usr/share/doc/reportbug/changelog.gz
646ca076fa0a57416ae6c887b7619d0c usr/share/man/man1/querybts.1.gz
410c8695fa7cab8ec535a3a2e4c2161b usr/share/man/man1/reportbug.1.gz
64feb30cac11c622a6f59cdfd3633ecb usr/lib/menu/reportbug

31
debian/reportbug/DEBIAN/postinst

@ -0,0 +1,31 @@
#! /bin/sh -e
#
# postinst script for Debian python packages.
# Written 1998 by Gregor Hoffleit <flight@debian.org>.
#
# Automatically added by dh_installmenu
if [ "$1" = "configure" ] && [ -x /usr/bin/update-menus ]; then update-menus ; fi
# End automatically added section
PACKAGE=reportbug
DIRLIST="/usr/share/reportbug"
PYTHON=python2.3
case "$1" in
configure|abort-upgrade|abort-remove|abort-deconfigure)
for i in $DIRLIST ; do
/usr/bin/$PYTHON -O /usr/lib/$PYTHON/compileall.py -q $i
/usr/bin/$PYTHON /usr/lib/$PYTHON/compileall.py -q $i
done
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0

5
debian/reportbug/DEBIAN/postrm

@ -0,0 +1,5 @@
#!/bin/sh
set -e
# Automatically added by dh_installmenu
if [ -x "`which update-menus 2>/dev/null`" ]; then update-menus ; fi
# End automatically added section

14
debian/reportbug/DEBIAN/prerm

@ -0,0 +1,14 @@
#! /bin/sh -e
#
# sample prerm script for Debian python packages.
# Written 1998 by Gregor Hoffleit <flight@debian.org>.
#
PACKAGE=reportbug
dpkg --listfiles $PACKAGE |
awk '$0~/\.py$/ {print $0"c\n" $0"o"}' |
xargs rm -f >&2

107
debian/reportbug/etc/reportbug.conf

@ -0,0 +1,107 @@
# Example configuration file for reportbug(1)
# Options can be specified in any order
# usually, no-OPTION will disable OPTION if OPTION is boolean
# Default severity level; will bypass prompt in reportbug, so disabled
# severity normal
# BTS to use
bts debian
# See 'reportbug --bts help' for a current list of supported BTSes
# Submission address: default is 'submit'
submit
# Can also be 'quiet' or 'maintonly'; see --report-quiet and --maintonly
# entries on man page
# Mailer to use (default is empty, to use internal mailer). One of:
# mutt
# af
# mh
# nmh
# You can also use 'mua'; it takes an argument like that to --mua
# mua 'mutt -H'
# Additional headers to add:
# header "X-Debbugs-CC: debian-qa@lists.debian.org"
# header "X-Silly-Header: I haven't edited my /etc/reportbug.conf"
# The following boolean options can be disabled by adding 'no-'
# Should I query the BTS?
query-bts
# Should I CC the reporter?
cc
# Should I ever include modified config files?
config-files
# Should I strip down modified config files?
compress
# 'Priority' order of BTS mirrors: list a series of national domains
# in order of preference; the first one a particular BTS supports will
# be the one that's used. Note that Debian is the only BTS with
# mirrors at the moment. (Uncomment the following lines then reorder
# the mirror list. MAKE SURE no-ldap IS SPECIFIED OR ELSE YOU WILL
# ALWAYS CONNECT TO THE U.S.!)
#
# This doesn't work for BTSes with a CGI root. Just as well, since
# the mirrors don't keep up.
# no-ldap
# mirror us
# mirror uk
# mirror de
# mirror nl
# Specify one of the following to digitally sign bug reports automatically.
# sign gpg
# sign pgp
# Default "from" email address and real name (override with env. vars.)
# email "humberto@debian.org"
# realname "Humberto Flores III"
# Default REPLYTO (override with env. variables)
# replyto "Humberto Flores <humflores@aol.com>"
# Default HTTP Proxy (override with the env. variable)
# http_proxy http://130.74.162.251:3128/
# Use this to enable the internal MTA (bypassing /usr/sbin/sendmail)
# smtphost localhost
# Use this to specify the path of your MTA; any SMTP server on Debian
# should be OK with the default.
# mta /usr/sbin/sendmail
# User interface: text or newt
# querybts and reportbug will use this setting
# ui text
# Editor
# editor "emacs -nw"
# Always use template mode (bypass all prompts, output to stdout)
# template
# Don't query source packages
# no-query-source
# Disable debconf-show output
# no-debconf
# Automatically verify package installation before reporting using
# debsums, if available
verify
# Disable all external queries
# offline
# Default operating mode (novice, standard, advanced, expert)
# mode novice
# Don't check whether user IDs are outside admin range - root is still checked
# no-check-uid

220
debian/reportbug/usr/bin/querybts

@ -0,0 +1,220 @@
#!/usr/bin/python2.3
# -*- python -*-
# querybts - Examine the state of a debbugs server
# Written by Chris Lawrence <lawrencc@debian.org>
# (C) 1999-2003 Chris Lawrence
#
# This program is freely distributable per the following license:
#
## Permission to use, copy, modify, and distribute this software and its
## documentation for any purpose and without fee is hereby granted,
## provided that the above copyright notice appears in all copies and that
## both that copyright notice and this permission notice appear in
## supporting documentation.
##
## I DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL I
## BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
## DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
## WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
#
# Version 2.42; see changelog for revision history
#
# $Id: querybts,v 1.1.1.1 2004-02-05 04:29:13 lawrencc Exp $
import sys, os
sys.path = [os.curdir, '/usr/share/reportbug'] + sys.path
import reportbug, debianbts, commands, getopt, re, mailcap, urlutils
try:
import reportbug_ui_newt as ui
ui_mode = 'newt'
## import reportbug_ui_text
## ui = reportbug_ui_text
except:
import reportbug_ui_text as ui
ui_mode = 'text'
VERSION = "querybts 2.42"
USAGE = ("querybts - Examine the state of a debbugs server.\n\n"
"Usage: querybts [options] {<package> | <report number> [report2] ...}\n"
"Supported options (see man page for long forms):\n"
" -A: Browse archived bugs.\n"
" -B: Specify an alternate debbugs BTS. *\n"
" -h: Display this help message.\n"
" -s: Query for source packages rather than binary packages.\n"
" -v: Show the version number of this program.\n"
" -w: Use a web browser instead of the internal interface.\n"
"\nOptions marked * take the word 'help' to list allowed options."
)
def main():
system = 'debian'
archived = False
http_proxy = interface = ''
use_browser = source = False
mirrors = None
mbox = False
args = reportbug.parse_config_files()
for option, arg in args.items():
if option == 'system':
system = arg
elif option == 'mirrors':
mirrors = arg
elif option == 'interface':
interface = arg
elif option == 'http_proxy':
http_proxy = arg
try:
(opts, args) = getopt.getopt(
sys.argv[1:], 'AB:hlmsuvw', ['help', 'version',
'bts=', 'web', 'mbox',
'archive', 'source',
'http_proxy=', 'proxy=',
'ui=', 'interface='])
except getopt.error, msg:
print msg
sys.exit(1)
for option, arg in opts:
if option in ('-h', '--help'):
print USAGE
return
elif option in ('-v', '--version'):
print VERSION
return
elif option in ('--proxy', '--http_proxy'):
http_proxy = arg
elif option in ('-m', '--mbox'):
mbox = True
elif option in ('--archive', '-A'):
archived = True
elif option in ('-s', '--source'):
source = True
elif option in ('-u', '--ui', '--interface'):
if arg in reportbug.VALID_UIS:
interface = arg
elif arg == 'help':
print 'Permitted arguments to --ui:\n'\
' text: line-oriented text mode\n'\
' newt: screen-oriented text mode'
sys.exit(0)
else:
print "Ignoring unknown user interface %s\n" % arg
elif option in ('-w', '--web'):
use_browser = True
elif option in ('-B', '--bts'):
if arg in debianbts.SYSTEMS.keys():
if debianbts.SYSTEMS[arg].get('btsroot'):
system = arg
else:
print "Queries not supported for %s BTS." % arg
return
elif arg == 'help':
print 'Permitted arguments to --bts:'
names = debianbts.SYSTEMS.keys()
names.sort()
for bsys in names:
if debianbts.SYSTEMS[bsys].get('btsroot'):
print ' %-11.11s %s' % \
(bsys, debianbts.SYSTEMS[bsys]['name'])
return
else:
print "Ignoring unknown BTS server %s." % arg
sysinfo = debianbts.SYSTEMS[system]
if len(args) == 0:
print "Please specify a package or one or more bug numbers."
print "Note: most shells consider # a comment character; however, a"
print "leading # is unneeded to specify a bug by number."
sys.exit(1)
if use_browser:
package = args[0]
m = re.match('^#?(\d+)$', package)
if m:
num = int(m.group(1))
url = debianbts.get_report_url(system, num, mirrors, archived)
else:
url = debianbts.get_package_url(system, package, mirrors, source, archived)
urlutils.launch_browser(url)
return
if mbox:
m = re.match('^#?(\d+)$', args[0])
if not m:
print >> sys.stderr, "You must specify a bug number when using the --mbox option."
sys.exit(1)
num = int(m.group(1))
url = debianbts.get_report_url(system, num, archived, mbox=True)
try:
report = urlutils.open_url(url)
sys.stdout.write(report.read())
except urlutils.urllib2.URLError, ex:
print >> sys.stderr, "Error while accessing mbox report (%s)." % ex
sys.exit(1)
return
if interface:
global ui, ui_mode
iface = 'reportbug_ui_'+interface
exec 'import '+iface
ui = eval(iface)
ui_mode = interface
reportre = re.compile(r'^#?(\d+)$')
try:
if len(args) > 1:
bugs = []
for report in args:
match = reportre.match(report)
if match:
bugs.append(int(match.group(1)))
package = bugs
if not bugs:
raise ui.NoBugs
else:
package = args[0]
match = reportre.match(package)
if match:
report = int(match.group(1))
return ui.show_report(report, system, mirrors,
http_proxy, queryonly=True,
title=VERSION,
archived=archived)
ui.handle_bts_query(package, system, mirrors, http_proxy,
queryonly=True, title=VERSION, archived=archived,
source=source)
except ui.NoPackage:
ui.ewrite('Package appears not to exist in the BTS.\n')
except ui.NoBugs:
ui.ewrite('No bug reports found.\n')
except ui.NoReport:
ui.ewrite('Nothing new to report; exiting.\n')
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
if ui_mode == 'newt':
print chr(27)+'c'
os.system('stty sane; clear')
print "querybts: exiting due to user interrupt."
except debianbts.Error, x:
if ui_mode == 'newt':
print chr(27)+'c'
os.system('stty sane; clear')
print 'error accessing BTS: '+str(x)
except SystemExit:
pass
except:
if ui_mode == 'newt':
print chr(27)+'c'
os.system('stty sane; clear')
raise

1775
debian/reportbug/usr/bin/reportbug

File diff suppressed because it is too large

2
debian/reportbug/usr/lib/menu/reportbug

@ -0,0 +1,2 @@
?package(reportbug):needs=text section=Apps/System\
title="reportbug" command="/usr/bin/reportbug" hints="Bug reporting"

14
debian/reportbug/usr/share/bug/reportbug/presubj

@ -0,0 +1,14 @@
Common issues with reportbug:
EMAIL ADDRESS SETTING: See the manual page reportbug(1) for how to set
your email address (i.e. the address that appears in the "From:"
header), if reportbug is unable to correctly figure it out for you.
Note that some mail systems will further rewrite the address
displayed by reportbug when it starts.
EDITORS: See the manual page reportbug(1) for how to choose an editor.
You probably will want to have this setting for other tools as
well. As an alternative, some mail programs, such as "mutt", can
be configured to be used as the editor for your report, which you
may find preferable.

24
debian/reportbug/usr/share/bug/reportbug/script

@ -0,0 +1,24 @@
#!/usr/bin/python2.3
# -*- python -*-
import os
OUT=os.fdopen(3, 'w')
envprint = False
for var in ['EDITOR', 'VISUAL', 'REPORTBUGEMAIL', 'DEBEMAIL', 'EMAIL',
'DEBFULLNAME', 'DEBNAME', 'NAME']:
if var in os.environ:
if not envprint:
print >> OUT, '** Environment settings:'
envprint = True
print >> OUT, '%s="%s"' % (var, os.environ[var])
USERFILE = os.path.expanduser('~/.reportbugrc')
if os.path.exists(USERFILE):
if envprint:
print >> OUT
print >> OUT, '** %s:' % USERFILE
for line in file(USERFILE):
if line and line[0] != '#' and line.strip():
OUT.write(line)

80
debian/reportbug/usr/share/doc/reportbug/README.developers

@ -0,0 +1,80 @@
This file is lifted, almost verbatim, from "bug".
BUG'S Features for Developers
=============================
Bug allows maintainers to control the bug reporting process by placing
files in special places.
Template Information & Interaction with the user
================================================
If /usr/share/bug/$package is executable, then bug executes it and
takes what comes out from the file descriptor 3 and puts it in the bug
template.
The maintainer can then ask questions to the user or run whatever
information gathering script he likes, and echo all the content to fd 3.
e.g.:
read -p 'color? '
echo "Color: $REPLY" >&3
...
system-information-tool >&3
If /usr/share/bug/$package is a directory, then
/usr/share/bug/$package/script is executed.
While the script is executed, the following shell functions are
available:
getkey - asks for a key
yesno <prompt> "yep"|"nop" - ask for a yes/no answer (with i18n)
leaves response as yep or nop
in REPLY. The second argument is
the default.
If the file /usr/share/bug/$package/presubj exists, its content is
shown to the user before asking him for the bug's subject.
Note: It's your responsibility to check if the information included
in the template can put the user in any security risk.
Package redirection
===================
The package maintainer can control to which packages are the bug reports
submitted to (i.e. the Package: field of the report). This will be mainly
used to redirect bugs in packages coming from a single source to where the
maintainer likes to have them.
This is done by having this line in /usr/share/bug/$package/control
Submit-As: $new-package
Note that bug will not check if the $new-package exists as a valid package.
BTS selection
=============
Packages not distributed by Debian can take advantage of this utility too.
They just need to add a "send-to" header to the control file
/usr/share/bug/$package/control.
Send-To: bugs.myproject.com
`bug' will add `submit@' `quiet@' or `maintonly@' to form the address the
bug report mail is send to.
(Note: you probably should use dpkg's support for Origin and Bugs tags
in lieu of this support.)
Nicolás Lichtmaier.-
nick@debian.org
Addendum: Languages other than SH
=================================
The script in /usr/share/bug/reportbug/script is an example of a bug
handling script written in Python. You can also write bug handlers in
many other languages that allow direct access to file descriptors,
including Perl and C/C++.

50
debian/reportbug/usr/share/doc/reportbug/TODO

@ -0,0 +1,50 @@
reportbug now has public CVS read access at:
http://phys251.phy.olemiss.edu/cgi-bin/viewcvs.cgi/reportbug
--
Silly TODO list (in no particular order):
1. Interface abstraction and multiple interfaces. The menus in
reportbug can be handled by a set of UI functions in a Python
module. reportbug_ui_text is there; reportbug_ui_newt is coming,
but its menu implementation leaves something to be desired... a new
menu may have to be designed from scratch, or we may have to
reimplement the nice newt dialogs in slang (boo, hiss). Robin
Putters has done quite a lot of work on a GNOME interface.
I'm not sure UI abstration is actually the way to go any more.
More thinking required here.
2. debconf: probably not; we have per-user configuration, which is
better 99.9% of the time.
3. BTS management interface for developers. You should be able to
view the list of bug reports for a package, construct a list of
actions, and produce one giant email to control@bugs.debian.org to
do that. Forwarding and merging, which both can be major PITAs,
will be helpful. (See #157283)
4. i18n/l10n. Python includes gettext support; however, the
Python-2.x interface is much better so reportbug will be using that
when 2.1 makes it in. (i18n/l10n with reportbug may not make much
sense, since the reports have to be in English for most maintainers
to understand them... unless we figure out some way to get bug
reports translated for maintainers.)
5. Iterators (2.3): Use enumerate instead of range where possible.
6. Convert BTS code to use the mbox-format reports if available, as
they should be easier to parse.
7. Convert the modules to a proper package and stick it in the Python
search path (per #157079). Reform the names. Rename
"reportbug.py" to something sensible.
8. Allow followups from the command line using a specific bug number,
rather than requiring people to go through the browser. Coupled
with --query-only, this should allow me to drop querybts completely.
9. Allow a --body option with a filename; this would prefill the
"body" section of the report. Might be useful for frontends.

BIN
debian/reportbug/usr/share/doc/reportbug/changelog.gz

Binary file not shown.

26
debian/reportbug/usr/share/doc/reportbug/copyright

@ -0,0 +1,26 @@
This package was written by Chris Lawrence <lawrencc@debian.org> on
Fri, 14 May 1999 01:07:35 -0500.
Copyright:
# reportbug -- Report bugs in the Debian GNU/Linux distribution
# Written by Chris Lawrence <lawrencc@debian.org>
# (C) 1999-2004 Chris Lawrence
#
# This program is freely distributable per the following license:
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appears in all copies and that
# both that copyright notice and this permission notice appear in
# supporting documentation.
#
# I DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL I
# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
The "handle_bugscript" script is subject to the GNU General Public
License. See /usr/share/common-licenses/GPL.

BIN
debian/reportbug/usr/share/man/man1/querybts.1.gz

Binary file not shown.

BIN
debian/reportbug/usr/share/man/man1/reportbug.1.gz

Binary file not shown.

84
debian/reportbug/usr/share/reportbug/checkbuildd.py

@ -0,0 +1,84 @@
#
# checkbuildd.py - Check buildd.debian.org for successful past builds
#
# Written by Chris Lawrence <lawrencc@debian.org>
# (C) 2002 Chris Lawrence
#
# This program is freely distributable per the following license:
#
## Permission to use, copy, modify, and distribute this software and its
## documentation for any purpose and without fee is hereby granted,
## provided that the above copyright notice appears in all copies and that
## both that copyright notice and this permission notice appear in
## supporting documentation.
##
## I DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL I
## BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
## DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
## WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
#
# Version 2.42; see changelog for revision history
import sgmllib, os, commands
from urlutils import open_url
from reportbug_exceptions import *
BUILDD_URL = 'http://buildd.debian.org/build.php?arch=%s&pkg=%s'
# This is easy; just look for succeeded in an em block...
class BuilddParser(sgmllib.SGMLParser):
def __init__(self):
sgmllib.SGMLParser.__init__(self)
self.versions = {}
self.savedata = None
self.found_succeeded = False
# --- Formatter interface, taking care of 'savedata' mode;
# shouldn't need to be overridden
def handle_data(self, data):
if self.savedata is not None:
self.savedata = self.savedata + data
# --- Hooks to save data; shouldn't need to be overridden
def save_bgn(self):
self.savedata = ''
def save_end(self, mode=0):
data = self.savedata
self.savedata = None
if not mode and data is not None: data = ' '.join(data.split())
return data
def start_em(self, attrs):
self.save_bgn()
def end_em(self):
data = self.save_end()
if data and 'successful' in data:
self.found_succeeded=True
def archname():
return commands.getoutput('dpkg --print-architecture')
def check_built(src_package, arch=None, http_proxy=None):
if not arch:
arch = archname()
try:
page = open_url(BUILDD_URL % (arch, src_package), http_proxy)
except NoNetwork:
return {}
if not page:
return {}
parser = BuilddParser()
parser.feed(page.read())
parser.close()
page.close()
return parser.found_succeeded

197
debian/reportbug/usr/share/reportbug/checkversions.py

@ -0,0 +1,197 @@
#
# checkversions.py - Find if the installed version of a package is the latest
#
# Written by Chris Lawrence <lawrencc@debian.org>
# (C) 2002-03 Chris Lawrence
#
# This program is freely distributable per the following license:
#
## Permission to use, copy, modify, and distribute this software and its
## documentation for any purpose and without fee is hereby granted,
## provided that the above copyright notice appears in all copies and that
## both that copyright notice and this permission notice appear in
## supporting documentation.
##
## I DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL I
## BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
## DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
## WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
#
# Version 2.42; see changelog for revision history
import sgmllib, os, re, sys, urllib2
from urlutils import open_url
from reportbug_exceptions import *
PACKAGES_URL = 'http://packages.debian.org/%s'
INCOMING_URL = 'http://incoming.debian.org/'
# The format is a table. We take the rows that have two complete columns
# only...
class PackagesParser(sgmllib.SGMLParser):
def __init__(self):
sgmllib.SGMLParser.__init__(self)
self.versions = {}
self.savedata = None
self.row = None
# --- Formatter interface, taking care of 'savedata' mode;
# shouldn't need to be overridden
def handle_data(self, data):
if self.savedata is not None:
self.savedata = self.savedata + data
# --- Hooks to save data; shouldn't need to be overridden
def save_bgn(self):
self.savedata = ''
def save_end(self, mode=0):
data = self.savedata
self.savedata = None
if not mode and data is not None: data = ' '.join(data.split())
return data
def start_tr(self, attrs):
if self.row is not None:
self.end_tr()
self.row = []
def end_tr(self):
if self.savedata:
self.end_td()
if self.row:
dist = self.row[0].strip()
if dist:
version = self.row[1].strip().split()[1]
self.versions[dist] = version
self.row = None
def start_td(self, attrs):
if self.savedata:
self.end_td()
if self.row is not None:
self.save_bgn()
def end_td(self):
if self.row is not None:
self.row.append(self.save_end())
class IncomingParser(sgmllib.SGMLParser):
def __init__(self, package):
sgmllib.SGMLParser.__init__(self)
self.found = []
self.savedata = None
self.package = re.compile(re.escape(package)+r'_([^_]+)_[^.]+.deb')
def start_a(self, attrs):
for attrib, value in attrs:
if attrib.lower() != 'href':
continue
mob = self.package.match(value)
if mob:
self.found.append(mob.group(1))
def compare_versions(current, upstream):
"""Return 1 if upstream is newer than current, -1 if current is
newer than upstream, and 0 if the same."""
if not upstream: return 0
rc = os.system('dpkg --compare-versions %s lt %s' % (current, upstream))
rc2 = os.system('dpkg --compare-versions %s gt %s' % (current, upstream))
if not rc:
return 1
elif not rc2:
return -1
return 0
def later_version(a, b):
if compare_versions(a, b) > 0:
return b
return a
def get_versions_available(package, dists=None, http_proxy=None):
if not dists:
dists = ('stable', 'testing', 'unstable')
try:
page = open_url(PACKAGES_URL % package, http_proxy)
except NoNetwork:
return {}
except urllib2.HTTPError, x:
print >> sys.stderr, "Warning:", x
return {}
if not page:
return {}
parser = PackagesParser()
parser.feed(page.read())
parser.close()
page.close()
versions = {}
for dist in dists:
if dist in parser.versions:
versions[dist] = parser.versions[dist]
return versions
def get_incoming_version(package, http_proxy=None):
try:
page = open_url(INCOMING_URL, http_proxy)
except NoNetwork:
return None
except urllib2.HTTPError, x:
print >> sys.stderr, "Warning:", x
return None
if not page:
return None
parser = IncomingParser(package)
parser.feed(page.read())
parser.close()
page.close()
if parser.found:
return reduce(later_version, parser.found, '0')
return None
def check_available(package, version, dists=None, check_incoming=1,
http_proxy=None):
avail = {}
if check_incoming:
iv = get_incoming_version(package, http_proxy)
if iv:
avail['incoming'] = iv
avail.update(get_versions_available(package, dists, http_proxy))
new = {}
newer = 0
for dist in avail:
if dist == 'incoming':
if ':' in version:
ver = version.split(':', 1)[1]
else:
ver = version
comparison = compare_versions(ver, avail[dist])
else:
comparison = compare_versions(version, avail[dist])
if comparison > 0:
new[dist] = avail[dist]
elif comparison < 0:
newer += 1
if newer and newer == len(avail):
return new, True
return new, False
if __name__=='__main__':
print check_available('mozilla-browser', '2:1.5-3')
print check_available('reportbug', '2.39')

675
debian/reportbug/usr/share/reportbug/debianbts.py

@ -0,0 +1,675 @@
#
# debianbts.py - Routines to deal with the debbugs web pages
#
# Written by Chris Lawrence <lawrencc@debian.org>
# (C) 1999-2003 Chris Lawrence
#
# This program is freely distributable per the following license:
#
## Permission to use, copy, modify, and distribute this software and its
## documentation for any purpose and without fee is hereby granted,
## provided that the above copyright notice appears in all copies and that
## both that copyright notice and this permission notice appear in
## supporting documentation.
##
## I DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL I
## BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
## DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
## WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
#
# Version 2.42; see changelog for revision history
#
# $Id: debianbts.py,v 1.1.1.1 2004-02-05 04:29:13 lawrencc Exp $
import sgmllib, glob, os, re, reportbug, rfc822, time, urllib, checkversions
from urlutils import open_url
from types import StringTypes
import sys
class Error(Exception):
pass
# Severity levels
SEVERITIES = {
'critical' : """makes unrelated software on the system (or the
whole system) break, or causes serious data loss, or introduces a
security hole on systems where you install the package.""",
'grave' : """makes the package in question unusable or mostly so,
or causes data loss, or introduces a security hole allowing access
to the accounts of users who use the package.""",
'serious' : """is a severe violation of Debian policy (that is,
the problem is a violation of a 'must' or 'required' directive);
may or may not affect the usability of the package.""",
'important' : """a bug which has a major effect on the usability
of a package, without rendering it completely unusable to
everyone.""",
'does-not-build' : """a bug that stops the package from being built
from source. (This is a 'virtual severity'.)""",
'normal' : """a bug that does not undermine the usability of the
whole package; for example, a problem with a particular option or
menu item.""",
'minor' : """things like spelling mistakes and other minor
cosmetic errors that do not affect the core functionality of the
package.""",
'wishlist' : "suggestions and requests for new features.",
}
# justifications for critical bugs
JUSTIFICATIONS = {
'critical' : (
('breaks unrelated software', """breaks unrelated software on the system
(packages that have a dependency relationship are not unrelated)"""),
('breaks the whole system', """renders the entire system unusable (e.g.,
unbootable, unable to reach a multiuser runlevel, etc.)"""),
('causes serious data loss', """causes loss of important, irreplaceable
data"""),
('root security hole', """introduces a security hole allowing access to
root (or another privileged system account), or data normally
accessible only by such accounts"""),
('unknown', """not sure, or none of the above"""),
),
'grave' : (
('renders package unusable', """renders the package unusable, or mostly
so, on all or nearly all possible systems on which it could be installed
(i.e., not a hardware-specific bug); or renders package uninstallable
or unremovable without special effort"""),
('causes non-serious data loss', """causes the loss of data on the system
that is unimportant, or restorable without resorting to backup media"""),
('user security hole', """introduces a security hole allowing access to
user accounts or data not normally accessible"""),
('unknown', """not sure, or none of the above"""),
)
}
# Ordering for justifications
JUSTORDER = {
'critical' : ['breaks unrelated software',
'breaks the whole system',
'causes serious data loss',
'root security hole',
'unknown'],
'grave' : ['renders package unusable',
'causes non-serious data loss',
'user security hole',
'unknown']
}
SEVERITIES_gnats = {
'critical' : 'The product, component or concept is completely'
'non-operational or some essential functionality is missing. No'
'workaround is known.',
'serious' : 'The product, component or concept is not working'
'properly or significant functionality is missing. Problems that'
'would otherwise be considered ''critical'' are rated ''serious'' when'
'a workaround is known.',
'non-critical' : 'The product, component or concept is working'
'in general, but lacks features, has irritating behavior, does'
'something wrong, or doesn''t match its documentation.',
}
# Rank order of severities, for sorting
SEVLIST = ['critical', 'grave', 'serious', 'important', 'does-not-build',
'normal', 'non-critical', 'minor', 'wishlist', 'fixed']
def convert_severity(severity, type='debbugs'):
"Convert severity names if needed."
if type == 'debbugs':
return {'non-critical' : 'normal'}.get(severity, severity)
elif type == 'gnats':
return {'grave' : 'critical',
'important' : 'serious',
'normal' : 'non-critical',
'minor' : 'non-critical',
'wishlist' : 'non-critical'}.get(severity, severity)
else:
return severity
# These packages are virtual in Debian; we don't look them up...
debother = {
'base' : 'General bugs in the base system',
# Actually a real package, but most people don't have boot-floppies installed for good reason
'boot-floppy' : '(Obsolete, please use boot-floppies instead.)',
'boot-floppies' : 'Bugs in the woody installation subsystem',
'bugs.debian.org' : 'The bug tracking system, @bugs.debian.org',
'cdimage.debian.org' : 'CD Image issues',
'cdrom' : 'Problems with installation from CD-ROMs',
# dpkg-iwj -- The dpkg branch maintained by Ian Jackson
'debian-policy' : 'Proposed changes in the Debian policy documentation',
'ftp.debian.org' : 'Problems with the FTP site',
'general' : 'General problems (e.g., that many manpages are mode 755)',
'install' : 'Problems with the sarge installer.',
'installation' : 'General installation problems not covered otherwise.',
'kernel' : '(Obsolete, please use "kernel-image" instead.)',
'kernel-image' : 'Problems with the Linux kernel, or the kernel shipped with Debian',
'listarchives' : 'Problems with the WWW mailing list archives',
'lists.debian.org' : 'The mailing lists, debian-*@lists.debian.org.',
'mirrors' : 'Problems with Debian archive mirrors.',
'nonus.debian.org' : 'Problems with the non-US FTP site',
'press' : 'Press release issues',
'project' : 'Problems related to Project administration',
'qa.debian.org' : 'Problems related to the quality assurance group',
#slink-cd -- Slink CD
#spam -- Spam (reassign spam to here so we can complain about it)
'security.debian.org' : 'Problems with the security updates server',
'wnpp' : 'Work-Needing and Prospective Packages list',
'www.debian.org' : 'Problems with the WWW site (including other *.debian.org sites)'
}
progenyother = {
'debian-general' : 'Any non-package-specific bug',
}
def handle_wnpp(package, bts, ui, online=True, http_proxy=None):
desc = body = ''
headers = []
query = True
tag = ui.menu('What sort of request is this? (If none of these '
'things mean anything to you, or you are trying to report '
'a bug in an existing package, please press Enter to '
'exit reportbug.)', {
'O' :