Another fix to suse distro detection in the media.1 parsing

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=368
This commit is contained in:
Charles Arnold 2017-09-18 16:52:32 +00:00 committed by Git OBS Bridge
parent 1c30216228
commit fa3a5c09cb

View File

@ -10,7 +10,7 @@ Index: virt-manager-1.4.2/virtinst/urlfetcher.py
===================================================================
--- virt-manager-1.4.2.orig/virtinst/urlfetcher.py
+++ virt-manager-1.4.2/virtinst/urlfetcher.py
@@ -392,7 +392,20 @@ def _distroFromSUSEContent(fetcher, arch
@@ -392,7 +392,23 @@ def _distroFromSUSEContent(fetcher, arch
try:
cbuf = fetcher.acquireFileContent("content")
except ValueError:
@ -18,21 +18,24 @@ Index: virt-manager-1.4.2/virtinst/urlfetcher.py
+ try:
+ # If no content file, try media.1/products and media.1/build and create
+ # a cbuf with enough info for the content file parsing code below to work
+ pbuf = fetcher.acquireFileContent("media.1/products").rsplit('/', 1)[1].strip()
+ # Older style products format: SUSE-Linux-Enterprise-Server-11-SP4 11.4.4-1.109
+ # Newer style products format: SLES12-SP3 12.3-0
+ pbuf = fetcher.acquireFileContent("media.1/products").strip()
+ pbuf = pbuf.split(' ', 1)[1].strip()
+ # The media.1/products file naming convention changed between SLE11 and SLE12
+ if pbuf.startswith('SLE') or pbuf.startswith('leanos'):
+ pbuf = pbuf.split(' ')[0]
+ pbuf = " ".join(re.split('(\d+)', pbuf, 1))
+ cbuf = "\nDISTRO ," + pbuf.replace('-', ' ')
+ bbuf = fetcher.acquireFileContent("media.1/build").split('-')
+ try:
+ bbuf = fetcher.acquireFileContent("media.1/build").split('-')
+ except:
+ bbuf = ["x86_64"]
+ cbuf = cbuf + "\n" + " ".join(bbuf)
+ except ValueError:
+ return None
distribution = None
distro_version = None
@@ -465,7 +478,8 @@ def _distroFromSUSEContent(fetcher, arch
@@ -465,7 +481,8 @@ def _distroFromSUSEContent(fetcher, arch
dclass = GenericDistro
if distribution:
if re.match(".*SUSE Linux Enterprise Server*", distribution[1]) or \
@ -42,7 +45,7 @@ Index: virt-manager-1.4.2/virtinst/urlfetcher.py
dclass = SLESDistro
if distro_version is None:
distro_version = _parse_sle_distribution(distribution)
@@ -481,7 +495,7 @@ def _distroFromSUSEContent(fetcher, arch
@@ -481,7 +498,7 @@ def _distroFromSUSEContent(fetcher, arch
dclass = CAASPDistro
if distro_version is None:
distro_version = ['VERSION', distribution[1].strip().rsplit(' ')[6]]
@ -51,7 +54,7 @@ Index: virt-manager-1.4.2/virtinst/urlfetcher.py
dclass = OpensuseDistro
if distro_version is None:
distro_version = ['VERSION', distribution[0].strip().rsplit(':')[4]]
@@ -1003,6 +1017,7 @@ class SLDistro(RHELDistro):
@@ -1003,6 +1020,7 @@ class SLDistro(RHELDistro):
class SuseDistro(Distro):
name = "SUSE"
@ -59,7 +62,7 @@ Index: virt-manager-1.4.2/virtinst/urlfetcher.py
_boot_iso_paths = ["boot/boot.iso"]
@@ -1040,8 +1055,11 @@ class SuseDistro(Distro):
@@ -1040,8 +1058,11 @@ class SuseDistro(Distro):
self._xen_kernel_paths = [("boot/%s/vmlinuz-xenpae" % self.arch,
"boot/%s/initrd-xenpae" % self.arch)]
else:
@ -73,7 +76,7 @@ Index: virt-manager-1.4.2/virtinst/urlfetcher.py
def _variantFromVersion(self):
distro_version = self.version_from_content[1].strip()
@@ -1053,7 +1071,7 @@ class SuseDistro(Distro):
@@ -1053,7 +1074,7 @@ class SuseDistro(Distro):
if len(distro_version.split('.', 1)) == 2:
sp_version = 'sp' + distro_version.split('.', 1)[1].strip()
self.os_variant += version
@ -82,7 +85,7 @@ Index: virt-manager-1.4.2/virtinst/urlfetcher.py
self.os_variant += sp_version
elif self.os_variant.startswith("opensuse"):
if len(version) == 8:
@@ -1077,6 +1095,23 @@ class SuseDistro(Distro):
@@ -1077,6 +1098,23 @@ class SuseDistro(Distro):
self.os_variant += "9"
def isValidStore(self):
@ -106,7 +109,7 @@ Index: virt-manager-1.4.2/virtinst/urlfetcher.py
# self.version_from_content is the VERSION line from the contents file
if (not self.version_from_content or
self.version_from_content[1] is None):
@@ -1128,8 +1163,6 @@ class OESDistro(SuseDistro):
@@ -1128,8 +1166,6 @@ class OESDistro(SuseDistro):
urldistro = "oes"