urlfetcher: Fix ubuntu url detection with latest libosinfo
This commit is contained in:
parent
e13f81a7c5
commit
8700fda757
|
@ -284,6 +284,7 @@ class _OsVariant(object):
|
|||
|
||||
self.name = self._os and self._os.get_short_id() or "generic"
|
||||
self.label = self._os and self._os.get_name() or "Generic"
|
||||
self.codename = self._os and self._os.get_codename() or ""
|
||||
|
||||
self.sortby = self._get_sortby()
|
||||
self.urldistro = self._get_urldistro()
|
||||
|
|
|
@ -1120,14 +1120,16 @@ class DebianDistro(Distro):
|
|||
"debian OS")
|
||||
return oses[0].name
|
||||
|
||||
# We grab the distro code name from the libosinfo label, and
|
||||
# see if we can find that in the URL
|
||||
for osobj in oses:
|
||||
# name looks like 'Debian Sarge' or 'Ubuntu Vivid Varvet'
|
||||
if " " not in osobj.label:
|
||||
continue
|
||||
if osobj.codename:
|
||||
# Ubuntu codenames look like 'Warty Warthog'
|
||||
codename = osobj.codename.split()[0].lower()
|
||||
else:
|
||||
if " " not in osobj.label:
|
||||
continue
|
||||
# Debian labels look like 'Debian Sarge'
|
||||
codename = osobj.label.split()[1].lower()
|
||||
|
||||
codename = osobj.label.lower().split()[1]
|
||||
if ("/%s/" % codename) in self.uri:
|
||||
logging.debug("Found codename=%s in the URL string", codename)
|
||||
return osobj.name
|
||||
|
|
Loading…
Reference in New Issue