python-gardenlinux-lib documentation
- python_gardenlinux_lib.parse_features.construct_layer_metadata(filetype: str, cname: str, version: str, arch: str, commit: str) dict
- Parameters:
filetype (str) – filetype of blob
cname (str) – the cname of the target image
version (str) – the version of the target image
arch (str) – the arch of the target image
commit (str) – commit of the garden linux source
- Returns:
dict of oci layer metadata for a given layer file
- python_gardenlinux_lib.parse_features.deduce_archive_filetype(feature_dir)
- Parameters:
feature_dir (str) – Directory of single Feature
- Returns:
str of filetype for archive
- python_gardenlinux_lib.parse_features.deduce_feature_name(feature_dir: str)
- Parameters:
feature_dir (str) – Directory of single Feature
- Returns:
string of feature name
- python_gardenlinux_lib.parse_features.deduce_filetype_from_string(feature_dir: str, script_base_name: str)
Garden Linux features can optionally have a image.<filetype> or convert.<filetype> script, where the <filetype> indicates the target filetype.
image.<filetype> script converts the .tar to <filetype> archive.
convert.<filetype> script converts the .raw to <filetype> image type.
Both scripts are bash scripts invoked by the builder, but this function does only read the file ending
- Parameters:
feature_dir (str) – feature directory of garden linux
script_base_name (str) – typically it is either image or convert
- Returns:
list of available filetypes deduced on the available script_base_name.<filetype>
- python_gardenlinux_lib.parse_features.deduce_image_filetype(feature_dir)
- Parameters:
feature_dir (str) – Directory of single Feature
- Returns:
str of filetype for image
- python_gardenlinux_lib.parse_features.get_features_dict(cname: str, gardenlinux_root: str) dict
- Parameters:
cname (str) – the target cname to get the feature dict for
gardenlinux_root (str) – path of garden linux src root
- Returns:
dict with list of features for a given cname, split into platform, element and flag
- python_gardenlinux_lib.parse_features.get_gardenlinux_commit(gardenlinux_root: str, limit: int | None = None) str
- Parameters:
gardenlinux_root (str) – path to garden linux src
- Returns:
output of get_commit script from gardenlinux src
- python_gardenlinux_lib.parse_features.get_oci_metadata(cname: str, version: str, gardenlinux_root: str)
- Parameters:
cname (str) – the target cname of the image
version (str) – the target version of the image
gardenlinux_root (str) – path of garden linux src root
- Returns:
list of dicts, where each dict represents a layer
- python_gardenlinux_lib.parse_features.lookup_media_type_for_filetype(filetype: str) str
- Parameters:
filetype (str) – filetype of the target layer
- Returns:
mediatype
- python_gardenlinux_lib.parse_features.parse_feature_yaml(feature_yaml_file: str)
Legacy function copied from gardenlinux/builder
extracts the feature name from the feature_yaml_file param, reads the info.yaml into a dict and outputs a dict containing the cname and the info yaml
- Parameters:
feature_yaml_file (str) – path to the target info.yaml that must be read
- python_gardenlinux_lib.parse_features.read_feature_files(feature_dir)
Legacy function copied from gardenlinux/builder
TODO: explain the structure of the graph
- Parameters:
feature_dir (str) – feature directory to create the graph for
- Returns:
an networkx based feature graph