summaryrefslogtreecommitdiffstats
path: root/lib/python/debian_support.py
diff options
context:
space:
mode:
authorFlorian Weimer <fw@deneb.enyo.de>2011-04-24 17:04:37 +0000
committerFlorian Weimer <fw@deneb.enyo.de>2011-04-24 17:04:37 +0000
commit2bb07d5f97fd765f6575ecee3966a0ef87a9b84f (patch)
treefdf45f40f6a3e6dd9d48ecfc4631d8b23076166a /lib/python/debian_support.py
parent04a7491986b779a604b4fb3fcafd87941a41cafd (diff)
debian_support.releasecodename(): new function
Use it in secmaster.listqueue(). git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@16585 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'lib/python/debian_support.py')
-rw-r--r--lib/python/debian_support.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/python/debian_support.py b/lib/python/debian_support.py
index a983700f56..fc76e892ec 100644
--- a/lib/python/debian_support.py
+++ b/lib/python/debian_support.py
@@ -518,7 +518,24 @@ def getconfig():
if _config is not None:
return _config
_config = json.load(file(findresource("data", "config.json")))
- return _config
+ return _config
+
+_releasecodename = None
+def releasecodename(dist):
+ """Converts a release name to the code name.
+ For instance, "sid" and "unstable" are turned into "sid"."""
+ global _releasecodename
+ if _releasecodename is None:
+ result = {}
+ for (codename, obj) in getconfig()["distributions"].items():
+ result[codename] = codename
+ if "release" in obj:
+ result[obj["release"]] = codename
+ _releasecodename = result
+ try:
+ return _releasecodename[dist]
+ except:
+ raise ValueError("invalid release name: " + repr(dist))
def test():
# Version

© 2014-2024 Faster IT GmbH | imprint | privacy policy