git; Mirror from Upstream to Local to Downstream
Project description
If you use git submodules, then you might have faced the issue that a user of your project does not have access to the remotes that your submodules point to.
You can then provide a full source-tarball to them instead, however, that is not always ideal. Sometimes, other infrastructure such as GitLAB, or BitBucket can provide automatic mirroring your third-party dependencies but if they cannot access that either, well then that is not really a solution either.
So, one might need to manually maintain some downstream mirrors, based on the actual upstream repositories. This is an annoyingly manual tasks, however, this command muld takes most of the heavy lifting out of it, such that you only have to fix issues when mirroring for some reason fails, but it will otherwise run happily in a cron-job.
NOTE, what muld does, could probably be done with 10 lines of Bash. But, using Python for the task is 1000 times more fun. Also, muld does plain git clone, does not use --bare, --mirror or --recursive.
Install
The common mode of usage is to install muld via the Python Package Index:
pip3 install --user muld
Once you have done so, you should be able to run it, try:
muld --help
If that does not work, then make sure that your shell looks for executables/binaries in the Python --user home, you can see where that is by running:
python3 -m site --user-base
And if you use the Bash shell, then you can add it to PATH like so:
echo "export PATH=\"$PATH:$(python3 -m site --user-base)/bin\"" >> ~/.bash_aliases
Usage
Provide a list of repository upstream/downstream pairs such as:
repos: - name: "spdk" upstream: "https://github.com/spdk/spdk" downstream: "ssh://git@example.com/somewhere/else/spdk.git" - name: "dpdk" upstream: "https://github.com/spdk/dpdk.git" downstream: "ssh://git@example.com/somewhere/else/dpdk.git"
In a file and name it as e.g. muld.yml. Then invoke muld:
muld --mirrors $HOME/mirrors --conf muld.yml
Behaviour
It will initially clone the upstream repository, when it exists then just fetch and prune. Regardless, after it will then push tags and branches to downstream.
If --conf is not given, then it assumes that a file named muld.yml exists inside the directory pointed to by --mirrors.
If --mirrors is not given, then it uses the current-working-directory.
Thus, in case you have prepared a home for mirrors with a config inside it, for example like so:
# Setup mkdir $HOME/mirrors echo "repos: [{upstream: 'https://github.com/spdk/spdk'}]" > muld.yml cd $HOME/mirrors
Then you can just go to the directory and run muld:
# Run it... cd $HOME/mirrors muld
Regarding the config-file, only upstream is required. When name is left out, then muld will produce a named based on the given upstream URL.
If downstream is left out, then it simply won’t push anywhere, it will just clone, prune and fetch.
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
Built Distribution
File details
Details for the file muld-0.0.11.tar.gz
.
File metadata
- Download URL: muld-0.0.11.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 299d5094eaed1493e19c6fcc66249af35ca509095e5e27e1505068b533b1ce7a |
|
MD5 | 9fe310f5e2ed7f688873ddebe539069b |
|
BLAKE2b-256 | 144855e48b9dbd2f530de0144ea32c0ec8dd79b21a3ef146eefc68bd56fba61e |
File details
Details for the file muld-0.0.11-py2.py3-none-any.whl
.
File metadata
- Download URL: muld-0.0.11-py2.py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8ecf9970887a10f5d99b1efde2001af3d9f2fa98cafc00fb0cb5a1d0463afe1 |
|
MD5 | a9fb4c5ca0375d61e4ebb4709e6c5457 |
|
BLAKE2b-256 | ca58e2398586774d83ce13d5c038206485278ca9e7bedf2ca683c243f0666113 |