kiwi.utils Package

Submodules

kiwi.utils.checksum Module

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

Bases: object

Get information from a block device

Attributes

  • device
    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
Return type:string
get_filesystem()[source]

Retrieve filesystem type from block device

Return type:string
get_label()[source]

Retrieve filesystem label from block device

Return type:string
get_uuid()[source]

Retrieve filesystem uuid from block device

Return type:string

kiwi.utils.block Module

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

Bases: object

Manage checksum creation for files

Attributes

  • source_filename
    source file name to build checksum for
  • checksum_filename
    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 (string) – checksum string to compare
  • filename (string) – filename containing checksum
md5(filename=None)[source]

Create md5 checksum

Parameters:filename (string) – filename for checksum
sha256(filename=None)[source]

Create sha256 checksum

Parameters:filename (string) – 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

Attributes

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

Detect compression format

Returns:compression format name
Return type:string
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()[source]

Create XZ compressed file

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

Attributes

  • source_dir
    source directory path name
  • target_dir
    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

Return type:bool

kiwi.utils.sysconfig Module

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

Bases: object

Read and Write sysconfig style files

Attributes

  • source_file
    source file path
write()[source]

Write back source file with changed content but in same order

Module Contents