/[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.24 Revision 1.25
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.24 2011/09/23 13:58:58 mgorny Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.25 2011/09/23 13:59:11 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# @BLURB: Eclass for fetching and unpacking git repositories. 8# @BLURB: Eclass for fetching and unpacking git repositories.
251 || die "${FUNCNAME}: can't mkdir \"${EGIT_STORE_DIR}\"" 251 || die "${FUNCNAME}: can't mkdir \"${EGIT_STORE_DIR}\""
252 fi 252 fi
253 253
254 # allow writing into EGIT_STORE_DIR 254 # allow writing into EGIT_STORE_DIR
255 addwrite "${EGIT_STORE_DIR}" 255 addwrite "${EGIT_STORE_DIR}"
256
257 # calculate git.eclass store dir for data
258 # We will try to clone the old repository,
259 # and we will remove it if we don't need it anymore.
260 EGIT_OLD_CLONE=
261 if [[ ${EGIT_STORE_DIR} == */egit-src ]]; then
262 local old_store_dir=${EGIT_STORE_DIR/%egit-src/git-src}
263 local old_location=${old_store_dir}/${EGIT_PROJECT:-${PN}}
264
265 if [[ -d ${old_location} ]]; then
266 EGIT_OLD_CLONE=${old_location}
267 # required to remove the old clone
268 addwrite "${old_store_dir}"
269 fi
270 fi
271
256 # calculate the proper store dir for data 272 # calculate the proper store dir for data
257 # If user didn't specify the EGIT_DIR, we check if he did specify 273 # 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. 274 # the EGIT_PROJECT or get the folder name from EGIT_REPO_URI.
259 EGIT_REPO_URI=${EGIT_REPO_URI%/} 275 EGIT_REPO_URI=${EGIT_REPO_URI%/}
260 if [[ ! ${EGIT_DIR} ]]; then 276 if [[ ! ${EGIT_DIR} ]]; then
263 else 279 else
264 clone_dir=${EGIT_REPO_URI##*/} 280 clone_dir=${EGIT_REPO_URI##*/}
265 fi 281 fi
266 EGIT_DIR=${EGIT_STORE_DIR}/${clone_dir} 282 EGIT_DIR=${EGIT_STORE_DIR}/${clone_dir}
267 283
268 # Try to migrate from git.eclass git-src/ 284 if [[ ${EGIT_OLD_CLONE} && ! -d ${EGIT_DIR} ]]; then
269 if [[ ! -d ${EGIT_DIR} && ${EGIT_STORE_DIR} == */egit-src ]]; then
270 local old_store_dir=${EGIT_STORE_DIR/%egit-src/git-src}
271 local old_location=${old_store_dir}/${EGIT_PROJECT:-${PN}}
272
273 if [[ -d ${old_location} ]]; then
274 elog "${FUNCNAME}: ${CATEGORY}/${PF} will be cloned from old location." 285 elog "${FUNCNAME}: ${CATEGORY}/${PF} will be cloned from old location."
275 elog "It will be necessary to rebuild the package to fetch updates." 286 elog "It will be necessary to rebuild the package to fetch updates."
276 EGIT_REPO_URI="${old_location} ${EGIT_REPO_URI}" 287 EGIT_REPO_URI="${EGIT_OLD_CLONE} ${EGIT_REPO_URI}"
277 fi
278 fi 288 fi
279 fi 289 fi
280 export EGIT_DIR=${EGIT_DIR} 290 export EGIT_DIR=${EGIT_DIR}
281 debug-print "${FUNCNAME}: Storing the repo into \"${EGIT_DIR}\"." 291 debug-print "${FUNCNAME}: Storing the repo into \"${EGIT_DIR}\"."
282} 292}
412 [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]] \ 422 [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]] \
413 && echo " commit: ${EGIT_COMMIT}" 423 && echo " commit: ${EGIT_COMMIT}"
414 echo " branch: ${EGIT_BRANCH}" 424 echo " branch: ${EGIT_BRANCH}"
415 echo " storage directory: \"${EGIT_DIR}\"" 425 echo " storage directory: \"${EGIT_DIR}\""
416 echo " checkout type: ${repo_type}" 426 echo " checkout type: ${repo_type}"
427
428 # Cleanup after git.eclass
429 if [[ ${EGIT_OLD_CLONE} ]]; then
430 einfo "${FUNCNAME}: removing old clone in ${EGIT_OLD_CLONE}."
431 rm -rf "${EGIT_OLD_CLONE}"
432 fi
417} 433}
418 434
419# @FUNCTION: git_bootstrap 435# @FUNCTION: git_bootstrap
420# @INTERNAL 436# @INTERNAL
421# @DESCRIPTION: 437# @DESCRIPTION:

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

  ViewVC Help
Powered by ViewVC 1.1.20