composeinfo – Compose metadata

This module provides classes for manipulating composeinfo.json files. composeifo.json files provide details about composes which includes product information, variants, architectures and paths.

Constants

productmd.composeinfo.COMPOSE_TYPES = ['test', 'nightly', 'production']

supported compose types

productmd.composeinfo.LABEL_NAMES = ['DevelPhaseExit', 'InternalAlpha', 'Alpha', 'InternalSnapshot', 'Beta', 'Snapshot', 'RC', 'Update']

supported milestone label names

productmd.composeinfo.VARIANT_TYPES = ['variant', 'optional', 'addon', 'layered-product']

supported variant types

Classes

class productmd.composeinfo.ComposeInfo

This class only encapsulates other classes with actual data.

header = None

(Header) – Metadata header

compose = None

(Compose) – Compose details

release = None

(Release) – Release details

base_product = None

(BaseProduct) – Base product details (optional)

variants = None

(Variants) – release variants

dump(f)

Dump data to a file.

Parameters:f (file or str) – file-like object or path to file
dumps()

Dump data to a string.

Return type:str
load(f)

Load data from a file.

Parameters:f (file or str) – file-like object or path to file
loads(s)

Load data from a string.

Parameters:s (str) – input data
validate()

Validate attributes by running all self._validate_*() methods.

Raises:
  • TypeError – if an attribute has invalid type
  • ValueError – if an attribute contains invalid value
class productmd.composeinfo.Compose(metadata)
label_major_version

Return major version for a label.

Examples: Beta-1.2 -> Beta-1, GA -> GA

class productmd.composeinfo.Release(metadata)

This class represents a product release.

name = None

(str) – Release name, for example: “Fedora”, “Red Hat Enterprise Linux”

version = None

(str) – Release version (incl. minor version), for example: “20”, “7.0”

short = None

(str) – Release short name, for example: “f”, “rhel”

type = None

(str) – Release type, for example: “ga”, “updates”

is_layered = None

(bool=False) – Determines if release is a layered product

class productmd.composeinfo.BaseProduct(metadata)

This class represents a base product a release is based on. For example: Spacewalk 2.2 release requires Fedora 20 base product. Information from this class is used only if release.is_layered is set.

name = None

(str) – Product name, for example: “Fedora”, “Red Hat Enterprise Linux”

version = None

(str) – Product version (typically major version), for example: “20”, “7”

short = None

(str) – Product short name, for example: “f”, “rhel”

type = None

(str) – Product type, for example: “ga”, “eus”

class productmd.composeinfo.Variants(metadata)

This class is a container for compose variants.

class productmd.composeinfo.Variant(metadata)
id = None

(str) – variant ID, for example: “Client”, “Server”, “optional”

uid = None

(str) – variant unique ID: $PARENT_UID-$ID, for example: “Server-optional”

name = None

(str) – variant name (pretty text), for example: “Enterprise Server”

type = None

(str) – variant type, see VARIANT_TYPES for supported values

arches = None

(set(<str>)) – set of arches for a variant

variants = None

(dict) – child variants

parent = None

(Variant or None) – parent variant

paths = None

(VariantPaths) – path mappings for a variant

release = None

(Release) –

class productmd.composeinfo.VariantPaths(variant)

This class stores relative paths for a variant in a compose. Paths are represented as dictionaries mapping arches to actual paths. List of supported paths follows.

Binary

  • os_tree – installable tree with binary RPMs, kickstart trees, readme etc.
  • packages – directory with binary RPMs
  • repository – YUM repository with binary RPMs
  • isos – Binary ISOs
  • jigdos – Jigdo files for binary ISOs

Source

  • source_tree – tree with source RPMs
  • source_packages – directory with source RPMs
  • source_repository – YUM repository with source RPMs
  • source_isos – Source ISOs
  • source_jigdos – Jigdo files for source ISOs

Debug

  • debug_tree – tree with debug RPMs
  • debug_packages – directory with debug RPMs
  • debug_repository – YUM repository with debug RPMs

Example:

self.os_tree = {
    "i386": "Server/i386/os",
    "x86_64": "Server/x86_64/os",
}
self.packages = {
    "i386": "Server/i386/os/Packages",
    "x86_64": "Server/x86_64/os/Packages",
}

Private Classes

class productmd.composeinfo.VariantBase(metadata)
get_variants(arch=None, types=None, recursive=False)

Return all variants of given arch and types.

Supported variant types:
self - include the top-level (“self”) variant as well addon variant optional