summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2014-03-02 11:46:42 +0000
committerMichał Górny <mgorny@gentoo.org>2014-03-02 11:46:42 +0000
commit6fd1abe21ec1105dc0a92c623fc0dec06e3b195b (patch)
treec1545fc126ccde5aa4dd95261c0da2797199859b /eclass/git-r3.eclass
parentFix support for non-master default branch. (diff)
downloadhistorical-6fd1abe21ec1105dc0a92c623fc0dec06e3b195b.tar.gz
historical-6fd1abe21ec1105dc0a92c623fc0dec06e3b195b.tar.bz2
historical-6fd1abe21ec1105dc0a92c623fc0dec06e3b195b.zip
Support using a local git mirror.
Diffstat (limited to 'eclass/git-r3.eclass')
-rw-r--r--eclass/git-r3.eclass24
1 files changed, 23 insertions, 1 deletions
diff --git a/eclass/git-r3.eclass b/eclass/git-r3.eclass
index 5de28a771dd9..7aa1d1ce698a 100644
--- a/eclass/git-r3.eclass
+++ b/eclass/git-r3.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.29 2014/03/02 11:46:15 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.30 2014/03/02 11:46:42 mgorny Exp $
# @ECLASS: git-r3.eclass
# @MAINTAINER:
@@ -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