/[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.27
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.27 2011/12/14 23:40:18 vapier 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
245 # initial clone, we have to create master git storage directory and play 246 # initial clone, we have to create master git storage directory and play
246 # nicely with sandbox 247 # nicely with sandbox
247 if [[ ! -d ${EGIT_STORE_DIR} ]]; then 248 if [[ ! -d ${EGIT_STORE_DIR} ]]; then
248 debug-print "${FUNCNAME}: Creating git main storage directory" 249 debug-print "${FUNCNAME}: Creating git main storage directory"
249 addwrite / 250 addwrite /
250 mkdir -p "${EGIT_STORE_DIR}" \ 251 mkdir -m 775 -p "${EGIT_STORE_DIR}" \
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
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}
267 284
268 # Try to migrate from git.eclass git-src/ 285 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." 286 elog "${FUNCNAME}: ${CATEGORY}/${PF} will be cloned from old location."
275 elog "It will be necessary to rebuild the package to fetch updates." 287 elog "It will be necessary to rebuild the package to fetch updates."
276 EGIT_REPO_URI="${old_location} ${EGIT_REPO_URI}" 288 EGIT_REPO_URI="${EGIT_OLD_CLONE} ${EGIT_REPO_URI}"
277 fi
278 fi 289 fi
279 fi 290 fi
280 export EGIT_DIR=${EGIT_DIR} 291 export EGIT_DIR=${EGIT_DIR}
281 debug-print "${FUNCNAME}: Storing the repo into \"${EGIT_DIR}\"." 292 debug-print "${FUNCNAME}: Storing the repo into \"${EGIT_DIR}\"."
282} 293}
412 [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]] \ 423 [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]] \
413 && echo " commit: ${EGIT_COMMIT}" 424 && echo " commit: ${EGIT_COMMIT}"
414 echo " branch: ${EGIT_BRANCH}" 425 echo " branch: ${EGIT_BRANCH}"
415 echo " storage directory: \"${EGIT_DIR}\"" 426 echo " storage directory: \"${EGIT_DIR}\""
416 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
417} 434}
418 435
419# @FUNCTION: git_bootstrap 436# @FUNCTION: git_bootstrap
420# @INTERNAL 437# @INTERNAL
421# @DESCRIPTION: 438# @DESCRIPTION:

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

  ViewVC Help
Powered by ViewVC 1.1.20