summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2013-09-25 11:19:09 +0000
committerMichał Górny <mgorny@gentoo.org>2013-09-25 11:19:09 +0000
commit8b49ac5bf6cff12aa1aa8cdc88a2658c4f8cf8af (patch)
treee981e44d78580a1fc4f4f7d75d55f97e865f184b /eclass/git-r3.eclass
parentAdd USE-flag and dependency for Twitter plugin, minor dependency corrections,... (diff)
downloadhistorical-8b49ac5bf6cff12aa1aa8cdc88a2658c4f8cf8af.tar.gz
historical-8b49ac5bf6cff12aa1aa8cdc88a2658c4f8cf8af.tar.bz2
historical-8b49ac5bf6cff12aa1aa8cdc88a2658c4f8cf8af.zip
Support EGIT_REPO_URI being an array. This is needed for tests.
Diffstat (limited to 'eclass/git-r3.eclass')
-rw-r--r--eclass/git-r3.eclass30
1 files changed, 22 insertions, 8 deletions
diff --git a/eclass/git-r3.eclass b/eclass/git-r3.eclass
index 23f8bee1dc1f..99b06e91fb1d 100644
--- a/eclass/git-r3.eclass
+++ b/eclass/git-r3.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.8 2013/09/25 10:49:11 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.9 2013/09/25 11:19:09 mgorny Exp $
# @ECLASS: git-r3.eclass
# @MAINTAINER:
@@ -44,6 +44,8 @@ if [[ ! ${_GIT_R3} ]]; then
#
# It can be overriden via env using ${PN}_LIVE_REPO variable.
#
+# Can be a whitespace-separated list or an array.
+#
# Example:
# @CODE
# EGIT_REPO_URI="git://a/b.git https://c/d.git"
@@ -372,7 +374,11 @@ _git-r3_smart_fetch() {
git-r3_fetch() {
debug-print-function ${FUNCNAME} "$@"
- local repos=( ${1:-${EGIT_REPO_URI}} )
+ if [[ $(declare -p EGIT_REPO_URI) != "declare -a"* ]]; then
+ local EGIT_REPO_URI=( ${EGIT_REPO_URI} )
+ fi
+
+ local repos=( "${1:-${EGIT_REPO_URI[@]}}" )
local branch=${EGIT_BRANCH:+refs/heads/${EGIT_BRANCH}}
local remote_ref=${2:-${EGIT_COMMIT:-${branch:-HEAD}}}
local local_id=${3:-${CATEGORY}/${PN}/${SLOT}}
@@ -381,11 +387,11 @@ git-r3_fetch() {
[[ ${repos[@]} ]] || die "No URI provided and EGIT_REPO_URI unset"
local -x GIT_DIR
- _git-r3_set_gitdir ${repos[0]}
+ _git-r3_set_gitdir "${repos[0]}"
# try to fetch from the remote
local r success
- for r in ${repos[@]}; do
+ for r in "${repos[@]}"; do
einfo "Fetching ${remote_ref} from ${r} ..."
local is_branch lookup_ref
@@ -521,12 +527,16 @@ git-r3_fetch() {
git-r3_checkout() {
debug-print-function ${FUNCNAME} "$@"
- local repos=( ${1:-${EGIT_REPO_URI}} )
+ if [[ $(declare -p EGIT_REPO_URI) != "declare -a"* ]]; then
+ local EGIT_REPO_URI=( ${EGIT_REPO_URI} )
+ fi
+
+ local repos=( "${1:-${EGIT_REPO_URI[@]}}" )
local out_dir=${2:-${EGIT_CHECKOUT_DIR:-${WORKDIR}/${P}}}
local local_id=${3:-${CATEGORY}/${PN}/${SLOT}}
local -x GIT_DIR GIT_WORK_TREE
- _git-r3_set_gitdir ${repos[0]}
+ _git-r3_set_gitdir "${repos[0]}"
GIT_WORK_TREE=${out_dir}
mkdir -p "${GIT_WORK_TREE}"
@@ -618,14 +628,18 @@ git-r3_checkout() {
git-r3_peek_remote_ref() {
debug-print-function ${FUNCNAME} "$@"
- local repos=( ${1:-${EGIT_REPO_URI}} )
+ if [[ $(declare -p EGIT_REPO_URI) != "declare -a"* ]]; then
+ local EGIT_REPO_URI=( ${EGIT_REPO_URI} )
+ fi
+
+ local repos=( "${1:-${EGIT_REPO_URI[@]}}" )
local branch=${EGIT_BRANCH:+refs/heads/${EGIT_BRANCH}}
local remote_ref=${2:-${EGIT_COMMIT:-${branch:-HEAD}}}
[[ ${repos[@]} ]] || die "No URI provided and EGIT_REPO_URI unset"
local r success
- for r in ${repos[@]}; do
+ for r in "${repos[@]}"; do
einfo "Peeking ${remote_ref} on ${r} ..." >&2
local is_branch lookup_ref