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

Diff of /eclass/git.eclass

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

Revision 1.8 Revision 1.15
1# Copyright 1999-2006 Gentoo Foundation 1# Copyright 1999-2006 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.8 2007/12/27 01:02:30 robbat2 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/git.eclass,v 1.15 2009/02/19 17:07:28 scarabeus Exp $
4 4
5## --------------------------------------------------------------------------- # 5## --------------------------------------------------------------------------- #
6# subversion.eclass author: Akinori Hattori <hattya@gentoo.org> 6# subversion.eclass author: Akinori Hattori <hattya@gentoo.org>
7# modified for git by Donnie Berkholz <spyderous@gentoo.org> 7# modified for git by Donnie Berkholz <spyderous@gentoo.org>
8# improved by Fernando J. Pereda <ferdy@gentoo.org> 8# improved by Fernando J. Pereda <ferdy@gentoo.org>
9# you should currently poke with updates Tomas Chvatal <scarabeus@gentoo.org>
9# 10#
10# The git eclass is written to fetch the software sources from 11# The git eclass is written to fetch the software sources from
11# git repositories like the subversion eclass. 12# git repositories like the subversion eclass.
12# 13#
13# 14#
37EGIT_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/git-src" 38EGIT_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/git-src"
38 39
39 40
40## -- EGIT_FETCH_CMD: git clone command 41## -- EGIT_FETCH_CMD: git clone command
41# 42#
42EGIT_FETCH_CMD="git clone --bare" 43EGIT_FETCH_CMD="git clone --bare --depth 1"
43 44
44## -- EGIT_UPDATE_CMD: git fetch command 45## -- EGIT_UPDATE_CMD: git fetch command
45# 46#
46EGIT_UPDATE_CMD="git fetch -f -u" 47EGIT_UPDATE_CMD="git fetch -f -u"
47 48
93# 94#
94# bootstrap script or command like autogen.sh or etc.. 95# bootstrap script or command like autogen.sh or etc..
95# 96#
96: ${EGIT_BOOTSTRAP:=} 97: ${EGIT_BOOTSTRAP:=}
97 98
99# @ECLASS-VARIABLE: EGIT_OFFLINE
100# @DESCRIPTION:
101# Set this variable to a non-empty value to disable the automatic updating of
102# an GIT source tree. This is intended to be set outside the git source
103# tree by users.
104EGIT_OFFLINE="${EGIT_OFFLINE:-${ESCM_OFFLINE}}"
98 105
99## -- EGIT_PATCHES: 106## -- EGIT_PATCHES:
100# 107#
101# git eclass can apply pathces in git_bootstrap(). 108# git eclass can apply pathces in git_bootstrap().
102# you can use regexp in this valiable like *.diff or *.patch or etc. 109# you can use regexp in this valiable like *.diff or *.patch or etc.
168 if [[ ! -d ${EGIT_STORE_DIR} ]] ; then 175 if [[ ! -d ${EGIT_STORE_DIR} ]] ; then
169 debug-print "${FUNCNAME}: initial clone. creating git directory" 176 debug-print "${FUNCNAME}: initial clone. creating git directory"
170 addwrite / 177 addwrite /
171 mkdir -p "${EGIT_STORE_DIR}" \ 178 mkdir -p "${EGIT_STORE_DIR}" \
172 || die "${EGIT}: can't mkdir ${EGIT_STORE_DIR}." 179 || die "${EGIT}: can't mkdir ${EGIT_STORE_DIR}."
173 chmod -f o+rw "${EGIT_STORE_DIR}" \
174 || die "${EGIT}: can't chmod ${EGIT_STORE_DIR}."
175 export SANDBOX_WRITE="${SANDBOX_WRITE%%:/}" 180 export SANDBOX_WRITE="${SANDBOX_WRITE%%:/}"
176 fi 181 fi
177 182
178 cd -P "${EGIT_STORE_DIR}" || die "${EGIT}: can't chdir to ${EGIT_STORE_DIR}" 183 cd -P "${EGIT_STORE_DIR}" || die "${EGIT}: can't chdir to ${EGIT_STORE_DIR}"
179 EGIT_STORE_DIR=${PWD} 184 EGIT_STORE_DIR=${PWD}
184 [[ -z ${EGIT_REPO_URI##*/} ]] && EGIT_REPO_URI="${EGIT_REPO_URI%/}" 189 [[ -z ${EGIT_REPO_URI##*/} ]] && EGIT_REPO_URI="${EGIT_REPO_URI%/}"
185 EGIT_CLONE_DIR="${EGIT_PROJECT}" 190 EGIT_CLONE_DIR="${EGIT_PROJECT}"
186 191
187 debug-print "${FUNCNAME}: EGIT_OPTIONS = \"${EGIT_OPTIONS}\"" 192 debug-print "${FUNCNAME}: EGIT_OPTIONS = \"${EGIT_OPTIONS}\""
188 193
189 export GIT_DIR="${EGIT_CLONE_DIR}" 194 export GIT_DIR="${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}"
190 195
191 if [[ ! -d ${EGIT_CLONE_DIR} ]] ; then 196 if [[ ! -d ${EGIT_CLONE_DIR} ]] ; then
192 # first clone 197 # first clone
193 einfo "git clone start -->" 198 einfo "git clone start -->"
194 einfo " repository: ${EGIT_REPO_URI}" 199 einfo " repository: ${EGIT_REPO_URI}"
196 ${EGIT_FETCH_CMD} ${EGIT_OPTIONS} "${EGIT_REPO_URI}" ${EGIT_PROJECT} \ 201 ${EGIT_FETCH_CMD} ${EGIT_OPTIONS} "${EGIT_REPO_URI}" ${EGIT_PROJECT} \
197 || die "${EGIT}: can't fetch from ${EGIT_REPO_URI}." 202 || die "${EGIT}: can't fetch from ${EGIT_REPO_URI}."
198 203
199 # We use --bare cloning, so git doesn't do this for us. 204 # We use --bare cloning, so git doesn't do this for us.
200 git config remote.origin.url "${EGIT_REPO_URI}" 205 git config remote.origin.url "${EGIT_REPO_URI}"
206 elif [[ -n ${EGIT_OFFLINE} ]] ; then
207 local oldsha1=$(git rev-parse ${EGIT_BRANCH})
208 einfo "git update offline mode -->"
209 einfo " repository: ${EGIT_REPO_URI}"
210 einfo " commit: ${oldsha1}"
201 else 211 else
202 # Git urls might change, so unconditionally set it here 212 # Git urls might change, so unconditionally set it here
203 git config remote.origin.url "${EGIT_REPO_URI}" 213 git config remote.origin.url "${EGIT_REPO_URI}"
204 214
205 # fetch updates 215 # fetch updates

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.15

  ViewVC Help
Powered by ViewVC 1.1.20