From 535f36cb25c0ec252ee9a553dc3128d3c632b656 Mon Sep 17 00:00:00 2001 From: Charles Arnold Date: Fri, 15 Sep 2017 21:07:50 +0000 Subject: [PATCH] Add .treeinfo detection. At some point the SLE15 media will have this. OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=366 --- virtinst-add-caasp-support.patch | 12 +++-- virtinst-add-sle15-detection-support.patch | 61 +++++++++++++++++++--- 2 files changed, 62 insertions(+), 11 deletions(-) diff --git a/virtinst-add-caasp-support.patch b/virtinst-add-caasp-support.patch index 1f2aeccf..2582495c 100644 --- a/virtinst-add-caasp-support.patch +++ b/virtinst-add-caasp-support.patch @@ -24,13 +24,15 @@ Index: virt-manager-1.4.2/virtinst/urlfetcher.py else: self.os_variant += "9" -@@ -1090,6 +1096,9 @@ class SuseDistro(Distro): - return osobj.name - return self.os_variant +@@ -1098,6 +1104,11 @@ class SLESDistro(SuseDistro): + class SLEDDistro(SuseDistro): + urldistro = "sled" ++ +class CAASPDistro(SuseDistro): + urldistro = "caasp" + ++ + class OESDistro(SuseDistro): + urldistro = "oes" - class SLESDistro(SuseDistro): - urldistro = "sles" diff --git a/virtinst-add-sle15-detection-support.patch b/virtinst-add-sle15-detection-support.patch index ed96e871..0cb7715d 100644 --- a/virtinst-add-sle15-detection-support.patch +++ b/virtinst-add-sle15-detection-support.patch @@ -1,11 +1,10 @@ References: bsc#1054986 With SLE15 and openSUSE 15 the content file has been removed from the media. This file was used for SUSE distro version and arch detection. Now detection -must be done by parsing the media.1/products file for distro version and the -media.1/build file for the arch. The media.1/products and media.1/build files -have always been around so the entire _distroFromSUSEContent could be rewritten -(and simplified) to only check them. The products file format did change -between 11-SP4 and 12. SLE10 has no build file. +must be done by parsing the .treeinfo file. +We must continue to keep the content parsing code for the older distros. +As a fallback, detection is also setup to look at the media.1/products and +media.1/build files. Index: virt-manager-1.4.2/virtinst/urlfetcher.py =================================================================== @@ -52,7 +51,15 @@ Index: virt-manager-1.4.2/virtinst/urlfetcher.py dclass = OpensuseDistro if distro_version is None: distro_version = ['VERSION', distribution[0].strip().rsplit(':')[4]] -@@ -1040,8 +1054,11 @@ class SuseDistro(Distro): +@@ -1003,6 +1017,7 @@ class SLDistro(RHELDistro): + + class SuseDistro(Distro): + name = "SUSE" ++ uses_treeinfo = True + + _boot_iso_paths = ["boot/boot.iso"] + +@@ -1040,8 +1055,11 @@ class SuseDistro(Distro): self._xen_kernel_paths = [("boot/%s/vmlinuz-xenpae" % self.arch, "boot/%s/initrd-xenpae" % self.arch)] else: @@ -66,3 +73,45 @@ 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): + if len(distro_version.split('.', 1)) == 2: + sp_version = 'sp' + distro_version.split('.', 1)[1].strip() + self.os_variant += version +- if sp_version: ++ if sp_version and sp_version != 'sp0': + self.os_variant += sp_version + elif self.os_variant.startswith("opensuse"): + if len(version) == 8: +@@ -1077,6 +1095,23 @@ class SuseDistro(Distro): + self.os_variant += "9" + + def isValidStore(self): ++ if self.treeinfo: ++ ret = False ++ if self.urldistro: ++ family = self.treeinfo.get("general", "family") ++ if "SUSE Linux Enterprise Server" in family and 'sles' in self.urldistro or \ ++ "SUSE Linux Enterprise Desktop" in family and 'sled' in self.urldistro or \ ++ "SUSE Containers" in family and 'caasp' in self.urldistro or \ ++ "openSUSE" in family and 'opensuse' in self.urldistro or \ ++ "Open Enterprise" in family and 'oes' in self.urldistro: ++ ret = True ++ if ret: ++ version = self.treeinfo.get("general", "version") ++ distro_version = ['VERSION', version] ++ self.version_from_content = distro_version ++ self._variantFromVersion() ++ return ret ++ + # 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): + urldistro = "oes" + + +-# Suse image store is harder - we fetch the kernel RPM and a helper +-# RPM and then munge bits together to generate a initrd + class OpensuseDistro(SuseDistro): + urldistro = "opensuse" +