Skip to main content

repopulator

License Language python pypi PyPI Downloads

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 a 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 a host will necessarily need to be able to build repositories for "foreign" packages. This library is an attempt to enable such a scenario. It provides both programmatic and command-line access.

Requirements

  • Python >= 3.9
  • If you plan to build repositories that require GPG signing, the gpg command needs to be available in the 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 the 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 the `pkg` tool, we do not parse the signer name out of the 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

Metadata

Release files for repopulator 2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for repopulator 2.0
File Size Uploaded Provenance Actions
repopulator-2.0.tar.gz 43.3 kB Without provenance Details for repopulator-2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for repopulator 2.0
File Interpreter ABI Platform Actions
repopulator-2.0-py3-none-any.whl Python 3 none any Details for repopulator-2.0-py3-none-any.whl

Total release size: 92.4 kB

Release files / repopulator-2.0.tar.gz

Download URL repopulator-2.0.tar.gz
Size 43.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1cf2df96104a04ca93815290a86222a92c0ae29d55f55d11f1f66d385d5af092
BLAKE2b-256 checksum
How to use checksums
c46cb032e47d20afab37109b5a3941c4d56f9fb3ff4383cd84545fd3e66fd946
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / repopulator-2.0-py3-none-any.whl

Download URL repopulator-2.0-py3-none-any.whl
Size 49.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d7588aac83e823da283fb95de63c2ac24e5c23c803f099037ebd225aca807737
BLAKE2b-256 checksum
How to use checksums
86603ab7081a5f447be2def5bab41634b943607c69a062668ef5aff6f18155bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Security for repopulator 2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page