kiwi.utils Package

Submodules

kiwi.utils.checksum Module

class kiwi.utils.block.BlockID(device)[source]

Bases: object

Get information from a block device

Parameters:device (str) – block device node name name
get_blkid(id_type)[source]

Retrieve information for specified metadata ID from block device

Parameters:id_type (string) – metadata ID, see man blkid for details
Returns:ID of the block device
Return type:str
get_filesystem()[source]

Retrieve filesystem type from block device

Returns:filesystem type
Return type:str
get_label()[source]

Retrieve filesystem label from block device

Returns:block device label
Return type:str
get_uuid()[source]

Retrieve filesystem uuid from block device

Returns:uuid for the filesystem of the block device
Return type:str

kiwi.utils.block Module

class kiwi.utils.checksum.Checksum(source_filename)[source]

Bases: object

Manage checksum creation for files

Parameters:
  • source_filename (str) – source file name to build checksum for
  • checksum_filename (str) – target file with checksum information
matches(checksum, filename)[source]

Compare given checksum with reference checksum stored in the provided filename. If the checksum matches the method returns True, or False in case it does not match

Parameters:
  • checksum (str) – checksum string to compare
  • filename (str) – filename containing checksum
Returns:

True or False

Return type:

bool

md5(filename=None)[source]

Create md5 checksum

Parameters:filename (str) – filename for checksum
Returns:checksum
Return type:str
sha256(filename=None)[source]

Create sha256 checksum

Parameters:filename (str) – filename for checksum

kiwi.utils.compress Module

class kiwi.utils.compress.Compress(source_filename, keep_source_on_compress=False)[source]

Bases: object

File compression / decompression

Parameters:
  • keep_source (bool) – Request to keep the uncompressed source
  • source_filename (str) – Source file name to compress
  • supported_zipper (list) – List of supported compression tools
  • compressed_filename (str) – Compressed file name path with compression suffix
  • uncompressed_filename (str) – Uncompressed file name path
get_format()[source]

Detect compression format

Returns:compression format name
Return type:str
gzip()[source]

Create gzip(max compression) compressed file

uncompress(temporary=False)[source]

Uncompress with format autodetection

By default the original source file will be changed into the uncompressed variant. If temporary is set to True a temporary file is created instead

Parameters:temporary (bool) – uncompress to a temporary file
xz(options=None)[source]

Create XZ compressed file

Parameters:options (list) – custom xz compression options

kiwi.utils.sync Module

class kiwi.utils.sync.DataSync(source_dir, target_dir)[source]

Bases: object

Sync data from a source directory to a target directory using the rsync protocol

Parameters:
  • source_dir (str) – source directory path name
  • target_dir (str) – target directory path name
sync_data(options=None, exclude=None)[source]

Sync data from source to target using rsync

Parameters:
  • options (list) – rsync options
  • exclude (list) – file patterns to exclude
target_supports_extended_attributes()[source]

Check if the target directory supports extended filesystem attributes

Returns:True or False
Return type:bool

kiwi.utils.sysconfig Module

class kiwi.utils.sysconfig.SysConfig(source_file)[source]

Bases: object

Read and Write sysconfig style files

Parameters:source_file (str) – source file path
write()[source]

Write back source file with changed content but in same order

Module Contents