Hello community,

here is the log from the commit of package python-kiwi for openSUSE:Leap:15.2 
checked in at 2020-04-30 18:51:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/python-kiwi (Old)
 and      /work/SRC/openSUSE:Leap:15.2/.python-kiwi.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-kiwi"

Thu Apr 30 18:51:11 2020 rev:75 rq:797091 version:9.20.5

Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/python-kiwi/python-kiwi.changes        
2020-04-12 15:37:53.293989279 +0200
+++ /work/SRC/openSUSE:Leap:15.2/.python-kiwi.new.2738/python-kiwi.changes      
2020-04-30 18:51:12.640568768 +0200
@@ -1,0 +2,69 @@
+Fri Apr 17 10:21:57 CEST 2020 - [email protected]
+
+- Fixed _get_grub2_mkconfig_tool
+  
+  Last patch on this method breaks the search for alternative
+  mkconfig names. It returns always on the first lookup which
+  could be none. This breaks on systems that uses a different
+  name than grub2-mkconfig, like on Ubuntu.
+  
+-------------------------------------------------------------------
+Thu Apr 16 11:52:26 CEST 2020 - [email protected]
+  
+- Increase spare space on disk repart
+  
+  The sizing of the virtual cylinders in parted seems to be unfavorable,
+  as with some disks and SD cards here the device size is not a multiple
+  of the cylinder size, so the last incomplete cylinder is wasted.
+  If this wasted space is more than 5MiB, kiwi tries to resize indefinitely.
+  Therefore min_additional_mbytes gets increased to prevent running
+  into this situation. This Fixes bsc#1165823
+  
+-------------------------------------------------------------------
+Thu Apr 16 11:24:28 CEST 2020 - [email protected]
+  
+- Fixed return value from _get_grub2_mkconfig_tool
+  
+  The method returned the basename of the tool if it could
+  be found by Path.which(). But the method's scope has been
+  changed in a way that the return value of the method must
+  be the result from Path.which() to allow working on the
+  full path name.
+  
+-------------------------------------------------------------------
+Wed Apr 15 15:53:48 CEST 2020 - [email protected]
+  
+- Make CommandCapabilities.check_version take the longest match
+  
+  This commit ensures that when trying to parse the version of a tool
+  the comparison is done with the longest match for the given regular
+  expression. This solves cases such in `grub2` where the tool name
+  already provides some digit that could be seen as a version.
+  
+-------------------------------------------------------------------
+Wed Apr 15 11:20:45 CEST 2020 - [email protected]
+    
+- Fixed check for grub mkconfig capabilities
+  
+  The check for the capabilities of the tool were applied to
+  the tool installed on the host but the later call of the
+  tool will be done with the tool inside the image root
+  
+-------------------------------------------------------------------
+Wed Apr 15 10:51:44 CEST 2020 - [email protected]
+  
+- Validate use of GRUB_USE_LINUXEFI
+  
+  On systems that uses GRUB_USE_LINUXEFI with grub2 version
+  less than 2.04 there is no support for dynamic EFI
+  environment checking. In this condition we extend the grub
+  setup to add this support. The change kiwi does is as
+  follows:
+  
+  * Apply only on grub < 2.04
+    1. Modify 10_linux to set linux/initrd as variables
+    2. Write hybrid setup as 01_efihybrid
+    
+    This Fixes bsc#1165960 and bsc#1168480
+    
+-------------------------------------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-kiwi.tar.gz ++++++
Binary files old/kiwi-9.20.5/doc/build/latex/kiwi.pdf and 
new/kiwi-9.20.5/doc/build/latex/kiwi.pdf differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.5/doc/build/man/kiwi.8 
new/kiwi-9.20.5/doc/build/man/kiwi.8
--- old/kiwi-9.20.5/doc/build/man/kiwi.8        2020-03-30 17:45:00.000000000 
+0200
+++ new/kiwi-9.20.5/doc/build/man/kiwi.8        2020-04-17 15:35:49.000000000 
+0200
@@ -1,6 +1,6 @@
 .\" Man page generated from reStructuredText.
 .
-.TH "KIWI" "8" "Mar 30, 2020" "9.20.5" "KIWI NG"
+.TH "KIWI" "8" "Apr 17, 2020" "9.20.5" "KIWI NG"
 .SH NAME
 kiwi \- Creating Operating System Images
 .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.5/doc/build/man/kiwi::image::info.8 
new/kiwi-9.20.5/doc/build/man/kiwi::image::info.8
--- old/kiwi-9.20.5/doc/build/man/kiwi::image::info.8   2020-03-30 
17:45:00.000000000 +0200
+++ new/kiwi-9.20.5/doc/build/man/kiwi::image::info.8   2020-04-17 
15:35:49.000000000 +0200
@@ -1,6 +1,6 @@
 .\" Man page generated from reStructuredText.
 .
-.TH "KIWI::IMAGE::INFO" "8" "Mar 30, 2020" "9.20.5" "KIWI NG"
+.TH "KIWI::IMAGE::INFO" "8" "Apr 17, 2020" "9.20.5" "KIWI NG"
 .SH NAME
 kiwi::image::info \- Provide detailed information about an image description
 .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.5/doc/build/man/kiwi::image::resize.8 
new/kiwi-9.20.5/doc/build/man/kiwi::image::resize.8
--- old/kiwi-9.20.5/doc/build/man/kiwi::image::resize.8 2020-03-30 
17:45:00.000000000 +0200
+++ new/kiwi-9.20.5/doc/build/man/kiwi::image::resize.8 2020-04-17 
15:35:49.000000000 +0200
@@ -1,6 +1,6 @@
 .\" Man page generated from reStructuredText.
 .
-.TH "KIWI::IMAGE::RESIZE" "8" "Mar 30, 2020" "9.20.5" "KIWI NG"
+.TH "KIWI::IMAGE::RESIZE" "8" "Apr 17, 2020" "9.20.5" "KIWI NG"
 .SH NAME
 kiwi::image::resize \- Resize disk images to new geometry
 .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.5/doc/build/man/kiwi::result::bundle.8 
new/kiwi-9.20.5/doc/build/man/kiwi::result::bundle.8
--- old/kiwi-9.20.5/doc/build/man/kiwi::result::bundle.8        2020-03-30 
17:45:00.000000000 +0200
+++ new/kiwi-9.20.5/doc/build/man/kiwi::result::bundle.8        2020-04-17 
15:35:49.000000000 +0200
@@ -1,6 +1,6 @@
 .\" Man page generated from reStructuredText.
 .
-.TH "KIWI::RESULT::BUNDLE" "8" "Mar 30, 2020" "9.20.5" "KIWI NG"
+.TH "KIWI::RESULT::BUNDLE" "8" "Apr 17, 2020" "9.20.5" "KIWI NG"
 .SH NAME
 kiwi::result::bundle \- Bundle build results
 .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.5/doc/build/man/kiwi::result::list.8 
new/kiwi-9.20.5/doc/build/man/kiwi::result::list.8
--- old/kiwi-9.20.5/doc/build/man/kiwi::result::list.8  2020-03-30 
17:45:00.000000000 +0200
+++ new/kiwi-9.20.5/doc/build/man/kiwi::result::list.8  2020-04-17 
15:35:49.000000000 +0200
@@ -1,6 +1,6 @@
 .\" Man page generated from reStructuredText.
 .
-.TH "KIWI::RESULT::LIST" "8" "Mar 30, 2020" "9.20.5" "KIWI NG"
+.TH "KIWI::RESULT::LIST" "8" "Apr 17, 2020" "9.20.5" "KIWI NG"
 .SH NAME
 kiwi::result::list \- List build results
 .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.5/doc/build/man/kiwi::system::build.8 
new/kiwi-9.20.5/doc/build/man/kiwi::system::build.8
--- old/kiwi-9.20.5/doc/build/man/kiwi::system::build.8 2020-03-30 
17:45:00.000000000 +0200
+++ new/kiwi-9.20.5/doc/build/man/kiwi::system::build.8 2020-04-17 
15:35:49.000000000 +0200
@@ -1,6 +1,6 @@
 .\" Man page generated from reStructuredText.
 .
-.TH "KIWI::SYSTEM::BUILD" "8" "Mar 30, 2020" "9.20.5" "KIWI NG"
+.TH "KIWI::SYSTEM::BUILD" "8" "Apr 17, 2020" "9.20.5" "KIWI NG"
 .SH NAME
 kiwi::system::build \- Build image in combined prepare and create step
 .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.5/doc/build/man/kiwi::system::create.8 
new/kiwi-9.20.5/doc/build/man/kiwi::system::create.8
--- old/kiwi-9.20.5/doc/build/man/kiwi::system::create.8        2020-03-30 
17:45:00.000000000 +0200
+++ new/kiwi-9.20.5/doc/build/man/kiwi::system::create.8        2020-04-17 
15:35:49.000000000 +0200
@@ -1,6 +1,6 @@
 .\" Man page generated from reStructuredText.
 .
-.TH "KIWI::SYSTEM::CREATE" "8" "Mar 30, 2020" "9.20.5" "KIWI NG"
+.TH "KIWI::SYSTEM::CREATE" "8" "Apr 17, 2020" "9.20.5" "KIWI NG"
 .SH NAME
 kiwi::system::create \- Create image from prepared root system
 .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.5/doc/build/man/kiwi::system::prepare.8 
new/kiwi-9.20.5/doc/build/man/kiwi::system::prepare.8
--- old/kiwi-9.20.5/doc/build/man/kiwi::system::prepare.8       2020-03-30 
17:45:00.000000000 +0200
+++ new/kiwi-9.20.5/doc/build/man/kiwi::system::prepare.8       2020-04-17 
15:35:49.000000000 +0200
@@ -1,6 +1,6 @@
 .\" Man page generated from reStructuredText.
 .
-.TH "KIWI::SYSTEM::PREPARE" "8" "Mar 30, 2020" "9.20.5" "KIWI NG"
+.TH "KIWI::SYSTEM::PREPARE" "8" "Apr 17, 2020" "9.20.5" "KIWI NG"
 .SH NAME
 kiwi::system::prepare \- Prepare image root system
 .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.5/doc/build/man/kiwi::system::update.8 
new/kiwi-9.20.5/doc/build/man/kiwi::system::update.8
--- old/kiwi-9.20.5/doc/build/man/kiwi::system::update.8        2020-03-30 
17:45:00.000000000 +0200
+++ new/kiwi-9.20.5/doc/build/man/kiwi::system::update.8        2020-04-17 
15:35:49.000000000 +0200
@@ -1,6 +1,6 @@
 .\" Man page generated from reStructuredText.
 .
-.TH "KIWI::SYSTEM::UPDATE" "8" "Mar 30, 2020" "9.20.5" "KIWI NG"
+.TH "KIWI::SYSTEM::UPDATE" "8" "Apr 17, 2020" "9.20.5" "KIWI NG"
 .SH NAME
 kiwi::system::update \- Update/Upgrade image root system
 .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kiwi-9.20.5/dracut/modules.d/90kiwi-repart/kiwi-repart-disk.sh 
new/kiwi-9.20.5/dracut/modules.d/90kiwi-repart/kiwi-repart-disk.sh
--- old/kiwi-9.20.5/dracut/modules.d/90kiwi-repart/kiwi-repart-disk.sh  
2020-03-30 15:44:37.000000000 +0200
+++ new/kiwi-9.20.5/dracut/modules.d/90kiwi-repart/kiwi-repart-disk.sh  
2020-04-17 15:33:22.000000000 +0200
@@ -74,15 +74,15 @@
         local disk_have_root_system_mbytes=$((
             disk_root_mbytes + disk_free_mbytes
         ))
-        local min_additional_mbytes=5
+        local min_additional_mbytes=10
     else
         local disk_have_root_system_mbytes=${kiwi_oemrootMB}
         local min_additional_mbytes=$((
             kiwi_oemrootMB - disk_root_mbytes
         ))
     fi
-    if [ "${min_additional_mbytes}" -lt 5 ];then
-        min_additional_mbytes=5
+    if [ "${min_additional_mbytes}" -lt 10 ];then
+        min_additional_mbytes=10
     fi
     # check if we can repart this disk
     if ! check_repart_possible \
@@ -124,7 +124,7 @@
         local disk_have_root_system_mbytes=$((
             disk_root_mbytes + disk_free_mbytes
         ))
-        local min_additional_mbytes=5
+        local min_additional_mbytes=10
     else
         local disk_have_root_system_mbytes=$((
             kiwi_oemrootMB
@@ -133,8 +133,8 @@
             kiwi_oemrootMB - disk_root_mbytes
         ))
     fi
-    if [ "${min_additional_mbytes}" -lt 5 ];then
-        min_additional_mbytes=5
+    if [ "${min_additional_mbytes}" -lt 10 ];then
+        min_additional_mbytes=10
     fi
     # check if we can repart this disk
     if ! check_repart_possible \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.5/kiwi/bootloader/config/grub2.py 
new/kiwi-9.20.5/kiwi/bootloader/config/grub2.py
--- old/kiwi-9.20.5/kiwi/bootloader/config/grub2.py     2020-03-30 
15:44:36.000000000 +0200
+++ new/kiwi-9.20.5/kiwi/bootloader/config/grub2.py     2020-04-17 
15:33:33.000000000 +0200
@@ -15,6 +15,7 @@
 # You should have received a copy of the GNU General Public License
 # along with kiwi.  If not, see <http://www.gnu.org/licenses/>
 #
+from string import Template
 import re
 import os
 import logging
@@ -24,6 +25,7 @@
 from collections import OrderedDict
 
 # project
+from kiwi.utils.command_capabilities import CommandCapabilities
 from kiwi.bootloader.config.base import BootLoaderConfigBase
 from kiwi.bootloader.template.grub2 import BootLoaderTemplateGrub2
 from kiwi.command import Command
@@ -140,6 +142,7 @@
         self.cmdline = None
         self.iso_boot = False
         self.shim_fallback_setup = False
+        self.validate_use_of_linuxefi = False
 
     def write(self):
         """
@@ -230,10 +233,45 @@
         Command.run(
             [
                 'chroot', self.root_mount.mountpoint,
-                self._get_grub2_mkconfig_tool(), '-o',
+                os.path.basename(self._get_grub2_mkconfig_tool()), '-o',
                 config_file.replace(self.root_mount.mountpoint, '')
             ]
         )
+
+        if self.validate_use_of_linuxefi:
+            # On systems that uses GRUB_USE_LINUXEFI with grub2 version
+            # less than 2.04 there is no support for dynamic EFI
+            # environment checking. In this condition we change the
+            # grub config to add this support as follows:
+            #
+            # * Apply only on grub < 2.04
+            #    1. Modify grub.cfg to set linux/initrd as variables
+            #    2. Prepend hybrid setup to select linux vs. linuxefi on demand
+            #
+            # Please note this is a one time modification done by kiwi
+            # Any subsequent call of the grub config tool will overwrite
+            # the setup and disables dynamic EFI environment checking
+            # at boot time
+            if not CommandCapabilities.check_version(
+                self._get_grub2_mkconfig_tool(),
+                version_waterline=(2, 4), raise_on_error=False
+            ):
+                with open(config_file) as grub_config_file:
+                    grub_config = grub_config_file.read()
+                    grub_config = re.sub(
+                        r'([ \t]+)linux[efi]*([ \t]+)', r'\1$linux\2',
+                        grub_config
+                    )
+                    grub_config = re.sub(
+                        r'([ \t]+)initrd[efi]*([ \t]+)', r'\1$initrd\2',
+                        grub_config
+                    )
+                with open(config_file, 'w') as grub_config_file:
+                    grub_config_file.write(
+                        Template(self.grub2.header_hybrid).substitute()
+                    )
+                    grub_config_file.write(grub_config)
+
         if self.root_reference:
             if self.root_filesystem_is_overlay or \
                Defaults.is_buildservice_worker():
@@ -575,12 +613,13 @@
                 use_linuxefi_implemented = Command.run(
                     [
                         'grep', '-q', 'GRUB_USE_LINUXEFI',
-                        Defaults.get_grub_config_tool()
+                        self._get_grub2_mkconfig_tool()
                     ], raise_on_error=False
                 )
                 if use_linuxefi_implemented.returncode == 0:
                     grub_default_entries['GRUB_USE_LINUXEFI'] = 'true'
                     grub_default_entries['GRUB_USE_INITRDEFI'] = 'true'
+                    self.validate_use_of_linuxefi = True
         if self.xml_state.build_type.get_btrfs_root_is_snapshot():
             grub_default_entries['SUSE_BTRFS_SNAPSHOT_BOOTING'] = 'true'
         if self.custom_args.get('boot_is_crypto'):
@@ -589,7 +628,7 @@
         enable_blscfg_implemented = Command.run(
             [
                 'grep', '-q', 'GRUB_ENABLE_BLSCFG',
-                Defaults.get_grub_config_tool()
+                self._get_grub2_mkconfig_tool()
             ], raise_on_error=False
         )
         if enable_blscfg_implemented.returncode == 0:
@@ -836,8 +875,11 @@
 
     def _get_grub2_mkconfig_tool(self):
         for grub_mkconfig_tool in ['grub2-mkconfig', 'grub-mkconfig']:
-            if Path.which(grub_mkconfig_tool, root_dir=self.root_dir):
-                return grub_mkconfig_tool
+            grub_mkconfig_file_path = Path.which(
+                grub_mkconfig_tool, root_dir=self.root_dir
+            )
+            if grub_mkconfig_file_path:
+                return grub_mkconfig_file_path
 
     def _get_grub2_boot_path(self):
         return self.boot_dir + '/boot/' + self.boot_directory_name
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.5/kiwi/defaults.py 
new/kiwi-9.20.5/kiwi/defaults.py
--- old/kiwi-9.20.5/kiwi/defaults.py    2020-03-30 15:44:37.000000000 +0200
+++ new/kiwi-9.20.5/kiwi/defaults.py    2020-04-16 15:42:49.000000000 +0200
@@ -369,20 +369,6 @@
             return 'grub'
 
     @staticmethod
-    def get_grub_config_tool():
-        """
-        Provides full qualified path name to grub mkconfig utility
-
-        :return: file path name
-
-        :rtype: str
-        """
-        for grub_mkconfig_tool in ['grub2-mkconfig', 'grub-mkconfig']:
-            grub_mkconfig_tool_file_path = Path.which(grub_mkconfig_tool)
-            if grub_mkconfig_tool_file_path:
-                return grub_mkconfig_tool_file_path
-
-    @staticmethod
     def get_grub_basic_modules(multiboot):
         """
         Provides list of basic grub modules
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.5/kiwi/utils/command_capabilities.py 
new/kiwi-9.20.5/kiwi/utils/command_capabilities.py
--- old/kiwi-9.20.5/kiwi/utils/command_capabilities.py  2020-03-30 
15:30:26.000000000 +0200
+++ new/kiwi-9.20.5/kiwi/utils/command_capabilities.py  2020-04-16 
15:43:12.000000000 +0200
@@ -103,10 +103,11 @@
         try:
             command = Command.run(arguments)
             for line in command.output.splitlines():
-                match = re.search('[0-9]+(\.[0-9]+)*', line)
-                if match:
+                matches = re.findall(r'([0-9]+(\.[0-9]+)*)', line)
+                if matches:
+                    match = max([m[0] for m in matches], key=len)
                     version_info = tuple(
-                        int(elt) for elt in match.group(0).split('.')
+                        int(elt) for elt in match.split('.')
                     )
                     break
             if version_info is None:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.5/kiwi/version.py 
new/kiwi-9.20.5/kiwi/version.py
--- old/kiwi-9.20.5/kiwi/version.py     2020-03-30 17:34:20.000000000 +0200
+++ new/kiwi-9.20.5/kiwi/version.py     2020-04-17 15:33:33.000000000 +0200
@@ -19,4 +19,4 @@
 Global version information used in kiwi and the package
 """
 __version__ = '9.20.5'
-__githash__ = 'e2df529eb48aea565758dc7db0ddffcadc7053c4'
+__githash__ = '1348dd4013674901db78093954d3175747e51981'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kiwi-9.20.5/test/unit/bootloader/config/grub2_test.py 
new/kiwi-9.20.5/test/unit/bootloader/config/grub2_test.py
--- old/kiwi-9.20.5/test/unit/bootloader/config/grub2_test.py   2020-03-30 
15:44:36.000000000 +0200
+++ new/kiwi-9.20.5/test/unit/bootloader/config/grub2_test.py   2020-04-16 
15:43:24.000000000 +0200
@@ -1,4 +1,5 @@
 import io
+import os
 import logging
 from mock import (
     patch, call, MagicMock, Mock
@@ -12,6 +13,7 @@
 from kiwi.xml_state import XMLState
 from kiwi.xml_description import XMLDescription
 from kiwi.bootloader.config.grub2 import BootLoaderConfigGrub2
+from kiwi.bootloader.template.grub2 import BootLoaderTemplateGrub2
 
 from kiwi.exceptions import (
     KiwiBootLoaderGrubPlatformError,
@@ -78,7 +80,9 @@
             return_value='0xffffffff'
         )
 
+        grub_template = BootLoaderTemplateGrub2()
         self.grub2 = Mock()
+        self.grub2.header_hybrid = grub_template.header_hybrid
         kiwi.bootloader.config.grub2.BootLoaderTemplateGrub2 = Mock(
             return_value=self.grub2
         )
@@ -410,10 +414,12 @@
     @patch.object(BootLoaderConfigGrub2, '_mount_system')
     @patch.object(BootLoaderConfigGrub2, '_copy_grub_config_to_efi_path')
     @patch('kiwi.bootloader.config.grub2.Command.run')
+    @patch('kiwi.bootloader.config.grub2.Path.which')
     def test_setup_disk_image_config(
-        self, mock_Command_run, mock_copy_grub_config_to_efi_path,
-        mock_mount_system
+        self, mock_Path_which, mock_Command_run,
+        mock_copy_grub_config_to_efi_path, mock_mount_system
     ):
+        mock_Path_which.return_value = '/path/to/grub2-mkconfig'
         self.firmware.efi_mode = Mock(
             return_value='uefi'
         )
@@ -448,6 +454,62 @@
                 'root=overlay:UUID=ID'
             )
 
+    @patch.object(BootLoaderConfigGrub2, '_mount_system')
+    @patch.object(BootLoaderConfigGrub2, '_copy_grub_config_to_efi_path')
+    @patch('kiwi.bootloader.config.grub2.Command.run')
+    @patch('kiwi.bootloader.config.grub2.CommandCapabilities.check_version')
+    @patch('kiwi.bootloader.config.grub2.Path.which')
+    def test_setup_disk_image_config_validate_linuxefi(
+        self, mock_Path_which, mock_CommandCapabilities_check_version,
+        mock_Command_run, mock_copy_grub_config_to_efi_path,
+        mock_mount_system
+    ):
+        mock_Path_which.return_value = '/path/to/grub2-mkconfig'
+        mock_CommandCapabilities_check_version.return_value = False
+        self.firmware.efi_mode = Mock(
+            return_value='uefi'
+        )
+        self.bootloader.validate_use_of_linuxefi = True
+        self.bootloader.root_mount = Mock()
+        self.bootloader.root_mount.mountpoint = 'root_mount_point'
+        self.bootloader.efi_mount = Mock()
+        self.bootloader.efi_mount.mountpoint = 'efi_mount_point'
+        with patch('builtins.open', create=True) as mock_open:
+            mock_open.return_value = MagicMock(spec=io.IOBase)
+            file_handle = mock_open.return_value.__enter__.return_value
+            file_handle.read.return_value = os.linesep.join(
+                [
+                    '\tlinuxefi ${rel_dirname}/${basename} ...',
+                    '\tlinux ${rel_dirname}/${basename} ...',
+                    '\tinitrdefi ${rel_dirname}/${initrd}',
+                    '\tinitrd ${rel_dirname}/${initrd}'
+                ]
+            )
+            self.bootloader.setup_disk_image_config(
+                boot_options={
+                    'root_device': 'rootdev', 'boot_device': 'bootdev'
+                }
+            )
+            assert file_handle.write.call_args_list == [
+                call(
+                    'set linux=linux\n'
+                    'set initrd=initrd\n'
+                    'if [ "${grub_cpu}" = "x86_64" -o '
+                    '"${grub_cpu}" = "i386" ];then\n'
+                    '    if [ "${grub_platform}" = "efi" ]; then\n'
+                    '        set linux=linuxefi\n'
+                    '        set initrd=initrdefi\n'
+                    '    fi\n'
+                    'fi\n'
+                ),
+                call(
+                    '\t$linux ${rel_dirname}/${basename} ...\n'
+                    '\t$linux ${rel_dirname}/${basename} ...\n'
+                    '\t$initrd ${rel_dirname}/${initrd}\n'
+                    '\t$initrd ${rel_dirname}/${initrd}'
+                )
+            ]
+
     def test_setup_install_image_config_standard(self):
         self.bootloader.multiboot = False
         self.bootloader.setup_install_image_config(self.mbrid)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kiwi-9.20.5/test/unit/utils/command_capabilities_test.py 
new/kiwi-9.20.5/test/unit/utils/command_capabilities_test.py
--- old/kiwi-9.20.5/test/unit/utils/command_capabilities_test.py        
2020-03-30 15:30:26.000000000 +0200
+++ new/kiwi-9.20.5/test/unit/utils/command_capabilities_test.py        
2020-04-16 15:43:12.000000000 +0200
@@ -95,6 +95,15 @@
         ])
 
     @patch('kiwi.command.Command.run')
+    def test_check_version_complex_pattern(self, mock_run):
+        command_type = namedtuple('command', ['output'])
+        mock_run.return_value = command_type(
+            output="grub2-mkconfig (GRUB2) 2.02\n"
+        )
+        assert CommandCapabilities.check_version('command', (2, 2)) is True
+        assert CommandCapabilities.check_version('command', (2, 4)) is False
+
+    @patch('kiwi.command.Command.run')
     def test_check_version_no_match(self, mock_run):
         command_type = namedtuple('command', ['output'])
         mock_run.return_value = command_type(


Reply via email to