From febd69ec0ffa74fac571fc7e8d8b97d6ac4dc706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20Sch=C3=A4fer?= Date: Tue, 19 Jan 2016 11:08:08 +0100 Subject: [PATCH] Refactor variable name for root directory If it is clear the source directory is the root directory of the image the variable should be named root_dir not source_dir --- kiwi/archive_builder.py | 6 +- kiwi/bootloader_config.py | 6 +- kiwi/bootloader_config_base.py | 8 +- kiwi/bootloader_config_grub2.py | 24 ++--- kiwi/bootloader_config_isolinux.py | 4 +- kiwi/bootloader_install.py | 4 +- kiwi/bootloader_install_base.py | 4 +- kiwi/bootloader_install_grub2.py | 2 +- kiwi/disk_builder.py | 36 +++---- kiwi/disk_format.py | 12 +-- kiwi/disk_format_base.py | 4 +- kiwi/disk_format_vmdk.py | 6 +- kiwi/disk_setup.py | 8 +- kiwi/filesystem.py | 20 ++-- kiwi/filesystem_base.py | 14 +-- kiwi/filesystem_builder.py | 10 +- kiwi/filesystem_clicfs.py | 8 +- kiwi/filesystem_isofs.py | 6 +- kiwi/filesystem_setup.py | 13 +-- kiwi/filesystem_squashfs.py | 2 +- kiwi/install_image_builder.py | 4 +- kiwi/live_image_builder.py | 8 +- kiwi/pxe_builder.py | 4 +- kiwi/volume_manager.py | 6 +- kiwi/volume_manager_base.py | 22 ++-- kiwi/volume_manager_btrfs.py | 4 +- kiwi/volume_manager_lvm.py | 2 +- test/unit/archive_builder_test.py | 6 +- test/unit/bootloader_config_base_test.py | 6 +- test/unit/bootloader_config_grub2_test.py | 100 +++++++++---------- test/unit/bootloader_config_isolinux_test.py | 14 +-- test/unit/bootloader_config_test.py | 10 +- test/unit/bootloader_install_base_test.py | 2 +- test/unit/bootloader_install_grub2_test.py | 4 +- test/unit/bootloader_install_test.py | 6 +- test/unit/disk_builder_test.py | 14 +-- test/unit/disk_format_base_test.py | 2 +- test/unit/disk_format_gce_test.py | 2 +- test/unit/disk_format_qcow2_test.py | 2 +- test/unit/disk_format_test.py | 22 ++-- test/unit/disk_format_vhd_test.py | 2 +- test/unit/disk_format_vhdfixed_test.py | 2 +- test/unit/disk_format_vmdk_test.py | 2 +- test/unit/disk_setup_test.py | 8 +- test/unit/filesystem_base_test.py | 10 +- test/unit/filesystem_btrfs_test.py | 2 +- test/unit/filesystem_builder_test.py | 10 +- test/unit/filesystem_clicfs_test.py | 4 +- test/unit/filesystem_ext2_test.py | 2 +- test/unit/filesystem_ext3_test.py | 2 +- test/unit/filesystem_ext4_test.py | 2 +- test/unit/filesystem_fat16_test.py | 2 +- test/unit/filesystem_fat32_test.py | 2 +- test/unit/filesystem_isofs_test.py | 6 +- test/unit/filesystem_setup_test.py | 4 +- test/unit/filesystem_squashfs_test.py | 4 +- test/unit/filesystem_test.py | 38 +++---- test/unit/filesystem_xfs_test.py | 2 +- test/unit/live_image_builder_test.py | 6 +- test/unit/pxe_builder_test.py | 2 +- test/unit/system_size_test.py | 6 +- test/unit/volume_manager_base_test.py | 16 +-- test/unit/volume_manager_btrfs_test.py | 10 +- test/unit/volume_manager_lvm_test.py | 8 +- test/unit/volume_manager_test.py | 10 +- 65 files changed, 302 insertions(+), 297 deletions(-) diff --git a/kiwi/archive_builder.py b/kiwi/archive_builder.py index 512cd42d..4e54c2ae 100644 --- a/kiwi/archive_builder.py +++ b/kiwi/archive_builder.py @@ -31,8 +31,8 @@ class ArchiveBuilder(object): """ root archive image builder """ - def __init__(self, xml_state, target_dir, source_dir): - self.source_dir = source_dir + def __init__(self, xml_state, target_dir, root_dir): + self.root_dir = root_dir self.target_dir = target_dir self.xml_state = xml_state self.requested_archive_type = xml_state.get_build_type_name() @@ -52,7 +52,7 @@ class ArchiveBuilder(object): archive = ArchiveTar( self.__target_file_for('tar') ) - archive.create_xz_compressed(self.source_dir) + archive.create_xz_compressed(self.root_dir) checksum = Checksum(self.filename) log.info('--> Creating archive checksum') checksum.md5(self.checksum) diff --git a/kiwi/bootloader_config.py b/kiwi/bootloader_config.py index ccb383b4..4487e07f 100644 --- a/kiwi/bootloader_config.py +++ b/kiwi/bootloader_config.py @@ -28,14 +28,14 @@ class BootLoaderConfig(object): """ BootLoaderConfig factory """ - def __new__(self, name, xml_state, source_dir): + def __new__(self, name, xml_state, root_dir): if name == 'grub2': return BootLoaderConfigGrub2( - xml_state, source_dir + xml_state, root_dir ) elif name == 'isolinux': return BootLoaderConfigIsoLinux( - xml_state, source_dir + xml_state, root_dir ) else: raise KiwiBootLoaderConfigSetupError( diff --git a/kiwi/bootloader_config_base.py b/kiwi/bootloader_config_base.py index f6f6f96c..844e9d0a 100644 --- a/kiwi/bootloader_config_base.py +++ b/kiwi/bootloader_config_base.py @@ -29,8 +29,8 @@ class BootLoaderConfigBase(object): """ base class for bootloader configuration """ - def __init__(self, xml_state, source_dir): - self.source_dir = source_dir + def __init__(self, xml_state, root_dir): + self.root_dir = root_dir self.xml_state = xml_state self.post_init() @@ -101,7 +101,7 @@ class BootLoaderConfigBase(object): raise NotImplementedError def create_efi_path(self, in_sub_dir='boot/efi'): - efi_boot_path = self.source_dir + '/' + in_sub_dir + '/EFI/BOOT' + efi_boot_path = self.root_dir + '/' + in_sub_dir + '/EFI/BOOT' Path.create(efi_boot_path) return efi_boot_path @@ -161,7 +161,7 @@ class BootLoaderConfigBase(object): bootpath = '/boot' need_boot_partition = False if target == 'disk': - disk_setup = DiskSetup(self.xml_state, self.source_dir) + disk_setup = DiskSetup(self.xml_state, self.root_dir) need_boot_partition = disk_setup.need_boot_partition() if need_boot_partition: # if an extra boot partition is used we will find the diff --git a/kiwi/bootloader_config_grub2.py b/kiwi/bootloader_config_grub2.py index 90e02fb3..dca16b04 100644 --- a/kiwi/bootloader_config_grub2.py +++ b/kiwi/bootloader_config_grub2.py @@ -228,10 +228,10 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase): self.__get_grub_boot_path() ) mbrid.write( - self.source_dir + '/boot/' + mbrid.get_id() + self.root_dir + '/boot/' + mbrid.get_id() ) mbrid.write( - self.source_dir + '/boot/mbrid' + self.root_dir + '/boot/mbrid' ) self.__copy_theme_data_to_boot_directory(lookup_path) @@ -278,7 +278,7 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase): """ use prebuilt and signed efi images provided by the distribution """ - secure_efi_lookup_path = self.source_dir + '/usr/lib64/efi/' + secure_efi_lookup_path = self.root_dir + '/usr/lib64/efi/' if lookup_path: secure_efi_lookup_path = lookup_path shim_image = secure_efi_lookup_path + Defaults.get_shim_name() @@ -299,9 +299,9 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase): ) def __create_embedded_fat_efi_image(self): - Path.create(self.source_dir + '/boot/' + self.arch) + Path.create(self.root_dir + '/boot/' + self.arch) efi_fat_image = ''.join( - [self.source_dir + '/boot/', self.arch, '/efi'] + [self.root_dir + '/boot/', self.arch, '/efi'] ) Command.run( ['qemu-img', 'create', efi_fat_image, '4M'] @@ -312,7 +312,7 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase): Command.run( [ 'mcopy', '-Do', '-s', '-i', efi_fat_image, - self.source_dir + '/EFI', '::' + self.root_dir + '/EFI', '::' ] ) @@ -376,7 +376,7 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase): ) def __get_grub_boot_path(self): - return self.source_dir + '/boot/grub2' + return self.root_dir + '/boot/grub2' def __get_basic_modules(self): return [ @@ -457,7 +457,7 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase): def __get_efi_modules_path(self, lookup_path=None): if not lookup_path: - lookup_path = self.source_dir + lookup_path = self.root_dir module_dir = ''.join( [ lookup_path, '/usr/lib/grub2/', @@ -468,7 +468,7 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase): def __get_bios_modules_path(self, lookup_path=None): if not lookup_path: - lookup_path = self.source_dir + lookup_path = self.root_dir module_dir = ''.join( [ lookup_path, '/usr/lib/grub2/', @@ -504,8 +504,8 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase): def __copy_theme_data_to_boot_directory(self, lookup_path): if not lookup_path: - lookup_path = self.source_dir - boot_unicode_font = self.source_dir + '/boot/unicode.pf2' + lookup_path = self.root_dir + boot_unicode_font = self.root_dir + '/boot/unicode.pf2' if not os.path.exists(boot_unicode_font): unicode_font = lookup_path + '/usr/share/grub2/unicode.pf2' try: @@ -517,7 +517,7 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase): 'Unicode font %s not found' % unicode_font ) - boot_theme_dir = self.source_dir + '/boot/grub2/themes' + boot_theme_dir = self.root_dir + '/boot/grub2/themes' if self.theme and not os.path.exists(boot_theme_dir): Path.create(boot_theme_dir) theme_dir = \ diff --git a/kiwi/bootloader_config_isolinux.py b/kiwi/bootloader_config_isolinux.py index 1e4a91e7..f4ae4399 100644 --- a/kiwi/bootloader_config_isolinux.py +++ b/kiwi/bootloader_config_isolinux.py @@ -172,7 +172,7 @@ class BootLoaderConfigIsoLinux(BootLoaderConfigBase): def __copy_loader_data_to_boot_directory(self, lookup_path): if not lookup_path: - lookup_path = self.source_dir + lookup_path = self.root_dir loader_data = lookup_path + '/image/loader/' Path.create(self.__get_iso_boot_path()) Command.run( @@ -182,7 +182,7 @@ class BootLoaderConfigIsoLinux(BootLoaderConfigBase): ) def __get_iso_boot_path(self): - return self.source_dir + '/boot/' + self.arch + '/loader' + return self.root_dir + '/boot/' + self.arch + '/loader' def __have_theme(self): if os.path.exists(self.__get_iso_boot_path() + '/bootlogo'): diff --git a/kiwi/bootloader_install.py b/kiwi/bootloader_install.py index 9a50a800..98b6727c 100644 --- a/kiwi/bootloader_install.py +++ b/kiwi/bootloader_install.py @@ -27,10 +27,10 @@ class BootLoaderInstall(object): """ BootLoaderInstall factory """ - def __new__(self, name, source_dir, device_provider): + def __new__(self, name, root_dir, device_provider): if name == 'grub2': return BootLoaderInstallGrub2( - source_dir, device_provider + root_dir, device_provider ) else: raise KiwiBootLoaderInstallSetupError( diff --git a/kiwi/bootloader_install_base.py b/kiwi/bootloader_install_base.py index 37f7570e..07ce1f9d 100644 --- a/kiwi/bootloader_install_base.py +++ b/kiwi/bootloader_install_base.py @@ -21,8 +21,8 @@ class BootLoaderInstallBase(object): """ base class for bootloader installation on device """ - def __init__(self, source_dir, device_provider): - self.source_dir = source_dir + def __init__(self, root_dir, device_provider): + self.root_dir = root_dir self.device_provider = device_provider self.device = self.device_provider.get_device() diff --git a/kiwi/bootloader_install_grub2.py b/kiwi/bootloader_install_grub2.py index 8862ba6e..da00d32a 100644 --- a/kiwi/bootloader_install_grub2.py +++ b/kiwi/bootloader_install_grub2.py @@ -50,7 +50,7 @@ class BootLoaderInstallGrub2(BootLoaderInstallBase): # which causes grub2-probe to fail again self.temporary_boot_dir = mkdtemp(prefix='kiwi_bootloader.') Command.run( - ['cp', '-a', self.source_dir + '/boot/', self.temporary_boot_dir] + ['cp', '-a', self.root_dir + '/boot/', self.temporary_boot_dir] ) Command.run( diff --git a/kiwi/disk_builder.py b/kiwi/disk_builder.py index 6d3ebf0e..60d401f2 100644 --- a/kiwi/disk_builder.py +++ b/kiwi/disk_builder.py @@ -48,8 +48,8 @@ class DiskBuilder(object): """ Disk image builder """ - def __init__(self, xml_state, target_dir, source_dir): - self.source_dir = source_dir + def __init__(self, xml_state, target_dir, root_dir): + self.root_dir = root_dir self.target_dir = target_dir self.xml_state = xml_state self.custom_filesystem_args = None @@ -71,10 +71,10 @@ class DiskBuilder(object): xml_state.build_type.get_bootfilesystem() self.bootloader = xml_state.build_type.get_bootloader() self.bootloader_config = BootLoaderConfig( - self.bootloader, xml_state, source_dir + self.bootloader, xml_state, root_dir ) self.disk_setup = DiskSetup( - xml_state, source_dir + xml_state, root_dir ) self.boot_image_task = BootImageTask( xml_state, target_dir @@ -83,7 +83,7 @@ class DiskBuilder(object): xml_state.build_type.get_firmware() ) self.system_setup = SystemSetup( - xml_state=xml_state, description_dir=None, root_dir=self.source_dir + xml_state=xml_state, description_dir=None, root_dir=self.root_dir ) self.diskname = ''.join( [ @@ -172,7 +172,7 @@ class DiskBuilder(object): } volume_manager = VolumeManager( self.volume_manager_name, device_map['root'], - self.source_dir + '/', + self.root_dir + '/', self.volumes, volume_manager_custom_parameters ) volume_manager.setup( @@ -191,7 +191,7 @@ class DiskBuilder(object): ) filesystem = FileSystem( self.requested_filesystem, device_map['root'], - self.source_dir + '/', + self.root_dir + '/', self.custom_filesystem_args ) filesystem.create_on_device( @@ -272,7 +272,7 @@ class DiskBuilder(object): log.info('Creating %s Disk Format', self.image_format) disk_format = DiskFormat( self.image_format, self.xml_state, - self.source_dir, self.target_dir + self.root_dir, self.target_dir ) disk_format.create_image_format() self.result.add( @@ -307,7 +307,7 @@ class DiskBuilder(object): device_map['efi'].get_device() ) filesystem = FileSystem( - 'fat16', device_map['efi'], self.source_dir + '/boot/efi/' + 'fat16', device_map['efi'], self.root_dir + '/boot/efi/' ) filesystem.create_on_device( label=self.disk_setup.get_efi_label() @@ -323,7 +323,7 @@ class DiskBuilder(object): boot_filesystem, device_map['boot'].get_device() ) filesystem = FileSystem( - boot_filesystem, device_map['boot'], self.source_dir + '/boot/' + boot_filesystem, device_map['boot'], self.root_dir + '/boot/' ) filesystem.create_on_device( label=self.disk_setup.get_boot_label() @@ -388,21 +388,21 @@ class DiskBuilder(object): if self.luks: log.info('Creating etc/crypttab') self.luks_root.create_crypttab( - self.source_dir + '/etc/crypttab' + self.root_dir + '/etc/crypttab' ) def __write_image_identifier_to_system_image(self): log.info('Creating image identifier: %s', self.mbrid.get_id()) self.mbrid.write( - self.source_dir + '/boot/mbrid' + self.root_dir + '/boot/mbrid' ) def __write_recovery_metadata_to_boot_image(self): - if os.path.exists(self.source_dir + '/recovery.partition.size'): + if os.path.exists(self.root_dir + '/recovery.partition.size'): log.info('Copying recovery metadata to boot image') Command.run( [ - 'cp', self.source_dir + '/recovery.partition.size', + 'cp', self.root_dir + '/recovery.partition.size', self.boot_image_task.boot_root_directory ] ) @@ -431,7 +431,7 @@ class DiskBuilder(object): def __install_bootloader(self, device_map): bootloader = BootLoaderInstall( - self.bootloader, self.source_dir, + self.bootloader, self.root_dir, self.disk.storage_provider ) bootloader.install() @@ -449,7 +449,7 @@ class DiskBuilder(object): if kernel.get_kernel(): log.info('--> boot image kernel as first boot linux.vmx') kernel.copy_kernel( - self.source_dir, '/boot/linux.vmx' + self.root_dir, '/boot/linux.vmx' ) else: raise KiwiDiskBootImageError( @@ -460,7 +460,7 @@ class DiskBuilder(object): if kernel.get_xen_hypervisor(): log.info('--> boot image Xen hypervisor as xen.gz') kernel.copy_xen_hypervisor( - self.source_dir, '/boot/xen.gz' + self.root_dir, '/boot/xen.gz' ) else: raise KiwiDiskBootImageError( @@ -471,6 +471,6 @@ class DiskBuilder(object): Command.run( [ 'mv', self.boot_image_task.initrd_filename, - self.source_dir + '/boot/initrd.vmx' + self.root_dir + '/boot/initrd.vmx' ] ) diff --git a/kiwi/disk_format.py b/kiwi/disk_format.py index 059e1981..57e26d35 100644 --- a/kiwi/disk_format.py +++ b/kiwi/disk_format.py @@ -31,14 +31,14 @@ class DiskFormat(object): """ DiskFormat factory """ - def __new__(self, name, xml_state, source_dir, target_dir): + def __new__(self, name, xml_state, root_dir, target_dir): if name == 'qcow2': return DiskFormatQcow2( - xml_state, source_dir, target_dir + xml_state, root_dir, target_dir ) elif name == 'vhd': return DiskFormatVhd( - xml_state, source_dir, target_dir + xml_state, root_dir, target_dir ) elif name == 'vhdfixed': custom_args = None @@ -48,7 +48,7 @@ class DiskFormat(object): '--tag': disk_tag } return DiskFormatVhdFixed( - xml_state, source_dir, target_dir, custom_args + xml_state, root_dir, target_dir, custom_args ) elif name == 'gce': custom_args = None @@ -58,7 +58,7 @@ class DiskFormat(object): '--tag': gce_license_tag } return DiskFormatGce( - xml_state, source_dir, target_dir, custom_args + xml_state, root_dir, target_dir, custom_args ) elif name == 'vmdk': custom_args = None @@ -69,7 +69,7 @@ class DiskFormat(object): 'adapter_type=%s' % vmdisk_section.get_controller(): None } return DiskFormatVmdk( - xml_state, source_dir, target_dir, custom_args + xml_state, root_dir, target_dir, custom_args ) else: raise KiwiDiskFormatSetupError( diff --git a/kiwi/disk_format_base.py b/kiwi/disk_format_base.py index 1bdce07c..6de6a63e 100644 --- a/kiwi/disk_format_base.py +++ b/kiwi/disk_format_base.py @@ -31,9 +31,9 @@ class DiskFormatBase(object): """ base class to create disk formats from a raw disk image """ - def __init__(self, xml_state, source_dir, target_dir, custom_args=None): + def __init__(self, xml_state, root_dir, target_dir, custom_args=None): self.xml_state = xml_state - self.source_dir = source_dir + self.root_dir = root_dir self.target_dir = target_dir self.custom_args = {} self.temp_image_dir = None diff --git a/kiwi/disk_format_vmdk.py b/kiwi/disk_format_vmdk.py index 6a68e0e1..fb65dd32 100644 --- a/kiwi/disk_format_vmdk.py +++ b/kiwi/disk_format_vmdk.py @@ -56,10 +56,10 @@ class DiskFormatVmdk(DiskFormatBase): part of the image. If not found a warning is provided to the user and the VMDK descriptor stays untouched """ - vmdk_vmtoolsd = self.source_dir + '/usr/bin/vmtoolsd' + vmdk_vmtoolsd = self.root_dir + '/usr/bin/vmtoolsd' if not os.path.exists(vmdk_vmtoolsd): log.warning( - 'Could not find vmtoolsd in image root %s' % self.source_dir + 'Could not find vmtoolsd in image root %s' % self.root_dir ) log.warning( 'Update of VMDK metadata skipped' @@ -93,7 +93,7 @@ class DiskFormatVmdk(DiskFormatBase): def __get_vmdk_tools_version(self): vmdk_tools_version_call = Command.run( - ['chroot', self.source_dir, 'vmtoolsd', '--version'] + ['chroot', self.root_dir, 'vmtoolsd', '--version'] ) vmdk_tools_version = vmdk_tools_version_call.output vmdk_tools_version_format = re.match( diff --git a/kiwi/disk_setup.py b/kiwi/disk_setup.py index 49c20a71..4b4a1645 100644 --- a/kiwi/disk_setup.py +++ b/kiwi/disk_setup.py @@ -30,7 +30,7 @@ class DiskSetup(object): Implement disk setup methods providing information required before building a disk image """ - def __init__(self, xml_state, source_dir): + def __init__(self, xml_state, root_dir): self.configured_size = xml_state.get_build_type_size() self.build_type_name = xml_state.get_build_type_name() self.filesystem = xml_state.build_type.get_filesystem() @@ -47,10 +47,10 @@ class DiskSetup(object): xml_state.build_type.get_firmware() ) self.rootsize = SystemSize( - source_dir + root_dir ) - self.source_dir = source_dir + self.root_dir = root_dir self.xml_state = xml_state def get_disksize_mbytes(self): @@ -276,7 +276,7 @@ class DiskSetup(object): volume_total = 0 for volume in self.volumes: if volume.realpath and not volume.realpath == '/': - path_to_volume = self.source_dir + '/' + volume.realpath + path_to_volume = self.root_dir + '/' + volume.realpath if os.path.exists(path_to_volume): volume_size = SystemSize(path_to_volume) volume_mbytes[volume.realpath] = volume_size.customize( diff --git a/kiwi/filesystem.py b/kiwi/filesystem.py index b7e7ac06..5047dfba 100644 --- a/kiwi/filesystem.py +++ b/kiwi/filesystem.py @@ -35,42 +35,42 @@ class FileSystem(object): """ FileSystem factory """ - def __new__(self, name, device_provider, source_dir=None, custom_args=None): + def __new__(self, name, device_provider, root_dir=None, custom_args=None): if name == 'ext2': return FileSystemExt2( - device_provider, source_dir, custom_args + device_provider, root_dir, custom_args ) elif name == 'ext3': return FileSystemExt3( - device_provider, source_dir, custom_args + device_provider, root_dir, custom_args ) elif name == 'ext4': return FileSystemExt4( - device_provider, source_dir, custom_args + device_provider, root_dir, custom_args ) elif name == 'btrfs': return FileSystemBtrfs( - device_provider, source_dir, custom_args + device_provider, root_dir, custom_args ) elif name == 'xfs': return FileSystemXfs( - device_provider, source_dir, custom_args + device_provider, root_dir, custom_args ) elif name == 'fat16': return FileSystemFat16( - device_provider, source_dir, custom_args + device_provider, root_dir, custom_args ) elif name == 'fat32': return FileSystemFat32( - device_provider, source_dir, custom_args + device_provider, root_dir, custom_args ) elif name == 'squashfs': return FileSystemSquashFs( - device_provider, source_dir, custom_args + device_provider, root_dir, custom_args ) elif name == 'clicfs': return FileSystemClicFs( - device_provider, source_dir, custom_args + device_provider, root_dir, custom_args ) else: raise KiwiFileSystemSetupError( diff --git a/kiwi/filesystem_base.py b/kiwi/filesystem_base.py index e4c86e96..9432c9ca 100644 --- a/kiwi/filesystem_base.py +++ b/kiwi/filesystem_base.py @@ -34,7 +34,7 @@ class FileSystemBase(object): """ Implements base class for filesystem interface """ - def __init__(self, device_provider, source_dir=None, custom_args=None): + def __init__(self, device_provider, root_dir=None, custom_args=None): # filesystems created with a block device stores the mountpoint # here. The file name of the file containing the filesystem is # stored in the device_provider if the filesystem is represented @@ -47,7 +47,7 @@ class FileSystemBase(object): # filesystem required a block device to become created self.device_provider = device_provider - self.source_dir = source_dir + self.root_dir = root_dir # filesystems created without a block device stores the result # filesystem file name here @@ -71,20 +71,20 @@ class FileSystemBase(object): raise NotImplementedError def sync_data(self, exclude=None): - if not self.source_dir: + if not self.root_dir: raise KiwiFileSystemSyncError( - 'no source directory specified' + 'no root directory specified' ) - if not os.path.exists(self.source_dir): + if not os.path.exists(self.root_dir): raise KiwiFileSystemSyncError( - 'given source directory %s does not exist' % self.source_dir + 'given root directory %s does not exist' % self.root_dir ) device = self.device_provider.get_device() Command.run( ['mount', device, self.__setup_mountpoint()] ) if self.mountpoint and self.is_mounted(): - data = DataSync(self.source_dir, self.mountpoint) + data = DataSync(self.root_dir, self.mountpoint) data.sync_data(exclude) Command.run( ['umount', self.mountpoint] diff --git a/kiwi/filesystem_builder.py b/kiwi/filesystem_builder.py index 4c1b0207..b5510f98 100644 --- a/kiwi/filesystem_builder.py +++ b/kiwi/filesystem_builder.py @@ -33,10 +33,10 @@ class FileSystemBuilder(object): """ Filesystem image builder """ - def __init__(self, xml_state, target_dir, source_dir): + def __init__(self, xml_state, target_dir, root_dir): self.custom_args = None self.label = None - self.source_dir = source_dir + self.root_dir = root_dir self.requested_image_type = xml_state.get_build_type_name() if self.requested_image_type == 'pxe': self.requested_filesystem = xml_state.build_type.get_filesystem() @@ -54,7 +54,7 @@ class FileSystemBuilder(object): ] ) self.blocksize = xml_state.build_type.get_target_blocksize() - self.filesystem_setup = FileSystemSetup(xml_state, source_dir) + self.filesystem_setup = FileSystemSetup(xml_state, root_dir) self.filesystems_no_device_node = [ 'squashfs' ] @@ -88,7 +88,7 @@ class FileSystemBuilder(object): loop_provider.create() filesystem = FileSystem( self.requested_filesystem, loop_provider, - self.source_dir, self.custom_args + self.root_dir, self.custom_args ) filesystem.create_on_device(self.label) log.info( @@ -103,7 +103,7 @@ class FileSystemBuilder(object): default_provider = DeviceProvider() filesystem = FileSystem( self.requested_filesystem, default_provider, - self.source_dir, self.custom_args + self.root_dir, self.custom_args ) filesystem.create_on_file( self.filename, self.label diff --git a/kiwi/filesystem_clicfs.py b/kiwi/filesystem_clicfs.py index bf7c16ce..9483c9a3 100644 --- a/kiwi/filesystem_clicfs.py +++ b/kiwi/filesystem_clicfs.py @@ -45,7 +45,7 @@ class FileSystemClicFs(FileSystemBase): ) loop_provider.create() filesystem = FileSystemExt4( - loop_provider, self.source_dir + loop_provider, self.root_dir ) filesystem.create_on_device() filesystem.sync_data() @@ -62,9 +62,9 @@ class FileSystemClicFs(FileSystemBase): ) def __get_container_filesystem_size_mbytes(self): - size = SystemSize(self.source_dir) - source_dir_mbytes = size.accumulate_mbyte_file_sizes() - return size.customize(source_dir_mbytes, 'ext4') + size = SystemSize(self.root_dir) + root_dir_mbytes = size.accumulate_mbyte_file_sizes() + return size.customize(root_dir_mbytes, 'ext4') def __del__(self): if self.container_dir: diff --git a/kiwi/filesystem_isofs.py b/kiwi/filesystem_isofs.py index d3e601ee..8ae4f3d7 100644 --- a/kiwi/filesystem_isofs.py +++ b/kiwi/filesystem_isofs.py @@ -31,14 +31,14 @@ class FileSystemIsoFs(FileSystemBase): def create_on_file(self, filename, label=None): # there is no label which could be set for an iso filesystem # thus this parameter is not used - iso = Iso(self.source_dir) + iso = Iso(self.root_dir) iso.init_iso_creation_parameters(self.custom_args) iso.add_efi_loader_parameters() Command.run( [ 'genisoimage' ] + iso.get_iso_creation_parameters() + [ - '-o', filename, self.source_dir + '-o', filename, self.root_dir ] ) hybrid_offset = iso.create_header_end_block(filename) @@ -48,7 +48,7 @@ class FileSystemIsoFs(FileSystemBase): '-hide', iso.header_end_name, '-hide-joliet', iso.header_end_name ] + iso.get_iso_creation_parameters() + [ - '-o', filename, self.source_dir + '-o', filename, self.root_dir ] ) return hybrid_offset diff --git a/kiwi/filesystem_setup.py b/kiwi/filesystem_setup.py index 59c5389b..5c5f1f3f 100644 --- a/kiwi/filesystem_setup.py +++ b/kiwi/filesystem_setup.py @@ -23,12 +23,13 @@ from defaults import Defaults class FileSystemSetup(object): """ - Implement filesystem setup methods providing information required - before building a filesystem image + Implement filesystem setup methods providing information + from the root directory required before building a + filesystem image """ - def __init__(self, xml_state, source_dir): + def __init__(self, xml_state, root_dir): self.configured_size = xml_state.get_build_type_size() - self.size = SystemSize(source_dir) + self.size = SystemSize(root_dir) self.requested_image_type = xml_state.get_build_type_name() if self.requested_image_type in Defaults.get_filesystem_image_types(): self.requested_filesystem = self.requested_image_type @@ -36,9 +37,9 @@ class FileSystemSetup(object): self.requested_filesystem = xml_state.build_type.get_filesystem() def get_size_mbytes(self): - source_dir_mbytes = self.size.accumulate_mbyte_file_sizes() + root_dir_mbytes = self.size.accumulate_mbyte_file_sizes() filesystem_mbytes = self.size.customize( - source_dir_mbytes, self.requested_filesystem + root_dir_mbytes, self.requested_filesystem ) if not self.configured_size: diff --git a/kiwi/filesystem_squashfs.py b/kiwi/filesystem_squashfs.py index 99590a9e..03b9ef40 100644 --- a/kiwi/filesystem_squashfs.py +++ b/kiwi/filesystem_squashfs.py @@ -28,5 +28,5 @@ class FileSystemSquashFs(FileSystemBase): # there is no label which could be set for a squashfs # thus this parameter is not used Command.run( - ['mksquashfs', self.source_dir, filename] + self.custom_args + ['mksquashfs', self.root_dir, filename] + self.custom_args ) diff --git a/kiwi/install_image_builder.py b/kiwi/install_image_builder.py index a634442e..3d685abc 100644 --- a/kiwi/install_image_builder.py +++ b/kiwi/install_image_builder.py @@ -108,7 +108,7 @@ class InstallImageBuilder(object): ) squashed_image_file = self.diskname + '.squashfs' squashed_image = FileSystemSquashFs( - device_provider=None, source_dir=self.squashed_contents + device_provider=None, root_dir=self.squashed_contents ) squashed_image.create_on_file(squashed_image_file) Command.run( @@ -150,7 +150,7 @@ class InstallImageBuilder(object): log.info('Creating ISO filesystem') iso_image = FileSystemIsoFs( device_provider=None, - source_dir=self.media_dir, + root_dir=self.media_dir, custom_args=self.custom_iso_args ) iso_header_offset = iso_image.create_on_file(self.isoname) diff --git a/kiwi/live_image_builder.py b/kiwi/live_image_builder.py index cb688353..0ad9cddd 100644 --- a/kiwi/live_image_builder.py +++ b/kiwi/live_image_builder.py @@ -43,10 +43,10 @@ class LiveImageBuilder(object): """ Live image builder """ - def __init__(self, xml_state, target_dir, source_dir): + def __init__(self, xml_state, target_dir, root_dir): self.media_dir = None self.arch = platform.machine() - self.source_dir = source_dir + self.root_dir = root_dir self.target_dir = target_dir self.xml_state = xml_state self.live_type = xml_state.build_type.get_flags() @@ -118,7 +118,7 @@ class LiveImageBuilder(object): live_type_image = FileSystem( name=self.types[self.live_type], device_provider=None, - source_dir=self.source_dir + root_dir=self.root_dir ) live_type_image.create_on_file(self.live_image_file) Command.run( @@ -173,7 +173,7 @@ class LiveImageBuilder(object): log.info('Creating live ISO image') iso_image = FileSystemIsoFs( device_provider=None, - source_dir=self.media_dir, + root_dir=self.media_dir, custom_args=custom_iso_args ) iso_header_offset = iso_image.create_on_file(self.isoname) diff --git a/kiwi/pxe_builder.py b/kiwi/pxe_builder.py index f26c855a..0f835298 100644 --- a/kiwi/pxe_builder.py +++ b/kiwi/pxe_builder.py @@ -36,14 +36,14 @@ class PxeBuilder(object): root filesystem image with a checksum. The result can be used within the kiwi PXE boot infrastructure """ - def __init__(self, xml_state, target_dir, source_dir): + def __init__(self, xml_state, target_dir, root_dir): self.target_dir = target_dir self.compressed = xml_state.build_type.get_compressed() self.image_name = xml_state.xml_data.get_name() self.machine = xml_state.get_build_type_machine_section() self.pxedeploy = xml_state.get_build_type_pxedeploy_section() self.filesystem = FileSystemBuilder( - xml_state, target_dir, source_dir + xml_state, target_dir, root_dir ) self.boot_image_task = BootImageTask( xml_state, target_dir diff --git a/kiwi/volume_manager.py b/kiwi/volume_manager.py index ebb30659..25397d5d 100644 --- a/kiwi/volume_manager.py +++ b/kiwi/volume_manager.py @@ -29,15 +29,15 @@ class VolumeManager(object): VolumeManager factory """ def __new__( - self, name, device_provider, source_dir, volumes, custom_args=None + self, name, device_provider, root_dir, volumes, custom_args=None ): if name == 'lvm': return VolumeManagerLVM( - device_provider, source_dir, volumes, custom_args + device_provider, root_dir, volumes, custom_args ) elif name == 'btrfs': return VolumeManagerBtrfs( - device_provider, source_dir, volumes, custom_args + device_provider, root_dir, volumes, custom_args ) else: raise KiwiVolumeManagerSetupError( diff --git a/kiwi/volume_manager_base.py b/kiwi/volume_manager_base.py index 26b679ed..67dbe158 100644 --- a/kiwi/volume_manager_base.py +++ b/kiwi/volume_manager_base.py @@ -36,7 +36,7 @@ class VolumeManagerBase(DeviceProvider): """ Implements base class for volume management interface """ - def __init__(self, device_provider, source_dir, volumes, custom_args=None): + def __init__(self, device_provider, root_dir, volumes, custom_args=None): # all volumes are combined into one mountpoint. This is # needed at sync_data time. How to mount the volumes is # special to the volume management class @@ -47,7 +47,7 @@ class VolumeManagerBase(DeviceProvider): # the device should be released. self.device_provider = device_provider - self.source_dir = source_dir + self.root_dir = root_dir self.volumes = volumes self.volume_group = None self.volume_map = {} @@ -55,9 +55,9 @@ class VolumeManagerBase(DeviceProvider): self.device = self.device_provider.get_device() - if not os.path.exists(source_dir): + if not os.path.exists(root_dir): raise KiwiVolumeManagerSetupError( - 'given source directory %s does not exist' % source_dir + 'given root directory %s does not exist' % root_dir ) self.post_init(custom_args) @@ -102,14 +102,16 @@ class VolumeManagerBase(DeviceProvider): """ return self.device_provider.get_device() - def create_volume_paths_in_source_dir(self): + def create_volume_paths_in_root_dir(self): """ Implements creation of volume paths in the given - source directory + root directory """ for volume in self.volumes: if volume.realpath and not volume.realpath == '/': - volume_image_path = self.source_dir + '/' + volume.realpath + volume_image_path = os.path.normpath( + self.root_dir + '/' + volume.realpath + ) if not os.path.exists(volume_image_path): # not existing volume paths will be created in the image # root directory. This happens hidden to the user but is @@ -162,7 +164,7 @@ class VolumeManagerBase(DeviceProvider): # # You are invited to fix it :) volume_size = SystemSize( - self.source_dir + '/' + realpath + self.root_dir + '/' + realpath ) mbsize = int(mbsize) + \ Defaults.get_min_volume_mbytes() @@ -186,10 +188,10 @@ class VolumeManagerBase(DeviceProvider): def sync_data(self, exclude=None): """ - Implements sync of source directory to mounted volumes + Implements sync of root directory to mounted volumes """ if self.mountpoint and self.is_mounted(): - data = DataSync(self.source_dir, self.mountpoint) + data = DataSync(self.root_dir, self.mountpoint) data.sync_data(exclude) def setup_mountpoint(self): diff --git a/kiwi/volume_manager_btrfs.py b/kiwi/volume_manager_btrfs.py index 4baa9ea7..f381a693 100644 --- a/kiwi/volume_manager_btrfs.py +++ b/kiwi/volume_manager_btrfs.py @@ -80,7 +80,7 @@ class VolumeManagerBtrfs(VolumeManagerBase): log.info( 'Creating %s sub volumes', filesystem_name ) - self.create_volume_paths_in_source_dir() + self.create_volume_paths_in_root_dir() canonical_volume_list = self.get_canonical_volume_list() if canonical_volume_list.full_size_volume: @@ -111,7 +111,7 @@ class VolumeManagerBtrfs(VolumeManagerBase): def sync_data(self, exclude=None): if self.mountpoint and self.is_mounted(): - data = DataSync(self.source_dir, self.mountpoint + '/@') + data = DataSync(self.root_dir, self.mountpoint + '/@') data.sync_data(exclude) def __del__(self): diff --git a/kiwi/volume_manager_lvm.py b/kiwi/volume_manager_lvm.py index 66fc1bd6..42751a76 100644 --- a/kiwi/volume_manager_lvm.py +++ b/kiwi/volume_manager_lvm.py @@ -81,7 +81,7 @@ class VolumeManagerLVM(VolumeManagerBase): log.info( 'Creating volumes(%s)', filesystem_name ) - self.create_volume_paths_in_source_dir() + self.create_volume_paths_in_root_dir() canonical_volume_list = self.get_canonical_volume_list() for volume in canonical_volume_list.volumes: diff --git a/test/unit/archive_builder_test.py b/test/unit/archive_builder_test.py index b3434845..9daacc13 100644 --- a/test/unit/archive_builder_test.py +++ b/test/unit/archive_builder_test.py @@ -19,7 +19,7 @@ class TestArchiveBuilder(object): return_value='myimage' ) self.archive = ArchiveBuilder( - self.xml_state, 'target_dir', 'source_dir' + self.xml_state, 'target_dir', 'root_dir' ) @raises(KiwiArchiveSetupError) @@ -32,7 +32,7 @@ class TestArchiveBuilder(object): return_value='myimage' ) archive = ArchiveBuilder( - xml_state, 'target_dir', 'source_dir' + xml_state, 'target_dir', 'root_dir' ) archive.create() @@ -48,7 +48,7 @@ class TestArchiveBuilder(object): 'target_dir/myimage.tar' ) archive.create_xz_compressed.assert_called_once_with( - 'source_dir' + 'root_dir' ) mock_checksum.assert_called_once_with( 'target_dir/myimage.tar.xz' diff --git a/test/unit/bootloader_config_base_test.py b/test/unit/bootloader_config_base_test.py index b022bd20..b32e7fa6 100644 --- a/test/unit/bootloader_config_base_test.py +++ b/test/unit/bootloader_config_base_test.py @@ -20,7 +20,7 @@ class TestBootLoaderConfigBase(object): description.load() ) self.bootloader = BootLoaderConfigBase( - self.state, 'source_dir' + self.state, 'root_dir' ) @raises(NotImplementedError) @@ -60,12 +60,12 @@ class TestBootLoaderConfigBase(object): @patch('kiwi.path.Path.create') def test_create_efi_path(self, mock_path): self.bootloader.create_efi_path() - mock_path.assert_called_once_with('source_dir/boot/efi/EFI/BOOT') + mock_path.assert_called_once_with('root_dir/boot/efi/EFI/BOOT') @patch('kiwi.path.Path.create') def test_create_efi_path_with_prefix(self, mock_path): self.bootloader.create_efi_path('') - mock_path.assert_called_once_with('source_dir//EFI/BOOT') + mock_path.assert_called_once_with('root_dir//EFI/BOOT') def test_get_boot_theme(self): assert self.bootloader.get_boot_theme() == 'openSUSE' diff --git a/test/unit/bootloader_config_grub2_test.py b/test/unit/bootloader_config_grub2_test.py index b1f97584..57d2c7c6 100644 --- a/test/unit/bootloader_config_grub2_test.py +++ b/test/unit/bootloader_config_grub2_test.py @@ -47,7 +47,7 @@ class TestBootLoaderConfigGrub2(object): ) kiwi.bootloader_config_grub2.Command = mock.Mock() self.bootloader = BootLoaderConfigGrub2( - self.state, 'source_dir' + self.state, 'root_dir' ) self.bootloader.get_hypervisor_domain = mock.Mock( return_value='domU' @@ -58,7 +58,7 @@ class TestBootLoaderConfigGrub2(object): @patch('platform.machine') def test_post_init_invalid_platform(self, mock_machine): mock_machine.return_value = 'unsupported-arch' - BootLoaderConfigGrub2(mock.Mock(), 'source_dir') + BootLoaderConfigGrub2(mock.Mock(), 'root_dir') @patch('os.path.exists') def test_post_init_dom0(self, mock_exists): @@ -80,14 +80,14 @@ class TestBootLoaderConfigGrub2(object): setattr(context_manager_mock, '__enter__', enter_mock) setattr(context_manager_mock, '__exit__', exit_mock) self.bootloader.config = 'some-data' - self.bootloader.efi_boot_path = 'source_dir/boot/efi/EFI/BOOT/' + self.bootloader.efi_boot_path = 'root_dir/boot/efi/EFI/BOOT/' self.bootloader.write() call = mock_open.call_args_list[0] assert mock_open.call_args_list[0] == \ - call('source_dir/boot/grub2/grub.cfg', 'w') + call('root_dir/boot/grub2/grub.cfg', 'w') call = mock_open.call_args_list[1] assert mock_open.call_args_list[1] == \ - call('source_dir/boot/efi/EFI/BOOT//grub.cfg', 'w') + call('root_dir/boot/efi/EFI/BOOT//grub.cfg', 'w') assert file_mock.write.call_args_list == [ call('some-data'), call('some-data') @@ -211,7 +211,7 @@ class TestBootLoaderConfigGrub2(object): def test_setup_disk_boot_images_raises_grub_modules_does_not_exist( self, mock_command ): - self.bootloader.source_dir = '../data/root-dir' + self.bootloader.root_dir = '../data/root-dir' mock_command.side_effect = Exception self.bootloader.setup_disk_boot_images('0815') @@ -236,8 +236,8 @@ class TestBootLoaderConfigGrub2(object): self.bootloader.setup_disk_boot_images('0815') assert mock_open.call_args_list == [ - call('source_dir/boot/efi/EFI/BOOT/earlyboot.cfg', 'w'), - call('source_dir/boot/grub2/earlyboot.cfg', 'w') + call('root_dir/boot/efi/EFI/BOOT/earlyboot.cfg', 'w'), + call('root_dir/boot/grub2/earlyboot.cfg', 'w') ] assert file_mock.write.call_args_list == [ call('search --fs-uuid --set=root 0815\n'), @@ -247,19 +247,19 @@ class TestBootLoaderConfigGrub2(object): ] assert mock_command.call_args_list == [ call([ - 'cp', 'source_dir/usr/share/grub2/unicode.pf2', - 'source_dir/boot/unicode.pf2' + 'cp', 'root_dir/usr/share/grub2/unicode.pf2', + 'root_dir/boot/unicode.pf2' ]), call([ - 'cp', '-a', 'source_dir/usr/lib/grub2/x86_64-efi', - 'source_dir/boot/grub2/x86_64-efi' + 'cp', '-a', 'root_dir/usr/lib/grub2/x86_64-efi', + 'root_dir/boot/grub2/x86_64-efi' ]), call([ 'grub2-mkimage', '-O', 'x86_64-efi', - '-o', 'source_dir/boot/efi/EFI/BOOT/bootx64.efi', - '-c', 'source_dir/boot/efi/EFI/BOOT/earlyboot.cfg', + '-o', 'root_dir/boot/efi/EFI/BOOT/bootx64.efi', + '-c', 'root_dir/boot/efi/EFI/BOOT/earlyboot.cfg', '-p', '//grub2', - '-d', 'source_dir/boot/grub2/x86_64-efi', + '-d', 'root_dir/boot/grub2/x86_64-efi', 'ext2', 'iso9660', 'linux', 'echo', 'configfile', 'search_label', 'search_fs_file', 'search', 'search_fs_uuid', 'ls', 'normal', 'gzio', 'png', 'fat', 'gettext', 'font', @@ -268,15 +268,15 @@ class TestBootLoaderConfigGrub2(object): 'efi_uga', 'linuxefi' ]), call([ - 'cp', '-a', 'source_dir/usr/lib/grub2/i386-pc', - 'source_dir/boot/grub2/i386-pc' + 'cp', '-a', 'root_dir/usr/lib/grub2/i386-pc', + 'root_dir/boot/grub2/i386-pc' ]), call([ 'grub2-mkimage', '-O', 'i386-pc', - '-o', 'source_dir/boot/grub2/i386-pc/core.img', - '-c', 'source_dir/boot/grub2/earlyboot.cfg', + '-o', 'root_dir/boot/grub2/i386-pc/core.img', + '-c', 'root_dir/boot/grub2/earlyboot.cfg', '-p', '//grub2', - '-d', 'source_dir/boot/grub2/i386-pc', + '-d', 'root_dir/boot/grub2/i386-pc', 'ext2', 'iso9660', 'linux', 'echo', 'configfile', 'search_label', 'search_fs_file', 'search', 'search_fs_uuid', 'ls', 'normal', 'gzio', 'png', 'fat', 'gettext', 'font', @@ -311,7 +311,7 @@ class TestBootLoaderConfigGrub2(object): self.bootloader.setup_disk_boot_images('0815') mock_open.assert_called_once_with( - 'source_dir/boot/grub2/earlyboot.cfg', 'w' + 'root_dir/boot/grub2/earlyboot.cfg', 'w' ) assert file_mock.write.call_args_list == [ call('search --fs-uuid --set=root 0815\n'), @@ -319,19 +319,19 @@ class TestBootLoaderConfigGrub2(object): ] assert mock_command.call_args_list == [ call([ - 'cp', 'source_dir/usr/share/grub2/unicode.pf2', - 'source_dir/boot/unicode.pf2' + 'cp', 'root_dir/usr/share/grub2/unicode.pf2', + 'root_dir/boot/unicode.pf2' ]), call([ - 'cp', '-a', 'source_dir/usr/lib/grub2/x86_64-xen', - 'source_dir/boot/grub2/x86_64-xen' + 'cp', '-a', 'root_dir/usr/lib/grub2/x86_64-xen', + 'root_dir/boot/grub2/x86_64-xen' ]), call([ 'grub2-mkimage', '-O', 'x86_64-xen', - '-o', 'source_dir/boot/grub2/x86_64-xen/core.img', - '-c', 'source_dir/boot/grub2/earlyboot.cfg', + '-o', 'root_dir/boot/grub2/x86_64-xen/core.img', + '-c', 'root_dir/boot/grub2/earlyboot.cfg', '-p', '//grub2', - '-d', 'source_dir/boot/grub2/x86_64-xen', + '-d', 'root_dir/boot/grub2/x86_64-xen', 'ext2', 'iso9660', 'linux', 'echo', 'configfile', 'search_label', 'search_fs_file', 'search', 'search_fs_uuid', 'ls', 'normal', 'gzio', 'png', 'fat', 'gettext', 'font', @@ -356,14 +356,14 @@ class TestBootLoaderConfigGrub2(object): call = mock_command.call_args_list[0] assert mock_command.call_args_list[0] == \ call([ - 'cp', 'source_dir/usr/lib64/efi/shim.efi', - 'source_dir/boot/efi/EFI/BOOT/bootx64.efi' + 'cp', 'root_dir/usr/lib64/efi/shim.efi', + 'root_dir/boot/efi/EFI/BOOT/bootx64.efi' ]) call = mock_command.call_args_list[1] assert mock_command.call_args_list[1] == \ call([ - 'cp', 'source_dir/usr/lib64/efi/grub.efi', - 'source_dir/boot/efi/EFI/BOOT' + 'cp', 'root_dir/usr/lib64/efi/grub.efi', + 'root_dir/boot/efi/EFI/BOOT' ]) @patch('kiwi.bootloader_config_grub2.Command.run') @@ -387,7 +387,7 @@ class TestBootLoaderConfigGrub2(object): self.bootloader.setup_install_boot_images(self.mbrid) assert mock_open.call_args_list == [ - call('source_dir//EFI/BOOT/earlyboot.cfg', 'w') + call('root_dir//EFI/BOOT/earlyboot.cfg', 'w') ] assert file_mock.write.call_args_list == [ call('search --file --set=root /boot/0xffffffff\n'), @@ -395,19 +395,19 @@ class TestBootLoaderConfigGrub2(object): ] assert mock_command.call_args_list == [ call([ - 'cp', 'source_dir/usr/share/grub2/unicode.pf2', - 'source_dir/boot/unicode.pf2' + 'cp', 'root_dir/usr/share/grub2/unicode.pf2', + 'root_dir/boot/unicode.pf2' ]), call([ - 'cp', '-a', 'source_dir/usr/lib/grub2/x86_64-efi', - 'source_dir/boot/grub2/x86_64-efi' + 'cp', '-a', 'root_dir/usr/lib/grub2/x86_64-efi', + 'root_dir/boot/grub2/x86_64-efi' ]), call([ 'grub2-mkimage', '-O', 'x86_64-efi', - '-o', 'source_dir//EFI/BOOT/bootx64.efi', - '-c', 'source_dir//EFI/BOOT/earlyboot.cfg', + '-o', 'root_dir//EFI/BOOT/bootx64.efi', + '-c', 'root_dir//EFI/BOOT/earlyboot.cfg', '-p', '//grub2', - '-d', 'source_dir/boot/grub2/x86_64-efi', + '-d', 'root_dir/boot/grub2/x86_64-efi', 'ext2', 'iso9660', 'linux', 'echo', 'configfile', 'search_label', 'search_fs_file', 'search', 'search_fs_uuid', 'ls', 'normal', 'gzio', 'png', 'fat', 'gettext', 'font', @@ -416,14 +416,14 @@ class TestBootLoaderConfigGrub2(object): 'efi_uga', 'linuxefi' ]), call([ - 'qemu-img', 'create', 'source_dir/boot/x86_64/efi', '4M' + 'qemu-img', 'create', 'root_dir/boot/x86_64/efi', '4M' ]), call([ - 'mkdosfs', '-n', 'BOOT', 'source_dir/boot/x86_64/efi' + 'mkdosfs', '-n', 'BOOT', 'root_dir/boot/x86_64/efi' ]), call([ - 'mcopy', '-Do', '-s', '-i', 'source_dir/boot/x86_64/efi', - 'source_dir/EFI', '::' + 'mcopy', '-Do', '-s', '-i', 'root_dir/boot/x86_64/efi', + 'root_dir/EFI', '::' ]) ] @@ -441,14 +441,14 @@ class TestBootLoaderConfigGrub2(object): call = mock_command.call_args_list[0] assert mock_command.call_args_list[0] == \ call([ - 'cp', 'source_dir/usr/lib64/efi/shim.efi', - 'source_dir//EFI/BOOT/bootx64.efi' + 'cp', 'root_dir/usr/lib64/efi/shim.efi', + 'root_dir//EFI/BOOT/bootx64.efi' ]) call = mock_command.call_args_list[1] assert mock_command.call_args_list[1] == \ call([ - 'cp', 'source_dir/usr/lib64/efi/grub.efi', - 'source_dir//EFI/BOOT' + 'cp', 'root_dir/usr/lib64/efi/grub.efi', + 'root_dir//EFI/BOOT' ]) @patch('kiwi.bootloader_config_grub2.Command.run') @@ -468,8 +468,8 @@ class TestBootLoaderConfigGrub2(object): self.bootloader.setup_install_boot_images(self.mbrid) assert mock_command.call_args_list[1] == call([ 'rsync', '-zav', - 'source_dir/usr/share/grub2/themes/some-theme', - 'source_dir/boot/grub2/themes' + 'root_dir/usr/share/grub2/themes/some-theme', + 'root_dir/boot/grub2/themes' ]) @patch('kiwi.bootloader_config_grub2.Command.run') diff --git a/test/unit/bootloader_config_isolinux_test.py b/test/unit/bootloader_config_isolinux_test.py index fe726338..aa9b704d 100644 --- a/test/unit/bootloader_config_isolinux_test.py +++ b/test/unit/bootloader_config_isolinux_test.py @@ -33,7 +33,7 @@ class TestBootLoaderConfigIsoLinux(object): return_value=self.isolinux ) self.bootloader = BootLoaderConfigIsoLinux( - self.state, 'source_dir' + self.state, 'root_dir' ) self.bootloader.get_hypervisor_domain = mock.Mock( return_value='domU' @@ -43,7 +43,7 @@ class TestBootLoaderConfigIsoLinux(object): @patch('platform.machine') def test_post_init_invalid_platform(self, mock_machine): mock_machine.return_value = 'unsupported-arch' - BootLoaderConfigIsoLinux(mock.Mock(), 'source_dir') + BootLoaderConfigIsoLinux(mock.Mock(), 'root_dir') @patch('os.path.exists') def test_post_init_dom0(self, mock_exists): @@ -70,8 +70,8 @@ class TestBootLoaderConfigIsoLinux(object): self.bootloader.write() assert mock_open.call_args_list == [ - call('source_dir/boot/x86_64/loader/isolinux.cfg', 'w'), - call('source_dir/boot/x86_64/loader/isolinux.msg', 'w') + call('root_dir/boot/x86_64/loader/isolinux.cfg', 'w'), + call('root_dir/boot/x86_64/loader/isolinux.msg', 'w') ] assert file_mock.write.call_args_list == [ call('some-data'), @@ -118,7 +118,7 @@ class TestBootLoaderConfigIsoLinux(object): mock_command.assert_called_once_with( [ 'rsync', '-zav', 'lookup_dir/image/loader/', - 'source_dir/boot/x86_64/loader' + 'root_dir/boot/x86_64/loader' ] ) @@ -129,8 +129,8 @@ class TestBootLoaderConfigIsoLinux(object): ) mock_command.assert_called_once_with( [ - 'rsync', '-zav', 'source_dir/image/loader/', - 'source_dir/boot/x86_64/loader' + 'rsync', '-zav', 'root_dir/image/loader/', + 'root_dir/boot/x86_64/loader' ] ) diff --git a/test/unit/bootloader_config_test.py b/test/unit/bootloader_config_test.py index 1e5c4be9..886c8b11 100644 --- a/test/unit/bootloader_config_test.py +++ b/test/unit/bootloader_config_test.py @@ -12,16 +12,16 @@ from kiwi.bootloader_config import BootLoaderConfig class TestBootLoaderConfig(object): @raises(KiwiBootLoaderConfigSetupError) def test_bootloader_config_not_implemented(self): - BootLoaderConfig('foo', mock.Mock(), 'source_dir') + BootLoaderConfig('foo', mock.Mock(), 'root_dir') @patch('kiwi.bootloader_config.BootLoaderConfigGrub2') def test_bootloader_config_grub2(self, mock_grub2): xml_state = mock.Mock() - BootLoaderConfig('grub2', xml_state, 'source_dir') - mock_grub2.assert_called_once_with(xml_state, 'source_dir') + BootLoaderConfig('grub2', xml_state, 'root_dir') + mock_grub2.assert_called_once_with(xml_state, 'root_dir') @patch('kiwi.bootloader_config.BootLoaderConfigIsoLinux') def test_bootloader_config_isolinux(self, mock_isolinux): xml_state = mock.Mock() - BootLoaderConfig('isolinux', xml_state, 'source_dir') - mock_isolinux.assert_called_once_with(xml_state, 'source_dir') + BootLoaderConfig('isolinux', xml_state, 'root_dir') + mock_isolinux.assert_called_once_with(xml_state, 'root_dir') diff --git a/test/unit/bootloader_install_base_test.py b/test/unit/bootloader_install_base_test.py index 36ca4354..be2c5b95 100644 --- a/test/unit/bootloader_install_base_test.py +++ b/test/unit/bootloader_install_base_test.py @@ -12,7 +12,7 @@ from kiwi.bootloader_install_base import BootLoaderInstallBase class TestBootLoaderInstallBase(object): def setup(self): self.bootloader = BootLoaderInstallBase( - 'source_dir', mock.Mock() + 'root_dir', mock.Mock() ) @raises(NotImplementedError) diff --git a/test/unit/bootloader_install_grub2_test.py b/test/unit/bootloader_install_grub2_test.py index fe9485f4..bae5d984 100644 --- a/test/unit/bootloader_install_grub2_test.py +++ b/test/unit/bootloader_install_grub2_test.py @@ -17,7 +17,7 @@ class TestBootLoaderInstallGrub2(object): return_value='/dev/some-device' ) self.bootloader = BootLoaderInstallGrub2( - 'source_dir', device_provider + 'root_dir', device_provider ) def test_post_init(self): @@ -49,7 +49,7 @@ class TestBootLoaderInstallGrub2(object): '(hd0) /dev/some-device\n' ) assert mock_command.call_args_list == [ - call(['cp', '-a', 'source_dir/boot/', 'tmpdir']), + call(['cp', '-a', 'root_dir/boot/', 'tmpdir']), call([ 'grub2-bios-setup', '-f', '-d', 'tmpdir/boot/grub2/i386-pc', diff --git a/test/unit/bootloader_install_test.py b/test/unit/bootloader_install_test.py index 97bd3a44..bb2b1fa9 100644 --- a/test/unit/bootloader_install_test.py +++ b/test/unit/bootloader_install_test.py @@ -12,10 +12,10 @@ from kiwi.bootloader_install import BootLoaderInstall class TestBootLoaderInstall(object): @raises(KiwiBootLoaderInstallSetupError) def test_bootloader_install_not_implemented(self): - BootLoaderInstall('foo', 'source_dir', mock.Mock()) + BootLoaderInstall('foo', 'root_dir', mock.Mock()) @patch('kiwi.bootloader_install.BootLoaderInstallGrub2') def test_bootloader_install_grub2(self, mock_grub2): device_provider = mock.Mock() - BootLoaderInstall('grub2', 'source_dir', device_provider) - mock_grub2.assert_called_once_with('source_dir', device_provider) + BootLoaderInstall('grub2', 'root_dir', device_provider) + mock_grub2.assert_called_once_with('root_dir', device_provider) diff --git a/test/unit/disk_builder_test.py b/test/unit/disk_builder_test.py index 4adfc353..cb347c76 100644 --- a/test/unit/disk_builder_test.py +++ b/test/unit/disk_builder_test.py @@ -131,7 +131,7 @@ class TestDiskBuilder(object): return_value=self.luks_root ) self.disk_builder = DiskBuilder( - XMLState(description.load()), 'target_dir', 'source_dir' + XMLState(description.load()), 'target_dir', 'root_dir' ) self.disk_builder.build_type_name = 'oem' self.machine = mock.Mock() @@ -238,7 +238,7 @@ class TestDiskBuilder(object): ]) assert mock_open.call_args_list == [ call('boot_dir/config.partids', 'w'), - call('source_dir/boot/mbrid', 'w'), + call('root_dir/boot/mbrid', 'w'), call('/dev/some-loop', 'wb') ] assert file_mock.write.call_args_list == [ @@ -248,14 +248,14 @@ class TestDiskBuilder(object): call('\x0f\x0f\x0f\x0f') ] assert mock_command.call_args_list == [ - call(['cp', 'source_dir/recovery.partition.size', 'boot_dir']), - call(['mv', 'initrd', 'source_dir/boot/initrd.vmx']), + call(['cp', 'root_dir/recovery.partition.size', 'boot_dir']), + call(['mv', 'initrd', 'root_dir/boot/initrd.vmx']), ] self.kernel.copy_kernel.assert_called_once_with( - 'source_dir', '/boot/linux.vmx' + 'root_dir', '/boot/linux.vmx' ) self.kernel.copy_xen_hypervisor.assert_called_once_with( - 'source_dir', '/boot/xen.gz' + 'root_dir', '/boot/xen.gz' ) @patch('kiwi.disk_builder.FileSystem') @@ -326,7 +326,7 @@ class TestDiskBuilder(object): passphrase='passphrase', os=None ) self.luks_root.create_crypttab.assert_called_once_with( - 'source_dir/etc/crypttab' + 'root_dir/etc/crypttab' ) @patch('kiwi.disk_builder.FileSystem') diff --git a/test/unit/disk_format_base_test.py b/test/unit/disk_format_base_test.py index 2e62716b..bb93fd5d 100644 --- a/test/unit/disk_format_base_test.py +++ b/test/unit/disk_format_base_test.py @@ -18,7 +18,7 @@ class TestDiskFormatBase(object): self.xml_state = mock.Mock() self.xml_state.xml_data = xml_data self.disk_format = DiskFormatBase( - self.xml_state, 'source_dir', 'target_dir' + self.xml_state, 'root_dir', 'target_dir' ) @raises(NotImplementedError) diff --git a/test/unit/disk_format_gce_test.py b/test/unit/disk_format_gce_test.py index ce65c317..96c6e01f 100644 --- a/test/unit/disk_format_gce_test.py +++ b/test/unit/disk_format_gce_test.py @@ -24,7 +24,7 @@ class TestDiskFormatGce(object): return_value='0.8.15' ) self.disk_format = DiskFormatGce( - self.xml_state, 'source_dir', 'target_dir' + self.xml_state, 'root_dir', 'target_dir' ) def test_post_init(self): diff --git a/test/unit/disk_format_qcow2_test.py b/test/unit/disk_format_qcow2_test.py index 951dd2cc..ecc6c1b6 100644 --- a/test/unit/disk_format_qcow2_test.py +++ b/test/unit/disk_format_qcow2_test.py @@ -18,7 +18,7 @@ class TestDiskFormatQcow2(object): self.xml_state = mock.Mock() self.xml_state.xml_data = xml_data self.disk_format = DiskFormatQcow2( - self.xml_state, 'source_dir', 'target_dir' + self.xml_state, 'root_dir', 'target_dir' ) def test_post_init(self): diff --git a/test/unit/disk_format_test.py b/test/unit/disk_format_test.py index a68c8fd2..3c9dd2a9 100644 --- a/test/unit/disk_format_test.py +++ b/test/unit/disk_format_test.py @@ -12,22 +12,22 @@ from kiwi.disk_format import DiskFormat class TestDiskFormat(object): @raises(KiwiDiskFormatSetupError) def test_format_not_implemented(self): - DiskFormat('foo', mock.Mock(), 'source_dir', 'target_dir') + DiskFormat('foo', mock.Mock(), 'root_dir', 'target_dir') @patch('kiwi.disk_format.DiskFormatQcow2') def test_disk_format_qcow2(self, mock_qcow2): xml_state = mock.Mock() - DiskFormat('qcow2', xml_state, 'source_dir', 'target_dir') + DiskFormat('qcow2', xml_state, 'root_dir', 'target_dir') mock_qcow2.assert_called_once_with( - xml_state, 'source_dir', 'target_dir' + xml_state, 'root_dir', 'target_dir' ) @patch('kiwi.disk_format.DiskFormatVhd') def test_disk_format_vhd(self, mock_vhd): xml_state = mock.Mock() - DiskFormat('vhd', xml_state, 'source_dir', 'target_dir') + DiskFormat('vhd', xml_state, 'root_dir', 'target_dir') mock_vhd.assert_called_once_with( - xml_state, 'source_dir', 'target_dir' + xml_state, 'root_dir', 'target_dir' ) @patch('kiwi.disk_format.DiskFormatVhdFixed') @@ -36,9 +36,9 @@ class TestDiskFormat(object): xml_state.build_type.get_vhdfixedtag = mock.Mock( return_value='disk-tag' ) - DiskFormat('vhdfixed', xml_state, 'source_dir', 'target_dir') + DiskFormat('vhdfixed', xml_state, 'root_dir', 'target_dir') mock_vhdfixed.assert_called_once_with( - xml_state, 'source_dir', 'target_dir', {'--tag': 'disk-tag'} + xml_state, 'root_dir', 'target_dir', {'--tag': 'disk-tag'} ) @patch('kiwi.disk_format.DiskFormatGce') @@ -47,9 +47,9 @@ class TestDiskFormat(object): xml_state.build_type.get_gcelicense = mock.Mock( return_value='gce_license_tag' ) - DiskFormat('gce', xml_state, 'source_dir', 'target_dir') + DiskFormat('gce', xml_state, 'root_dir', 'target_dir') mock_gce.assert_called_once_with( - xml_state, 'source_dir', 'target_dir', {'--tag': 'gce_license_tag'} + xml_state, 'root_dir', 'target_dir', {'--tag': 'gce_license_tag'} ) @patch('kiwi.disk_format.DiskFormatVmdk') @@ -65,8 +65,8 @@ class TestDiskFormat(object): xml_state.get_build_type_vmdisk_section = mock.Mock( return_value=vmdisk ) - DiskFormat('vmdk', xml_state, 'source_dir', 'target_dir') + DiskFormat('vmdk', xml_state, 'root_dir', 'target_dir') mock_vmdk.assert_called_once_with( - xml_state, 'source_dir', 'target_dir', + xml_state, 'root_dir', 'target_dir', {'adapter_type=controller': None, 'subformat=disk-mode': None} ) diff --git a/test/unit/disk_format_vhd_test.py b/test/unit/disk_format_vhd_test.py index 422f04cf..77003bdf 100644 --- a/test/unit/disk_format_vhd_test.py +++ b/test/unit/disk_format_vhd_test.py @@ -18,7 +18,7 @@ class TestDiskFormatVhd(object): self.xml_state = mock.Mock() self.xml_state.xml_data = xml_data self.disk_format = DiskFormatVhd( - self.xml_state, 'source_dir', 'target_dir' + self.xml_state, 'root_dir', 'target_dir' ) def test_post_init(self): diff --git a/test/unit/disk_format_vhdfixed_test.py b/test/unit/disk_format_vhdfixed_test.py index 3051c40c..d4cb0859 100644 --- a/test/unit/disk_format_vhdfixed_test.py +++ b/test/unit/disk_format_vhdfixed_test.py @@ -18,7 +18,7 @@ class TestDiskFormatVhdFixed(object): self.xml_state = mock.Mock() self.xml_state.xml_data = xml_data self.disk_format = DiskFormatVhdFixed( - self.xml_state, 'source_dir', 'target_dir' + self.xml_state, 'root_dir', 'target_dir' ) def test_post_init(self): diff --git a/test/unit/disk_format_vmdk_test.py b/test/unit/disk_format_vmdk_test.py index 07224037..1c6ac173 100644 --- a/test/unit/disk_format_vmdk_test.py +++ b/test/unit/disk_format_vmdk_test.py @@ -18,7 +18,7 @@ class TestDiskFormatVmdk(object): self.xml_state = mock.Mock() self.xml_state.xml_data = xml_data self.disk_format = DiskFormatVmdk( - self.xml_state, 'source_dir', 'target_dir' + self.xml_state, 'root_dir', 'target_dir' ) def test_post_init(self): diff --git a/test/unit/disk_setup_test.py b/test/unit/disk_setup_test.py index f16af295..f53cea4d 100644 --- a/test/unit/disk_setup_test.py +++ b/test/unit/disk_setup_test.py @@ -29,25 +29,25 @@ class TestDiskSetup(object): '../data/example_disk_size_config.xml' ) self.setup = DiskSetup( - XMLState(description.load()), 'source_dir' + XMLState(description.load()), 'root_dir' ) description = XMLDescription( '../data/example_disk_size_volume_config.xml' ) self.setup_volumes = DiskSetup( - XMLState(description.load()), 'source_dir' + XMLState(description.load()), 'root_dir' ) description = XMLDescription( '../data/example_disk_size_empty_vol_config.xml' ) self.setup_empty_volumes = DiskSetup( - XMLState(description.load()), 'source_dir' + XMLState(description.load()), 'root_dir' ) description = XMLDescription( '../data/example_disk_size_vol_root_config.xml' ) self.setup_root_volume = DiskSetup( - XMLState(description.load()), 'source_dir' + XMLState(description.load()), 'root_dir' ) def test_need_boot_partition_on_request(self): diff --git a/test/unit/filesystem_base_test.py b/test/unit/filesystem_base_test.py index 07c48aab..38537989 100644 --- a/test/unit/filesystem_base_test.py +++ b/test/unit/filesystem_base_test.py @@ -15,15 +15,15 @@ class TestFileSystemBase(object): provider.get_device = mock.Mock( return_value='/dev/loop0' ) - self.fsbase = FileSystemBase(provider, 'source_dir') + self.fsbase = FileSystemBase(provider, 'root_dir') @raises(KiwiFileSystemSyncError) - def test_source_dir_does_not_exist(self): - fsbase = FileSystemBase(mock.Mock(), 'source_dir_not_existing') + def test_root_dir_does_not_exist(self): + fsbase = FileSystemBase(mock.Mock(), 'root_dir_not_existing') fsbase.sync_data() @raises(KiwiFileSystemSyncError) - def test_source_dir_not_defined(self): + def test_root_dir_not_defined(self): fsbase = FileSystemBase(mock.Mock()) fsbase.sync_data() @@ -62,7 +62,7 @@ class TestFileSystemBase(object): mock_exists.return_value = True mock_mkdtemp.return_value = 'tmpdir' self.fsbase.sync_data(['exclude_me']) - mock_sync.assert_called_once_with('source_dir', 'tmpdir') + mock_sync.assert_called_once_with('root_dir', 'tmpdir') data_sync.sync_data.assert_called_once_with(['exclude_me']) call = mock_command.call_args_list[0] assert mock_command.call_args_list[0] == \ diff --git a/test/unit/filesystem_btrfs_test.py b/test/unit/filesystem_btrfs_test.py index 58dacc7c..0653cc55 100644 --- a/test/unit/filesystem_btrfs_test.py +++ b/test/unit/filesystem_btrfs_test.py @@ -17,7 +17,7 @@ class TestFileSystemBtrfs(object): provider.get_device = mock.Mock( return_value='/dev/foo' ) - self.btrfs = FileSystemBtrfs(provider, 'source_dir') + self.btrfs = FileSystemBtrfs(provider, 'root_dir') self.btrfs.setup_mountpoint = mock.Mock( return_value='some-mount-point' ) diff --git a/test/unit/filesystem_builder_test.py b/test/unit/filesystem_builder_test.py index 3713f75d..1dbd13be 100644 --- a/test/unit/filesystem_builder_test.py +++ b/test/unit/filesystem_builder_test.py @@ -39,7 +39,7 @@ class TestFileSystemBuilder(object): ) mock_fs_setup.return_value = fs_setup self.fs = FileSystemBuilder( - self.xml_state, 'target_dir', 'source_dir' + self.xml_state, 'target_dir', 'root_dir' ) @raises(KiwiFileSystemSetupError) @@ -52,7 +52,7 @@ class TestFileSystemBuilder(object): return_value='myimage' ) fs = FileSystemBuilder( - xml_state, 'target_dir', 'source_dir' + xml_state, 'target_dir', 'root_dir' ) fs.create() @@ -65,7 +65,7 @@ class TestFileSystemBuilder(object): xml_state.build_type.get_filesystem = mock.Mock( return_value=None ) - FileSystemBuilder(xml_state, 'target_dir', 'source_dir') + FileSystemBuilder(xml_state, 'target_dir', 'root_dir') @patch('kiwi.filesystem_builder.LoopDevice') @patch('kiwi.filesystem_builder.FileSystem') @@ -78,7 +78,7 @@ class TestFileSystemBuilder(object): ) self.loop_provider.create.assert_called_once_with() mock_fs.assert_called_once_with( - 'ext3', self.loop_provider, 'source_dir', None + 'ext3', self.loop_provider, 'root_dir', None ) self.filesystem.create_on_device.assert_called_once_with(None) self.filesystem.sync_data.assert_called_once_with( @@ -95,7 +95,7 @@ class TestFileSystemBuilder(object): self.fs.filename = 'target_dir/myimage.squashfs' self.fs.create() mock_fs.assert_called_once_with( - 'squashfs', provider, 'source_dir', None + 'squashfs', provider, 'root_dir', None ) self.filesystem.create_on_file.assert_called_once_with( 'target_dir/myimage.squashfs', None diff --git a/test/unit/filesystem_clicfs_test.py b/test/unit/filesystem_clicfs_test.py index 86c6473e..dfb256b2 100644 --- a/test/unit/filesystem_clicfs_test.py +++ b/test/unit/filesystem_clicfs_test.py @@ -13,7 +13,7 @@ class TestFileSystemClicFs(object): @patch('os.path.exists') def setup(self, mock_exists): mock_exists.return_value = True - self.clicfs = FileSystemClicFs(mock.Mock(), 'source_dir') + self.clicfs = FileSystemClicFs(mock.Mock(), 'root_dir') @patch('kiwi.filesystem_clicfs.Command.run') @patch('kiwi.filesystem_clicfs.mkdtemp') @@ -48,7 +48,7 @@ class TestFileSystemClicFs(object): ) loop_provider.create.assert_called_once_with() mock_ext4.assert_called_once_with( - loop_provider, 'source_dir' + loop_provider, 'root_dir' ) filesystem.create_on_device.assert_called_once_with() assert mock_command.call_args_list == [ diff --git a/test/unit/filesystem_ext2_test.py b/test/unit/filesystem_ext2_test.py index 011335c8..d01bf7b6 100644 --- a/test/unit/filesystem_ext2_test.py +++ b/test/unit/filesystem_ext2_test.py @@ -17,7 +17,7 @@ class TestFileSystemExt2(object): provider.get_device = mock.Mock( return_value='/dev/foo' ) - self.ext2 = FileSystemExt2(provider, 'source_dir') + self.ext2 = FileSystemExt2(provider, 'root_dir') self.ext2.setup_mountpoint = mock.Mock( return_value='some-mount-point' ) diff --git a/test/unit/filesystem_ext3_test.py b/test/unit/filesystem_ext3_test.py index a20a76a3..8617d32c 100644 --- a/test/unit/filesystem_ext3_test.py +++ b/test/unit/filesystem_ext3_test.py @@ -17,7 +17,7 @@ class TestFileSystemExt3(object): provider.get_device = mock.Mock( return_value='/dev/foo' ) - self.ext3 = FileSystemExt3(provider, 'source_dir') + self.ext3 = FileSystemExt3(provider, 'root_dir') self.ext3.setup_mountpoint = mock.Mock( return_value='some-mount-point' ) diff --git a/test/unit/filesystem_ext4_test.py b/test/unit/filesystem_ext4_test.py index 361402e0..f56ee56d 100644 --- a/test/unit/filesystem_ext4_test.py +++ b/test/unit/filesystem_ext4_test.py @@ -17,7 +17,7 @@ class TestFileSystemExt4(object): provider.get_device = mock.Mock( return_value='/dev/foo' ) - self.ext4 = FileSystemExt4(provider, 'source_dir') + self.ext4 = FileSystemExt4(provider, 'root_dir') self.ext4.setup_mountpoint = mock.Mock( return_value='some-mount-point' ) diff --git a/test/unit/filesystem_fat16_test.py b/test/unit/filesystem_fat16_test.py index a32bf061..04d4bf50 100644 --- a/test/unit/filesystem_fat16_test.py +++ b/test/unit/filesystem_fat16_test.py @@ -17,7 +17,7 @@ class TestFileSystemFat16(object): provider.get_device = mock.Mock( return_value='/dev/foo' ) - self.fat16 = FileSystemFat16(provider, 'source_dir') + self.fat16 = FileSystemFat16(provider, 'root_dir') self.fat16.setup_mountpoint = mock.Mock( return_value='some-mount-point' ) diff --git a/test/unit/filesystem_fat32_test.py b/test/unit/filesystem_fat32_test.py index bd59011d..6a1dd7a9 100644 --- a/test/unit/filesystem_fat32_test.py +++ b/test/unit/filesystem_fat32_test.py @@ -17,7 +17,7 @@ class TestFileSystemFat32(object): provider.get_device = mock.Mock( return_value='/dev/foo' ) - self.fat32 = FileSystemFat32(provider, 'source_dir') + self.fat32 = FileSystemFat32(provider, 'root_dir') self.fat32.setup_mountpoint = mock.Mock( return_value='some-mount-point' ) diff --git a/test/unit/filesystem_isofs_test.py b/test/unit/filesystem_isofs_test.py index 98f10e60..c62e3079 100644 --- a/test/unit/filesystem_isofs_test.py +++ b/test/unit/filesystem_isofs_test.py @@ -13,7 +13,7 @@ class TestFileSystemIsoFs(object): @patch('os.path.exists') def setup(self, mock_exists): mock_exists.return_value = True - self.isofs = FileSystemIsoFs(mock.Mock(), 'source_dir') + self.isofs = FileSystemIsoFs(mock.Mock(), 'root_dir') def test_post_init(self): self.isofs.post_init(['args']) @@ -36,11 +36,11 @@ class TestFileSystemIsoFs(object): ) mock_command.call_args_list == [ call([ - 'genisoimage', 'args', '-o', 'myimage', 'source_dir' + 'genisoimage', 'args', '-o', 'myimage', 'root_dir' ]), call([ 'genisoimage', '-hide', 'header_end', '-hide-joliet', 'header_end', 'args', '-o', 'myimage', - 'source_dir' + 'root_dir' ]) ] diff --git a/test/unit/filesystem_setup_test.py b/test/unit/filesystem_setup_test.py index 613647a4..bfa1bf6e 100644 --- a/test/unit/filesystem_setup_test.py +++ b/test/unit/filesystem_setup_test.py @@ -25,7 +25,7 @@ class TestFileSystemSetup(object): return_value='ext4' ) self.setup = FileSystemSetup( - self.xml_state, 'source_dir' + self.xml_state, 'root_dir' ) def test_setup_with_pxe_type(self): @@ -36,7 +36,7 @@ class TestFileSystemSetup(object): return_value='xfs' ) setup = FileSystemSetup( - self.xml_state, 'source_dir' + self.xml_state, 'root_dir' ) assert setup.requested_filesystem == 'xfs' diff --git a/test/unit/filesystem_squashfs_test.py b/test/unit/filesystem_squashfs_test.py index c7f3bf5e..1857a503 100644 --- a/test/unit/filesystem_squashfs_test.py +++ b/test/unit/filesystem_squashfs_test.py @@ -13,11 +13,11 @@ class TestFileSystemSquashfs(object): @patch('os.path.exists') def setup(self, mock_exists): mock_exists.return_value = True - self.squashfs = FileSystemSquashFs(mock.Mock(), 'source_dir') + self.squashfs = FileSystemSquashFs(mock.Mock(), 'root_dir') @patch('kiwi.filesystem_squashfs.Command.run') def test_create_on_file(self, mock_command): self.squashfs.create_on_file('myimage', 'label') mock_command.assert_called_once_with( - ['mksquashfs', 'source_dir', 'myimage'] + ['mksquashfs', 'root_dir', 'myimage'] ) diff --git a/test/unit/filesystem_test.py b/test/unit/filesystem_test.py index 5b93d2a7..91fc3d61 100644 --- a/test/unit/filesystem_test.py +++ b/test/unit/filesystem_test.py @@ -12,58 +12,58 @@ from kiwi.filesystem import FileSystem class TestFileSystem(object): @raises(KiwiFileSystemSetupError) def test_filesystem_not_implemented(self): - FileSystem('foo', mock.Mock(), 'source_dir') + FileSystem('foo', mock.Mock(), 'root_dir') @patch('kiwi.filesystem.FileSystemExt2') def test_filesystem_ext2(self, mock_ext2): provider = mock.Mock() - FileSystem('ext2', provider, 'source_dir') - mock_ext2.assert_called_once_with(provider, 'source_dir', None) + FileSystem('ext2', provider, 'root_dir') + mock_ext2.assert_called_once_with(provider, 'root_dir', None) @patch('kiwi.filesystem.FileSystemExt3') def test_filesystem_ext3(self, mock_ext3): provider = mock.Mock() - FileSystem('ext3', provider, 'source_dir') - mock_ext3.assert_called_once_with(provider, 'source_dir', None) + FileSystem('ext3', provider, 'root_dir') + mock_ext3.assert_called_once_with(provider, 'root_dir', None) @patch('kiwi.filesystem.FileSystemExt4') def test_filesystem_ext4(self, mock_ext4): provider = mock.Mock() - FileSystem('ext4', provider, 'source_dir') - mock_ext4.assert_called_once_with(provider, 'source_dir', None) + FileSystem('ext4', provider, 'root_dir') + mock_ext4.assert_called_once_with(provider, 'root_dir', None) @patch('kiwi.filesystem.FileSystemXfs') def test_filesystem_xfs(self, mock_xfs): provider = mock.Mock() - FileSystem('xfs', provider, 'source_dir') - mock_xfs.assert_called_once_with(provider, 'source_dir', None) + FileSystem('xfs', provider, 'root_dir') + mock_xfs.assert_called_once_with(provider, 'root_dir', None) @patch('kiwi.filesystem.FileSystemBtrfs') def test_filesystem_btrfs(self, mock_btrfs): provider = mock.Mock() - FileSystem('btrfs', provider, 'source_dir') - mock_btrfs.assert_called_once_with(provider, 'source_dir', None) + FileSystem('btrfs', provider, 'root_dir') + mock_btrfs.assert_called_once_with(provider, 'root_dir', None) @patch('kiwi.filesystem.FileSystemFat16') def test_filesystem_fat16(self, mock_fat16): provider = mock.Mock() - FileSystem('fat16', provider, 'source_dir') - mock_fat16.assert_called_once_with(provider, 'source_dir', None) + FileSystem('fat16', provider, 'root_dir') + mock_fat16.assert_called_once_with(provider, 'root_dir', None) @patch('kiwi.filesystem.FileSystemFat32') def test_filesystem_fat32(self, mock_fat32): provider = mock.Mock() - FileSystem('fat32', provider, 'source_dir') - mock_fat32.assert_called_once_with(provider, 'source_dir', None) + FileSystem('fat32', provider, 'root_dir') + mock_fat32.assert_called_once_with(provider, 'root_dir', None) @patch('kiwi.filesystem.FileSystemSquashFs') def test_filesystem_squashfs(self, mock_squashfs): provider = mock.Mock() - FileSystem('squashfs', provider, 'source_dir') - mock_squashfs.assert_called_once_with(provider, 'source_dir', None) + FileSystem('squashfs', provider, 'root_dir') + mock_squashfs.assert_called_once_with(provider, 'root_dir', None) @patch('kiwi.filesystem.FileSystemClicFs') def test_filesystem_clicfs(self, mock_clicfs): provider = mock.Mock() - FileSystem('clicfs', provider, 'source_dir') - mock_clicfs.assert_called_once_with(provider, 'source_dir', None) + FileSystem('clicfs', provider, 'root_dir') + mock_clicfs.assert_called_once_with(provider, 'root_dir', None) diff --git a/test/unit/filesystem_xfs_test.py b/test/unit/filesystem_xfs_test.py index 89a35973..5a63b4f5 100644 --- a/test/unit/filesystem_xfs_test.py +++ b/test/unit/filesystem_xfs_test.py @@ -17,7 +17,7 @@ class TestFileSystemXfs(object): provider.get_device = mock.Mock( return_value='/dev/foo' ) - self.xfs = FileSystemXfs(provider, 'source_dir') + self.xfs = FileSystemXfs(provider, 'root_dir') self.xfs.setup_mountpoint = mock.Mock( return_value='some-mount-point' ) diff --git a/test/unit/live_image_builder_test.py b/test/unit/live_image_builder_test.py index cf4378e1..68bcfb6b 100644 --- a/test/unit/live_image_builder_test.py +++ b/test/unit/live_image_builder_test.py @@ -58,7 +58,7 @@ class TestLiveImageBuilder(object): return_value='custom_cmdline' ) self.live_image = LiveImageBuilder( - self.xml_state, 'target_dir', 'source_dir' + self.xml_state, 'target_dir', 'root_dir' ) self.live_image.machine = mock.Mock() self.live_image.machine.get_domain = mock.Mock( @@ -112,7 +112,7 @@ class TestLiveImageBuilder(object): self.live_image.boot_image_task.prepare.assert_called_once_with() mock_fs.assert_called_once_with( - device_provider=None, name='squashfs', source_dir='source_dir' + device_provider=None, name='squashfs', root_dir='root_dir' ) live_type_image.create_on_file.assert_called_once_with( 'target_dir/result-image-read-only.x86_64-1.2.3' @@ -178,7 +178,7 @@ class TestLiveImageBuilder(object): '-publisher', '"SUSE LINUX GmbH"', '-V', '"volid"', '-allow-limited-size', '-udf' - ], device_provider=None, source_dir='temp_media_dir' + ], device_provider=None, root_dir='temp_media_dir' ) iso_image.create_on_file.assert_called_once_with( 'target_dir/result-image.iso' diff --git a/test/unit/pxe_builder_test.py b/test/unit/pxe_builder_test.py index 237426a4..4b0b547d 100644 --- a/test/unit/pxe_builder_test.py +++ b/test/unit/pxe_builder_test.py @@ -40,7 +40,7 @@ class TestPxeBuilder(object): return_value=self.kernel ) self.pxe = PxeBuilder( - self.xml_state, 'target_dir', 'source_dir' + self.xml_state, 'target_dir', 'root_dir' ) self.machine = mock.Mock() self.machine.get_domain = mock.Mock( diff --git a/test/unit/system_size_test.py b/test/unit/system_size_test.py index 63b16920..12826f7e 100644 --- a/test/unit/system_size_test.py +++ b/test/unit/system_size_test.py @@ -11,7 +11,7 @@ from kiwi.system_size import SystemSize class TestSystemSize(object): def setup(self): - self.size = SystemSize('source_dir') + self.size = SystemSize('directory') def test_customize_ext(self): self.size.accumulate_files = mock.Mock( @@ -29,12 +29,12 @@ class TestSystemSize(object): def test_accumulate_mbyte_file_sizes(self, mock_command): self.size.accumulate_mbyte_file_sizes() mock_command.assert_called_once_with( - ['du', '-s', '--apparent-size', '--block-size', '1', 'source_dir'] + ['du', '-s', '--apparent-size', '--block-size', '1', 'directory'] ) @patch('kiwi.system_size.Command.run') def test_accumulate_files(self, mock_command): self.size.accumulate_files() mock_command.assert_called_once_with( - ['bash', '-c', 'find source_dir | wc -l'] + ['bash', '-c', 'find directory | wc -l'] ) diff --git a/test/unit/volume_manager_base_test.py b/test/unit/volume_manager_base_test.py index 26fb78b8..0ffc6250 100644 --- a/test/unit/volume_manager_base_test.py +++ b/test/unit/volume_manager_base_test.py @@ -31,12 +31,14 @@ class TestVolumeManagerBase(object): return_value='/dev/storage' ) self.volume_manager = VolumeManagerBase( - self.device_provider, 'source_dir', mock.Mock() + self.device_provider, 'root_dir', mock.Mock() ) + @patch('os.path.exists') @raises(KiwiVolumeManagerSetupError) - def test_source_dir_does_not_exist(self): - VolumeManagerBase(mock.Mock(), 'source_dir', mock.Mock()) + def test_root_dir_does_not_exist(self, mock_exists): + mock_exists.return_value = False + VolumeManagerBase(mock.Mock(), 'root_dir', mock.Mock()) def test_is_loop(self): assert self.volume_manager.is_loop() == \ @@ -56,7 +58,7 @@ class TestVolumeManagerBase(object): @patch('kiwi.volume_manager_base.Path.create') @patch('os.path.exists') - def test_create_volume_paths_in_source_dir(self, mock_os_path, mock_path): + def test_create_volume_paths_in_root_dir(self, mock_os_path, mock_path): mock_os_path.return_value = False self.volume_manager.volumes = [ self.volume_type( @@ -64,8 +66,8 @@ class TestVolumeManagerBase(object): mountpoint='/etc', fullsize=False ) ] - self.volume_manager.create_volume_paths_in_source_dir() - mock_path.assert_called_once_with('source_dir//etc') + self.volume_manager.create_volume_paths_in_root_dir() + mock_path.assert_called_once_with('root_dir/etc') def test_get_canonical_volume_list(self): self.volume_manager.volumes = [ @@ -123,7 +125,7 @@ class TestVolumeManagerBase(object): self.volume_manager.mountpoint = 'mountpoint' self.volume_manager.sync_data(['exclude_me']) mock_sync.assert_called_once_with( - 'source_dir', 'mountpoint' + 'root_dir', 'mountpoint' ) data_sync.sync_data.assert_called_once_with(['exclude_me']) diff --git a/test/unit/volume_manager_btrfs_test.py b/test/unit/volume_manager_btrfs_test.py index 54431711..fb8fe5e4 100644 --- a/test/unit/volume_manager_btrfs_test.py +++ b/test/unit/volume_manager_btrfs_test.py @@ -49,7 +49,7 @@ class TestVolumeManagerBtrfs(object): return_value='/dev/storage' ) self.volume_manager = VolumeManagerBtrfs( - self.device_provider, 'source_dir', self.volumes + self.device_provider, 'root_dir', self.volumes ) def test_post_init(self): @@ -126,17 +126,17 @@ class TestVolumeManagerBtrfs(object): call = mock_command.call_args_list[0] assert mock_command.call_args_list[0] == \ call([ - 'mkdir', '-p', 'source_dir//etc' + 'mkdir', '-p', 'root_dir/etc' ]) call = mock_command.call_args_list[1] assert mock_command.call_args_list[1] == \ call([ - 'mkdir', '-p', 'source_dir//data' + 'mkdir', '-p', 'root_dir/data' ]) call = mock_command.call_args_list[2] assert mock_command.call_args_list[2] == \ call([ - 'mkdir', '-p', 'source_dir//home' + 'mkdir', '-p', 'root_dir/home' ]) call = mock_command.call_args_list[3] assert mock_command.call_args_list[3] == \ @@ -165,7 +165,7 @@ class TestVolumeManagerBtrfs(object): sync = mock.Mock() mock_sync.return_value = sync self.volume_manager.sync_data(['exclude_me']) - mock_sync.assert_called_once_with('source_dir', 'tmpdir/@') + mock_sync.assert_called_once_with('root_dir', 'tmpdir/@') sync.sync_data.assert_called_once_with(['exclude_me']) @patch('time.sleep') diff --git a/test/unit/volume_manager_lvm_test.py b/test/unit/volume_manager_lvm_test.py index 92f85f26..75a7ff49 100644 --- a/test/unit/volume_manager_lvm_test.py +++ b/test/unit/volume_manager_lvm_test.py @@ -55,7 +55,7 @@ class TestVolumeManagerLVM(object): return_value='/dev/storage' ) self.volume_manager = VolumeManagerLVM( - self.device_provider, 'source_dir', self.volumes + self.device_provider, 'root_dir', self.volumes ) def test_post_init(self): @@ -129,9 +129,9 @@ class TestVolumeManagerLVM(object): etc_size = 200 + 42 + Defaults.get_min_volume_mbytes() root_size = 100 + 42 + Defaults.get_min_volume_mbytes() assert mock_command.call_args_list == [ - call(['mkdir', '-p', 'source_dir//etc']), - call(['mkdir', '-p', 'source_dir//data']), - call(['mkdir', '-p', 'source_dir//home']), + call(['mkdir', '-p', 'root_dir/etc']), + call(['mkdir', '-p', 'root_dir/data']), + call(['mkdir', '-p', 'root_dir/home']), call([ 'lvcreate', '-L', format(root_size), '-n', 'LVRoot', 'volume_group' diff --git a/test/unit/volume_manager_test.py b/test/unit/volume_manager_test.py index d1d6c6c2..553fd19f 100644 --- a/test/unit/volume_manager_test.py +++ b/test/unit/volume_manager_test.py @@ -12,7 +12,7 @@ from kiwi.volume_manager import VolumeManager class TestVolumeManager(object): @raises(KiwiVolumeManagerSetupError) def test_volume_manager_not_implemented(self): - VolumeManager('foo', mock.Mock(), 'source_dir', mock.Mock()) + VolumeManager('foo', mock.Mock(), 'root_dir', mock.Mock()) @patch('kiwi.volume_manager.VolumeManagerLVM') @patch('os.path.exists') @@ -20,9 +20,9 @@ class TestVolumeManager(object): mock_path.return_value = True provider = mock.Mock() volumes = mock.Mock() - VolumeManager('lvm', provider, 'source_dir', volumes) + VolumeManager('lvm', provider, 'root_dir', volumes) mock_lvm.assert_called_once_with( - provider, 'source_dir', volumes, None + provider, 'root_dir', volumes, None ) @patch('kiwi.volume_manager.VolumeManagerBtrfs') @@ -31,7 +31,7 @@ class TestVolumeManager(object): mock_path.return_value = True provider = mock.Mock() volumes = mock.Mock() - VolumeManager('btrfs', provider, 'source_dir', volumes) + VolumeManager('btrfs', provider, 'root_dir', volumes) mock_btrfs.assert_called_once_with( - provider, 'source_dir', volumes, None + provider, 'root_dir', volumes, None )