# repolulator
[![License](https://img.shields.io/badge/license-BSD-brightgreen.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![Language](https://img.shields.io/badge/language-Python-blue.svg)](https://www.python.org)
[![python](https://img.shields.io/badge/python->=3.8-blue.svg)](https://www.python.org/downloads/release/python-380/)
[![pypi](https://img.shields.io/pypi/v/repopulator)](https://pypi.org/project/repopulator)
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
```bash
pip install repopulator
```
## Documentation
Documentation for API and command-line syntax is available at https://gershnik.github.io/repopulator/
## Examples
### APT
#### Programmatic
```python
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
```bash
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
```python
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
```bash
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
```python
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
```bash
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
```python
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
```bash
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
```python
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
```bash
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
```
Raw data
{
"_id": null,
"home_page": null,
"name": "repopulator",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "cross-platform, apt-repository, yum-repositories, freebsd-packages, rpm-repositories, apt-repo, yum-repos, pacman-repo, alpine-repository",
"author": null,
"author_email": "Eugene Gershnik <gershnik@hotmail.com>",
"download_url": "https://files.pythonhosted.org/packages/ad/52/6198a48e47401673726b8eeb9e569577bdd059d853317cfdcca099e0c029/repopulator-1.3.tar.gz",
"platform": null,
"description": "\n\n# repolulator\n\n[![License](https://img.shields.io/badge/license-BSD-brightgreen.svg)](https://opensource.org/licenses/BSD-3-Clause)\n[![Language](https://img.shields.io/badge/language-Python-blue.svg)](https://www.python.org)\n[![python](https://img.shields.io/badge/python->=3.8-blue.svg)](https://www.python.org/downloads/release/python-380/)\n[![pypi](https://img.shields.io/pypi/v/repopulator)](https://pypi.org/project/repopulator)\n\nA portable Python library to generate binary software repositories\n\n## Purpose\n\nEver 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.\n\nAll 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.\n\n## Requirements\n\n* Python >= 3.8\n* If you plan to build repositories that require GPG signing `gpg` command needs to be available in PATH\n* If you plan to build repositories that require private key signing OpenSSL > 3.0 libraries need to be available on your platform\n\n## Supported repository formats\n\n* APT\n* RPM\n* Pacman\n* Alpine apk\n* FreeBSD pkg\n\n## Installing\n\n```bash\npip install repopulator\n```\n\n## Documentation\n\nDocumentation for API and command-line syntax is available at https://gershnik.github.io/repopulator/\n\n## Examples\n\n### APT\n\n#### Programmatic\n\n```python\nfrom repopulator import AptRepo, PgpSigner\n\nrepo = AptRepo()\n\npackage1 = repo.add_package('/path/to/awesome_3.14_amd64.deb')\npackage2 = repo.add_package('/path/to/awesome_3.14_arm64.deb')\n\ndist = repo.add_distribution('jammy')\n\nrepo.assign_package(package1, dist, component='main')\nrepo.assign_package(package2, dist, component='main')\n\nsigner = PgpSigner('name_of_key_to_use', 'password_of_that_key')\n\nrepo.export('/path/of/new/repo', signer)\n\n```\n\n#### Command-line\n\n```bash\nrepopulator apt -o /path/of/new/repo -k name_of_key_to_use -w password_of_that_key \\\n -d jammy -c main \\\n -p /path/to/awesome_3.14_amd64.deb /path/to/awesome_3.14_arm64.deb\n```\n\n### RPM\n\n#### Programmatic\n\n```python\nfrom repopulator import RpmRepo, PgpSigner\n\nrepo = RpmRepo()\nrepo.add_package('/path/to/awesome-3.14-1.el9.x86_64.rpm')\nrepo.add_package('/path/to/awesome-3.14-1.el9.aarch64.rpm')\n\nsigner = PgpSigner('name_of_key_to_use', 'password_of_that_key')\n\nrepo.export('/path/of/new/repo', signer)\n\n```\n\n#### Command-line\n\n```bash\nrepopulator rpm -o /path/of/new/repo -k name_of_key_to_use -w password_of_that_key \\\n -p /path/to/awesome-3.14-1.el9.x86_64.rpm /path/to/awesome-3.14-1.el9.aarch64.rpm\n```\n\n### Pacman\n\n#### Programmatic\n\n```python\nfrom repopulator import PacmanRepo, PgpSigner\n\nrepo = PacmanRepo('myrepo')\nrepo.add_package('/path/to/awesome-3.14-1-x86_64.pkg.tar.zst')\nrepo.add_package('/path/to/another-1.2-1-x86_64.pkg.tar.zst')\n\nsigner = PgpSigner('name_of_key_to_use', 'password_of_that_key')\n\nrepo.export('/path/of/new/repo', signer)\n\n```\n\n#### Command-line\n\n```bash\nrepopulator pacman -o /path/of/new/repo -k name_of_key_to_use -w password_of_that_key \\\n -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\n```\n\n### Alpine apk\n\n#### Programmatic\n\n```python\nfrom repopulator import AlpineRepo, PkiSigner\n\nrepo = AlpineRepo('my repo description')\nrepo.add_package('/path/to/awesome-3.14-r0.apk')\nrepo.add_package('/path/to/another-1.23-r0.apk')\n\nsigner = PkiSigner('/path/to/private/key', 'password_or_None')\n\n# Unlike `pkg` tool we do not parse signer name out of private key filename\n# so you can name your key files whatever you wish\nrepo.export('/path/of/new/repo', signer, signer_name = 'mymail@mydomain.com-1234abcd')\n\n```\n\n#### Command-line\n\n```bash\nrepopulator alpine -o /path/of/new/repo -d 'my repo description' \\\n -k /path/to/private/key.rsa -w password_of_that_key \\\n -s 'mymail@mydomain.com-1234abcd' \\\n -p /path/to/awesome-3.14-r0.apk /path/to/another-1.23-r0.apk\n```\n\n### FreeBSD pkg\n\n#### Programmatic\n\n```python\nfrom repopulator import FreeBSDRepo, PkiSigner\n\nrepo = FreeBSDRepo()\nrepo.add_package('/path/to/awesome-3.14.pkg')\nrepo.add_package('/path/to/another-1.2.pkg')\n\nsigner = PkiSigner('/path/to/private/key', 'password_or_None')\n\nrepo.export('/path/of/new/repo', signer)\n\n```\n\n#### Command-line\n\n```bash\nrepopulator freebsd -o /path/of/new/repo \\\n -k /path/to/private/key -w password_of_that_key \\\n -p /path/to/awesome-3.14.pkg /path/to/another-1.2.pkg\n```\n\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "A portable library to generate binary software repositories",
"version": "1.3",
"project_urls": {
"Changelog": "https://github.com/gershnik/repopulator/blob/master/CHANGELOG.md",
"Documentation": "https://gershnik.github.io/repopulator",
"Homepage": "https://github.com/gershnik/repopulator",
"Issues": "https://github.com/gershnik/repopulator/issues"
},
"split_keywords": [
"cross-platform",
" apt-repository",
" yum-repositories",
" freebsd-packages",
" rpm-repositories",
" apt-repo",
" yum-repos",
" pacman-repo",
" alpine-repository"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "36951d5ea0e9a869314391220805fa587181466ce49034f901edf4e4ef01d8b7",
"md5": "6a399a526ecaf6757031bd88948ed4b2",
"sha256": "bbdf8ef0301e2f86ae9efdff1dc6acee6afac40c380eb196f1eb38bd643e5ebb"
},
"downloads": -1,
"filename": "repopulator-1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6a399a526ecaf6757031bd88948ed4b2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 47881,
"upload_time": "2024-10-04T07:46:34",
"upload_time_iso_8601": "2024-10-04T07:46:34.790870Z",
"url": "https://files.pythonhosted.org/packages/36/95/1d5ea0e9a869314391220805fa587181466ce49034f901edf4e4ef01d8b7/repopulator-1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ad526198a48e47401673726b8eeb9e569577bdd059d853317cfdcca099e0c029",
"md5": "cf86dbcd91d479cc1abea97464eed142",
"sha256": "73cbb814279ea9abc2f6417403638f2ab69c6ec76b0cb800e2985dcaa5740d23"
},
"downloads": -1,
"filename": "repopulator-1.3.tar.gz",
"has_sig": false,
"md5_digest": "cf86dbcd91d479cc1abea97464eed142",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 40104,
"upload_time": "2024-10-04T07:46:36",
"upload_time_iso_8601": "2024-10-04T07:46:36.699783Z",
"url": "https://files.pythonhosted.org/packages/ad/52/6198a48e47401673726b8eeb9e569577bdd059d853317cfdcca099e0c029/repopulator-1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-04 07:46:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gershnik",
"github_project": "repopulator",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "repopulator"
}