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

Diff of /eclass/git-2.eclass

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

Revision 1.1 Revision 1.5
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2011 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-2.eclass,v 1.1 2011/04/20 10:56:27 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.5 2011/05/02 21:15:30 mgorny Exp $
4 4
5# @ECLASS: git-2.eclass 5# @ECLASS: git-2.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Tomas Chvatal <scarabeus@gentoo.org> 7# Tomas Chvatal <scarabeus@gentoo.org>
8# @BLURB: Eclass for fetching and unpacking git repositories. 8# @BLURB: Eclass for fetching and unpacking git repositories.
81# @DESCRIPTION: 81# @DESCRIPTION:
82# Variable containing commit hash/tag we want to check out. 82# Variable containing commit hash/tag we want to check out.
83# It can be overriden via env using packagename_LIVE_COMMIT 83# It can be overriden via env using packagename_LIVE_COMMIT
84# variable. 84# variable.
85# 85#
86# EGIT_BRANCH="${EGIT_BRANCH}" 86# EGIT_COMMIT="${EGIT_BRANCH}"
87 87
88# @ECLASS-VARIABLE: EGIT_REPACK 88# @ECLASS-VARIABLE: EGIT_REPACK
89# @DEFAULT_UNSET 89# @DEFAULT_UNSET
90# @DESCRIPTION: 90# @DESCRIPTION:
91# If non-empty this variable specifies that repository will be repacked to 91# If non-empty this variable specifies that repository will be repacked to
304 EGIT_REPO_URI_SELECTED="" 304 EGIT_REPO_URI_SELECTED=""
305 for repo_uri in ${EGIT_REPO_URI}; do 305 for repo_uri in ${EGIT_REPO_URI}; do
306 # git urls might change, so reset it 306 # git urls might change, so reset it
307 git config remote.origin.url "${repo_uri}" 307 git config remote.origin.url "${repo_uri}"
308 308
309 debug-print "${EGIT_UPDATE_CMD} ${EGIT_OPTIONS}" 309 debug-print "${EGIT_UPDATE_CMD}"
310 ${EGIT_UPDATE_CMD} > /dev/null 310 ${EGIT_UPDATE_CMD} > /dev/null
311 if [[ $? -eq 0 ]]; then 311 if [[ $? -eq 0 ]]; then
312 # global variable containing the repo_name we will be using 312 # global variable containing the repo_name we will be using
313 debug-print "${FUNCNAME}: EGIT_REPO_URI_SELECTED=\"${repo_uri}\"" 313 debug-print "${FUNCNAME}: EGIT_REPO_URI_SELECTED=\"${repo_uri}\""
314 EGIT_REPO_URI_SELECTED="${repo_uri}" 314 EGIT_REPO_URI_SELECTED="${repo_uri}"
356 356
357 # fetch updates 357 # fetch updates
358 echo "GIT update -->" 358 echo "GIT update -->"
359 echo " repository: ${EGIT_REPO_URI_SELECTED}" 359 echo " repository: ${EGIT_REPO_URI_SELECTED}"
360 # write out message based on the revisions 360 # write out message based on the revisions
361 if [[ "${oldsha1}" != "${cursha1}" ]]; then 361 if [[ "${oldsha}" != "${cursha}" ]]; then
362 echo " updating from commit: ${oldsha}" 362 echo " updating from commit: ${oldsha}"
363 echo " to commit: ${cursha}" 363 echo " to commit: ${cursha}"
364 else 364 else
365 echo " at the commit: ${cursha}" 365 echo " at the commit: ${cursha}"
366 fi 366 fi
368 # print nice statistic of what was changed 368 # print nice statistic of what was changed
369 git --no-pager diff --stat ${oldsha}..${UPSTREAM_BRANCH} 369 git --no-pager diff --stat ${oldsha}..${UPSTREAM_BRANCH}
370 popd > /dev/null 370 popd > /dev/null
371 fi 371 fi
372 # export the version the repository is at 372 # export the version the repository is at
373 export EGIT_VERSION="${cursha1}" 373 export EGIT_VERSION="${cursha}"
374 # log the repo state 374 # log the repo state
375 [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]] \ 375 [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]] \
376 && echo " commit: ${EGIT_COMMIT}" 376 && echo " commit: ${EGIT_COMMIT}"
377 echo " branch: ${EGIT_BRANCH}" 377 echo " branch: ${EGIT_BRANCH}"
378 echo " storage directory: \"${EGIT_DIR}\"" 378 echo " storage directory: \"${EGIT_DIR}\""
477 # set various options to work with both targets 477 # set various options to work with both targets
478 if [[ ${target} == bare ]]; then 478 if [[ ${target} == bare ]]; then
479 debug-print "${FUNCNAME}: working in bare repository for \"${EGIT_DIR}\"" 479 debug-print "${FUNCNAME}: working in bare repository for \"${EGIT_DIR}\""
480 EGIT_OPTIONS+=" --bare" 480 EGIT_OPTIONS+=" --bare"
481 MOVE_COMMAND="git clone -l -s -n ${EGIT_DIR// /\\ }" 481 MOVE_COMMAND="git clone -l -s -n ${EGIT_DIR// /\\ }"
482 EGIT_UPDATE_CMD="git fetch -f -u origin ${EGIT_BRANCH}:${EGIT_BRANCH}" 482 EGIT_UPDATE_CMD="git fetch -t -f -u origin ${EGIT_BRANCH}:${EGIT_BRANCH}"
483 UPSTREAM_BRANCH="${EGIT_BRANCH}" 483 UPSTREAM_BRANCH="${EGIT_BRANCH}"
484 else 484 else
485 debug-print "${FUNCNAME}: working in bare repository for non-bare \"${EGIT_DIR}\"" 485 debug-print "${FUNCNAME}: working in bare repository for non-bare \"${EGIT_DIR}\""
486 MOVE_COMMAND="cp -pPR ." 486 MOVE_COMMAND="cp -pPR ."
487 EGIT_UPDATE_CMD="git pull -f -u ${EGIT_OPTIONS}" 487 EGIT_UPDATE_CMD="git pull -f -u ${EGIT_OPTIONS}"

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.20