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

Diff of /eclass/git.eclass

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

Revision 1.36 Revision 1.37
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.36 2010/01/13 22:14:59 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/git.eclass,v 1.37 2010/01/22 09:32:57 scarabeus 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>
143: ${EGIT_PRUNE:=false} 143: ${EGIT_PRUNE:=false}
144 144
145# @FUNCTION: git_submodules 145# @FUNCTION: git_submodules
146# @DESCRIPTION: 146# @DESCRIPTION:
147# Internal function wrapping the submodule initialisation and update 147# Internal function wrapping the submodule initialisation and update
148git_sumbodules() { 148git_submodules() {
149 debug-print "git submodule init" 149 debug-print "git submodule init"
150 git submodule init 150 git submodule init
151 debug-print "git submodule update" 151 debug-print "git submodule update"
152 git submodule update 152 git submodule update
153} 153}
189 # folder. 189 # folder.
190 #[[ ${EGIT_COMMIT} = ${EGIT_BRANCH} ]] && \ 190 #[[ ${EGIT_COMMIT} = ${EGIT_BRANCH} ]] && \
191 # EGIT_FETCH_CMD="${EGIT_FETCH_CMD} --depth 1" 191 # EGIT_FETCH_CMD="${EGIT_FETCH_CMD} --depth 1"
192 if [[ ! -z ${EGIT_TREE} ]] ; then 192 if [[ ! -z ${EGIT_TREE} ]] ; then
193 EGIT_COMMIT=${EGIT_TREE} 193 EGIT_COMMIT=${EGIT_TREE}
194 eqawarn "Usage of deprecated EGIT_TREE variable detected." 194 ewarn "QA: Usage of deprecated EGIT_TREE variable detected."
195 eqawarn "Use EGIT_COMMIT variable instead." 195 ewarn "QA: Use EGIT_COMMIT variable instead."
196 fi 196 fi
197 197
198 # EGIT_REPO_URI is empty. 198 # EGIT_REPO_URI is empty.
199 [[ -z ${EGIT_REPO_URI} ]] && die "${EGIT}: EGIT_REPO_URI is empty." 199 [[ -z ${EGIT_REPO_URI} ]] && die "${EGIT}: EGIT_REPO_URI is empty."
200 200
226 EGIT_CLONE_DIR="${EGIT_PROJECT}" 226 EGIT_CLONE_DIR="${EGIT_PROJECT}"
227 227
228 debug-print "${FUNCNAME}: EGIT_OPTIONS = \"${EGIT_OPTIONS}\"" 228 debug-print "${FUNCNAME}: EGIT_OPTIONS = \"${EGIT_OPTIONS}\""
229 229
230 GIT_DIR="${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" 230 GIT_DIR="${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}"
231 pushd ${EGIT_STORE_DIR} &> /dev/null
232 # we also have to remove all shallow copied repositories 231 # we also have to remove all shallow copied repositories
233 # and fetch them again 232 # and fetch them again
234 if [[ -e "${GIT_DIR}/shallow" ]]; then 233 if [[ -e "${GIT_DIR}/shallow" ]]; then
235 rm -rf "${GIT_DIR}" 234 rm -rf "${GIT_DIR}"
236 einfo "The ${EGIT_CLONE_DIR} was shallow copy. Refetching." 235 einfo "The ${EGIT_CLONE_DIR} was shallow copy. Refetching."
252 251
253 pushd "${GIT_DIR}" &> /dev/null 252 pushd "${GIT_DIR}" &> /dev/null
254 cursha1=$(git rev-parse origin/${EGIT_BRANCH}) 253 cursha1=$(git rev-parse origin/${EGIT_BRANCH})
255 ${elogcmd} " at the commit: ${cursha1}" 254 ${elogcmd} " at the commit: ${cursha1}"
256 255
257 git_branch
258 git_sumbodules 256 git_submodules
259 popd &> /dev/null 257 popd &> /dev/null
260 elif [[ -n ${EGIT_OFFLINE} ]] ; then 258 elif [[ -n ${EGIT_OFFLINE} ]] ; then
261 pushd "${GIT_DIR}" &> /dev/null 259 pushd "${GIT_DIR}" &> /dev/null
262 cursha1=$(git rev-parse origin/${EGIT_BRANCH}) 260 cursha1=$(git rev-parse origin/${EGIT_BRANCH})
263 ${elogcmd} "GIT offline update -->" 261 ${elogcmd} "GIT offline update -->"
274 ${elogcmd} " repository: ${EGIT_REPO_URI}" 272 ${elogcmd} " repository: ${EGIT_REPO_URI}"
275 273
276 oldsha1=$(git rev-parse origin/${EGIT_BRANCH}) 274 oldsha1=$(git rev-parse origin/${EGIT_BRANCH})
277 275
278 debug-print "${EGIT_UPDATE_CMD} ${EGIT_OPTIONS}" 276 debug-print "${EGIT_UPDATE_CMD} ${EGIT_OPTIONS}"
277 # fix branching
278 git checkout master
279 for x in $(git branch |grep -v "* master" |tr '\n' ' '); do
280 git branch -D ${x}
281 done
279 ${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} \ 282 ${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} \
280 || die "${EGIT}: can't update from ${EGIT_REPO_URI}." 283 || die "${EGIT}: can't update from ${EGIT_REPO_URI}."
281 284
282 git_branch
283 git_sumbodules 285 git_submodules
284 cursha1=$(git rev-parse origin/${EGIT_BRANCH}) 286 cursha1=$(git rev-parse origin/${EGIT_BRANCH})
285 287
286 # write out message based on the revisions 288 # write out message based on the revisions
287 if [[ ${oldsha1} != ${cursha1} ]]; then 289 if [[ ${oldsha1} != ${cursha1} ]]; then
288 ${elogcmd} " updating from commit: ${oldsha1}" 290 ${elogcmd} " updating from commit: ${oldsha1}"
313 popd &> /dev/null 315 popd &> /dev/null
314 316
315 # export the git version 317 # export the git version
316 export EGIT_VERSION="${cursha1}" 318 export EGIT_VERSION="${cursha1}"
317 319
320 # log the repo state
318 [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]] && elog " commit: ${EGIT_COMMIT}" 321 [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]] && elog " commit: ${EGIT_COMMIT}"
319 ${elogcmd} " branch: ${EGIT_BRANCH}" 322 ${elogcmd} " branch: ${EGIT_BRANCH}"
320 ${elogcmd} " storage directory: \"${GIT_DIR}\"" 323 ${elogcmd} " storage directory: \"${GIT_DIR}\""
321 324
322 # unpack to the ${S} 325 pushd "${GIT_DIR}" &> /dev/null
326 debug-print "rsync -rlpgo . \"${S}\""
327 time rsync -rlpgo . "${S}"
323 popd &> /dev/null 328 popd &> /dev/null
324 debug-print "git clone -l -s \"${GIT_DIR}\" \"${S}\"" 329
325 git clone -l -s "${GIT_DIR}" "${S}" 330 pushd "${S}" &> /dev/null
331 git_branch
332 # submodules always reqire net (thanks to branches changing)
333 [[ -n ${EGIT_OFFLINE} ]] || git_submodules
334 popd &> /dev/null
326 335
327 echo ">>> Unpacked to ${S}" 336 echo ">>> Unpacked to ${S}"
328} 337}
329 338
330# @FUNCTION: git_bootstrap 339# @FUNCTION: git_bootstrap

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.37

  ViewVC Help
Powered by ViewVC 1.1.20