[Reportbug-commits] [reportbug] 03/11: checkversions: let rmadison do the architecture/suite filtering

Sandro Tosi morph at moszumanska.debian.org
Sun Jan 26 19:45:35 UTC 2014


This is an automated email from the git hooks/post-receive script.

morph pushed a commit to branch master
in repository reportbug.

commit 518d68389e9c10a917f1f2b5af9cbd991da8e9cc
Author: Julien Cristau <jcristau at debian.org>
Date:   Thu May 9 21:01:45 2013 +0200

    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 750da1a..4fb2ba1 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 27ba052..359b89b 100644
--- a/test/test_checkversions.py
+++ b/test/test_checkversions.py
@@ -90,3 +90,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')

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reportbug/reportbug.git



More information about the Reportbug-commits mailing list