When multiple Gentoo machines are used on the local network, and they use the same git ebuilds it may be useful to set a local mirror :).
The idea is quite simple -- you set the host to EGIT_CLONE_TYPE=mirror, and then share the EGIT3_STORE_DIR directory. Then you set EGIT_MIRROR_URI on the remaining hosts and they try to fetch from your local mirror first. --- eclass/git-r3.eclass | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/eclass/git-r3.eclass b/eclass/git-r3.eclass index 7c78b66..8462fba 100644 --- a/eclass/git-r3.eclass +++ b/eclass/git-r3.eclass @@ -41,6 +41,20 @@ fi # # EGIT3_STORE_DIR=${DISTDIR}/git3-src +# @ECLASS-VARIABLE: EGIT_MIRROR_URI +# @DEFAULT_UNSET +# @DESCRIPTION: +# 'Top' URI to a local git mirror. If specified, the eclass will try +# to fetch from the local mirror instead of using the remote repository. +# +# The mirror needs to follow EGIT3_STORE_DIR structure. The directory +# created by eclass can be used for that purpose. +# +# Example: +# @CODE +# EGIT_MIRROR_URI="git://mirror.lan/" +# @CODE + # @ECLASS-VARIABLE: EGIT_REPO_URI # @REQUIRED # @DESCRIPTION: @@ -358,6 +372,14 @@ git-r3_fetch() { local -x GIT_DIR _git-r3_set_gitdir "${repos[0]}" + # prepend the local mirror if applicable + if [[ ${EGIT_MIRROR_URI} ]]; then + repos=( + "${EGIT_MIRROR_URI%/}/${GIT_DIR##*/}" + "${repos[@]}" + ) + fi + # try to fetch from the remote local r success for r in "${repos[@]}"; do -- 1.8.3.2