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

Diff of /eclass/git.eclass

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

Revision 1.27 Revision 1.28
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.27 2009/05/14 13:52:08 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/git.eclass,v 1.28 2009/08/24 21:48:58 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>
73# https:// 73# https://
74# git:// 74# git://
75# git+ssh:// 75# git+ssh://
76# rsync:// 76# rsync://
77# ssh:// 77# ssh://
78: ${EGIT_REPO_URI:=} 78eval X="\$${PN//-/_}_LIVE_REPO"
79 79if [[ ${X} = "" ]]; then
80 EGIT_REPO_URI=${EGIT_REPO_URI:=}
81else
82 EGIT_REPO_URI="${X}"
83fi
80# @ECLASS-VARIABLE: EGIT_PROJECT 84# @ECLASS-VARIABLE: EGIT_PROJECT
81# @DESCRIPTION: 85# @DESCRIPTION:
82# Project name of your ebuild. 86# Project name of your ebuild.
83# Git eclass will check out the git repository like: 87# Git eclass will check out the git repository like:
84# ${EGIT_STORE_DIR}/${EGIT_PROJECT}/${EGIT_REPO_URI##*/} 88# ${EGIT_STORE_DIR}/${EGIT_PROJECT}/${EGIT_REPO_URI##*/}
107# Please take note that this variable should be bash array. 111# Please take note that this variable should be bash array.
108 112
109# @ECLASS-VARIABLE: EGIT_BRANCH 113# @ECLASS-VARIABLE: EGIT_BRANCH
110# @DESCRIPTION: 114# @DESCRIPTION:
111# git eclass can fetch any branch in git_fetch(). 115# git eclass can fetch any branch in git_fetch().
112: ${EGIT_BRANCH:=master} 116eval X="\$${PN//-/_}_LIVE_BRANCH"
117if [[ ${X} = "" ]]; then
118 EGIT_BRANCH=${EGIT_BRANCH:=master}
119else
120 EGIT_BRANCH="${X}"
121fi
113 122
114# @ECLASS-VARIABLE: EGIT_TREE 123# @ECLASS-VARIABLE: EGIT_TREE
115# @DESCRIPTION: 124# @DESCRIPTION:
116# git eclass can checkout any tree (commit). 125# git eclass can checkout any tree (commit).
126eval X="\$${PN//-/_}_LIVE_TREE"
127if [[ ${X} = "" ]]; then
117: ${EGIT_TREE:=${EGIT_BRANCH}} 128 : ${EGIT_TREE:=${EGIT_BRANCH}}
129else
130 EGIT_TREE="${X}"
131fi
118 132
119# @ECLASS-VARIABLE: EGIT_REPACK 133# @ECLASS-VARIABLE: EGIT_REPACK
120# @DESCRIPTION: 134# @DESCRIPTION:
121# git eclass will repack objects to save disk space. However this can take a 135# git eclass will repack objects to save disk space. However this can take a
122# long time with VERY big repositories. 136# long time with VERY big repositories.
216 ${elogcmd} "GIT update -->" 230 ${elogcmd} "GIT update -->"
217 ${elogcmd} " repository: ${EGIT_REPO_URI}" 231 ${elogcmd} " repository: ${EGIT_REPO_URI}"
218 232
219 oldsha1=$(git rev-parse ${EGIT_BRANCH}) 233 oldsha1=$(git rev-parse ${EGIT_BRANCH})
220 234
235 ${elogcmd} ${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} origin ${EGIT_BRANCH}:${EGIT_BRANCH}
221 ${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} origin ${EGIT_BRANCH}:${EGIT_BRANCH} \ 236 ${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} origin ${EGIT_BRANCH}:${EGIT_BRANCH} \
222 || die "${EGIT}: can't update from ${EGIT_REPO_URI}." 237 || die "${EGIT}: can't update from ${EGIT_REPO_URI}."
223 238
224 cursha1=$(git rev-parse ${EGIT_BRANCH}) 239 cursha1=$(git rev-parse ${EGIT_BRANCH})
225 240
227 if [[ ${oldsha1} != ${cursha1} ]]; then 242 if [[ ${oldsha1} != ${cursha1} ]]; then
228 ${elogcmd} " updating from commit: ${oldsha1}" 243 ${elogcmd} " updating from commit: ${oldsha1}"
229 ${elogcmd} " to commit: ${cursha1}" 244 ${elogcmd} " to commit: ${cursha1}"
230 else 245 else
231 ${elogcmd} " at the commit: ${cursha1}" 246 ${elogcmd} " at the commit: ${cursha1}"
247 # @ECLASS_VARIABLE: LIVE_FAIL_FETCH_IF_REPO_NOT_UPDATED
248 # @DESCRIPTION:
249 # If this variable is set to TRUE in make.conf or somewhere in
250 # enviroment the package will fail if there is no update, thus in
251 # combination with --keep-going it would lead in not-updating
252 # pakcages that are up-to-date.
253 # TODO: this can lead to issues if more projects/packages use same repo
254 [[ ${LIVE_FAIL_FETCH_IF_REPO_NOT_UPDATED} = true ]] && \
255 debug-print "${FUNCNAME}: Repository \"${EGIT_REPO_URI}\" is up-to-date. Skipping." && \
256 die "${EGIT}: Repository \"${EGIT_REPO_URI}\" is up-to-date. Skipping."
232 fi 257 fi
233 ${EGIT_DIFFSTAT_CMD} ${oldsha1}..${EGIT_BRANCH} 258 ${EGIT_DIFFSTAT_CMD} ${oldsha1}..${EGIT_BRANCH}
234 fi 259 fi
235 260
236 if ${EGIT_REPACK} || ${EGIT_PRUNE} ; then 261 if ${EGIT_REPACK} || ${EGIT_PRUNE} ; then
258 branchname=tree-${EGIT_TREE} 283 branchname=tree-${EGIT_TREE}
259 src=${EGIT_TREE} 284 src=${EGIT_TREE}
260 fi 285 fi
261 debug-print "git checkout -b ${branchname} ${src}" 286 debug-print "git checkout -b ${branchname} ${src}"
262 git checkout -b ${branchname} ${src} 2>&1 > /dev/null 287 git checkout -b ${branchname} ${src} 2>&1 > /dev/null
288 debug-print "git submodule init"
289 git submodule init 2>&1 > /dev/null
290 debug-print "git submodule update"
291 git submodule update 2>&1 > /dev/null
263 popd > /dev/null 292 popd > /dev/null
264 293
265 unset branchname src 294 unset branchname src
266 295
267 echo ">>> Unpacked to ${S}" 296 echo ">>> Unpacked to ${S}"

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28

  ViewVC Help
Powered by ViewVC 1.1.20