summaryrefslogtreecommitdiff
path: root/eclass
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
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')
-rw-r--r--eclass/ChangeLog5
-rw-r--r--eclass/git-r3.eclass24
2 files changed, 27 insertions, 2 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index e3b0d31de4f7..52dd41df6c18 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,9 @@
# ChangeLog for eclass directory
# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1154 2014/03/02 11:46:15 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1155 2014/03/02 11:46:42 mgorny Exp $
+
+ 02 Mar 2014; Michał Górny <mgorny@gentoo.org> git-r3.eclass:
+ Support using a local git mirror.
02 Mar 2014; Michał Górny <mgorny@gentoo.org> git-r3.eclass:
Fix support for non-master default branch.
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