Hello community,

here is the log from the commit of package python-kiwi for openSUSE:Factory 
checked in at 2020-04-27 23:30:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-kiwi (Old)
 and      /work/SRC/openSUSE:Factory/.python-kiwi.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-kiwi"

Mon Apr 27 23:30:25 2020 rev:61 rq:797077 version:9.20.9

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-kiwi/python-kiwi.changes  2020-04-14 
16:31:05.176094956 +0200
+++ /work/SRC/openSUSE:Factory/.python-kiwi.new.2738/python-kiwi.changes        
2020-04-27 23:30:35.794611885 +0200
@@ -1,0 +2,112 @@
+Fri Apr 17 11:06:19 CEST 2020 - Marcus Schäfer <m...@suse.de>
+
+- Bump version: 9.20.8 → 9.20.9
+
+-------------------------------------------------------------------
+Fri Apr 17 10:21:57 CEST 2020 - Marcus Schäfer <m...@suse.de>
+
+- 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 12:13:39 CEST 2020 - Marcus Schäfer <m...@suse.de>
+
+- Bump version: 9.20.7 → 9.20.8
+
+-------------------------------------------------------------------
+Thu Apr 16 11:52:26 CEST 2020 - Marcus Schäfer <m...@suse.de>
+
+- 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 - Marcus Schäfer <m...@suse.de>
+
+- 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.
+
+-------------------------------------------------------------------
+Thu Apr 16 10:26:29 CEST 2020 - Marcus Schäfer <m...@suse.de>
+
+- Bump version: 9.20.6 → 9.20.7
+
+-------------------------------------------------------------------
+Wed Apr 15 15:53:48 CEST 2020 - David Cassany <dcass...@suse.com>
+
+- 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 - Marcus Schäfer <m...@suse.de>
+
+- 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 - Marcus Schäfer <m...@suse.de>
+
+- 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
+
+-------------------------------------------------------------------
+Tue Apr 14 16:25:48 CEST 2020 - Jan Löser <jan.loe...@elektrobit.com>
+
+- Fixed typo in docstring
+
+  Istall -> Install
+
+-------------------------------------------------------------------
+Sat Apr 11 18:18:02 CEST 2020 - Marcus Schäfer <m...@suse.de>
+
+- Create qcow2 images in two steps
+
+  The creation of the qcow2 format was done in one qemu-img
+  convert call. That call instructs qemu to compress and
+  convert in one call. The downside of this approach is that
+  not all qcow2 options can be used. For example the setup
+  of:
+
+  <type ... formatoptions="preallocation=metadata"/>
+
+  failed the build with an error message that compression and
+  preallocation is not possible at the same time. Thus this patch
+  changes the way the qcow2 image is created to be done in two
+  steps. The first step converts the format without compression
+  and therefore allows for any format option to be used. The
+  second call only applies the compression and leads to the
+  final result.
+
+-------------------------------------------------------------------

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

Other differences:
------------------
++++++ python-kiwi.spec ++++++
--- /var/tmp/diff_new_pack.f2glgK/_old  2020-04-27 23:30:39.390618904 +0200
+++ /var/tmp/diff_new_pack.f2glgK/_new  2020-04-27 23:30:39.394618912 +0200
@@ -43,7 +43,7 @@
 %endif
 
 Name:           python-kiwi
-Version:        9.20.6
+Version:        9.20.9
 Provides:       kiwi-schema = 7.1
 Release:        0
 Url:            https://github.com/SUSE/kiwi

++++++ python-kiwi.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.6/.bumpversion.cfg 
new/kiwi-9.20.9/.bumpversion.cfg
--- old/kiwi-9.20.6/.bumpversion.cfg    2020-04-03 16:11:57.000000000 +0200
+++ new/kiwi-9.20.9/.bumpversion.cfg    2020-04-17 11:06:19.000000000 +0200
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 9.20.6
+current_version = 9.20.9
 commit = True
 tag = True
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.6/PKG-INFO new/kiwi-9.20.9/PKG-INFO
--- old/kiwi-9.20.6/PKG-INFO    2020-04-03 16:13:32.000000000 +0200
+++ new/kiwi-9.20.9/PKG-INFO    2020-04-17 11:07:58.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: kiwi
-Version: 9.20.6
+Version: 9.20.9
 Summary: KIWI - Appliance Builder (next generation)
 Home-page: https://osinside.github.io/kiwi
 Author: Marcus Schaefer
Binary files old/kiwi-9.20.6/doc/build/latex/kiwi.pdf and 
new/kiwi-9.20.9/doc/build/latex/kiwi.pdf differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.6/doc/build/man/kiwi.8 
new/kiwi-9.20.9/doc/build/man/kiwi.8
--- old/kiwi-9.20.6/doc/build/man/kiwi.8        2020-04-03 16:13:31.000000000 
+0200
+++ new/kiwi-9.20.9/doc/build/man/kiwi.8        2020-04-17 11:07:56.000000000 
+0200
@@ -1,6 +1,6 @@
 .\" Man page generated from reStructuredText.
 .
-.TH "KIWI" "8" "Apr 03, 2020" "9.20.6" "KIWI NG"
+.TH "KIWI" "8" "Apr 17, 2020" "9.20.9" "KIWI NG"
 .SH NAME
 kiwi \- Creating Operating System Images
 .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.6/doc/build/man/kiwi::image::info.8 
new/kiwi-9.20.9/doc/build/man/kiwi::image::info.8
--- old/kiwi-9.20.6/doc/build/man/kiwi::image::info.8   2020-04-03 
16:13:31.000000000 +0200
+++ new/kiwi-9.20.9/doc/build/man/kiwi::image::info.8   2020-04-17 
11:07:56.000000000 +0200
@@ -1,6 +1,6 @@
 .\" Man page generated from reStructuredText.
 .
-.TH "KIWI::IMAGE::INFO" "8" "Apr 03, 2020" "9.20.6" "KIWI NG"
+.TH "KIWI::IMAGE::INFO" "8" "Apr 17, 2020" "9.20.9" "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.6/doc/build/man/kiwi::image::resize.8 
new/kiwi-9.20.9/doc/build/man/kiwi::image::resize.8
--- old/kiwi-9.20.6/doc/build/man/kiwi::image::resize.8 2020-04-03 
16:13:31.000000000 +0200
+++ new/kiwi-9.20.9/doc/build/man/kiwi::image::resize.8 2020-04-17 
11:07:56.000000000 +0200
@@ -1,6 +1,6 @@
 .\" Man page generated from reStructuredText.
 .
-.TH "KIWI::IMAGE::RESIZE" "8" "Apr 03, 2020" "9.20.6" "KIWI NG"
+.TH "KIWI::IMAGE::RESIZE" "8" "Apr 17, 2020" "9.20.9" "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.6/doc/build/man/kiwi::result::bundle.8 
new/kiwi-9.20.9/doc/build/man/kiwi::result::bundle.8
--- old/kiwi-9.20.6/doc/build/man/kiwi::result::bundle.8        2020-04-03 
16:13:31.000000000 +0200
+++ new/kiwi-9.20.9/doc/build/man/kiwi::result::bundle.8        2020-04-17 
11:07:56.000000000 +0200
@@ -1,6 +1,6 @@
 .\" Man page generated from reStructuredText.
 .
-.TH "KIWI::RESULT::BUNDLE" "8" "Apr 03, 2020" "9.20.6" "KIWI NG"
+.TH "KIWI::RESULT::BUNDLE" "8" "Apr 17, 2020" "9.20.9" "KIWI NG"
 .SH NAME
 kiwi::result::bundle \- Bundle build results
 .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.6/doc/build/man/kiwi::result::list.8 
new/kiwi-9.20.9/doc/build/man/kiwi::result::list.8
--- old/kiwi-9.20.6/doc/build/man/kiwi::result::list.8  2020-04-03 
16:13:31.000000000 +0200
+++ new/kiwi-9.20.9/doc/build/man/kiwi::result::list.8  2020-04-17 
11:07:56.000000000 +0200
@@ -1,6 +1,6 @@
 .\" Man page generated from reStructuredText.
 .
-.TH "KIWI::RESULT::LIST" "8" "Apr 03, 2020" "9.20.6" "KIWI NG"
+.TH "KIWI::RESULT::LIST" "8" "Apr 17, 2020" "9.20.9" "KIWI NG"
 .SH NAME
 kiwi::result::list \- List build results
 .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.6/doc/build/man/kiwi::system::build.8 
new/kiwi-9.20.9/doc/build/man/kiwi::system::build.8
--- old/kiwi-9.20.6/doc/build/man/kiwi::system::build.8 2020-04-03 
16:13:31.000000000 +0200
+++ new/kiwi-9.20.9/doc/build/man/kiwi::system::build.8 2020-04-17 
11:07:56.000000000 +0200
@@ -1,6 +1,6 @@
 .\" Man page generated from reStructuredText.
 .
-.TH "KIWI::SYSTEM::BUILD" "8" "Apr 03, 2020" "9.20.6" "KIWI NG"
+.TH "KIWI::SYSTEM::BUILD" "8" "Apr 17, 2020" "9.20.9" "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.6/doc/build/man/kiwi::system::create.8 
new/kiwi-9.20.9/doc/build/man/kiwi::system::create.8
--- old/kiwi-9.20.6/doc/build/man/kiwi::system::create.8        2020-04-03 
16:13:31.000000000 +0200
+++ new/kiwi-9.20.9/doc/build/man/kiwi::system::create.8        2020-04-17 
11:07:56.000000000 +0200
@@ -1,6 +1,6 @@
 .\" Man page generated from reStructuredText.
 .
-.TH "KIWI::SYSTEM::CREATE" "8" "Apr 03, 2020" "9.20.6" "KIWI NG"
+.TH "KIWI::SYSTEM::CREATE" "8" "Apr 17, 2020" "9.20.9" "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.6/doc/build/man/kiwi::system::prepare.8 
new/kiwi-9.20.9/doc/build/man/kiwi::system::prepare.8
--- old/kiwi-9.20.6/doc/build/man/kiwi::system::prepare.8       2020-04-03 
16:13:31.000000000 +0200
+++ new/kiwi-9.20.9/doc/build/man/kiwi::system::prepare.8       2020-04-17 
11:07:56.000000000 +0200
@@ -1,6 +1,6 @@
 .\" Man page generated from reStructuredText.
 .
-.TH "KIWI::SYSTEM::PREPARE" "8" "Apr 03, 2020" "9.20.6" "KIWI NG"
+.TH "KIWI::SYSTEM::PREPARE" "8" "Apr 17, 2020" "9.20.9" "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.6/doc/build/man/kiwi::system::update.8 
new/kiwi-9.20.9/doc/build/man/kiwi::system::update.8
--- old/kiwi-9.20.6/doc/build/man/kiwi::system::update.8        2020-04-03 
16:13:31.000000000 +0200
+++ new/kiwi-9.20.9/doc/build/man/kiwi::system::update.8        2020-04-17 
11:07:56.000000000 +0200
@@ -1,6 +1,6 @@
 .\" Man page generated from reStructuredText.
 .
-.TH "KIWI::SYSTEM::UPDATE" "8" "Apr 03, 2020" "9.20.6" "KIWI NG"
+.TH "KIWI::SYSTEM::UPDATE" "8" "Apr 17, 2020" "9.20.9" "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.6/dracut/modules.d/90kiwi-repart/kiwi-repart-disk.sh 
new/kiwi-9.20.9/dracut/modules.d/90kiwi-repart/kiwi-repart-disk.sh
--- old/kiwi-9.20.6/dracut/modules.d/90kiwi-repart/kiwi-repart-disk.sh  
2020-03-27 10:41:44.000000000 +0100
+++ new/kiwi-9.20.9/dracut/modules.d/90kiwi-repart/kiwi-repart-disk.sh  
2020-04-17 11:06:15.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.6/kiwi/bootloader/config/grub2.py 
new/kiwi-9.20.9/kiwi/bootloader/config/grub2.py
--- old/kiwi-9.20.6/kiwi/bootloader/config/grub2.py     2020-03-27 
10:37:41.000000000 +0100
+++ new/kiwi-9.20.9/kiwi/bootloader/config/grub2.py     2020-04-17 
11:06:15.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.6/kiwi/bootloader/install/base.py 
new/kiwi-9.20.9/kiwi/bootloader/install/base.py
--- old/kiwi-9.20.6/kiwi/bootloader/install/base.py     2020-02-28 
15:13:35.000000000 +0100
+++ new/kiwi-9.20.9/kiwi/bootloader/install/base.py     2020-04-16 
10:26:10.000000000 +0200
@@ -53,7 +53,7 @@
 
     def install(self):
         """
-        Istall bootloader on self.device
+        Install bootloader on self.device
 
         Implementation in specialized bootloader install class required
         """
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.6/kiwi/defaults.py 
new/kiwi-9.20.9/kiwi/defaults.py
--- old/kiwi-9.20.6/kiwi/defaults.py    2020-03-27 10:41:44.000000000 +0100
+++ new/kiwi-9.20.9/kiwi/defaults.py    2020-04-16 10:26:10.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.6/kiwi/storage/subformat/qcow2.py 
new/kiwi-9.20.9/kiwi/storage/subformat/qcow2.py
--- old/kiwi-9.20.6/kiwi/storage/subformat/qcow2.py     2020-02-28 
15:13:35.000000000 +0100
+++ new/kiwi-9.20.9/kiwi/storage/subformat/qcow2.py     2020-04-16 
10:26:10.000000000 +0200
@@ -14,7 +14,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 tempfile import NamedTemporaryFile
 
 # project
 from kiwi.storage.subformat.base import DiskFormatBase
@@ -40,11 +40,19 @@
         """
         Create qcow2 disk format
         """
+        intermediate = NamedTemporaryFile()
         Command.run(
             [
-                'qemu-img', 'convert', '-c', '-f', 'raw', self.diskname,
+                'qemu-img', 'convert', '-f', 'raw', self.diskname,
                 '-O', self.image_format
             ] + self.options + [
+                intermediate.name
+            ]
+        )
+        Command.run(
+            [
+                'qemu-img', 'convert', '-c', '-f', self.image_format,
+                intermediate.name, '-O', self.image_format,
                 self.get_target_file_path_for_format(self.image_format)
             ]
         )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.6/kiwi/utils/command_capabilities.py 
new/kiwi-9.20.9/kiwi/utils/command_capabilities.py
--- old/kiwi-9.20.6/kiwi/utils/command_capabilities.py  2020-02-28 
15:13:35.000000000 +0100
+++ new/kiwi-9.20.9/kiwi/utils/command_capabilities.py  2020-04-16 
10:26:10.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.6/kiwi/version.py 
new/kiwi-9.20.9/kiwi/version.py
--- old/kiwi-9.20.6/kiwi/version.py     2020-04-03 16:11:57.000000000 +0200
+++ new/kiwi-9.20.9/kiwi/version.py     2020-04-17 11:06:19.000000000 +0200
@@ -18,5 +18,5 @@
 """
 Global version information used in kiwi and the package
 """
-__version__ = '9.20.6'
-__githash__ = '974662934da9d4ff7d2f1d952bcf0d252ad12d80'
+__version__ = '9.20.9'
+__githash__ = '947b741748ea0d5d0df8da26337bbb7070f7fdee'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kiwi-9.20.6/kiwi.egg-info/PKG-INFO 
new/kiwi-9.20.9/kiwi.egg-info/PKG-INFO
--- old/kiwi-9.20.6/kiwi.egg-info/PKG-INFO      2020-04-03 16:13:32.000000000 
+0200
+++ new/kiwi-9.20.9/kiwi.egg-info/PKG-INFO      2020-04-17 11:07:57.000000000 
+0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: kiwi
-Version: 9.20.6
+Version: 9.20.9
 Summary: KIWI - Appliance Builder (next generation)
 Home-page: https://osinside.github.io/kiwi
 Author: Marcus Schaefer
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kiwi-9.20.6/test/unit/bootloader/config/grub2_test.py 
new/kiwi-9.20.9/test/unit/bootloader/config/grub2_test.py
--- old/kiwi-9.20.6/test/unit/bootloader/config/grub2_test.py   2020-03-27 
10:37:41.000000000 +0100
+++ new/kiwi-9.20.9/test/unit/bootloader/config/grub2_test.py   2020-04-16 
12:13:33.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.6/test/unit/storage/subformat/qcow2_test.py 
new/kiwi-9.20.9/test/unit/storage/subformat/qcow2_test.py
--- old/kiwi-9.20.6/test/unit/storage/subformat/qcow2_test.py   2020-02-28 
15:13:35.000000000 +0100
+++ new/kiwi-9.20.9/test/unit/storage/subformat/qcow2_test.py   2020-04-16 
10:26:10.000000000 +0200
@@ -1,6 +1,6 @@
-from mock import patch
-
-import mock
+from mock import (
+    patch, Mock, call
+)
 
 from kiwi.storage.subformat.qcow2 import DiskFormatQcow2
 
@@ -9,13 +9,13 @@
     @patch('platform.machine')
     def setup(self, mock_machine):
         mock_machine.return_value = 'x86_64'
-        xml_data = mock.Mock()
-        xml_data.get_name = mock.Mock(
+        xml_data = Mock()
+        xml_data.get_name = Mock(
             return_value='some-disk-image'
         )
-        self.xml_state = mock.Mock()
+        self.xml_state = Mock()
         self.xml_state.xml_data = xml_data
-        self.xml_state.get_image_version = mock.Mock(
+        self.xml_state.get_image_version = Mock(
             return_value='1.2.3'
         )
         self.disk_format = DiskFormatQcow2(
@@ -27,18 +27,33 @@
         assert self.disk_format.options == ['-o', 'option=value']
 
     @patch('kiwi.storage.subformat.qcow2.Command.run')
-    def test_create_image_format(self, mock_command):
+    @patch('kiwi.storage.subformat.qcow2.NamedTemporaryFile')
+    def test_create_image_format(self, mock_NamedTemporaryFile, mock_command):
+        tmpfile = Mock()
+        tmpfile.name = 'tmpfile'
+        mock_NamedTemporaryFile.return_value = tmpfile
         self.disk_format.create_image_format()
-        mock_command.assert_called_once_with(
-            [
-                'qemu-img', 'convert', '-c', '-f', 'raw',
-                'target_dir/some-disk-image.x86_64-1.2.3.raw', '-O', 'qcow2',
-                'target_dir/some-disk-image.x86_64-1.2.3.qcow2'
-            ]
-        )
+        assert mock_command.call_args_list == [
+            call(
+                [
+                    'qemu-img', 'convert', '-f', 'raw',
+                    'target_dir/some-disk-image.x86_64-1.2.3.raw',
+                    '-O', 'qcow2',
+                    'tmpfile'
+                ]
+            ),
+            call(
+                [
+                    'qemu-img', 'convert', '-c', '-f', 'qcow2',
+                    'tmpfile',
+                    '-O', 'qcow2',
+                    'target_dir/some-disk-image.x86_64-1.2.3.qcow2'
+                ]
+            )
+        ]
 
     def test_store_to_result(self):
-        result = mock.Mock()
+        result = Mock()
         self.disk_format.store_to_result(result)
         result.add.assert_called_once_with(
             compress=False,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kiwi-9.20.6/test/unit/utils/command_capabilities_test.py 
new/kiwi-9.20.9/test/unit/utils/command_capabilities_test.py
--- old/kiwi-9.20.6/test/unit/utils/command_capabilities_test.py        
2020-02-28 15:13:35.000000000 +0100
+++ new/kiwi-9.20.9/test/unit/utils/command_capabilities_test.py        
2020-04-16 10:26:10.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