Skip to main content

A portable library to generate binary software repositories

Project description

repolulator

License Language python pypi

A portable Python library to generate binary software repositories

Purpose

Ever needed to build an APT package repository on Fedora? Or perhaps a DNF repository on Debian? How about FreeBSD repository on Windows or Mac? This library allows you to do all these things and more. And yes, you can do it even on Windows if you are so inclined for some reason.

All binary package repositories have their own tools that usually range from being "non-portable" to "portable with lots of effort to limited platforms only". On the other hand it is often convenient to build software packages in a Map/Reduce fashion where a single host collects multiple packages built for different platforms to produce binary repositories. Such host will necessarily need to be able to build repositories for "foreign" packages. This library is an attempt to enable such scenario. It provides both programmatic and command-line access.

Requirements

  • Python >= 3.8
  • If you plan to build repositories that require GPG signing gpg command needs to be available in PATH
  • If you plan to build repositories that require private key signing OpenSSL > 3.0 libraries need to be available on your platform

Supported repository formats

  • APT
  • RPM
  • Pacman
  • Alpine apk
  • FreeBSD pkg

Installing

pip install repopulator

Documentation

Documentation for API and command-line syntax is available at https://gershnik.github.io/repopulator/

Examples

APT

Programmatic

from repopulator import AptRepo, PgpSigner

repo = AptRepo()

package1 = repo.add_package('/path/to/awesome_3.14_amd64.deb')
package2 = repo.add_package('/path/to/awesome_3.14_arm64.deb')

dist = repo.add_distribution('jammy')

repo.assign_package(package1, dist, component='main')
repo.assign_package(package2, dist, component='main')

signer = PgpSigner('name_of_key_to_use', 'password_of_that_key')

repo.export('/path/of/new/repo', signer)

Command-line

repopulator apt -o /path/of/new/repo -k name_of_key_to_use -w password_of_that_key \
  -d jammy -c main \
  -p /path/to/awesome_3.14_amd64.deb /path/to/awesome_3.14_arm64.deb

RPM

Programmatic

from repopulator import RpmRepo, PgpSigner

repo = RpmRepo()
repo.add_package('/path/to/awesome-3.14-1.el9.x86_64.rpm')
repo.add_package('/path/to/awesome-3.14-1.el9.aarch64.rpm')

signer = PgpSigner('name_of_key_to_use', 'password_of_that_key')

repo.export('/path/of/new/repo', signer)

Command-line

repopulator rpm -o /path/of/new/repo -k name_of_key_to_use -w password_of_that_key \
  -p /path/to/awesome-3.14-1.el9.x86_64.rpm /path/to/awesome-3.14-1.el9.aarch64.rpm

Pacman

Programmatic

from repopulator import PacmanRepo, PgpSigner

repo = PacmanRepo('myrepo')
repo.add_package('/path/to/awesome-3.14-1-x86_64.pkg.tar.zst')
repo.add_package('/path/to/another-1.2-1-x86_64.pkg.tar.zst')

signer = PgpSigner('name_of_key_to_use', 'password_of_that_key')

repo.export('/path/of/new/repo', signer)

Command-line

repopulator pacman -o /path/of/new/repo -k name_of_key_to_use -w password_of_that_key \
    -n myrepo -p /path/to/awesome-3.14-1-x86_64.pkg.tar.zst /path/to/another-1.2-1-x86_64.pkg.tar.zst

Alpine apk

Programmatic

from repopulator import AlpineRepo, PkiSigner

repo = AlpineRepo('my repo description')
repo.add_package('/path/to/awesome-3.14-r0.apk')
repo.add_package('/path/to/another-1.23-r0.apk')

signer = PkiSigner('/path/to/private/key', 'password_or_None')

# Unlike `pkg` tool we do not parse signer name out of private key filename
# so you can name your key files whatever you wish
repo.export('/path/of/new/repo', signer, signer_name = 'mymail@mydomain.com-1234abcd')

Command-line

repopulator alpine -o /path/of/new/repo -d 'my repo description' \
  -k /path/to/private/key.rsa -w password_of_that_key \
  -s 'mymail@mydomain.com-1234abcd' \
  -p /path/to/awesome-3.14-r0.apk /path/to/another-1.23-r0.apk

FreeBSD pkg

Programmatic

from repopulator import FreeBSDRepo, PkiSigner

repo = FreeBSDRepo()
repo.add_package('/path/to/awesome-3.14.pkg')
repo.add_package('/path/to/another-1.2.pkg')

signer = PkiSigner('/path/to/private/key', 'password_or_None')

repo.export('/path/of/new/repo', signer)

Command-line

repopulator freebsd -o /path/of/new/repo \
  -k /path/to/private/key -w password_of_that_key \
  -p /path/to/awesome-3.14.pkg /path/to/another-1.2.pkg

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

repopulator-1.2.tar.gz (40.0 kB view details)

Uploaded Source

Built Distribution

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

repopulator-1.2-py3-none-any.whl (47.9 kB view details)

Uploaded Python 3

File details

Details for the file repopulator-1.2.tar.gz.

File metadata

  • Download URL: repopulator-1.2.tar.gz
  • Upload date:
  • Size: 40.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.0

File hashes

Hashes for repopulator-1.2.tar.gz
Algorithm Hash digest
SHA256 5c5f203f7b64f8e480007340740a27a1760fc8ec3c4a57478e93aaa14453324c
MD5 6c7912b9c056cdb087ebb7a595c74655
BLAKE2b-256 3ef1f8596e324c9ff4e2112ae21b7ffee02ab7288955765a2341bb9064cb7ea1

See more details on using hashes here.

File details

Details for the file repopulator-1.2-py3-none-any.whl.

File metadata

  • Download URL: repopulator-1.2-py3-none-any.whl
  • Upload date:
  • Size: 47.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.0

File hashes

Hashes for repopulator-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1210259509443db45f2d635ac25bf3b268ff2e0aa3d9365ac1112f515587a36c
MD5 2285192a78eb38f8c9ed876a3079e2fa
BLAKE2b-256 47dbbfcf1dfb92bfc001d00bfa53eaf96d10c315caf0c79bb84d840ee8d0b383

See more details on using hashes here.

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