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

Diff of /eclass/git.eclass

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

Revision 1.52 Revision 1.53
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2009 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/Attic/git.eclass,v 1.52 2011/03/19 15:06:02 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/git.eclass,v 1.53 2011/04/15 08:57:04 hkbst Exp $
4 4
5# @ECLASS: git.eclass 5# @ECLASS: git.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Tomas Chvatal <scarabeus@gentoo.org> 7# Tomas Chvatal <scarabeus@gentoo.org>
8# Donnie Berkholz <dberkholz@gentoo.org> 8# Donnie Berkholz <dberkholz@gentoo.org>
9# @BLURB: This eclass provides functions for fetch and unpack git repositories 9# @BLURB: Fetching and unpacking of git repositories
10# @DESCRIPTION: 10# @DESCRIPTION:
11# The eclass is based on subversion eclass. 11# The git eclass provides functions to fetch, patch and bootstrap
12# If you use this eclass, the ${S} is ${WORKDIR}/${P}. 12# software sources from git repositories and is based on the subversion eclass.
13# It is necessary to define the EGIT_REPO_URI variable at least. 13# It is necessary to define at least the EGIT_REPO_URI variable.
14# @THANKS TO: 14# @THANKS TO:
15# Fernando J. Pereda <ferdy@gentoo.org> 15# Fernando J. Pereda <ferdy@gentoo.org>
16 16
17inherit eutils 17inherit eutils
18 18
19EGIT="git.eclass" 19EGIT="git.eclass"
20 20
21# We DEPEND on at least a bit recent git version 21# We DEPEND on a not too ancient git version
22DEPEND=">=dev-vcs/git-1.6" 22DEPEND=">=dev-vcs/git-1.6"
23 23
24EXPORTED_FUNCTIONS="src_unpack" 24EXPORTED_FUNCTIONS="src_unpack"
25case "${EAPI:-0}" in 25case "${EAPI:-0}" in
26 4|3|2) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare" ;; 26 4|3|2) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare" ;;
40# @ECLASS-VARIABLE: EGIT_STORE_DIR 40# @ECLASS-VARIABLE: EGIT_STORE_DIR
41# @DESCRIPTION: 41# @DESCRIPTION:
42# Storage directory for git sources. 42# Storage directory for git sources.
43# Can be redefined. 43# Can be redefined.
44: ${EGIT_STORE_DIR:="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/git-src"} 44: ${EGIT_STORE_DIR:="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/git-src"}
45
46# @ECLASS-VARIABLE: EGIT_UNPACK_DIR
47# @DESCRIPTION:
48# Directory to unpack git sources in.
45 49
46# @ECLASS-VARIABLE: EGIT_HAS_SUBMODULES 50# @ECLASS-VARIABLE: EGIT_HAS_SUBMODULES
47# @DESCRIPTION: 51# @DESCRIPTION:
48# Set this to non-empty value to enable submodule support (slower). 52# Set this to non-empty value to enable submodule support (slower).
49: ${EGIT_HAS_SUBMODULES:=} 53: ${EGIT_HAS_SUBMODULES:=}
356 ${elogcmd} " branch: ${EGIT_BRANCH}" 360 ${elogcmd} " branch: ${EGIT_BRANCH}"
357 ${elogcmd} " storage directory: \"${GIT_DIR}\"" 361 ${elogcmd} " storage directory: \"${GIT_DIR}\""
358 362
359 if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then 363 if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then
360 pushd "${GIT_DIR}" &> /dev/null 364 pushd "${GIT_DIR}" &> /dev/null
361 debug-print "rsync -rlpgo . \"${S}\"" 365 debug-print "rsync -rlpgo . \"${EGIT_UNPACK_DIR:-${S}}\""
362 rsync -rlpgo . "${S}" 366 time rsync -rlpgo . "${EGIT_UNPACK_DIR:-${S}}"
363 popd &> /dev/null 367 popd &> /dev/null
364 else 368 else
365 unset GIT_DIR 369 unset GIT_DIR
366 debug-print "git clone -l -s -n \"${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}\" \"${S}\"" 370 debug-print "git clone -l -s -n \"${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}\" \"${EGIT_UNPACK_DIR:-${S}}\""
367 git clone -l -s -n "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" "${S}" 371 git clone -l -s -n "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" "${EGIT_UNPACK_DIR:-${S}}"
368 fi 372 fi
369 373
370 pushd "${S}" &> /dev/null 374 pushd "${EGIT_UNPACK_DIR:-${S}}" &> /dev/null
371 git_branch 375 git_branch
372 # submodules always reqire net (thanks to branches changing) 376 # submodules always reqire net (thanks to branches changing)
373 [[ -z ${EGIT_OFFLINE} ]] && git_submodules 377 [[ -z ${EGIT_OFFLINE} ]] && git_submodules
374 popd &> /dev/null 378 popd &> /dev/null
375 379
376 echo ">>> Unpacked to ${S}" 380 echo ">>> Unpacked to ${EGIT_UNPACK_DIR:-${S}}"
377} 381}
378 382
379# @FUNCTION: git_bootstrap 383# @FUNCTION: git_bootstrap
380# @DESCRIPTION: 384# @DESCRIPTION:
381# Runs bootstrap command if EGIT_BOOTSTRAP variable contains some value 385# Runs bootstrap command if EGIT_BOOTSTRAP variable contains some value
420# it also as normal space separated string list. (This part of code should be 424# it also as normal space separated string list. (This part of code should be
421# removed when all ebuilds get converted on bash array). 425# removed when all ebuilds get converted on bash array).
422git_apply_patches() { 426git_apply_patches() {
423 debug-print-function ${FUNCNAME} "$@" 427 debug-print-function ${FUNCNAME} "$@"
424 428
425 pushd "${S}" > /dev/null 429 pushd "${EGIT_UNPACK_DIR:-${S}}" > /dev/null
426 if [[ ${#EGIT_PATCHES[@]} -gt 1 ]] ; then 430 if [[ ${#EGIT_PATCHES[@]} -gt 1 ]] ; then
427 for i in "${EGIT_PATCHES[@]}"; do 431 for i in "${EGIT_PATCHES[@]}"; do
428 debug-print "$FUNCNAME: git_autopatch: patching from ${i}" 432 debug-print "$FUNCNAME: git_autopatch: patching from ${i}"
429 epatch "${i}" 433 epatch "${i}"
430 done 434 done

Legend:
Removed from v.1.52  
changed lines
  Added in v.1.53

  ViewVC Help
Powered by ViewVC 1.1.20