/[gentoo-x86]/eclass/git-r3.eclass
Gentoo

Diff of /eclass/git-r3.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.10 Revision 1.11
1# Copyright 1999-2013 Gentoo Foundation 1# Copyright 1999-2013 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.10 2013/09/26 12:38:38 mgorny Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.11 2013/09/26 21:04:42 mgorny Exp $
4 4
5# @ECLASS: git-r3.eclass 5# @ECLASS: git-r3.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Michał Górny <mgorny@gentoo.org> 7# Michał Górny <mgorny@gentoo.org>
8# @BLURB: Eclass for fetching and unpacking git repositories. 8# @BLURB: Eclass for fetching and unpacking git repositories.
374# If the repository contains submodules, they will be fetched 374# If the repository contains submodules, they will be fetched
375# recursively. 375# recursively.
376git-r3_fetch() { 376git-r3_fetch() {
377 debug-print-function ${FUNCNAME} "$@" 377 debug-print-function ${FUNCNAME} "$@"
378 378
379 local repos
380 if [[ ${1} ]]; then
381 repos=( ${1} )
379 if [[ $(declare -p EGIT_REPO_URI) != "declare -a"* ]]; then 382 elif [[ $(declare -p EGIT_REPO_URI) == "declare -a"* ]]; then
380 local EGIT_REPO_URI=( ${EGIT_REPO_URI} )
381 fi
382
383 local repos=( "${1:-${EGIT_REPO_URI[@]}}" ) 383 repos=( "${EGIT_REPO_URI[@]}" )
384 else
385 repos=( ${EGIT_REPO_URI} )
386 fi
387
384 local branch=${EGIT_BRANCH:+refs/heads/${EGIT_BRANCH}} 388 local branch=${EGIT_BRANCH:+refs/heads/${EGIT_BRANCH}}
385 local remote_ref=${2:-${EGIT_COMMIT:-${branch:-HEAD}}} 389 local remote_ref=${2:-${EGIT_COMMIT:-${branch:-HEAD}}}
386 local local_id=${3:-${CATEGORY}/${PN}/${SLOT}} 390 local local_id=${3:-${CATEGORY}/${PN}/${SLOT}}
387 local local_ref=refs/heads/${local_id}/__main__ 391 local local_ref=refs/heads/${local_id}/__main__
388 392
527# the repository state into the environment. If the repository contains 531# the repository state into the environment. If the repository contains
528# submodules, they will be checked out recursively. 532# submodules, they will be checked out recursively.
529git-r3_checkout() { 533git-r3_checkout() {
530 debug-print-function ${FUNCNAME} "$@" 534 debug-print-function ${FUNCNAME} "$@"
531 535
536 local repos
537 if [[ ${1} ]]; then
538 repos=( ${1} )
532 if [[ $(declare -p EGIT_REPO_URI) != "declare -a"* ]]; then 539 elif [[ $(declare -p EGIT_REPO_URI) == "declare -a"* ]]; then
533 local EGIT_REPO_URI=( ${EGIT_REPO_URI} )
534 fi
535
536 local repos=( "${1:-${EGIT_REPO_URI[@]}}" ) 540 repos=( "${EGIT_REPO_URI[@]}" )
541 else
542 repos=( ${EGIT_REPO_URI} )
543 fi
544
537 local out_dir=${2:-${EGIT_CHECKOUT_DIR:-${WORKDIR}/${P}}} 545 local out_dir=${2:-${EGIT_CHECKOUT_DIR:-${WORKDIR}/${P}}}
538 local local_id=${3:-${CATEGORY}/${PN}/${SLOT}} 546 local local_id=${3:-${CATEGORY}/${PN}/${SLOT}}
539 547
540 local -x GIT_DIR GIT_WORK_TREE 548 local -x GIT_DIR GIT_WORK_TREE
541 _git-r3_set_gitdir "${repos[0]}" 549 _git-r3_set_gitdir "${repos[0]}"
628# On success, the function returns 0 and writes hexadecimal commit SHA1 636# On success, the function returns 0 and writes hexadecimal commit SHA1
629# to stdout. On failure, the function returns 1. 637# to stdout. On failure, the function returns 1.
630git-r3_peek_remote_ref() { 638git-r3_peek_remote_ref() {
631 debug-print-function ${FUNCNAME} "$@" 639 debug-print-function ${FUNCNAME} "$@"
632 640
641 local repos
642 if [[ ${1} ]]; then
643 repos=( ${1} )
633 if [[ $(declare -p EGIT_REPO_URI) != "declare -a"* ]]; then 644 elif [[ $(declare -p EGIT_REPO_URI) == "declare -a"* ]]; then
634 local EGIT_REPO_URI=( ${EGIT_REPO_URI} )
635 fi
636
637 local repos=( "${1:-${EGIT_REPO_URI[@]}}" ) 645 repos=( "${EGIT_REPO_URI[@]}" )
646 else
647 repos=( ${EGIT_REPO_URI} )
648 fi
649
638 local branch=${EGIT_BRANCH:+refs/heads/${EGIT_BRANCH}} 650 local branch=${EGIT_BRANCH:+refs/heads/${EGIT_BRANCH}}
639 local remote_ref=${2:-${EGIT_COMMIT:-${branch:-HEAD}}} 651 local remote_ref=${2:-${EGIT_COMMIT:-${branch:-HEAD}}}
640 652
641 [[ ${repos[@]} ]] || die "No URI provided and EGIT_REPO_URI unset" 653 [[ ${repos[@]} ]] || die "No URI provided and EGIT_REPO_URI unset"
642 654

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.20