Browse Source

Finalize 3.21

suites/jessie-proposed-backports
Chris Lawrence 17 years ago
parent
commit
7dcb610ae9
  1. 106
      checkversions.py
  2. 11
      debian/changelog
  3. 5
      debian/control
  4. 11
      reportbug
  5. 27
      reportbug.py
  6. 50
      reportbug_submit.py

106
checkversions.py

@ -20,7 +20,7 @@
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
#
# $Id: checkversions.py,v 1.5 2006-04-09 16:36:43 lawrencc Exp $
# $Id: checkversions.py,v 1.6 2006-06-05 12:58:06 lawrencc Exp $
#
# Version ##VERSION##; see changelog for revision history
@ -30,18 +30,14 @@ from reportbug_exceptions import *
PACKAGES_URL = 'http://packages.debian.org/%s'
INCOMING_URL = 'http://incoming.debian.org/'
NEWQUEUE_URL = 'http://ftp-master.debian.org/new.html'
# The format is an unordered list
class PackagesParser(sgmllib.SGMLParser):
def __init__(self, arch='i386'):
class BaseParser(sgmllib.SGMLParser):
def __init__(self,):
sgmllib.SGMLParser.__init__(self)
self.versions = {}
self.savedata = None
self.row = None
arch = r'\s(all|'+re.escape(arch)+r')\b'
self.arch = re.compile(arch)
self.dist = None
# --- Formatter interface, taking care of 'savedata' mode;
# shouldn't need to be overridden
@ -60,6 +56,15 @@ class PackagesParser(sgmllib.SGMLParser):
if not mode and data is not None: data = ' '.join(data.split())
return data
class PackagesParser(BaseParser):
def __init__(self, arch='i386'):
BaseParser.__init__(self)
self.versions = {}
self.row = None
arch = r'\s(all|'+re.escape(arch)+r')\b'
self.arch = re.compile(arch)
self.dist = None
def start_li(self, attrs):
if self.row is not None:
self.end_li()
@ -106,6 +111,54 @@ class IncomingParser(sgmllib.SGMLParser):
if mob:
self.found.append(mob.group(1))
class NewQueueParser(BaseParser):
def __init__(self, package, arch='i386'):
BaseParser.__init__(self)
self.package = package
self.row = None
arch = r'\s(all|'+re.escape(arch)+r')\b'
self.arch = re.compile(arch)
self.versions = {}
def start_tr (self, attrs):
for name, value in attrs:
if name == 'class' and value in ("odd", "even"):
self.row = []
def end_tr (self):
if self.row is not None:
# row (name, versions, architectures, distribution)
dist = "%s (new queue)" % self.row[3]
for version in self.row[1].split():
self.versions[dist] = version
self.row = None
def start_td (self, attrs):
if self.row is None:
return
self.save_bgn()
def end_td (self):
if self.row is None:
return
data = self.save_end()
l = len(self.row)
if l == 0:
# package name
if self.package == data:
# found package name
self.row.append(data)
else:
self.row = None
elif l == 2:
# architecture
if self.arch.search(data):
self.row.append(data)
else:
self.row = None
else:
self.row.append(data)
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."""
@ -150,6 +203,30 @@ def get_versions_available(package, dists=None, http_proxy=None, arch='i386'):
return versions
def get_newqueue_available(package, dists=None, http_proxy=None, arch='i386'):
if dists is None:
dists = ('unstable (new queue)', )
try:
page = open_url(NEWQUEUE_URL, http_proxy)
except NoNetwork:
return {}
except urllib2.HTTPError, x:
print >> sys.stderr, "Warning:", x
return {}
if not page:
return {}
parser = NewQueueParser(package, arch)
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, arch='i386'):
try:
page = open_url(INCOMING_URL, http_proxy)
@ -172,6 +249,7 @@ def get_incoming_version(package, http_proxy=None, arch='i386'):
return None
def check_available(package, version, dists=None, check_incoming=True,
check_newqueue=True,
http_proxy=None, arch='i386'):
avail = {}
@ -179,8 +257,13 @@ def check_available(package, version, dists=None, check_incoming=True,
iv = get_incoming_version(package, http_proxy, arch)
if iv:
avail['incoming'] = iv
avail.update(get_versions_available(package, dists, http_proxy, arch))
if check_newqueue:
import reportbug
srcpackage = reportbug.get_source_name(package)
if srcpackage is None:
srcpackage = package
avail.update(get_newqueue_available(srcpackage, dists, http_proxy, arch))
new = {}
newer = 0
@ -197,9 +280,8 @@ def check_available(package, version, dists=None, check_incoming=True,
new[dist] = avail[dist]
elif comparison < 0:
newer += 1
if newer and newer == len(avail):
return new, True
return new, False
too_new = (newer and newer == len(avail))
return new, too_new
if __name__=='__main__':
#print check_available('mozilla-browser', '2:1.5-3', arch='s390')

11
debian/changelog

@ -1,3 +1,14 @@
reportbug (3.21) unstable; urgency=low
* Parse the NEW queue for new packages; patch from Bastian Kleineidam.
(Closes: #370443)
* Avoid metapackage bug reporting crash. (Closes: #345699, #345402)
* Retry if SMTP password fails; patch from Adam Porter.
(Closes: #318787)
* Improve "Kernel" line on kFreeBSD, Hurd. (Closes: #264042)
-- Chris Lawrence <lawrencc@debian.org> Mon, 5 Jun 2006 08:57:00 -0400
reportbug (3.20) unstable; urgency=low
* Remove the experimental tag. (Closes: #360662)

5
debian/control

@ -2,8 +2,9 @@ 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)
Standards-Version: 3.7.2
Build-Depends: debhelper (>> 4)
Build-Depends-Indep: python2.3 (>= 2.3-4)
Package: reportbug
Architecture: all

11
reportbug

@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE."""
#
# Version ##VERSION##; see changelog for revision history
# $Id: reportbug,v 1.90 2006-03-16 03:55:27 lawrencc Exp $
# $Id: reportbug,v 1.91 2006-06-05 12:58:06 lawrencc Exp $
# Work around case where Python install might be broken (#290043)
try:
@ -1025,8 +1025,9 @@ def main():
'actual package "%s".\n', package, depends[0])
package = depends[0]
else:
opts = [(x, reportbug.get_package_status(x)[11])
for x in depends]
opts = [(x,
(reportbug.get_package_status(x)[11] or
'not installed')) for x in depends]
if mode >= MODE_ADVANCED:
opts += [(package,
status[11]+' (dependency package)')]
@ -1204,8 +1205,10 @@ def main():
and bts=='debian'):
ewrite('Checking for newer versions at packages.debian.org...\n')
arch = reportbug.get_arch()
check_more = (mode > MODE_STANDARD)
(avail, toonew) = checkversions.check_available(
package, pkgversion, check_incoming=(mode > MODE_STANDARD),
package, pkgversion, check_incoming=check_more,
check_newqueue=check_more,
http_proxy=options.http_proxy, arch=arch)
if toonew:
if not ui.yes_no(

27
reportbug.py

@ -21,7 +21,7 @@
#
# Version ##VERSION##; see changelog for revision history
#
# $Id: reportbug.py,v 1.29 2005-06-21 22:09:37 lawrencc Exp $
# $Id: reportbug.py,v 1.30 2006-06-05 12:58:06 lawrencc Exp $
VERSION = "reportbug ##VERSION##"
VERSION_NUMBER = "##VERSION##"
@ -388,6 +388,22 @@ def get_source_package(package):
packages.sort()
return packages
def get_source_name(package):
"""Return source package name for given package or None."""
packinfo = get_avail_database()
has_source = re.compile(r'^Source: %s$' % re.escape(package), re.MULTILINE).search
get_source = re.compile(r'^Source: (?P<pkg>.*)$', re.MULTILINE).search
has_package = re.compile(r'^Package: %s$' % re.escape(package), re.MULTILINE).search
for p in packinfo:
match = has_source(p)
if match:
return package
if has_package(p):
match = get_source(p)
if match:
return match.group('pkg')
return None
def get_package_info(packages):
if not packages:
return []
@ -682,7 +698,14 @@ def generate_blank_report(package, pkgversion, severity, justification,
if not body:
body = "\n"
uname_string = '%s %s' % (un[0], un[2])
if un[0].startswith('GNU/'):
un[0] = un[0][4:]
if un[0] == 'GNU':
# Use uname -v on Hurd
uname_string = un[3]
else:
uname_string = '%s %s' % (un[0], un[2])
return """%s%s%s
-- System Information:

50
reportbug_submit.py

@ -22,7 +22,7 @@
#
# Version ##VERSION##; see changelog for revision history
#
# $Id: reportbug_submit.py,v 1.15 2005-11-30 04:27:05 lawrencc Exp $
# $Id: reportbug_submit.py,v 1.16 2006-06-05 12:58:06 lawrencc Exp $
import sys
@ -350,26 +350,34 @@ def send_report(body, attachments, mua, fromaddr, sendto, ccaddr, bccaddr,
toaddrs = [x[1] for x in alist]
smtp_message = re.sub(r'(?m)^[.]', '..', message)
ewrite("Connecting to %s via SMTP...\n", smtphost)
try:
conn = smtplib.SMTP(smtphost)
if smtptls:
conn.starttls()
if smtpuser:
if not smtppasswd:
smtppasswd = ui.get_password(
'Enter SMTP password for %s@%s: ' %
(smtpuser, smtphost))
conn.login(smtpuser, smtppasswd)
conn.sendmail(fromaddr, toaddrs, smtp_message)
conn.quit()
except (socket.error, smtplib.SMTPException), x:
failed = True
ewrite('SMTP send failure: %s\n', x)
fh, msgname = TempFile(prefix=tfprefix)
fh.write(message)
fh.close()
ewrite('Wrote bug report to %s\n', msgname)
# Modified by AP 2006-03-29
while failed != True:
ewrite("Connecting to %s via SMTP...\n", smtphost)
try:
conn = smtplib.SMTP(smtphost)
if smtptls:
conn.starttls()
if smtpuser:
if not smtppasswd:
smtppasswd = ui.get_password(
'Enter SMTP password for %s@%s: ' %
(smtpuser, smtphost))
conn.login(smtpuser, smtppasswd)
conn.sendmail(fromaddr, toaddrs, smtp_message)
conn.quit()
except (socket.error, smtplib.SMTPException), x:
# If wrong password, try again...
if smtplib.SMTPResponseException.smtp_code == '535'
ewrite('SMTP error: authentication failed. Try again.')
continue
failed = True
ewrite('SMTP send failure: %s\n', x)
fh, msgname = TempFile(prefix=tfprefix)
fh.write(message)
fh.close()
ewrite('Wrote bug report to %s\n', msgname)
else:
try:
pipe.write(message)

Loading…
Cancel
Save