File virtinst-add-slem-detection-support.patch of Package virt-manager

Add support for detecting SUSE Linux Enterprise Micro.
See also the osinfo-db package for the description file.

Index: virt-manager-5.1.0/virtinst/install/urldetect.py
===================================================================
--- virt-manager-5.1.0.orig/virtinst/install/urldetect.py
+++ virt-manager-5.1.0/virtinst/install/urldetect.py
@@ -280,7 +280,7 @@ class _SUSEContent:
                 sle_version = self.product_name.strip().rsplit(' ')[7]
             else:
                 sle_version = self.product_name.strip().rsplit(' ')[4]
-            if len(self.product_name.strip().rsplit(" ")) > 5:
+            if len(self.product_name.strip().rsplit(' ')) > 5 and not " Micro " in self.product_name:
                 if " SAP " in self.product_name:
                     sle_version = (sle_version + '.' + self.product_name.strip().rsplit(' ')[8][2])
                 else:
@@ -592,6 +592,9 @@ class _SuseDistro(_RHELDistro):
 
         version = distro_version.split(".", 1)[0].strip()
 
+        if self._variant_prefix.startswith(("slem")):
+            return self._variant_prefix + distro_version
+
         if self._variant_prefix.startswith(("caasp")):
             return self._variant_prefix + distro_version
 
@@ -679,6 +682,14 @@ class _OpensuseDistro(_SuseDistro):
     famregex = ".*openSUSE.*"
 
 
+class _MICRODistro(_SuseDistro):
+    PRETTY_NAME = "SLES"
+    matching_distros = ["slem"]
+    _variant_prefix = "slem"
+    _suse_regex = [".*SUSE Linux Enterprise Micro*", ".*SUSE Micro*"]
+    famregex = ".*SUSE Linux Enterprise Micro.*"
+
+
 class _CAASPDistro(_SuseDistro):
     PRETTY_NAME = "SLES"
     matching_distros = ["caasp"]
@@ -926,6 +937,7 @@ def _build_distro_list(osobj):
         _SLESDistro,
         _SLEDDistro,
         _OpensuseDistro,
+        _MICRODistro,
         _CAASPDistro,
         _OESDistro,
         _DebianDistro,
openSUSE Build Service is sponsored by