Package: reportbug
Severity: wishlist
Tags: patch

Please apply the attached patches to move all the release name
hardcoding into one place so that it isn't possible to forget updating
one of the places where names are hardcoded after a release happens.
Also add an entry for buster since the release team announced that:

https://lists.debian.org/20141109115231.gb2...@lupin.home.powdarrmonkey.net

-- 
bye,
pabs

https://wiki.debian.org/PaulWise


From 226520a05940c64a8b504e052f81ae3a557343b9 Mon Sep 17 00:00:00 2001
From: Paul Wise <p...@debian.org>
Date: Sun, 18 Oct 2015 11:03:25 +0800
Subject: [PATCH 1/3] Rename SUITES2DISTS variable to CODENAME2SUITE as name is
 incorrect.

The variable maps codenames like jessie to suites like stable.

Also adjust the comment.
---
 reportbug/checkversions.py | 2 +-
 reportbug/utils.py         | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/reportbug/checkversions.py b/reportbug/checkversions.py
index bb7a3fd..b04f46b 100644
--- a/reportbug/checkversions.py
+++ b/reportbug/checkversions.py
@@ -134,7 +134,7 @@ 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], l[2])
+        dist = utils.CODENAME2SUITE.get(l[2], l[2])
         versions[dist] = l[1]
 
     return versions
diff --git a/reportbug/utils.py b/reportbug/utils.py
index 2b4d64c..aaabd40 100644
--- a/reportbug/utils.py
+++ b/reportbug/utils.py
@@ -89,8 +89,8 @@ NEWBIELINE = """Dear Maintainer,
 fhs_directories = ['/', '/usr', '/usr/share', '/var', '/usr/X11R6',
                    '/usr/man', '/usr/doc', '/usr/bin']
 
-# A map between suites and distributions names
-SUITES2DISTS = {'squeeze': 'oldoldstable',
+# A map between codenames and suites
+CODENAME2SUITE = {'squeeze': 'oldoldstable',
                 'wheezy': 'oldstable',
                 'jessie': 'stable',
                 'stretch': 'testing',
-- 
2.6.2

From ec10d69e54001181abe03ee0a82916bace05d567 Mon Sep 17 00:00:00 2001
From: Paul Wise <p...@debian.org>
Date: Fri, 16 Oct 2015 01:27:06 +0800
Subject: [PATCH 2/3] Remove hard-coding of release names in the
 release.debian.org handling

This means there is only one place to update after a release.

Pre-compute the codenames and then use them in the UI because some
members of the Debian release team prefer codenames in the UI:

<pabs> is there any reason for the reportbug handling of the release.debian.org
       pseudo-package to be hard-coding release names? I was thinking of sending
       this to the maintainer http://paste.debian.net/315948/
<jcristau> it needs to set suite tags
<pabs> ok. maybe tomorrow I'll update it to use the SUITES2DISTS mapping,
       so there is only one place to update
<pabs> so the tag is the only thing that needs to use the codename?
       can the UI use the suite names for eg?
<jcristau> personally i think codenames are clearer
<jcristau> but that may just be me, and i don't maintainer reportbug

Inspired-by: https://wiki.debian.org/SuitesAndReposExtension
---
 reportbug/debbugs.py | 30 ++++++++++++++++++++----------
 reportbug/utils.py   |  1 +
 2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/reportbug/debbugs.py b/reportbug/debbugs.py
index ebde5c4..11831cf 100644
--- a/reportbug/debbugs.py
+++ b/reportbug/debbugs.py
@@ -387,6 +387,16 @@ def handle_debian_release(package, bts, ui, fromaddr, timeout, online=True, http
     archs = None
     version = None
 
+    oldstable = utils.SUITE2CODENAME['oldstable']
+    oldstable_pu = oldstable + '-pu'
+    oldstable_backports = oldstable + '-backports'
+    oldstable_security = oldstable + '-security'
+    stable = utils.SUITE2CODENAME['stable']
+    stable_pu = stable + '-pu'
+    stable_backports = stable + '-backports'
+    stable_security = stable + '-security'
+    testing = utils.SUITE2CODENAME['testing']
+
     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 '
@@ -395,8 +405,8 @@ def handle_debian_release(package, bts, ui, fromaddr, timeout, online=True, http
                       'britney': "testing migration script bugs",
                       'transition': "transition tracking",
                       'unblock': "unblock requests",
-                      'wheezy-pu': "wheezy proposed updates requests",
-                      'jessie-pu': "jessie proposed updates requests",
+                      oldstable_pu: "%s proposed updates requests" % oldstable,
+                      stable_pu: "%s proposed updates requests" % stable,
                       'rm': "Stable/Testing removal requests",
                       'other': "None of the other options",
                   }, 'Choose the request type: ', empty_ok=True)
@@ -441,7 +451,7 @@ def handle_debian_release(package, bts, ui, fromaddr, timeout, online=True, http
         else:
             package = info[12] or package
 
-    if tag in ('binnmu', 'unblock', 'jessie-pu', 'wheezy-pu', 'rm'):
+    if tag in ('binnmu', 'unblock', stable_pu, oldstable_pu, 'rm'):
         # FIXME: pu/rm should lookup the version elsewhere
         version = info and info[0]
         if online and tag.endswith('-pu'):
@@ -480,13 +490,13 @@ def handle_debian_release(package, bts, ui, fromaddr, timeout, online=True, http
     if tag == 'binnmu':
         suite = ui.menu("For which suite are you requesting this binNMU?"
                         "  Don't select anything for \"unstable\"", {
-                            'jessie': "",
-                            'jessie-backports': "",
-                            'jessie-security': "",
-                            'wheezy': "",
-                            'wheezy-backports': "",
-                            'wheezy-security': "",
-                            'stretch': "",
+                            stable: "",
+                            stable_backports: "",
+                            stable_security: "",
+                            oldstable: "",
+                            oldstable_backports: "",
+                            oldstable_security: "",
+                            testing: "",
                             'experimental': "",
                         }, 'Choose the suite: ', empty_ok=True)
         if not suite:
diff --git a/reportbug/utils.py b/reportbug/utils.py
index aaabd40..8928b8c 100644
--- a/reportbug/utils.py
+++ b/reportbug/utils.py
@@ -96,6 +96,7 @@ CODENAME2SUITE = {'squeeze': 'oldoldstable',
                 'stretch': 'testing',
                 'sid': 'unstable',
                 'experimental': 'experimental'}
+SUITE2CODENAME = dict([(suite, codename) for codename, suite in CODENAME2SUITE.items())])
 
 
 def realpath(filename):
-- 
2.6.2

From 03de2511cc765bcc2427a2a337616ccdb4dbd686 Mon Sep 17 00:00:00 2001
From: Paul Wise <p...@debian.org>
Date: Mon, 9 Nov 2015 08:17:25 +0800
Subject: [PATCH 3/3] Add a CODENAME2SUITE entry for buster

---
 reportbug/utils.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/reportbug/utils.py b/reportbug/utils.py
index 8928b8c..9a0977f 100644
--- a/reportbug/utils.py
+++ b/reportbug/utils.py
@@ -94,6 +94,7 @@ CODENAME2SUITE = {'squeeze': 'oldoldstable',
                 'wheezy': 'oldstable',
                 'jessie': 'stable',
                 'stretch': 'testing',
+                'buster': 'next-testing',
                 'sid': 'unstable',
                 'experimental': 'experimental'}
 SUITE2CODENAME = dict([(suite, codename) for codename, suite in CODENAME2SUITE.items())])
-- 
2.6.2

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to