Skip to main content

Templating system/generator for distributions

Project description

Distribution oriented templating system

Copr package Fedora package Coverage Status Documentation Status

The problem this project tries to mitigate is "portable" scripting for variety of operating systems (currently Linux distributions only) in the wild. While writing an "universal" script, one needs to take into account small or bigger differences among operating systems (like package installation tools, versions of utilities, expected directories for binaries, libraries, etc.).

The distgen project is thus something like database of OS differences together with convenience tool-set that allows you to instantiate valid script for particular distribution. The concept is to have template file (mostly raw jinja2 template) together with "declarative" spec file (YAML file) that fulfils the needs of particular template.

You can find distgen documentation at http://distgen.readthedocs.io.

Download/Installation

Stable releases of distgen are available as RPMs in Fedora and EPEL repositories, and in pypi:

$ sudo dnf install distgen

$ pip install distgen

Development (git snapshot) RPMs are automatically built in Fedora Copr.

You can also run development version directly from git, simply use the dg shell wrapper available in this git root directory.

Example with Dockerfile

Typical example is the need to instantiate working FOO package oriented Dockerfiles for all supported Fedora/RHEL versions.

To achieve that goal with distgen, you need to write something like docker.tpl template and FOO.yaml spec file. If the system-default docker.tpl template is good enough, its enough to write proper spec file:

  1. create FOO.yaml spec:

    $ cat FOO.yaml
    maintainer: John Doe <jdoe@example.com>
    parts:
      pkginstall:
        data:
          - type: pkg
            action: install
            packages:
              - vim
      footer:
        cmd: ["vim"]
    
  2. Run dg tool to generate Fedora 22 Dockerfile:

    $ dg --template docker.tpl \
         --spec FOO.yaml \
         --distro fedora-22-x86_64.yaml \
    > Dockerfile
    $ cat Dockerfile
    FROM index.docker.io/fedora:22
    MAINTAINER John Doe <jdoe@example.com>
    
    ENV container="docker"
    
    RUN dnf -y --setopt=tsflags=nodocs install vim \
        && dnf -y --setopt=tsflags=nodocs clean all --enablerepo='*'
    
    CMD ["vim"]
    
  3. Run dg tool again to generate RHEL 7 dockerfile:

    $ dg --template docker.tpl \
         --spec FOO.yaml \
         --distro rhel-7-x86_64.yaml \
    > Dockerfile
    $ cat Dockerfile
    FROM registry.access.redhat.com/rhel7
    MAINTAINER John Doe <jdoe@example.com>
    
    ENV container="docker"
    
    RUN yum -y --setopt=tsflags=nodocs install vim \
        && yum -y --setopt=tsflags=nodocs clean all --enablerepo='*'
    
    CMD ["vim"]
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

distgen-2.3.tar.gz (85.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

distgen-2.3-py3-none-any.whl (53.1 kB view details)

Uploaded Python 3

File details

Details for the file distgen-2.3.tar.gz.

File metadata

  • Download URL: distgen-2.3.tar.gz
  • Upload date:
  • Size: 85.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for distgen-2.3.tar.gz
Algorithm Hash digest
SHA256 10344219fe2568766cfff137c39171964b937db54bc6768699017fc63c1a2834
MD5 734016c9c16f64df706a3c8665457e72
BLAKE2b-256 6c35ca1be192d31be01b6584caadea47cd1fd78f96030dbdc6efba1064775a41

See more details on using hashes here.

Provenance

The following attestation bundles were made for distgen-2.3.tar.gz:

Publisher: pypi-publish.yml on devexp-db/distgen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file distgen-2.3-py3-none-any.whl.

File metadata

  • Download URL: distgen-2.3-py3-none-any.whl
  • Upload date:
  • Size: 53.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for distgen-2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c49adc70a3eef4f95d2417216214eeeac6f86c568049bfb4e5db4744cf9529ed
MD5 75e448429fae8158e5c421d482293e2d
BLAKE2b-256 0ad843323466a8c8ac9c727f28a4335d2021ee9f3c059a3f62ab8703deb81943

See more details on using hashes here.

Provenance

The following attestation bundles were made for distgen-2.3-py3-none-any.whl:

Publisher: pypi-publish.yml on devexp-db/distgen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page