/[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.23 Revision 1.26
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.23 2011/09/23 13:58:35 mgorny Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.26 2011/09/23 14:10:47 mgorny Exp $
4 4
5# @ECLASS: git-2.eclass 5# @ECLASS: git-2.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Donnie Berkholz <dberkholz@gentoo.org> 7# Donnie Berkholz <dberkholz@gentoo.org>
8# Michał Górny <mgorny@gentoo.org>
8# @BLURB: Eclass for fetching and unpacking git repositories. 9# @BLURB: Eclass for fetching and unpacking git repositories.
9# @DESCRIPTION: 10# @DESCRIPTION:
10# Eclass for easing maitenance of live ebuilds using git as remote repository. 11# Eclass for easing maitenance of live ebuilds using git as remote repository.
11# Eclass support working with git submodules and branching. 12# Eclass support working with git submodules and branching.
12 13
251 || die "${FUNCNAME}: can't mkdir \"${EGIT_STORE_DIR}\"" 252 || die "${FUNCNAME}: can't mkdir \"${EGIT_STORE_DIR}\""
252 fi 253 fi
253 254
254 # allow writing into EGIT_STORE_DIR 255 # allow writing into EGIT_STORE_DIR
255 addwrite "${EGIT_STORE_DIR}" 256 addwrite "${EGIT_STORE_DIR}"
257
258 # calculate git.eclass store dir for data
259 # We will try to clone the old repository,
260 # and we will remove it if we don't need it anymore.
261 EGIT_OLD_CLONE=
262 if [[ ${EGIT_STORE_DIR} == */egit-src ]]; then
263 local old_store_dir=${EGIT_STORE_DIR/%egit-src/git-src}
264 local old_location=${old_store_dir}/${EGIT_PROJECT:-${PN}}
265
266 if [[ -d ${old_location} ]]; then
267 EGIT_OLD_CLONE=${old_location}
268 # required to remove the old clone
269 addwrite "${old_store_dir}"
270 fi
271 fi
272
256 # calculate the proper store dir for data 273 # calculate the proper store dir for data
257 # If user didn't specify the EGIT_DIR, we check if he did specify 274 # If user didn't specify the EGIT_DIR, we check if he did specify
258 # the EGIT_PROJECT or get the folder name from EGIT_REPO_URI. 275 # the EGIT_PROJECT or get the folder name from EGIT_REPO_URI.
259 EGIT_REPO_URI=${EGIT_REPO_URI%/} 276 EGIT_REPO_URI=${EGIT_REPO_URI%/}
260 if [[ ! ${EGIT_DIR} ]]; then 277 if [[ ! ${EGIT_DIR} ]]; then
262 clone_dir=${EGIT_PROJECT} 279 clone_dir=${EGIT_PROJECT}
263 else 280 else
264 clone_dir=${EGIT_REPO_URI##*/} 281 clone_dir=${EGIT_REPO_URI##*/}
265 fi 282 fi
266 EGIT_DIR=${EGIT_STORE_DIR}/${clone_dir} 283 EGIT_DIR=${EGIT_STORE_DIR}/${clone_dir}
284
285 if [[ ${EGIT_OLD_CLONE} && ! -d ${EGIT_DIR} ]]; then
286 elog "${FUNCNAME}: ${CATEGORY}/${PF} will be cloned from old location."
287 elog "It will be necessary to rebuild the package to fetch updates."
288 EGIT_REPO_URI="${EGIT_OLD_CLONE} ${EGIT_REPO_URI}"
289 fi
267 fi 290 fi
268 export EGIT_DIR=${EGIT_DIR} 291 export EGIT_DIR=${EGIT_DIR}
269 debug-print "${FUNCNAME}: Storing the repo into \"${EGIT_DIR}\"." 292 debug-print "${FUNCNAME}: Storing the repo into \"${EGIT_DIR}\"."
270} 293}
271 294
400 [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]] \ 423 [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]] \
401 && echo " commit: ${EGIT_COMMIT}" 424 && echo " commit: ${EGIT_COMMIT}"
402 echo " branch: ${EGIT_BRANCH}" 425 echo " branch: ${EGIT_BRANCH}"
403 echo " storage directory: \"${EGIT_DIR}\"" 426 echo " storage directory: \"${EGIT_DIR}\""
404 echo " checkout type: ${repo_type}" 427 echo " checkout type: ${repo_type}"
428
429 # Cleanup after git.eclass
430 if [[ ${EGIT_OLD_CLONE} ]]; then
431 einfo "${FUNCNAME}: removing old clone in ${EGIT_OLD_CLONE}."
432 rm -rf "${EGIT_OLD_CLONE}"
433 fi
405} 434}
406 435
407# @FUNCTION: git_bootstrap 436# @FUNCTION: git_bootstrap
408# @INTERNAL 437# @INTERNAL
409# @DESCRIPTION: 438# @DESCRIPTION:

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.26

  ViewVC Help
Powered by ViewVC 1.1.20