| 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.5 2011/05/02 21:15:30 mgorny Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.6 2011/05/19 12:03:41 scarabeus 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. |
| … | |
… | |
| 44 | # Variable for specifying master branch. |
44 | # Variable for specifying master branch. |
| 45 | # Usefull when upstream don't have master branch or name it differently. |
45 | # Usefull when upstream don't have master branch or name it differently. |
| 46 | # |
46 | # |
| 47 | # EGIT_MASTER="master" |
47 | # EGIT_MASTER="master" |
| 48 | |
48 | |
|
|
49 | # @ECLASS-VARIABLE: EGIT_PROJECT |
|
|
50 | # @DESCRIPTION: |
|
|
51 | # Variable specifying name for the folder where we check out the git |
|
|
52 | # repository. Value of this variable should be unique in the |
|
|
53 | # EGIT_STORE_DIR as otherwise you would override another repository. |
|
|
54 | # |
|
|
55 | # EGIT_PROJECT="${EGIT_REPO_URI##*/}" |
|
|
56 | |
| 49 | # @ECLASS-VARIABLE: EGIT_DIR |
57 | # @ECLASS-VARIABLE: EGIT_DIR |
| 50 | # @DESCRIPTION: |
58 | # @DESCRIPTION: |
| 51 | # Directory where we want to store the git data. |
59 | # Directory where we want to store the git data. |
| 52 | # This should not be overriden unless really required. |
60 | # This should not be overriden unless really required. |
| 53 | # |
61 | # |
| 54 | # EGIT_DIR="${EGIT_STORE_DIR}/${EGIT_REPO_URI##*/}" |
62 | # EGIT_DIR="${EGIT_STORE_DIR}/${EGIT_PROJECT}" |
| 55 | |
63 | |
| 56 | # @ECLASS-VARIABLE: EGIT_REPO_URI |
64 | # @ECLASS-VARIABLE: EGIT_REPO_URI |
| 57 | # @REQUIRED |
65 | # @REQUIRED |
| 58 | # @DEFAULT_UNSET |
66 | # @DEFAULT_UNSET |
| 59 | # @DESCRIPTION: |
67 | # @DESCRIPTION: |
| … | |
… | |
| 233 | cd -P "${EGIT_STORE_DIR}" \ |
241 | cd -P "${EGIT_STORE_DIR}" \ |
| 234 | || die "${FUNCNAME}: can't chdir to \"${EGIT_STORE_DIR}\"" |
242 | || die "${FUNCNAME}: can't chdir to \"${EGIT_STORE_DIR}\"" |
| 235 | # allow writing into EGIT_STORE_DIR |
243 | # allow writing into EGIT_STORE_DIR |
| 236 | addwrite "${EGIT_STORE_DIR}" |
244 | addwrite "${EGIT_STORE_DIR}" |
| 237 | # calculate the proper store dir for data |
245 | # calculate the proper store dir for data |
|
|
246 | # If user didn't specify the EGIT_DIR, we check if he did specify |
|
|
247 | # the EGIT_PROJECT or get the folder name from EGIT_REPO_URI. |
| 238 | [[ -z ${EGIT_REPO_URI##*/} ]] && EGIT_REPO_URI="${EGIT_REPO_URI%/}" |
248 | [[ -z ${EGIT_REPO_URI##*/} ]] && EGIT_REPO_URI="${EGIT_REPO_URI%/}" |
| 239 | if [[ -z ${EGIT_DIR} ]]; then |
249 | if [[ -z ${EGIT_DIR} ]]; then |
|
|
250 | if [[ -n ${EGIT_PROJECT} ]]; then |
|
|
251 | clone_dir=${EGIT_PROJECT} |
|
|
252 | else |
| 240 | clone_dir=${EGIT_REPO_URI##*/} |
253 | clone_dir=${EGIT_REPO_URI##*/} |
|
|
254 | fi |
| 241 | EGIT_DIR=${EGIT_STORE_DIR}/${clone_dir} |
255 | EGIT_DIR=${EGIT_STORE_DIR}/${clone_dir} |
| 242 | fi |
256 | fi |
| 243 | export EGIT_DIR=${EGIT_DIR} |
257 | export EGIT_DIR=${EGIT_DIR} |
| 244 | debug-print "${FUNCNAME}: Storing the repo into \"${EGIT_DIR}\"." |
258 | debug-print "${FUNCNAME}: Storing the repo into \"${EGIT_DIR}\"." |
| 245 | } |
259 | } |