24

OpenAPT: Description Format for Apt Repositories

 4 years ago
source link: https://github.com/allocloud/openapt
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

OpenAPT

OpenAPT is a description format for APT repositories. An OpenAPT file allows you to describe the objects and relationships you need to maintain custom APT repositories through:

  • (Local) Repositories
  • Mirrors
  • Snapshots
  • Publishings

Most of the concepts and workflows used are borrowed from aptly entities and transitions .

Specifications

An OpenAPT schema is nothing more than a structured JSON file and looks like the following:

{
  "repositories": {
    "mylocalrepo": {
    }
  },
  "mirrors": {
    "debian_buster": {
      "archive": "http://deb.debian.org/debian",
      "distribution": "buster"
    }
  },
  "snapshots": {
    "mylocalrepo": {
      "type": "create",
      "repository": "mylocalrepo"
    },
    "buster": {
      "type": "create",
      "mirror": "debian_buster"
    },
    "mydistro": {
      "type": "merge",
      "sources": [
        "buster_filtered",
        "mylocalrepo"
      ]
    },
    "buster_filtered": {
      "type": "filter",
      "source": "buster",
      "filter": "toilet",
      "withDeps": true
    }
  },
  "publishings": {
    "public": {
      "snapshot": "mydistro",
      "distribution": "buster"
    }
  }
}

This file is validated using a meta-schema .

Implementation

Under the hood, openapt is forging aptly commands and call its CLI.

Usage:

usage: openapt [-h] [--debug] [--config <file>] [--dry-run]
               [--snapshot-subst <template>]
               [--limit <limit-description>]
               <schema>

OpenAPT Aptly implementation.

positional arguments:
  <schema>

optional arguments:
  -h, --help                   show this help message and exit
  --debug
  --config <file>
  --dry-run
  --snapshot-subst <template>  formating string for snapshots (e.g. "{now:date:%Y%d%m_%H%M%S}_{random:.8s}_{name}")
  --limit <limit-description>  limit string (e.g. "publishing:mydistro")

Example:

openapt --config=aptly.conf --debug myshema.json

Alternatives

Test

To start the test suite, do it using docker-compose :

user@machine:~$ docker-compose run main python3.7 setup.py test

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK