composeinfo – Compose metadata

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


import productmd.compose
compose = productmd.compose.Compose("/path/to/compose")
print(  # prints "Fedora-Rawhide-20180616.n.0"


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

supported compose types

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

supported milestone label names

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

supported variant types


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 data to a file.

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

Dump data to a string.

Return type:str

Load data from a file.

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

Load data from a string.

Parameters:s (str) – input data

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

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

This class represents the top level of metadata for a compose.

It provides access to general information about the compose (ID, type, date, etc.) and structures with RPMs and images.


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

internal = None

(bool=False) – Determine if release is meant for public consumption

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”


This is used in compose ID.

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.


  • 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_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_tree – tree with debug RPMs
  • debug_packages – directory with debug RPMs
  • debug_repository – YUM repository with debug RPMs


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)

x.__init__(…) initializes x; see help(type(x)) for signature

__repr__() <==> repr(x)
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