[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#707631: reportbug: update for release.debian.org proposed-updates bugs



Package: reportbug
Version: 6.4.4
Severity: normal
Tags: patch

Hi,

I've got a few patches for reportbug to:
- update the suite/codename mapping
- fix a possible test failure
- change the checkversions.get_versions_available function to
  - not do arch/dist filtering itself, getting madison to do it instead
  - work with codenames instead of suites
- change the way release.debian.org pu bugs are tagged.  Instead of
  using pu and opu usertags (which need to be switched across a
  release), just use a combination of pu usertag and normal suite tag.

Cheers,
Julien
From 70a674175cf08d6302ae1465ed11b795e74048a3 Mon Sep 17 00:00:00 2001
From: Julien Cristau <jcristau@debian.org>
Date: Thu, 9 May 2013 20:51:42 +0200
Subject: [PATCH 1/4] Update codename/suite mapping for wheezy release

---
 reportbug/utils.py |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/reportbug/utils.py b/reportbug/utils.py
index 01f7062..8a104d8 100644
--- a/reportbug/utils.py
+++ b/reportbug/utils.py
@@ -88,9 +88,9 @@ fhs_directories = ['/', '/usr', '/usr/share', '/var', '/usr/X11R6',
                    '/usr/man', '/usr/doc', '/usr/bin']
 
 # A map between suites and distributions names
-SUITES2DISTS = {'lenny': 'oldstable',
-                'squeeze': 'stable',
-                'wheezy': 'testing',
+SUITES2DISTS = {'squeeze': 'oldstable',
+                'wheezy': 'stable',
+                'jessie': 'testing',
                 'sid': 'unstable',
                 'experimental': 'experimental'}
 
-- 
1.7.10.4

From 746c7676dbce96df94d020dbdd0a4c6770aeb7bf Mon Sep 17 00:00:00 2001
From: Julien Cristau <jcristau@debian.org>
Date: Thu, 9 May 2013 20:53:07 +0200
Subject: [PATCH 2/4] test: don't assert that unstable version is strictly
 greater than stable

---
 test/test_checkversions.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/test_checkversions.py b/test/test_checkversions.py
index 17a27d3..58b7e64 100644
--- a/test/test_checkversions.py
+++ b/test/test_checkversions.py
@@ -38,7 +38,7 @@ class TestVersionAvailable(unittest2.TestCase):
         vers = checkversions.get_versions_available('reportbug', 60)
         # check stable version is lower than unstable
         chk = checkversions.compare_versions(vers['stable'], vers['unstable'])
-        self.assertEqual(chk, 1)
+        self.assertGreaterEqual(chk, 0)
 
     @attr('network') #marking the test as using network
     def test_bts649649(self):
-- 
1.7.10.4

From f77beaed90c8f73c85cd09d24405661308498809 Mon Sep 17 00:00:00 2001
From: Julien Cristau <jcristau@debian.org>
Date: Thu, 9 May 2013 21:01:45 +0200
Subject: [PATCH 3/4] checkversions: let rmadison do the architecture/suite
 filtering

Also accept codenames (wheezy, jessie, sid) instead of suite names
(stable, testing, unstable).
---
 reportbug/checkversions.py |   19 ++++++++++---------
 test/test_checkversions.py |    6 ++++++
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/reportbug/checkversions.py b/reportbug/checkversions.py
index 5ce2802..38d7762 100644
--- a/reportbug/checkversions.py
+++ b/reportbug/checkversions.py
@@ -104,8 +104,15 @@ def get_versions_available(package, timeout, dists=None, http_proxy=None, arch='
     if not dists:
         dists = ('oldstable', 'stable', 'testing', 'unstable', 'experimental')
 
+    arch = utils.get_arch()
+
+    url = RMADISON_URL % package
+    url += '&s=' + ','.join(dists)
+    # select only those lines that refers to source pkg
+    # or to binary packages available on the current arch
+    url += '&a=source,all,' + arch
     try:
-        page = open_url(RMADISON_URL % package)
+        page = open_url(url)
     except NoNetwork:
         return {}
     except urllib2.HTTPError, x:
@@ -118,7 +125,6 @@ def get_versions_available(package, timeout, dists=None, http_proxy=None, arch='
     content = page.read().replace(' ', '').strip()
     page.close()
 
-    arch = utils.get_arch()
     versions = {}
     for line in content.split('\n'):
         l = line.split('|')
@@ -126,13 +132,8 @@ def get_versions_available(package, timeout, dists=None, http_proxy=None, arch='
         if len(l) != 4:
             continue
         # map suites name (returned by madison) to dist name
-        dist = utils.SUITES2DISTS.get(l[2], '')
-        if dist in dists:
-            # select only those lines that refers to source pkg
-            # or to binary packages available on the current arch
-            if 'source' in l[3].split(',') or arch in l[3].split(',') or \
-                    l[3] == 'all':
-                versions[dist] = l[1]
+        dist = utils.SUITES2DISTS.get(l[2], l[2])
+        versions[dist] = l[1]
 
     return versions
 
diff --git a/test/test_checkversions.py b/test/test_checkversions.py
index 58b7e64..8ad34a6 100644
--- a/test/test_checkversions.py
+++ b/test/test_checkversions.py
@@ -52,3 +52,9 @@ class TestVersionAvailable(unittest2.TestCase):
         # squeeze (stable at this time) is the first suite where texlive-xetex
         # is arch:all
         self.assertIn('stable', vers)
+
+    @attr('network')
+    def test_codenames(self):
+        vers = checkversions.get_versions_available('reportbug', 60, ['sid'])
+	self.assertEqual(1, len(vers))
+	self.assertEqual(vers.keys()[0], 'unstable')
-- 
1.7.10.4

From 06502520600c95ac1996d89cd7e008921357dc0e Mon Sep 17 00:00:00 2001
From: Julien Cristau <jcristau@debian.org>
Date: Thu, 9 May 2013 21:11:49 +0200
Subject: [PATCH 4/4] debbugs: retire the opu tag for release.debian.org

Use a combination of 'pu' usertag and normal suite tags instead.
---
 reportbug/debbugs.py |   24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/reportbug/debbugs.py b/reportbug/debbugs.py
index 257ab10..9c727e7 100644
--- a/reportbug/debbugs.py
+++ b/reportbug/debbugs.py
@@ -401,8 +401,8 @@ def handle_debian_release(package, bts, ui, fromaddr, timeout, online=True, http
         'britney':          "testing migration script bugs",
         'transition':       "transition tracking",
         'unblock':          "unblock requests",
-        'opu':              "oldstable proposed updates requests",
-        'pu':               "stable proposed updates requests",
+        'squeeze-pu':       "squeeze proposed updates requests",
+        'wheezy-pu':        "wheezy proposed updates requests",
         'rm':               "Stable/Testing removal requests",
         'other' :           "None of the other options",
         }, 'Choose the request type: ', empty_ok=True)
@@ -447,14 +447,14 @@ def handle_debian_release(package, bts, ui, fromaddr, timeout, online=True, http
         else:
             package = info[12] or package
 
-    if tag in ('binnmu', 'unblock', 'opu', 'pu', 'rm'):
-        # FIXME: opu/pu/rm should lookup the version elsewhere
+    if tag in ('binnmu', 'unblock', 'wheezy-pu', 'squeeze-pu', 'rm'):
+        # FIXME: pu/rm should lookup the version elsewhere
         version = info and info[0]
         if online:
-            if tag == 'pu':
-                version = checkversions.get_versions_available(package, timeout).get('stable', '')
-            elif tag == 'opu':
-                version = checkversions.get_versions_available(package, timeout).get('oldstable', '')
+            if tag == 'wheezy-pu':
+                version = checkversions.get_versions_available(package, timeout, 'wheezy').values()[0]
+            elif tag == 'squeeze-pu':
+                version = checkversions.get_versions_available(package, timeout, 'squeeze').values()[0]
         if version:
             cont = ui.select_options(
                 "Latest version seems to be %s, is this the proper one ?" % (version),
@@ -487,7 +487,11 @@ def handle_debian_release(package, bts, ui, fromaddr, timeout, online=True, http
                 ui.long_message('No architecture specified, skipping...')
 
     pseudos.append("User: release.debian.org@packages.debian.org")
-    pseudos.append("Usertags: %s" % (tag))
+    if tag.endswith('-pu'):
+        pseudos.append("Usertags: pu")
+        pseudos.append("Tags: %s" % (tag[:-3]))
+    else:
+        pseudos.append("Usertags: %s" % (tag))
 
     if tag == 'binnmu':
         reason  = ui.get_string("binNMU changelog entry: ")
@@ -558,7 +562,7 @@ def handle_debian_release(package, bts, ui, fromaddr, timeout, online=True, http
 
                 unblock %s/%s
                 """ % (package, package, version))
-    elif tag == 'pu' or tag == 'opu':
+    elif tag.endswith('-pu'):
         subject = '%s: package %s/%s' % (tag, package, version)
         body    = '(please explain the reason for this update here)\n'
     elif tag == 'rm':
-- 
1.7.10.4

Attachment: signature.asc
Description: Digital signature


Reply to: