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. The device can also be specified as UUID=<uuid>
- 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
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
kiwi.utils.compress
Module
- class kiwi.utils.compress.Compress(source_filename: str, keep_source_on_compress: bool = 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() str | None [source]
Detect compression format
- Returns:
compression format name or None if it couldn’t be inferred
- Return type:
Optional[str]
kiwi.utils.sync
Module
- class kiwi.utils.sync.DataSync(source_dir: str, target_dir: str)[source]
Bases:
object
Sync data from a source directory to a target directory
- sync_data(options: List[str] = [], exclude: List[str] = [], force_trailing_slash: bool = False) None [source]
Sync data from source to target using the rsync protocol
- Parameters:
options (list) – rsync options
exclude (list) – file patterns to exclude
force_trailing_slash (bool) – add ‘/’ to source_dir if not present
A speciality of the rsync tool is that it behaves differently if the given source_dir ends with a ‘/’ or not. If it ends with a slash the data structure below will be synced to the target_dir. If it does not end with a slash the source_dir and its contents are synced to the target_dir. For example
source └── some_data 1. $ rsync -a source target target └── source └── some_data 2. $ rsync -a source/ target target └── some_data
The parameter force_trailing_slash can be used to make sure rsync behaves like shown in the second case. If set to true a ‘/’ is appended to the given source_dir if not already present