/[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.39 Revision 1.40
1# Copyright 1999-2014 Gentoo Foundation 1# Copyright 1999-2014 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.39 2014/03/03 21:45:06 mgorny Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.40 2014/03/24 21:32:31 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.
45# Upstream-removed branches and tags are purged from the local clone 45# Upstream-removed branches and tags are purged from the local clone
46# while fetching. This mode is suitable for cloning the local copy 46# while fetching. This mode is suitable for cloning the local copy
47# for development or hosting a local git mirror. However, clones 47# for development or hosting a local git mirror. However, clones
48# of repositories with large diverged branches may quickly grow large. 48# of repositories with large diverged branches may quickly grow large.
49# 49#
50# The 'single+tags' type clones the requested branch and all tags
51# in the repository. All notes are fetched as well. EGIT_COMMIT
52# can safely specify hashes throughout the current branch and all tags.
53# No purging of old references is done (if you often switch branches,
54# you may need to remove stale branches yourself). This mode is intended
55# mostly for use with broken git servers such as Google Code that fail
56# to fetch tags along with the branch in 'single' mode.
57#
50# The 'single' type clones only the requested branch or tag. Tags 58# The 'single' type clones only the requested branch or tag. Tags
51# referencing commits throughout the branch history are fetched as well, 59# referencing commits throughout the branch history are fetched as well,
52# and all notes. EGIT_COMMIT can safely specify only hashes 60# and all notes. EGIT_COMMIT can safely specify only hashes
53# in the current branch. No purging of old references is done (if you 61# in the current branch. No purging of old references is done (if you
54# often switch branches, you may need to remove stale branches 62# often switch branches, you may need to remove stale branches
70# 78#
71# This variable is intended to be used by ebuilds only. Users are 79# This variable is intended to be used by ebuilds only. Users are
72# supposed to set EGIT_CLONE_TYPE instead. 80# supposed to set EGIT_CLONE_TYPE instead.
73# 81#
74# A common case is to use 'single' whenever the build system requires 82# A common case is to use 'single' whenever the build system requires
75# access to full branch history or the remote (Google Code) does not 83# access to full branch history, or 'single+tags' when Google Code
76# support shallow clones. Please use sparingly, and to fix fatal errors 84# or a similar remote is used that does not support shallow clones
85# and fetching tags along with commits. Please use sparingly, and to fix
77# rather than 'non-pretty versions'. 86# fatal errors rather than 'non-pretty versions'.
78: ${EGIT_MIN_CLONE_TYPE:=shallow} 87: ${EGIT_MIN_CLONE_TYPE:=shallow}
79 88
80# @ECLASS-VARIABLE: EGIT3_STORE_DIR 89# @ECLASS-VARIABLE: EGIT3_STORE_DIR
81# @DESCRIPTION: 90# @DESCRIPTION:
82# Storage directory for git sources. 91# Storage directory for git sources.
152_git-r3_env_setup() { 161_git-r3_env_setup() {
153 debug-print-function ${FUNCNAME} "$@" 162 debug-print-function ${FUNCNAME} "$@"
154 163
155 # check the clone type 164 # check the clone type
156 case "${EGIT_CLONE_TYPE}" in 165 case "${EGIT_CLONE_TYPE}" in
157 mirror|single|shallow) 166 mirror|single+tags|single|shallow)
158 ;; 167 ;;
159 *) 168 *)
160 die "Invalid EGIT_CLONE_TYPE=${EGIT_CLONE_TYPE}" 169 die "Invalid EGIT_CLONE_TYPE=${EGIT_CLONE_TYPE}"
161 esac 170 esac
162 case "${EGIT_MIN_CLONE_TYPE}" in 171 case "${EGIT_MIN_CLONE_TYPE}" in
164 ;; 173 ;;
165 single) 174 single)
166 if [[ ${EGIT_CLONE_TYPE} == shallow ]]; then 175 if [[ ${EGIT_CLONE_TYPE} == shallow ]]; then
167 einfo "git-r3: ebuild needs to be cloned in 'single' mode, adjusting" 176 einfo "git-r3: ebuild needs to be cloned in 'single' mode, adjusting"
168 EGIT_CLONE_TYPE=single 177 EGIT_CLONE_TYPE=single
178 fi
179 ;;
180 single+tags)
181 if [[ ${EGIT_CLONE_TYPE} == shallow || ${EGIT_CLONE_TYPE} == single ]]; then
182 einfo "git-r3: ebuild needs to be cloned in 'single+tags' mode, adjusting"
183 EGIT_CLONE_TYPE=single+tags
169 fi 184 fi
170 ;; 185 ;;
171 mirror) 186 mirror)
172 if [[ ${EGIT_CLONE_TYPE} != mirror ]]; then 187 if [[ ${EGIT_CLONE_TYPE} != mirror ]]; then
173 einfo "git-r3: ebuild needs to be cloned in 'mirror' mode, adjusting" 188 einfo "git-r3: ebuild needs to be cloned in 'mirror' mode, adjusting"
508 fi 523 fi
509 524
510 fetch_command+=( 525 fetch_command+=(
511 "+${fetch_l}:${fetch_r}" 526 "+${fetch_l}:${fetch_r}"
512 ) 527 )
528
529 if [[ ${EGIT_CLONE_TYPE} == single+tags ]]; then
530 fetch_command+=(
531 # pull tags explicitly as requested
532 "+refs/tags/*:refs/tags/*"
533 )
534 fi
513 fi 535 fi
514 536
515 if [[ ${EGIT_CLONE_TYPE} == shallow ]]; then 537 if [[ ${EGIT_CLONE_TYPE} == shallow ]]; then
516 if _git-r3_is_local_repo; then 538 if _git-r3_is_local_repo; then
517 # '--depth 1' causes sandbox violations with local repos 539 # '--depth 1' causes sandbox violations with local repos

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.40

  ViewVC Help
Powered by ViewVC 1.1.20