From ae851fca36320c6c0b232cd91ae266a9a8abd530 Mon Sep 17 00:00:00 2001
From: openeuler-ci-bot <80474298@qq.com>
Date: Wed, 28 Oct 2020 20:30:20 +0800
Subject: [PATCH 1/4] [patch tracking] 20201028203007658356 -
https://github.com/OSInside/kiwi/commit/a77ef5212e999d9b72d8e92992343bb32e568685
---
...f5212e999d9b72d8e92992343bb32e568685.patch | 882 ++++++++++++++++++
1 file changed, 882 insertions(+)
create mode 100644 a77ef5212e999d9b72d8e92992343bb32e568685.patch
diff --git a/a77ef5212e999d9b72d8e92992343bb32e568685.patch b/a77ef5212e999d9b72d8e92992343bb32e568685.patch
new file mode 100644
index 0000000..c941947
--- /dev/null
+++ b/a77ef5212e999d9b72d8e92992343bb32e568685.patch
@@ -0,0 +1,882 @@
+diff --git a/build-tests/s390/sle15/test-image-disk/appliance.kiwi b/build-tests/s390/sle15/test-image-disk/appliance.kiwi
+index 03009c86d6..a3863a9e4f 100644
+--- a/build-tests/s390/sle15/test-image-disk/appliance.kiwi
++++ b/build-tests/s390/sle15/test-image-disk/appliance.kiwi
+@@ -10,7 +10,7 @@
+
+
+
+-
++
+
+
+ 1.15.1
+@@ -30,11 +30,11 @@
+
+
+
+-
+-
++
++
+
+ true
+- 4096
++ 512
+
+
+
+diff --git a/build-tests/s390/suse/test-image-disk-simple/appliance.kiwi b/build-tests/s390/suse/test-image-disk-simple/appliance.kiwi
+deleted file mode 100644
+index 25da4ce49e..0000000000
+--- a/build-tests/s390/suse/test-image-disk-simple/appliance.kiwi
++++ /dev/null
+@@ -1,64 +0,0 @@
+-
+-
+-
+-
+- Marcus Schäfer
+- ms@suse.com
+- Simple disk test build
+-
+-
+- 1.15.1
+- zypper
+- en_US
+- us
+- Europe/Berlin
+- true
+- false
+-
+-
+- false
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+diff --git a/build-tests/s390/suse/test-image-disk-simple/config.sh b/build-tests/s390/suse/test-image-disk-simple/config.sh
+deleted file mode 100644
+index 3f41e7cf8e..0000000000
+--- a/build-tests/s390/suse/test-image-disk-simple/config.sh
++++ /dev/null
+@@ -1,42 +0,0 @@
+-#!/bin/bash
+-#================
+-# FILE : config.sh
+-#----------------
+-# PROJECT : OpenSuSE KIWI Image System
+-# COPYRIGHT : (c) 2006 SUSE LINUX Products GmbH. All rights reserved
+-# :
+-# AUTHOR : Marcus Schaefer
+-# :
+-# BELONGS TO : Operating System images
+-# :
+-# DESCRIPTION : configuration script for SUSE based
+-# : operating systems
+-# :
+-# :
+-# STATUS : BETA
+-#----------------
+-#======================================
+-# Functions...
+-#--------------------------------------
+-test -f /.kconfig && . /.kconfig
+-test -f /.profile && . /.profile
+-
+-#======================================
+-# Greeting...
+-#--------------------------------------
+-echo "Configure image: [$kiwi_iname]..."
+-
+-#======================================
+-# Setup baseproduct link
+-#--------------------------------------
+-suseSetupProduct
+-
+-#======================================
+-# Activate services
+-#--------------------------------------
+-suseInsertService sshd
+-
+-#======================================
+-# Setup default target, multi-user
+-#--------------------------------------
+-baseSetRunlevel 3
+diff --git a/build-tests/s390/suse/test-image-disk/appliance.kiwi b/build-tests/s390/suse/test-image-disk/appliance.kiwi
+index e966776b94..39e42cae61 100644
+--- a/build-tests/s390/suse/test-image-disk/appliance.kiwi
++++ b/build-tests/s390/suse/test-image-disk/appliance.kiwi
+@@ -1,24 +1,40 @@
+
+
++
++
+
+
+- Marcus Schaefer
++ Marcus Schäfer
+ ms@suse.com
+- Disk to run on emulated DASD(FBA mode)
++ Virtual and Physical disk image test
+
++
++
++
++
+
+- 1.1.0
++ 1.15.1
+ zypper
+- true
+- false
+ en_US
+ us
+ Europe/Berlin
+-
+-
++ true
++ false
++
++
++
++
++ false
++
++
++
++
++
++
++
+
+ true
+- 4096
++ 512
+
+
+
+@@ -30,7 +46,7 @@
+
+
+
+-
++
+
+
+
+@@ -38,7 +54,6 @@
+
+
+
+-
+
+
+
+@@ -60,9 +75,11 @@
+
+
+
++
+
+
+
++
+
+
+
+diff --git a/build-tests/s390/suse/test-image-disk/config.sh b/build-tests/s390/suse/test-image-disk/config.sh
+index e11f266720..3f41e7cf8e 100644
+--- a/build-tests/s390/suse/test-image-disk/config.sh
++++ b/build-tests/s390/suse/test-image-disk/config.sh
+@@ -1,4 +1,20 @@
+ #!/bin/bash
++#================
++# FILE : config.sh
++#----------------
++# PROJECT : OpenSuSE KIWI Image System
++# COPYRIGHT : (c) 2006 SUSE LINUX Products GmbH. All rights reserved
++# :
++# AUTHOR : Marcus Schaefer
++# :
++# BELONGS TO : Operating System images
++# :
++# DESCRIPTION : configuration script for SUSE based
++# : operating systems
++# :
++# :
++# STATUS : BETA
++#----------------
+ #======================================
+ # Functions...
+ #--------------------------------------
+diff --git a/kiwi/bootloader/config/base.py b/kiwi/bootloader/config/base.py
+index 01f72804a6..7b57e98a9a 100644
+--- a/kiwi/bootloader/config/base.py
++++ b/kiwi/bootloader/config/base.py
+@@ -487,10 +487,16 @@ def _mount_system(
+ self.root_mount = MountManager(
+ device=root_device
+ )
+- self.boot_mount = MountManager(
+- device=boot_device,
+- mountpoint=self.root_mount.mountpoint + '/boot'
+- )
++ if 's390' in self.arch:
++ self.boot_mount = MountManager(
++ device=boot_device,
++ mountpoint=self.root_mount.mountpoint + '/boot/zipl'
++ )
++ else:
++ self.boot_mount = MountManager(
++ device=boot_device,
++ mountpoint=self.root_mount.mountpoint + '/boot'
++ )
+ if efi_device:
+ self.efi_mount = MountManager(
+ device=efi_device,
+diff --git a/kiwi/bootloader/config/grub2.py b/kiwi/bootloader/config/grub2.py
+index af65046986..f31df25e8e 100644
+--- a/kiwi/bootloader/config/grub2.py
++++ b/kiwi/bootloader/config/grub2.py
+@@ -39,6 +39,7 @@
+ KiwiBootLoaderGrubModulesError,
+ KiwiBootLoaderGrubSecureBootError,
+ KiwiBootLoaderGrubFontError,
++ KiwiDiskGeometryError
+ )
+
+ log = logging.getLogger('kiwi')
+@@ -102,6 +103,7 @@ def post_init(self, custom_args):
+ self.firmware = FirmWare(
+ self.xml_state
+ )
++ self.target_table_type = self.firmware.get_partition_table_type()
+
+ self.live_type = self.xml_state.build_type.get_flags()
+ if not self.live_type:
+@@ -553,15 +555,19 @@ def _setup_zipl2grub_conf(self):
+ zipl_config = zipl_config_file.read()
+ zipl_config = re.sub(
+ r'(:menu)',
+- r':menu\n'
+- r' targettype = {0}\n'
+- r' targetbase = {1}\n'
+- r' targetblocksize = {2}\n'
+- r' targetoffset = {3}'.format(
++ ':menu\n'
++ ' targettype = {0}\n'
++ ' targetbase = {1}\n'
++ ' targetblocksize = {2}\n'
++ ' targetoffset = {3}\n'
++ ' {4}'.format(
+ target_type,
+ self.custom_args['targetbase'],
+ target_blocksize or 512,
+- self._get_partition_start_sector(
++ self._get_partition_start(
++ self.custom_args['targetbase']
++ ),
++ self._get_disk_geometry(
+ self.custom_args['targetbase']
+ )
+ ),
+@@ -1132,6 +1138,7 @@ def _fix_grub_to_support_dynamic_efi_and_bios_boot(self, config_file):
+ def _fix_grub_root_device_reference(self, config_file, boot_options):
+ if self.root_reference:
+ if self.root_filesystem_is_overlay or \
++ self.arch.startswith('s390') or \
+ Defaults.is_buildservice_worker():
+ # grub2-mkconfig has no idea how the correct root= setup is
+ # for disk images created with overlayroot enabled or in a
+@@ -1205,15 +1212,67 @@ def _fix_grub_loader_entries_boot_cmdline(self):
+ with open(menu_entry_file, 'w') as grub_menu_entry_file:
+ grub_menu_entry_file.write(menu_entry)
+
+- def _get_partition_start_sector(self, disk_device):
+- bash_command = ' '.join(
+- [
+- 'sfdisk', '--dump', disk_device,
+- '|', 'grep', '"1 :"',
+- '|', 'cut', '-f1', '-d,',
+- '|', 'cut', '-f2', '-d='
++ def _get_partition_start(self, disk_device):
++ if self.target_table_type == 'dasd':
++ blocks = self._get_dasd_disk_geometry_element(
++ disk_device, 'blocks per track'
++ )
++ bash_command = [
++ 'fdasd', '-f', '-s', '-p', disk_device,
++ '|', 'grep', '"^ "',
++ '|', 'head', '-n', '1',
++ '|', 'tr', '-s', '" "'
+ ]
++ fdasd_call = Command.run(
++ ['bash', '-c', ' '.join(bash_command)]
++ )
++ fdasd_output = fdasd_call.output
++ try:
++ start_track = int(fdasd_output.split(' ')[2].lstrip())
++ except Exception:
++ raise KiwiDiskGeometryError(
++ 'unknown partition format: %s' % fdasd_output
++ )
++ return '{0}'.format(start_track * blocks)
++ else:
++ bash_command = ' '.join(
++ [
++ 'sfdisk', '--dump', disk_device,
++ '|', 'grep', '"1 :"',
++ '|', 'cut', '-f1', '-d,',
++ '|', 'cut', '-f2', '-d='
++ ]
++ )
++ return Command.run(
++ ['bash', '-c', bash_command]
++ ).output.strip()
++
++ def _get_disk_geometry(self, disk_device):
++ disk_geometry = ''
++ if self.target_table_type == 'dasd':
++ disk_geometry = 'targetgeometry = {0},{1},{2}'.format(
++ self._get_dasd_disk_geometry_element(
++ disk_device, 'cylinders'
++ ),
++ self._get_dasd_disk_geometry_element(
++ disk_device, 'tracks per cylinder'
++ ),
++ self._get_dasd_disk_geometry_element(
++ disk_device, 'blocks per track'
++ )
++ )
++ return disk_geometry
++
++ def _get_dasd_disk_geometry_element(self, disk_device, search):
++ fdasd = ['fdasd', '-f', '-p', disk_device]
++ bash_command = fdasd + ['|', 'grep', '"' + search + '"']
++ fdasd_call = Command.run(
++ ['bash', '-c', ' '.join(bash_command)]
+ )
+- return Command.run(
+- ['bash', '-c', bash_command]
+- ).output.strip()
++ fdasd_output = fdasd_call.output
++ try:
++ return int(fdasd_output.split(':')[1].lstrip())
++ except Exception:
++ raise KiwiDiskGeometryError(
++ 'unknown format for disk geometry: %s' % fdasd_output
++ )
+diff --git a/kiwi/bootloader/install/grub2.py b/kiwi/bootloader/install/grub2.py
+index 8d395a5cc2..5d908a7b87 100644
+--- a/kiwi/bootloader/install/grub2.py
++++ b/kiwi/bootloader/install/grub2.py
+@@ -160,10 +160,16 @@ def install(self): # noqa: C901
+ self.root_mount = MountManager(
+ device=self.custom_args['root_device']
+ )
+- self.boot_mount = MountManager(
+- device=self.custom_args['boot_device'],
+- mountpoint=self.root_mount.mountpoint + '/boot'
+- )
++ if 's390' in self.arch:
++ self.boot_mount = MountManager(
++ device=self.custom_args['boot_device'],
++ mountpoint=self.root_mount.mountpoint + '/boot/zipl'
++ )
++ else:
++ self.boot_mount = MountManager(
++ device=self.custom_args['boot_device'],
++ mountpoint=self.root_mount.mountpoint + '/boot'
++ )
+ if self.custom_args.get('efi_device'):
+ self.efi_mount = MountManager(
+ device=self.custom_args['efi_device'],
+@@ -230,18 +236,57 @@ def install(self): # noqa: C901
+ Path.wipe(grubenv)
+
+ # install grub2 boot code
+- Command.run(
+- [
+- 'chroot', self.root_mount.mountpoint,
+- self._get_grub2_install_tool_name(self.root_mount.mountpoint)
+- ] + self.install_arguments + [
+- '--directory', module_directory,
+- '--boot-directory', boot_directory,
+- '--target', self.target,
+- '--modules', self.modules,
+- self.install_device
+- ]
+- )
++ if self.firmware.get_partition_table_type() == 'dasd':
++ # On s390 and in CDL mode (4k DASD) the call of grub2-install
++ # does not work because grub2-install is not able to identify
++ # a 4k fdasd partitioned device as a grub supported device
++ # and fails. As grub2-install is only used to invoke
++ # grub2-zipl-setup and has no other job to do we can
++ # circumvent this problem by directly calling grub2-zipl-setup
++ # instead.
++ Command.run(
++ [
++ 'chroot', self.root_mount.mountpoint,
++ 'grub2-zipl-setup', '--keep'
++ ]
++ )
++ zipl_config_file = ''.join(
++ [
++ self.root_mount.mountpoint, '/boot/zipl/config'
++ ]
++ )
++ zipl2grub_config_file_orig = ''.join(
++ [
++ self.root_mount.mountpoint,
++ '/etc/default/zipl2grub.conf.in.orig'
++ ]
++ )
++ if os.path.exists(zipl2grub_config_file_orig):
++ Command.run(
++ [
++ 'mv', zipl2grub_config_file_orig,
++ zipl2grub_config_file_orig.replace('.orig', '')
++ ]
++ )
++ if os.path.exists(zipl_config_file):
++ Command.run(
++ ['mv', zipl_config_file, zipl_config_file + '.kiwi']
++ )
++ else:
++ Command.run(
++ [
++ 'chroot', self.root_mount.mountpoint,
++ self._get_grub2_install_tool_name(
++ self.root_mount.mountpoint
++ )
++ ] + self.install_arguments + [
++ '--directory', module_directory,
++ '--boot-directory', boot_directory,
++ '--target', self.target,
++ '--modules', self.modules,
++ self.install_device
++ ]
++ )
+
+ if self.firmware and self.firmware.efi_mode() == 'uefi':
+ shim_install = self._get_shim_install_tool_name(
+diff --git a/kiwi/builder/disk.py b/kiwi/builder/disk.py
+index e9d7801665..6d9058e71d 100644
+--- a/kiwi/builder/disk.py
++++ b/kiwi/builder/disk.py
+@@ -656,7 +656,10 @@ def _get_exclude_list_for_root_data_sync(self, device_map):
+ exclude_list.append(
+ '{0}/.*'.format(self.spare_part_mountpoint.lstrip(os.sep))
+ )
+- if 'boot' in device_map:
++ if 'boot' in device_map and 's390' in self.arch:
++ exclude_list.append('boot/zipl/*')
++ exclude_list.append('boot/zipl/.*')
++ elif 'boot' in device_map:
+ exclude_list.append('boot/*')
+ exclude_list.append('boot/.*')
+ if 'efi' in device_map:
+@@ -708,6 +711,8 @@ def _build_boot_filesystems(self, device_map):
+ if not boot_filesystem:
+ boot_filesystem = self.requested_filesystem
+ boot_directory = self.root_dir + '/boot/'
++ if 's390' in self.arch:
++ boot_directory = self.root_dir + '/boot/zipl/'
+ log.info(
+ 'Creating boot(%s) filesystem on %s',
+ boot_filesystem, device_map['boot'].get_device()
+@@ -898,7 +903,10 @@ def _write_generic_fstab(self, device_map, setup):
+ custom_root_mount_args, fs_check_interval
+ )
+ if device_map.get('boot'):
+- boot_mount_point = '/boot'
++ if 's390' in self.arch:
++ boot_mount_point = '/boot/zipl'
++ else:
++ boot_mount_point = '/boot'
+ self._add_generic_fstab_entry(
+ device_map['boot'].get_device(), boot_mount_point
+ )
+diff --git a/kiwi/firmware.py b/kiwi/firmware.py
+index bf07e19911..c34508bf8f 100644
+--- a/kiwi/firmware.py
++++ b/kiwi/firmware.py
+@@ -63,9 +63,7 @@ def get_partition_table_type(self):
+ :rtype: str
+ """
+ if 's390' in self.arch:
+- if self.zipl_target_type and 'LDL' in self.zipl_target_type:
+- return 'dasd'
+- elif self.zipl_target_type and 'CDL' in self.zipl_target_type:
++ if self.zipl_target_type and 'CDL' in self.zipl_target_type:
+ return 'dasd'
+ else:
+ return 'msdos'
+diff --git a/kiwi/schema/kiwi.rnc b/kiwi/schema/kiwi.rnc
+index fd2598d774..a9dc8d22c7 100644
+--- a/kiwi/schema/kiwi.rnc
++++ b/kiwi/schema/kiwi.rnc
+@@ -2198,9 +2198,10 @@ div {
+ ]
+ k.bootloader.targettype.attribute =
+ ## The device type of the disk on s390. For zFCP
+- ## devices use SCSI, for emulated DASD devices use FBA
++ ## devices use SCSI, for emulated DASD devices use FBA,
++ ## for 4k DASD devices use CDL
+ attribute targettype {
+- "FBA" | "SCSI"
++ "FBA" | "SCSI" | "CDL"
+ }
+ >> sch:pattern [ id = "targettype" is-a = "bootloader_name_type"
+ sch:param [ name = "attr" value = "targettype" ]
+diff --git a/kiwi/schema/kiwi.rng b/kiwi/schema/kiwi.rng
+index 368aeaf569..270e2eaa83 100644
+--- a/kiwi/schema/kiwi.rng
++++ b/kiwi/schema/kiwi.rng
+@@ -3365,10 +3365,12 @@ is displayed. The attribute is available for the grub loader.
+
+
+ The device type of the disk on s390. For zFCP
+-devices use SCSI, for emulated DASD devices use FBA
++devices use SCSI, for emulated DASD devices use FBA,
++for 4k DASD devices use CDL
+
+ FBA
+ SCSI
++ CDL
+
+
+
+diff --git a/test/unit/bootloader/config/base_test.py b/test/unit/bootloader/config/base_test.py
+index 5cb14ad948..8d66fc9a93 100644
+--- a/test/unit/bootloader/config/base_test.py
++++ b/test/unit/bootloader/config/base_test.py
+@@ -277,6 +277,37 @@ def test_get_gfxmode_other_loader(self, mock_get_vga):
+ assert self.bootloader.get_gfxmode('some-loader') == \
+ mock_get_vga.return_value
+
++ @patch('kiwi.bootloader.config.base.MountManager')
++ def test_mount_system_s390(self, mock_MountManager):
++ tmp_mount = MagicMock()
++ proc_mount = MagicMock()
++ dev_mount = MagicMock()
++ root_mount = MagicMock()
++ root_mount.mountpoint = 'root_mount_point'
++ root_mount.device = 'rootdev'
++ boot_mount = MagicMock()
++ boot_mount.device = 'bootdev'
++
++ mount_managers = [
++ proc_mount, dev_mount, tmp_mount, boot_mount, root_mount
++ ]
++
++ def mount_managers_effect(**args):
++ return mount_managers.pop()
++
++ self.bootloader.arch = 's390x'
++
++ mock_MountManager.side_effect = mount_managers_effect
++ self.bootloader._mount_system(
++ 'rootdev', 'bootdev'
++ )
++ assert mock_MountManager.call_args_list == [
++ call(device='rootdev'),
++ call(device='bootdev', mountpoint='root_mount_point/boot/zipl'),
++ call(device='/dev', mountpoint='root_mount_point/dev'),
++ call(device='/proc', mountpoint='root_mount_point/proc')
++ ]
++
+ @patch('kiwi.bootloader.config.base.MountManager')
+ def test_mount_system(self, mock_MountManager):
+ tmp_mount = MagicMock()
+diff --git a/test/unit/bootloader/config/grub2_test.py b/test/unit/bootloader/config/grub2_test.py
+index ab08b7e139..d1a2252458 100644
+--- a/test/unit/bootloader/config/grub2_test.py
++++ b/test/unit/bootloader/config/grub2_test.py
+@@ -1,6 +1,7 @@
+ import io
+ import os
+ import logging
++from collections import namedtuple
+ from mock import (
+ patch, call, MagicMock, Mock
+ )
+@@ -21,7 +22,8 @@
+ KiwiTemplateError,
+ KiwiBootLoaderGrubDataError,
+ KiwiBootLoaderGrubFontError,
+- KiwiBootLoaderGrubModulesError
++ KiwiBootLoaderGrubModulesError,
++ KiwiDiskGeometryError
+ )
+
+
+@@ -36,6 +38,9 @@ def inject_fixtures(self, caplog):
+ def setup(
+ self, mock_machine, mock_theme, mock_firmware
+ ):
++ self.command_type = namedtuple(
++ 'command_return_type', ['output']
++ )
+ self.find_grub = {}
+ self.os_exists = {
+ 'root_dir/boot/grub2/fonts/unicode.pf2': True,
+@@ -342,7 +347,7 @@ def test_copy_grub_config_to_efi_path(
+ @patch('shutil.copy')
+ @patch('os.path.exists')
+ @patch('kiwi.bootloader.config.grub2.Command.run')
+- def test_setup_zipl2grub_conf(
++ def test_setup_zipl2grub_conf_512_byte_target(
+ self, mock_Command_run, mock_exists, mock_shutil_copy
+ ):
+ path_return_values = [True, False]
+@@ -352,6 +357,7 @@ def path_exists(arg):
+
+ command = Mock()
+ command.output = ' 2048'
++ self.bootloader.target_table_type = 'msdos'
+ mock_Command_run.return_value = command
+ mock_exists.side_effect = path_exists
+ xml_state = MagicMock()
+@@ -389,6 +395,120 @@ def path_exists(arg):
+ 'root_dir/etc/default/zipl2grub.conf.in'
+ )
+
++ @patch('shutil.copy')
++ @patch('os.path.exists')
++ @patch('kiwi.bootloader.config.grub2.Command.run')
++ def test_setup_zipl2grub_conf_4096_byte_target(
++ self, mock_Command_run, mock_exists, mock_shutil_copy
++ ):
++ path_return_values = [True, False]
++ command_return_values = [
++ self.command_type(
++ output=' blocks per track .....: 12\n'
++ ),
++ self.command_type(
++ output=' /dev/loop01 2 6401 6400 1 Linux native\n'
++ ),
++ self.command_type(
++ output=' cylinders ............: 10017\n'
++ ),
++ self.command_type(
++ output=' tracks per cylinder ..: 15\n'
++ ),
++ self.command_type(
++ output=' blocks per track .....: 12\n'
++ )
++ ]
++
++ def path_exists(arg):
++ return path_return_values.pop(0)
++
++ def command_run(arg):
++ return command_return_values.pop(0)
++
++ self.bootloader.target_table_type = 'dasd'
++ mock_Command_run.side_effect = command_run
++ mock_exists.side_effect = path_exists
++ xml_state = MagicMock()
++ xml_state.get_build_type_bootloader_targettype = Mock(
++ return_value='CDL'
++ )
++ xml_state.build_type.get_target_blocksize = Mock(
++ return_value=4096
++ )
++ self.bootloader.xml_state = xml_state
++ with open('../data/etc/default/zipl2grub.conf.in') as zipl_grub:
++ zipl_config = zipl_grub.read()
++ with patch('builtins.open', create=True) as mock_open:
++ file_handle = mock_open.return_value.__enter__.return_value
++ file_handle.read.return_value = zipl_config
++ self.bootloader._setup_zipl2grub_conf()
++ assert \
++ ' targettype = CDL\n' \
++ ' targetbase = rootdev\n' \
++ ' targetblocksize = 4096\n' \
++ ' targetoffset = 24\n' \
++ ' targetgeometry = 10017,15,12' \
++ in file_handle.write.call_args[0][0]
++
++ assert mock_Command_run.call_args_list == [
++ call(
++ [
++ 'bash', '-c',
++ 'fdasd -f -p rootdev | grep "blocks per track"'
++ ]
++ ),
++ call(
++ [
++ 'bash', '-c',
++ 'fdasd -f -s -p rootdev | grep "^ " | '
++ 'head -n 1 | tr -s " "'
++ ]
++ ),
++ call(
++ [
++ 'bash', '-c', 'fdasd -f -p rootdev | grep "cylinders"'
++ ]
++ ),
++ call(
++ [
++ 'bash', '-c',
++ 'fdasd -f -p rootdev | grep "tracks per cylinder"'
++ ]
++ ),
++ call(
++ [
++ 'bash', '-c',
++ 'fdasd -f -p rootdev | grep "blocks per track"'
++ ]
++ )
++ ]
++
++ @patch('kiwi.bootloader.config.grub2.Command.run')
++ @patch.object(BootLoaderConfigGrub2, '_get_dasd_disk_geometry_element')
++ def test_get_partition_start_raises(
++ self, mock_get_dasd_disk_geometry_element, mock_Command_run
++ ):
++ self.bootloader.target_table_type = 'dasd'
++ mock_Command_run.return_value = self.command_type(
++ output='bogus data'
++ )
++ with raises(KiwiDiskGeometryError):
++ self.bootloader._get_partition_start('/dev/disk')
++
++ @patch('kiwi.bootloader.config.grub2.Command.run')
++ def test_get_dasd_disk_geometry_element_raises(
++ self, mock_Command_run
++ ):
++ self.bootloader.target_table_type = 'dasd'
++ mock_Command_run.return_value = self.command_type(
++ output='bogus data'
++ )
++ with raises(KiwiDiskGeometryError):
++ self.bootloader._get_dasd_disk_geometry_element(
++ '/dev/disk', 'tracks per cylinder'
++ )
++
+ @patch('os.path.exists')
+ @patch('kiwi.bootloader.config.grub2.SysConfig')
+ @patch('kiwi.bootloader.config.grub2.Command.run')
+diff --git a/test/unit/bootloader/install/grub2_test.py b/test/unit/bootloader/install/grub2_test.py
+index 47840abca9..2a6815c3d2 100644
+--- a/test/unit/bootloader/install/grub2_test.py
++++ b/test/unit/bootloader/install/grub2_test.py
+@@ -182,6 +182,52 @@ def side_effect(device, mountpoint=None):
+ ]
+ )
+
++ @patch('kiwi.bootloader.install.grub2.Path.wipe')
++ @patch('kiwi.bootloader.install.grub2.Path.which')
++ @patch('kiwi.bootloader.install.grub2.Command.run')
++ @patch('kiwi.bootloader.install.grub2.MountManager')
++ @patch('kiwi.bootloader.install.grub2.Defaults.get_grub_path')
++ @patch('kiwi.bootloader.install.grub2.glob.glob')
++ @patch('os.path.exists')
++ def test_install_on_dasd_disk(
++ self, mock_os_path_exists, mock_glob, mock_grub_path,
++ mock_mount_manager, mock_command, mock_which, mock_wipe
++ ):
++ mock_os_path_exists.return_value = True
++ self.firmware.get_partition_table_type = mock.Mock(
++ return_value='dasd'
++ )
++
++ def side_effect(device, mountpoint=None):
++ return self.mount_managers.pop()
++
++ mock_mount_manager.side_effect = side_effect
++
++ self.bootloader.install()
++ self.bootloader.root_mount.mount.assert_called_once_with()
++ self.bootloader.boot_mount.mount.assert_called_once_with()
++ assert mock_command.call_args_list == [
++ call(
++ [
++ 'chroot', 'tmp_root', 'grub2-zipl-setup', '--keep'
++ ]
++ ),
++ call(
++ [
++ 'mv',
++ 'tmp_root/etc/default/zipl2grub.conf.in.orig',
++ 'tmp_root/etc/default/zipl2grub.conf.in'
++ ]
++ ),
++ call(
++ [
++ 'mv',
++ 'tmp_root/boot/zipl/config',
++ 'tmp_root/boot/zipl/config.kiwi'
++ ]
++ )
++ ]
++
+ @patch('kiwi.bootloader.install.grub2.Path.wipe')
+ @patch('kiwi.bootloader.install.grub2.Path.which')
+ @patch('kiwi.bootloader.install.grub2.Command.run')
+diff --git a/test/unit/firmware_test.py b/test/unit/firmware_test.py
+index ccd4a6ce2e..277d7df60b 100644
+--- a/test/unit/firmware_test.py
++++ b/test/unit/firmware_test.py
+@@ -35,8 +35,6 @@ def setup(self, mock_platform):
+ mock_platform.return_value = 's390x'
+ xml_state.build_type.get_firmware.return_value = None
+ xml_state.get_build_type_bootloader_targettype = mock.Mock()
+- xml_state.get_build_type_bootloader_targettype.return_value = 'LDL'
+- self.firmware_s390_ldl = FirmWare(xml_state)
+
+ xml_state.get_build_type_bootloader_targettype.return_value = 'CDL'
+ self.firmware_s390_cdl = FirmWare(xml_state)
+@@ -65,7 +63,6 @@ def test_get_partition_table_type(self):
+ assert self.firmware_bios.get_partition_table_type() == 'msdos'
+ assert self.firmware_efi.get_partition_table_type() == 'gpt'
+ assert self.firmware_efi_mbr.get_partition_table_type() == 'msdos'
+- assert self.firmware_s390_ldl.get_partition_table_type() == 'dasd'
+ assert self.firmware_s390_cdl.get_partition_table_type() == 'dasd'
+ assert self.firmware_s390_scsi.get_partition_table_type() == 'msdos'
+
--
Gitee
From d740a554bec31c6d0ffa74d2b218cd3c612aff2e Mon Sep 17 00:00:00 2001
From: openeuler-ci-bot <80474298@qq.com>
Date: Wed, 28 Oct 2020 20:30:21 +0800
Subject: [PATCH 2/4] [patch tracking] 20201028203007658356 -
https://github.com/OSInside/kiwi/commit/226be19c91790ecbef93792ea119bfbbf9f7defd
---
...e19c91790ecbef93792ea119bfbbf9f7defd.patch | 787 ++++++++++++++++++
1 file changed, 787 insertions(+)
create mode 100644 226be19c91790ecbef93792ea119bfbbf9f7defd.patch
diff --git a/226be19c91790ecbef93792ea119bfbbf9f7defd.patch b/226be19c91790ecbef93792ea119bfbbf9f7defd.patch
new file mode 100644
index 0000000..2ef8f3b
--- /dev/null
+++ b/226be19c91790ecbef93792ea119bfbbf9f7defd.patch
@@ -0,0 +1,787 @@
+diff --git a/doc/source/working_with_images/custom_volumes.rst b/doc/source/working_with_images/custom_volumes.rst
+index 15b15b6cad..b334f66ad8 100644
+--- a/doc/source/working_with_images/custom_volumes.rst
++++ b/doc/source/working_with_images/custom_volumes.rst
+@@ -54,6 +54,16 @@ attributes:
+
+
+
++ In addition to the custom size of the root volume it's also possible
++ to setup the name of the root volume as follows:
++
++ .. code:: xml
++
++
++
++ If no name for the root volume is specified the
++ default name: **LVRoot** applies.
++
+ - `freespace`: Optional attribute defining the additional free space added
+ to the volume. If no suffix (`M` or `G`) is used, the value is considered
+ to be in megabytes.
+diff --git a/dracut/modules.d/99kiwi-lib/kiwi-lvm-lib.sh b/dracut/modules.d/99kiwi-lib/kiwi-lvm-lib.sh
+index 674e08e724..1b2a084506 100644
+--- a/dracut/modules.d/99kiwi-lib/kiwi-lvm-lib.sh
++++ b/dracut/modules.d/99kiwi-lib/kiwi-lvm-lib.sh
+@@ -152,7 +152,6 @@ function read_volume_setup_all_free {
+ local volume
+ local name
+ local mpoint
+- local have_root_volume_setup=false
+ while read -r volspec;do
+ if ! [[ "${volspec}" =~ "kiwi_Volume_" ]];then
+ continue
+@@ -160,18 +159,12 @@ function read_volume_setup_all_free {
+ volume=$(echo "${volspec}" | cut -f2 -d= | tr -d \' | tr -d \")
+ size=$(echo "${volume}" | cut -f2 -d\| | cut -f2 -d:)
+ name=$(echo "${volume}" | cut -f1 -d\|)
+- if [ "${name}" = "LVRoot" ];then
+- have_root_volume_setup=true
+- fi
+ if [ "${size}" = "all" ];then
+ mpoint=$(echo "${volume}" | cut -f3 -d\|)
+ echo "${name},${mpoint}"
+ return
+ fi
+ done < "${profile}"
+- if [ "${have_root_volume_setup}" = "false" ];then
+- echo LVRoot,
+- fi
+ }
+
+ function get_all_free_volume {
+diff --git a/kiwi/defaults.py b/kiwi/defaults.py
+index 8ead41d20c..414cb7890c 100644
+--- a/kiwi/defaults.py
++++ b/kiwi/defaults.py
+@@ -37,6 +37,7 @@
+ EDIT_BOOT_CONFIG_SCRIPT = 'edit_boot_config.sh'
+ EDIT_BOOT_INSTALL_SCRIPT = 'edit_boot_install.sh'
+ IMAGE_METADATA_DIR = 'image'
++ROOT_VOLUME_NAME = 'LVRoot'
+
+
+ class Defaults:
+diff --git a/kiwi/storage/disk.py b/kiwi/storage/disk.py
+index 14b4f6cfc7..ad463a3dab 100644
+--- a/kiwi/storage/disk.py
++++ b/kiwi/storage/disk.py
+@@ -105,14 +105,13 @@ def create_root_lvm_partition(self, mbsize):
+ """
+ Create root partition for use with LVM
+
+- Populates kiwi_RootPart(id) and kiwi_RootPartVol(LVRoot)
++ Populates kiwi_RootPart(id)
+
+ :param int mbsize: partition size
+ """
+ self.partitioner.create('p.lxlvm', mbsize, 't.lvm')
+ self._add_to_map('root')
+ self._add_to_public_id_map('kiwi_RootPart')
+- self._add_to_public_id_map('kiwi_RootPartVol', 'LVRoot')
+
+ def create_root_raid_partition(self, mbsize):
+ """
+diff --git a/kiwi/storage/setup.py b/kiwi/storage/setup.py
+index ef809ed27f..b93a3b2591 100644
+--- a/kiwi/storage/setup.py
++++ b/kiwi/storage/setup.py
+@@ -322,7 +322,7 @@ def _accumulate_volume_size(self, root_mbytes):
+
+ def _get_root_volume_configuration(self):
+ """
+- Provide LVRoot volume configuration if present and in
++ Provide root volume configuration if present and in
+ use according to the selected volume management. So far
+ this only affects the LVM volume manager
+ """
+@@ -330,7 +330,7 @@ def _get_root_volume_configuration(self):
+ 'root_volume_type', ['size_type', 'req_size']
+ )
+ for volume in self.volumes:
+- if volume.name == 'LVRoot':
++ if volume.is_root_volume:
+ if volume.size:
+ [size_type, req_size] = volume.size.split(':')
+ return root_volume_type(
+diff --git a/kiwi/system/profile.py b/kiwi/system/profile.py
+index 58e4512a21..392eb6930b 100644
+--- a/kiwi/system/profile.py
++++ b/kiwi/system/profile.py
+@@ -232,7 +232,11 @@ def _systemdisk_to_profile(self):
+
+ volume_count = 1
+ for volume in self.xml_state.get_volumes():
+- volume_id_name = 'kiwi_Volume_{id}'.format(id=volume_count)
++ if volume.is_root_volume:
++ volume_id_name = 'kiwi_Volume_Root'
++ else:
++ volume_id_name = 'kiwi_Volume_{id}'.format(id=volume_count)
++ volume_count += 1
+ self.dot_profile[volume_id_name] = '|'.join(
+ [
+ volume.name,
+@@ -240,7 +244,6 @@ def _systemdisk_to_profile(self):
+ volume.mountpoint or ''
+ ]
+ )
+- volume_count += 1
+
+ def _preferences_to_profile(self):
+ # kiwi_iversion
+diff --git a/kiwi/volume_manager/base.py b/kiwi/volume_manager/base.py
+index 408524fdd8..973f625da6 100644
+--- a/kiwi/volume_manager/base.py
++++ b/kiwi/volume_manager/base.py
+@@ -299,7 +299,7 @@ def get_volume_mbsize(
+ if lookup_path == volume_path:
+ continue
+ if lookup_path == os.sep:
+- # exclude any sub volume path if lookup_path is / [LVRoot]
++ # exclude any sub volume path if lookup_path is /
+ exclude_paths.append(
+ os.path.normpath(self.root_dir + os.sep + volume_path)
+ )
+diff --git a/kiwi/volume_manager/btrfs.py b/kiwi/volume_manager/btrfs.py
+index 48c5110067..e2e6705520 100644
+--- a/kiwi/volume_manager/btrfs.py
++++ b/kiwi/volume_manager/btrfs.py
+@@ -157,7 +157,7 @@ def create_volumes(self, filesystem_name):
+ )
+
+ for volume in canonical_volume_list.volumes:
+- if volume.name == 'LVRoot':
++ if volume.is_root_volume:
+ # the btrfs root volume named '@' has been created as
+ # part of the setup procedure
+ pass
+diff --git a/kiwi/volume_manager/lvm.py b/kiwi/volume_manager/lvm.py
+index 7d459819ba..2f48e9539d 100644
+--- a/kiwi/volume_manager/lvm.py
++++ b/kiwi/volume_manager/lvm.py
+@@ -70,8 +70,8 @@ def get_device(self):
+ """
+ device_map = {}
+ for volume_name, volume_node in list(self.volume_map.items()):
+- if volume_name == 'LVRoot':
+- # LVRoot volume device takes precedence over the
++ if self._is_root_volume(volume_name):
++ # root volume device takes precedence over the
+ # root partition device from the disk. Therefore use
+ # the same key to put them on the same level
+ volume_name = 'root'
+@@ -228,7 +228,7 @@ def get_fstab(self, persistency_type, filesystem_name):
+ """
+ fstab_entries = []
+ for volume_mount in self.mount_list:
+- if 'LVRoot' not in volume_mount.device:
++ if not self._is_root_volume(volume_mount.device):
+ mount_path = '/'.join(volume_mount.mountpoint.split('/')[3:])
+ if not mount_path.startswith('/'):
+ mount_path = '/' + mount_path
+@@ -288,7 +288,7 @@ def umount_volumes(self):
+
+ def _create_filesystem(self, volume_name, volume_label, filesystem_name):
+ device_node = self.volume_map[volume_name]
+- if volume_name == 'LVRoot' and not volume_label:
++ if self._is_root_volume(volume_name) and not volume_label:
+ # if there is no @root volume definition for the root volume,
+ # perform a second lookup of a label specified via the
+ # rootfs_label from the type setup
+@@ -306,7 +306,7 @@ def _create_filesystem(self, volume_name, volume_label, filesystem_name):
+
+ def _add_to_mount_list(self, volume_name, realpath):
+ device_node = self.volume_map[volume_name]
+- if volume_name == 'LVRoot':
++ if self._is_root_volume(volume_name):
+ # root volume must be first in the list
+ self.mount_list.insert(
+ 0, MountManager(
+@@ -343,6 +343,11 @@ def _volume_group_in_use_on_host_system(self, volume_group_name):
+ # group name, it is considered to be not used
+ return False
+
++ def _is_root_volume(self, name):
++ for volume in self.volumes:
++ if name in volume.name and volume.is_root_volume:
++ return True
++
+ def __del__(self):
+ if self.volume_group:
+ log.info('Cleaning up %s instance', type(self).__name__)
+diff --git a/kiwi/xml_state.py b/kiwi/xml_state.py
+index 755756a5c7..a6e6e5bb48 100644
+--- a/kiwi/xml_state.py
++++ b/kiwi/xml_state.py
+@@ -23,6 +23,8 @@
+ from textwrap import dedent
+
+ # project
++import kiwi.defaults as defaults
++
+ from kiwi import xml_parse
+ from kiwi.system.uri import Uri
+ from kiwi.defaults import Defaults
+@@ -1223,7 +1225,8 @@ def get_volumes(self): # noqa C901
+ mountpoint=path,
+ fullsize=True,
+ label=volume_label,
+- attributes=['no-copy-on-write']
++ attributes=['no-copy-on-write'],
++ is_root_volume=True|False
+ )
+ ]
+
+@@ -1243,7 +1246,8 @@ def get_volumes(self): # noqa C901
+ 'mountpoint',
+ 'fullsize',
+ 'label',
+- 'attributes'
++ 'attributes',
++ 'is_root_volume'
+ ]
+ )
+
+@@ -1262,6 +1266,7 @@ def get_volumes(self): # noqa C901
+ fullsize = False
+ label = volume.get_label()
+ attributes = []
++ is_root_volume = False
+
+ if volume.get_copy_on_write() is False:
+ # by default copy-on-write is switched on for any
+@@ -1270,11 +1275,21 @@ def get_volumes(self): # noqa C901
+ attributes.append('no-copy-on-write')
+
+ if '@root' in name:
+- # setup root volume, it takes a fixed volume name and
+- # has no specific mountpoint
++ # setup root volume, it takes an optional volume
++ # name if specified as @root=name and has no specific
++ # mountpoint. The default name is set to
++ # defaults.ROOT_VOLUME_NAME if no other root volume
++ # name is provided
+ mountpoint = None
+ realpath = '/'
+- name = 'LVRoot'
++ is_root_volume = True
++ root_volume_expression = re.match(
++ r'@root=(.+)', name
++ )
++ if root_volume_expression:
++ name = root_volume_expression.group(1)
++ else:
++ name = defaults.ROOT_VOLUME_NAME
+ have_root_volume_setup = True
+ elif not mountpoint:
+ # setup volume without mountpoint. In this case the name
+@@ -1310,7 +1325,8 @@ def get_volumes(self): # noqa C901
+ mountpoint=mountpoint,
+ realpath=realpath,
+ label=label,
+- attributes=attributes
++ attributes=attributes,
++ is_root_volume=is_root_volume
+ )
+ )
+
+@@ -1327,13 +1343,14 @@ def get_volumes(self): # noqa C901
+ fullsize = True
+ volume_type_list.append(
+ volume_type(
+- name='LVRoot',
++ name=defaults.ROOT_VOLUME_NAME,
+ size=size,
+ fullsize=fullsize,
+ mountpoint=None,
+ realpath='/',
+ label=None,
+- attributes=[]
++ attributes=[],
++ is_root_volume=True
+ )
+ )
+
+@@ -1346,7 +1363,8 @@ def get_volumes(self): # noqa C901
+ mountpoint=None,
+ realpath='swap',
+ label='SWAP',
+- attributes=[]
++ attributes=[],
++ is_root_volume=False
+ )
+ )
+
+diff --git a/test/data/example_lvm_custom_rootvol_config.xml b/test/data/example_lvm_custom_rootvol_config.xml
+new file mode 100644
+index 0000000000..aef74d9072
+--- /dev/null
++++ b/test/data/example_lvm_custom_rootvol_config.xml
+@@ -0,0 +1,41 @@
++
++
++
++
++ Marcus Schäfer
++ ms@suse.com
++
++ openSUSE 13.2 JeOS, is a small text based image
++
++
++
++ 1.13.2
++ zypper
++ en_US
++ us.map.gz
++ Europe/Berlin
++ true
++ false
++ openSUSE
++ openSUSE
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+diff --git a/test/unit/storage/disk_test.py b/test/unit/storage/disk_test.py
+index c4f766dde4..9880a056e8 100644
+--- a/test/unit/storage/disk_test.py
++++ b/test/unit/storage/disk_test.py
+@@ -73,7 +73,6 @@ def test_create_root_lvm_partition(self):
+ 'p.lxlvm', 100, 't.lvm'
+ )
+ assert self.disk.public_partition_id_map['kiwi_RootPart'] == 1
+- assert self.disk.public_partition_id_map['kiwi_RootPartVol'] == 'LVRoot'
+
+ def test_create_root_raid_partition(self):
+ self.disk.create_root_raid_partition(100)
+diff --git a/test/unit/system/profile_test.py b/test/unit/system/profile_test.py
+index 2ef62698a8..887b0dd37e 100644
+--- a/test/unit/system/profile_test.py
++++ b/test/unit/system/profile_test.py
+@@ -29,11 +29,11 @@ def test_create(self, mock_which, mock_temp):
+ os.remove(self.profile_file)
+ assert self.profile.dot_profile == {
+ 'kiwi_Volume_1': 'usr_lib|size:1024|usr/lib',
+- 'kiwi_Volume_2': 'LVRoot|freespace:500|',
+- 'kiwi_Volume_3': 'etc_volume|freespace:30|etc',
+- 'kiwi_Volume_4': 'bin_volume|size:all|/usr/bin',
+- 'kiwi_Volume_5': 'usr_bin|freespace:30|usr/bin',
+- 'kiwi_Volume_6': 'LVSwap|size:128|',
++ 'kiwi_Volume_2': 'etc_volume|freespace:30|etc',
++ 'kiwi_Volume_3': 'bin_volume|size:all|/usr/bin',
++ 'kiwi_Volume_4': 'usr_bin|freespace:30|usr/bin',
++ 'kiwi_Volume_5': 'LVSwap|size:128|',
++ 'kiwi_Volume_Root': 'LVRoot|freespace:500|',
+ 'kiwi_bootkernel': None,
+ 'kiwi_bootloader': 'grub2',
+ 'kiwi_bootprofile': None,
+diff --git a/test/unit/volume_manager/base_test.py b/test/unit/volume_manager/base_test.py
+index 6e71a363ad..12d4bf98e3 100644
+--- a/test/unit/volume_manager/base_test.py
++++ b/test/unit/volume_manager/base_test.py
+@@ -19,7 +19,8 @@ def setup(self, mock_path):
+ 'realpath',
+ 'mountpoint',
+ 'fullsize',
+- 'attributes'
++ 'attributes',
++ 'is_root_volume'
+ ]
+ )
+ mock_path.return_value = True
+@@ -38,11 +39,13 @@ def setup(self, mock_path):
+ self.volume_manager.volumes = [
+ self.volume_type(
+ name='LVetc', size='freespace:200', realpath='/etc',
+- mountpoint='/etc', fullsize=False, attributes=[]
++ mountpoint='/etc', fullsize=False, attributes=[],
++ is_root_volume=False
+ ),
+ self.volume_type(
+ name='LVRoot', size='size:500', realpath='/',
+- mountpoint='/', fullsize=True, attributes=[]
++ mountpoint='/', fullsize=True, attributes=[],
++ is_root_volume=True
+ )
+ ]
+
+@@ -146,11 +149,13 @@ def test_get_volume_mbsize_nested_volumes(
+ self.volume_manager.volumes = [
+ self.volume_type(
+ name='LVusr', size='freespace:200', realpath='/usr',
+- mountpoint='/usr', fullsize=False, attributes=[]
++ mountpoint='/usr', fullsize=False, attributes=[],
++ is_root_volume=False
+ ),
+ self.volume_type(
+ name='LVusr_lib', size='freespace:100', realpath='/usr/lib',
+- mountpoint='/usr/lib', fullsize=False, attributes=[]
++ mountpoint='/usr/lib', fullsize=False, attributes=[],
++ is_root_volume=False
+ )
+ ]
+ assert self.volume_manager.get_volume_mbsize(
+@@ -175,15 +180,18 @@ def test_get_volume_mbsize_root_volume(
+ self.volume_manager.volumes = [
+ self.volume_type(
+ name='LVusr', size='freespace:200', realpath='/usr',
+- mountpoint='/usr', fullsize=False, attributes=[]
++ mountpoint='/usr', fullsize=False, attributes=[],
++ is_root_volume=False
+ ),
+ self.volume_type(
+ name='LVusr_lib', size='freespace:100', realpath='/usr/lib',
+- mountpoint='/usr/lib', fullsize=False, attributes=[]
++ mountpoint='/usr/lib', fullsize=False, attributes=[],
++ is_root_volume=False
+ ),
+ self.volume_type(
+ name='LVRoot', size='size:500', realpath='/',
+- mountpoint='/', fullsize=True, attributes=[]
++ mountpoint='/', fullsize=True, attributes=[],
++ is_root_volume=True
+ )
+ ]
+ assert self.volume_manager.get_volume_mbsize(
+@@ -244,7 +252,8 @@ def test_apply_attributes_on_volume(self, mock_command):
+ 'toplevel', self.volume_type(
+ name='LVetc', size='freespace:200', realpath='/etc',
+ mountpoint='/etc', fullsize=False,
+- attributes=['no-copy-on-write']
++ attributes=['no-copy-on-write'],
++ is_root_volume=False
+ )
+ )
+ mock_command.assert_called_once_with(
+diff --git a/test/unit/volume_manager/btrfs_test.py b/test/unit/volume_manager/btrfs_test.py
+index 1c473124fa..9ad545293f 100644
+--- a/test/unit/volume_manager/btrfs_test.py
++++ b/test/unit/volume_manager/btrfs_test.py
+@@ -32,29 +32,30 @@ def setup(self, mock_path):
+ 'realpath',
+ 'mountpoint',
+ 'fullsize',
+- 'attributes'
++ 'attributes',
++ 'is_root_volume'
+ ]
+ )
+ self.volumes = [
+ self.volume_type(
+ name='LVRoot', size='freespace:100', realpath='/',
+ mountpoint=None, fullsize=False,
+- attributes=[]
++ attributes=[], is_root_volume=True
+ ),
+ self.volume_type(
+ name='LVetc', size='freespace:200', realpath='/etc',
+ mountpoint='/etc', fullsize=False,
+- attributes=[]
++ attributes=[], is_root_volume=False
+ ),
+ self.volume_type(
+ name='myvol', size='size:500', realpath='/data',
+ mountpoint='LVdata', fullsize=False,
+- attributes=[]
++ attributes=[], is_root_volume=False
+ ),
+ self.volume_type(
+ name='LVhome', size=None, realpath='/home',
+ mountpoint='/home', fullsize=True,
+- attributes=[]
++ attributes=[], is_root_volume=False
+ )
+ ]
+ mock_path.return_value = True
+@@ -186,15 +187,23 @@ def test_create_volumes(
+ call(
+ 'tmpdir/@/', self.volume_type(
+ name='myvol', size='size:500', realpath='/data',
+- mountpoint='LVdata', fullsize=False, attributes=[])
++ mountpoint='LVdata', fullsize=False, attributes=[],
++ is_root_volume=False
++ )
+ ),
+- call('tmpdir/@/', self.volume_type(
+- name='LVetc', size='freespace:200', realpath='/etc',
+- mountpoint='/etc', fullsize=False, attributes=[])
++ call(
++ 'tmpdir/@/', self.volume_type(
++ name='LVetc', size='freespace:200', realpath='/etc',
++ mountpoint='/etc', fullsize=False, attributes=[],
++ is_root_volume=False
++ )
+ ),
+- call('tmpdir/@/', self.volume_type(
+- name='LVhome', size=None, realpath='/home',
+- mountpoint='/home', fullsize=True, attributes=[])
++ call(
++ 'tmpdir/@/', self.volume_type(
++ name='LVhome', size=None, realpath='/home',
++ mountpoint='/home', fullsize=True, attributes=[],
++ is_root_volume=False
++ )
+ )
+ ]
+ assert mock_path.call_args_list == [
+diff --git a/test/unit/volume_manager/lvm_test.py b/test/unit/volume_manager/lvm_test.py
+index aae30c1823..155d9b70f3 100644
+--- a/test/unit/volume_manager/lvm_test.py
++++ b/test/unit/volume_manager/lvm_test.py
+@@ -28,29 +28,35 @@ def setup(self, mock_path):
+ 'mountpoint',
+ 'fullsize',
+ 'label',
+- 'attributes'
++ 'attributes',
++ 'is_root_volume'
+ ]
+ )
+ self.volumes = [
+ self.volume_type(
+ name='LVRoot', size='freespace:100', realpath='/',
+- mountpoint=None, fullsize=False, label=None, attributes=[]
++ mountpoint=None, fullsize=False, label=None, attributes=[],
++ is_root_volume=True
+ ),
+ self.volume_type(
+ name='LVSwap', size='size:100', realpath='swap',
+- mountpoint=None, fullsize=False, label='SWAP', attributes=[]
++ mountpoint=None, fullsize=False, label='SWAP', attributes=[],
++ is_root_volume=False
+ ),
+ self.volume_type(
+ name='LVetc', size='freespace:200', realpath='/etc',
+- mountpoint='/etc', fullsize=False, label='etc', attributes=[]
++ mountpoint='/etc', fullsize=False, label='etc', attributes=[],
++ is_root_volume=False
+ ),
+ self.volume_type(
+ name='myvol', size='size:500', realpath='/data',
+- mountpoint='LVdata', fullsize=False, label=None, attributes=[]
++ mountpoint='LVdata', fullsize=False, label=None, attributes=[],
++ is_root_volume=False
+ ),
+ self.volume_type(
+ name='LVhome', size=None, realpath='/home',
+- mountpoint='/home', fullsize=True, label=None, attributes=[]
++ mountpoint='/home', fullsize=True, label=None, attributes=[],
++ is_root_volume=False
+ ),
+ ]
+ mock_path.return_value = True
+@@ -178,28 +184,28 @@ def mock_os_exists_return(path):
+ 'root_dir', self.volume_type(
+ name='LVSwap', size='size:100', realpath='swap',
+ mountpoint=None, fullsize=False, label='SWAP',
+- attributes=[]
++ attributes=[], is_root_volume=False
+ )
+ ),
+ call(
+ 'root_dir', self.volume_type(
+ name='LVRoot', size='freespace:100', realpath='/',
+ mountpoint=None, fullsize=False, label=None,
+- attributes=[]
++ attributes=[], is_root_volume=True
+ )
+ ),
+ call(
+ 'root_dir', self.volume_type(
+ name='myvol', size='size:500', realpath='/data',
+ mountpoint='LVdata', fullsize=False, label=None,
+- attributes=[]
++ attributes=[], is_root_volume=False
+ )
+ ),
+ call(
+ 'root_dir', self.volume_type(
+ name='LVetc', size='freespace:200', realpath='/etc',
+ mountpoint='/etc', fullsize=False, label='etc',
+- attributes=[]
++ attributes=[], is_root_volume=False
+ )
+ )
+ ]
+diff --git a/test/unit/xml_state_test.py b/test/unit/xml_state_test.py
+index 8309e18338..f960843379 100644
+--- a/test/unit/xml_state_test.py
++++ b/test/unit/xml_state_test.py
+@@ -292,6 +292,35 @@ def test_profile_requires(self):
+ 'composedProfile', 'vmxSimpleFlavour', 'xenDomUFlavour'
+ ]
+
++ def test_get_volumes_custom_root_volume_name(self):
++ description = XMLDescription(
++ '../data/example_lvm_custom_rootvol_config.xml'
++ )
++ xml_data = description.load()
++ state = XMLState(xml_data)
++ volume_type = namedtuple(
++ 'volume_type', [
++ 'name',
++ 'size',
++ 'realpath',
++ 'mountpoint',
++ 'fullsize',
++ 'label',
++ 'attributes',
++ 'is_root_volume'
++ ]
++ )
++ assert state.get_volumes() == [
++ volume_type(
++ name='myroot', size='freespace:500',
++ realpath='/',
++ mountpoint=None, fullsize=False,
++ label=None,
++ attributes=[],
++ is_root_volume=True
++ )
++ ]
++
+ def test_get_volumes(self):
+ description = XMLDescription('../data/example_lvm_default_config.xml')
+ xml_data = description.load()
+@@ -304,44 +333,51 @@ def test_get_volumes(self):
+ 'mountpoint',
+ 'fullsize',
+ 'label',
+- 'attributes'
++ 'attributes',
++ 'is_root_volume'
+ ]
+ )
+ assert state.get_volumes() == [
+ volume_type(
+ name='usr_lib', size='size:1024',
+ realpath='usr/lib',
+- mountpoint='usr/lib', fullsize=False,
++ mountpoint='usr/lib',
++ fullsize=False,
+ label='library',
+- attributes=[]
++ attributes=[],
++ is_root_volume=False
+ ),
+ volume_type(
+ name='LVRoot', size='freespace:500',
+ realpath='/',
+ mountpoint=None, fullsize=False,
+ label=None,
+- attributes=[]
++ attributes=[],
++ is_root_volume=True
+ ),
+ volume_type(
+ name='etc_volume', size='freespace:30',
+ realpath='etc',
+ mountpoint='etc', fullsize=False,
+ label=None,
+- attributes=['no-copy-on-write']
++ attributes=['no-copy-on-write'],
++ is_root_volume=False
+ ),
+ volume_type(
+ name='bin_volume', size=None,
+ realpath='/usr/bin',
+ mountpoint='/usr/bin', fullsize=True,
+ label=None,
+- attributes=[]
++ attributes=[],
++ is_root_volume=False
+ ),
+ volume_type(
+ name='LVSwap', size='size:128',
+ realpath='swap',
+ mountpoint=None, fullsize=False,
+ label='SWAP',
+- attributes=[]
++ attributes=[],
++ is_root_volume=False
+ )
+ ]
+
+@@ -357,7 +393,8 @@ def test_get_volumes_no_explicit_root_setup(self):
+ 'mountpoint',
+ 'fullsize',
+ 'label',
+- 'attributes'
++ 'attributes',
++ 'is_root_volume'
+ ]
+ )
+ assert state.get_volumes() == [
+@@ -365,14 +402,16 @@ def test_get_volumes_no_explicit_root_setup(self):
+ name='LVRoot', size=None, realpath='/',
+ mountpoint=None, fullsize=True,
+ label=None,
+- attributes=[]
++ attributes=[],
++ is_root_volume=True
+ ),
+ volume_type(
+ name='LVSwap', size='size:128',
+ realpath='swap',
+ mountpoint=None, fullsize=False,
+ label='SWAP',
+- attributes=[]
++ attributes=[],
++ is_root_volume=False
+ )
+ ]
+
+@@ -390,7 +429,8 @@ def test_get_volumes_no_explicit_root_setup_other_fullsize_volume(self):
+ 'mountpoint',
+ 'fullsize',
+ 'label',
+- 'attributes'
++ 'attributes',
++ 'is_root_volume'
+ ]
+ )
+ assert state.get_volumes() == [
+@@ -398,20 +438,23 @@ def test_get_volumes_no_explicit_root_setup_other_fullsize_volume(self):
+ name='usr', size=None, realpath='usr',
+ mountpoint='usr', fullsize=True,
+ label=None,
+- attributes=[]
++ attributes=[],
++ is_root_volume=False
+ ),
+ volume_type(
+ name='LVRoot', size='freespace:30', realpath='/',
+ mountpoint=None, fullsize=False,
+ label=None,
+- attributes=[]
++ attributes=[],
++ is_root_volume=True
+ ),
+ volume_type(
+ name='LVSwap', size='size:128',
+ realpath='swap',
+ mountpoint=None, fullsize=False,
+ label='SWAP',
+- attributes=[]
++ attributes=[],
++ is_root_volume=False
+ )
+ ]
+
--
Gitee
From 1a5bf3777cacf0adcf0e2297b5b4bdbc3118cc71 Mon Sep 17 00:00:00 2001
From: openeuler-ci-bot <80474298@qq.com>
Date: Wed, 28 Oct 2020 20:30:21 +0800
Subject: [PATCH 3/4] [patch tracking] 20201028203007658356 -
https://github.com/OSInside/kiwi/commit/0175eac6934f9263075f2e047686809b32e89dd3
---
...eac6934f9263075f2e047686809b32e89dd3.patch | 35 +++++++++++++++++++
1 file changed, 35 insertions(+)
create mode 100644 0175eac6934f9263075f2e047686809b32e89dd3.patch
diff --git a/0175eac6934f9263075f2e047686809b32e89dd3.patch b/0175eac6934f9263075f2e047686809b32e89dd3.patch
new file mode 100644
index 0000000..0a57923
--- /dev/null
+++ b/0175eac6934f9263075f2e047686809b32e89dd3.patch
@@ -0,0 +1,35 @@
+diff --git a/.bumpversion.cfg b/.bumpversion.cfg
+index 4b27951600..465fad23cc 100644
+--- a/.bumpversion.cfg
++++ b/.bumpversion.cfg
+@@ -1,5 +1,5 @@
+ [bumpversion]
+-current_version = 9.21.19
++current_version = 9.21.20
+ commit = True
+ tag = True
+
+diff --git a/doc/source/conf.py b/doc/source/conf.py
+index edd33ca142..999e9e2e33 100644
+--- a/doc/source/conf.py
++++ b/doc/source/conf.py
+@@ -128,7 +128,7 @@ def setup(app):
+ # built documents.
+ #
+ # The short X.Y version.
+-version = '9.21.19'
++version = '9.21.20'
+ # The full version, including alpha/beta/rc tags.
+ release = version
+
+diff --git a/kiwi/version.py b/kiwi/version.py
+index cdc37c1a59..8186ba28e2 100644
+--- a/kiwi/version.py
++++ b/kiwi/version.py
+@@ -18,5 +18,5 @@
+ """
+ Global version information used in kiwi and the package
+ """
+-__version__ = '9.21.19'
++__version__ = '9.21.20'
+ __githash__ = '$Format:%H$'
--
Gitee
From 66d30e898b3c310e7a590d5b3f6c6fc7a20808fa Mon Sep 17 00:00:00 2001
From: openeuler-ci-bot <80474298@qq.com>
Date: Wed, 28 Oct 2020 20:30:22 +0800
Subject: [PATCH 4/4] [patch tracking] 20201028203007658356 - update spec file
---
kiwi.spec | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/kiwi.spec b/kiwi.spec
index e59772e..ddf77b3 100644
--- a/kiwi.spec
+++ b/kiwi.spec
@@ -2,12 +2,15 @@
Name: kiwi
Version: 9.21.5
-Release: 1
+Release: 2
License: GPLv3+
Summary: Flexible operating system image builder
URL: http://osinside.github.io/kiwi/
Source0: https://files.pythonhosted.org/packages/source/k/%{name}/%{name}-%{version}.tar.gz
+Patch6000: a77ef5212e999d9b72d8e92992343bb32e568685.patch
+Patch6001: 226be19c91790ecbef93792ea119bfbbf9f7defd.patch
+Patch6002: 0175eac6934f9263075f2e047686809b32e89dd3.patch
BuildRequires: bash-completion dracut fdupes gcc make
BuildRequires: python3-devel python3-setuptools shadow-utils
@@ -189,6 +192,9 @@ done
%{_mandir}/man8/%{name}*
%changelog
+* 20201028203007658356 patch-tracking 9.21.5-2
+- append patch file of upstream repository from to <0175eac6934f9263075f2e047686809b32e89dd3>
+
* Tue Jul 28 2020 xinghe - 9.21.5-1
- update version to 9.21.5
@@ -208,4 +214,4 @@ done
- Remove python2 dependency
* Sat Sep 21 2019 openEuler Buildteam - 9.16.12-2
-- Package init
+- Package init
\ No newline at end of file
--
Gitee