2
# Copyright (C) 2013 Canonical Ltd.
4
# Author: Scott Moser <scott.moser@canonical.com>
6
# Simplestreams is free software: you can redistribute it and/or modify it
7
# under the terms of the GNU Affero General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or (at your
9
# option) any later version.
11
# Simplestreams is distributed in the hope that it will be useful, but
12
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
14
# License for more details.
16
# You should have received a copy of the GNU Affero General Public License
17
# along with Simplestreams. If not, see <http://www.gnu.org/licenses/>.
19
# this is only used if no distro_info available
21
"hardy": {'version': "8.04", 'devname': "Hardy Heron"},
22
"lucid": {'version': "10.04", 'devname': "Lucid Lynx"},
23
"oneiric": {'version': "11.10", 'devname': "Oneiric Ocelot"},
24
"precise": {'version': "12.04", 'devname': "Precise Pangolin"},
25
"quantal": {'version': "12.10", 'devname': "Quantal Quetzal"},
26
"raring": {'version': "13.04", 'devname': "Raring Ringtail"},
27
"saucy": {'version': "13.10", 'devname': "Saucy Salamander"},
28
"trusty": {'version': "14.04", 'devname': "Trusty Tahr"},
29
"utopic": {'version': "14.10", 'devname': "Utopic Unicorn"},
30
"vivid": {'version': "15.04", 'devname': "Vivid Vervet"},
31
"vivid": {'version': "15.10", 'devname': "Wily Werewolf"},
34
from simplestreams.log import LOG
37
def get_ubuntu_info(date=None):
38
# this returns a sorted list of dicts
39
# each dict has information about an ubuntu release.
40
# Notably absent is any date information (release or eol)
41
# its harder than you'd like to get at data via the distro_info library
43
# The resultant dicts looks like this:
44
# {'codename': 'saucy', 'devel': True,
45
# 'full_codename': 'Saucy Salamander',
46
# 'fullname': 'Ubuntu 13.10 "Saucy Salamander"',
47
# 'lts': False, 'supported': True, 'version': '13.10'}
49
udi = distro_info.UbuntuDistroInfo()
50
# 'all' is a attribute, not a function. so we can't ask for it formated.
51
# s2all and us2all are lists, the value of each is the index
52
# where that release should fall in 'all'.
54
s2all = [allcn.index(c) for c in
55
udi.supported(result="codename", date=date)]
56
us2all = [allcn.index(c) for c in
57
udi.unsupported(result="codename", date=date)]
59
def getall(result, date):
60
ret = [None for f in range(0, len(allcn))]
61
for i, r in enumerate(udi.supported(result=result, date=date)):
63
for i, r in enumerate(udi.unsupported(result=result, date=date)):
65
return [r for r in ret if r is not None]
67
codenames = getall(result="codename", date=date)
68
fullnames = getall(result="fullname", date=date)
69
lts = [bool('LTS' in f) for f in fullnames]
70
versions = [x.replace(" LTS", "") for x in
71
getall(result="release", date=date)]
72
full_codenames = [x.split('"')[1] for x in fullnames]
73
supported = udi.supported(date=date)
75
devel = udi.devel(date=date)
76
except distro_info.DistroDataOutdated as e:
77
LOG.warn("distro_info.UbuntuDistroInfo() raised exception (%s)."
78
" Using stable release as devel.", e)
79
devel = udi.stable(date=date)
81
for i, codename in enumerate(codenames):
82
ret.append({'lts': lts[i], 'version': versions[i],
83
'supported': codename in supported,
84
'fullname': fullnames[i], 'codename': codename,
85
'devname': full_codenames[i],
86
'devel': bool(codename == devel)})
93
info = get_ubuntu_info()
96
if r['codename'] < "hardy":
98
REL2VER[r['codename']] = {x: r[x] for x in ("version", "devname")}
101
REL2VER = HARDCODED_REL2VER