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-3.3.0/virtinst/install/urldetect.py
===================================================================
--- virt-manager-3.3.0.orig/virtinst/install/urldetect.py
+++ virt-manager-3.3.0/virtinst/install/urldetect.py
@@ -276,7 +276,7 @@ class _SUSEContent(object):
                 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])
@@ -597,6 +597,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
 
@@ -684,6 +687,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"]
@@ -930,6 +941,7 @@ def _build_distro_list(osobj):
         _SLESDistro,
         _SLEDDistro,
         _OpensuseDistro,
+        _MICRODistro,
         _CAASPDistro,
         _OESDistro,
         _DebianDistro,
openSUSE Build Service is sponsored by