apt-mirror Python reimplementation
Project description
apt-mirror2
apt-mirror2
is the Python/asyncio reimplementation of the
apt-mirror developed as drop-in replacement for the latest.
This project should be suitable as general apt-mirror replacement.
One of the main advantages of the apt-mirror2
over the apt-mirror
- you should never got broken mirror in case apt-mirror2
returns 0 exit code.
This is ensured by data integrity checks at all stages of mirroring.
Requirements
Python 3.10 is the minimum supported version.
For additional dependencies look to the pyproject.yml
and/or requirements.txt
.
Installation
Docker
Docker image is available in the Docker Hub under aptmirror/apt-mirror2 repository. You can try it using
docker run -it --rm aptmirror/apt-mirror2 --help
PyPi
PyPi package is available with the name apt-mirror
:
pip install apt-mirror
apt-mirror --help
Build from source with virtualenv
It's possible to use apt-mirror2
from a virtualenv:
# Let's work in the home folder
cd
# Create virtualenv
virtualenv ~/venv/apt-mirror2
source ~/venv/apt-mirror2/bin/activate
# Clone apt-mirror2 source code
git clone https://gitlab.com/apt-mirror2/apt-mirror2
cd apt-mirror2
# Install requirements
pip install -r requirements.txt
# Install apt-mirror2 into virtualenv
python setup.py install
apt-mirror --help
Usage
As the drop-in replacement for the apt-mirror
this project supports same CLI syntax.
usage: apt-mirror [-h] [--version] [configfile]
positional arguments:
configfile Path to config file. Default /etc/apt/mirror.list
options:
-h, --help show this help message and exit
--version Show version
apt-mirror compatibility
Most of apt-mirror
configuration directives are supported.
As of now proxy for FTP repositories is not supported.
File lists (ALL, NEW, MD5, SHA256, SHA512) are not written by default, but you can enable them with the write_file_lists
option.
In addition there are some enhancements available:
- Repositories without MD5 hashsums are correctly mirrored
- Old index files are properly cleaned and don't produces errors in mirror processing
- Standard source.list
[ arch=arch1,arch2 ]
can be used to specify multiple repository architectures for mirroring. - multiple codenames (or flat folders) can be specified using comma as delimiter.
mirror_path URL PATH
option may be used to specifyPATH
to use for saving mirror files instead of path that is generated fromURL
.- Additional configuration is loaded from the
*.list
files in the directory named same asconfigfile
with the.d
suffix. Eg/etc/apt/mirror.list.d/*.list
. - Rate limit is enforced for overall download rate.
- Non-zero exit code is returned if some of required files were not downloaded due to network or server errors or no repositories were configured.
- HTTP user agent can be configured via
user_agent
configuration. - Configuration variables are exposed to postmirror_script.
by-hash
list option can be used to control whetherAcquire-By-Hash
Release option should be respected or enforced.- mirror wipe protection is available and configurable via
wipe_size_ratio
andwipe_count_ratio
settings. - per-repository log files are available in the
var_path
folder dists
folder is almost atomicaly replaced using move instead of copy/link- native Prometheus metrics are supported
License
GNU General Public License v3.0 or later
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file apt_mirror-5.tar.gz
.
File metadata
- Download URL: apt_mirror-5.tar.gz
- Upload date:
- Size: 68.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 387c4deb4f545c6c56023cff87a66e87b91445c5c43d7feea304b392ca46ed0c |
|
MD5 | acfed315ce603a8b19db1fdc1084e0b0 |
|
BLAKE2b-256 | dac338b4311c0e19ddbc54eb13d70c410d15769faa1a7885353972e91b82a506 |
File details
Details for the file apt_mirror-5-py3-none-any.whl
.
File metadata
- Download URL: apt_mirror-5-py3-none-any.whl
- Upload date:
- Size: 58.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | af3f8e781a191ea61f8fd418b8ca62dc6d8e36c3ca86b148399d63755c7d78d5 |
|
MD5 | fdd44eaa2954ce18bffcfc4067139684 |
|
BLAKE2b-256 | 6c84a5f8e36c01cdb64cd5041781edd9387428a1a9adb13013c1e4808dbe864d |