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

Contents of /eclass/git.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.62 - (hide annotations) (download)
Fri Aug 2 15:41:17 2013 UTC (13 months, 2 weeks ago) by mgorny
Branch: MAIN
Changes since 1.61: +6 -4 lines
Mark git.eclass @DEAD.

1 jlec 1.60 # Copyright 1999-2013 Gentoo Foundation
2 ferdy 1.1 # Distributed under the terms of the GNU General Public License v2
3 mgorny 1.62 # $Header: /var/cvsroot/gentoo-x86/eclass/git.eclass,v 1.61 2013/07/05 17:39:10 ulm Exp $
4 scarabeus 1.54
5 mgorny 1.62 # @DEAD
6     # Michał Górny <mgorny@gentoo.org> (2 Aug 2013)
7     # This eclass has been superseded by git-2 eclass and will be removed
8     # on 2013-09-02. Please modify your ebuilds to use git-2 instead.
9     # Bug #479474.
10 ferdy 1.1
11 scarabeus 1.17 # @ECLASS: git.eclass
12     # @MAINTAINER:
13     # Donnie Berkholz <dberkholz@gentoo.org>
14 hkbst 1.53 # @BLURB: Fetching and unpacking of git repositories
15 scarabeus 1.17 # @DESCRIPTION:
16 hkbst 1.53 # The git eclass provides functions to fetch, patch and bootstrap
17     # software sources from git repositories and is based on the subversion eclass.
18     # It is necessary to define at least the EGIT_REPO_URI variable.
19 jlec 1.60 #
20     # THANKS TO:
21 scarabeus 1.17 # Fernando J. Pereda <ferdy@gentoo.org>
22 ferdy 1.1
23 scarabeus 1.25 inherit eutils
24 ferdy 1.1
25     EGIT="git.eclass"
26    
27 hkbst 1.53 # We DEPEND on a not too ancient git version
28 sping 1.44 DEPEND=">=dev-vcs/git-1.6"
29 abcd 1.42
30 scarabeus 1.17 EXPORTED_FUNCTIONS="src_unpack"
31     case "${EAPI:-0}" in
32 axs 1.59 2|3|4|5) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare" ;;
33 scarabeus 1.40 1|0) ;;
34 scarabeus 1.52 *) die "EAPI=${EAPI} is not supported" ;;
35 scarabeus 1.17 esac
36     EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
37 ferdy 1.1
38 scarabeus 1.17 # define some nice defaults but only if nothing is set already
39     : ${HOMEPAGE:=http://git-scm.com/}
40 ferdy 1.1
41 scarabeus 1.17 # @ECLASS-VARIABLE: EGIT_QUIET
42     # @DESCRIPTION:
43 reavertm 1.46 # Set to non-empty value to supress some eclass messages.
44 reavertm 1.45 : ${EGIT_QUIET:=${ESCM_QUIET}}
45 ferdy 1.1
46 scarabeus 1.17 # @ECLASS-VARIABLE: EGIT_STORE_DIR
47     # @DESCRIPTION:
48     # Storage directory for git sources.
49 scarabeus 1.27 # Can be redefined.
50 reavertm 1.47 : ${EGIT_STORE_DIR:="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/git-src"}
51 ferdy 1.1
52 hkbst 1.53 # @ECLASS-VARIABLE: EGIT_UNPACK_DIR
53     # @DESCRIPTION:
54     # Directory to unpack git sources in.
55    
56 abcd 1.42 # @ECLASS-VARIABLE: EGIT_HAS_SUBMODULES
57     # @DESCRIPTION:
58 reavertm 1.46 # Set this to non-empty value to enable submodule support (slower).
59 reavertm 1.45 : ${EGIT_HAS_SUBMODULES:=}
60 abcd 1.42
61 scarabeus 1.17 # @ECLASS-VARIABLE: EGIT_FETCH_CMD
62     # @DESCRIPTION:
63     # Command for cloning the repository.
64 scarabeus 1.32 : ${EGIT_FETCH_CMD:="git clone"}
65 ferdy 1.1
66 scarabeus 1.17 # @ECLASS-VARIABLE: EGIT_UPDATE_CMD
67     # @DESCRIPTION:
68     # Git fetch command.
69 reavertm 1.45 if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then
70 abcd 1.42 EGIT_UPDATE_CMD="git pull -f -u"
71     else
72     EGIT_UPDATE_CMD="git fetch -f -u"
73     fi
74 ferdy 1.1
75 scarabeus 1.17 # @ECLASS-VARIABLE: EGIT_DIFFSTAT_CMD
76     # @DESCRIPTION:
77     # Git command for diffstat.
78 robbat2 1.18 EGIT_DIFFSTAT_CMD="git --no-pager diff --stat"
79 ferdy 1.1
80 scarabeus 1.17 # @ECLASS-VARIABLE: EGIT_OPTIONS
81     # @DESCRIPTION:
82     # This variable value is passed to clone and fetch.
83 ferdy 1.1 : ${EGIT_OPTIONS:=}
84    
85 scarabeus 1.38 # @ECLASS-VARIABLE: EGIT_MASTER
86     # @DESCRIPTION:
87     # Variable for specifying master branch.
88     # Usefull when upstream don't have master branch.
89     : ${EGIT_MASTER:=master}
90    
91 scarabeus 1.17 # @ECLASS-VARIABLE: EGIT_REPO_URI
92     # @DESCRIPTION:
93     # URI for the repository
94 ferdy 1.1 # e.g. http://foo, git://bar
95 scarabeus 1.17 # Supported protocols:
96 ferdy 1.1 # http://
97     # https://
98     # git://
99     # git+ssh://
100     # rsync://
101     # ssh://
102 scarabeus 1.29 eval X="\$${PN//[-+]/_}_LIVE_REPO"
103 scarabeus 1.28 if [[ ${X} = "" ]]; then
104 reavertm 1.47 : ${EGIT_REPO_URI:=}
105 scarabeus 1.28 else
106     EGIT_REPO_URI="${X}"
107     fi
108 scarabeus 1.17 # @ECLASS-VARIABLE: EGIT_PROJECT
109     # @DESCRIPTION:
110 reavertm 1.48 # Project name, it must be unique across EGIT_STORE_DIR.
111     # Git eclass will check out the git repository into ${EGIT_STORE_DIR}/${EGIT_PROJECT}/${EGIT_REPO_URI##*/}
112     # Default is ${PN}.
113     : ${EGIT_PROJECT:=${PN}}
114 ferdy 1.1
115 scarabeus 1.31 # @ECLASS-VARIABLE: EGIT_BOOTSTRAP
116 scarabeus 1.17 # @DESCRIPTION:
117     # bootstrap script or command like autogen.sh or etc...
118 ferdy 1.1 : ${EGIT_BOOTSTRAP:=}
119    
120 robbat2 1.9 # @ECLASS-VARIABLE: EGIT_OFFLINE
121     # @DESCRIPTION:
122     # Set this variable to a non-empty value to disable the automatic updating of
123 robbat2 1.10 # an GIT source tree. This is intended to be set outside the git source
124 robbat2 1.9 # tree by users.
125 reavertm 1.45 : ${EGIT_OFFLINE:=${ESCM_OFFLINE}}
126 ferdy 1.1
127 scarabeus 1.17 # @ECLASS-VARIABLE: EGIT_PATCHES
128     # @DESCRIPTION:
129     # Similar to PATCHES array from base.eclass
130     # Only difference is that this patches are applied before bootstrap.
131     # Please take note that this variable should be bash array.
132 ferdy 1.1
133 scarabeus 1.17 # @ECLASS-VARIABLE: EGIT_BRANCH
134     # @DESCRIPTION:
135 ferdy 1.1 # git eclass can fetch any branch in git_fetch().
136 scarabeus 1.29 eval X="\$${PN//[-+]/_}_LIVE_BRANCH"
137 reavertm 1.47 if [[ "${X}" = "" ]]; then
138     : ${EGIT_BRANCH:=master}
139 scarabeus 1.28 else
140     EGIT_BRANCH="${X}"
141     fi
142 ferdy 1.1
143 scarabeus 1.32 # @ECLASS-VARIABLE: EGIT_COMMIT
144 scarabeus 1.17 # @DESCRIPTION:
145 scarabeus 1.32 # git eclass can checkout any commit.
146     eval X="\$${PN//[-+]/_}_LIVE_COMMIT"
147 reavertm 1.47 if [[ "${X}" = "" ]]; then
148 scarabeus 1.32 : ${EGIT_COMMIT:=${EGIT_BRANCH}}
149 scarabeus 1.28 else
150 scarabeus 1.32 EGIT_COMMIT="${X}"
151 scarabeus 1.28 fi
152 ferdy 1.1
153 scarabeus 1.17 # @ECLASS-VARIABLE: EGIT_REPACK
154     # @DESCRIPTION:
155 reavertm 1.46 # Set to non-empty value to repack objects to save disk space. However this can
156     # take a long time with VERY big repositories.
157 reavertm 1.45 : ${EGIT_REPACK:=}
158 ferdy 1.1
159 scarabeus 1.17 # @ECLASS-VARIABLE: EGIT_PRUNE
160     # @DESCRIPTION:
161 reavertm 1.46 # Set to non-empty value to prune loose objects on each fetch. This is useful
162     # if upstream rewinds and rebases branches often.
163 reavertm 1.45 : ${EGIT_PRUNE:=}
164 ferdy 1.1
165 scarabeus 1.32 # @FUNCTION: git_submodules
166     # @DESCRIPTION:
167     # Internal function wrapping the submodule initialisation and update
168 scarabeus 1.37 git_submodules() {
169 reavertm 1.45 if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then
170 abcd 1.42 debug-print "git submodule init"
171     git submodule init
172 mgorny 1.49 debug-print "git submodule sync"
173     git submodule sync
174 abcd 1.42 debug-print "git submodule update"
175     git submodule update
176     fi
177 scarabeus 1.32 }
178    
179 scarabeus 1.36 # @FUNCTION: git_branch
180     # @DESCRIPTION:
181     # Internal function that changes branch for the repo based on EGIT_TREE and
182     # EGIT_BRANCH variables.
183     git_branch() {
184     local branchname=branch-${EGIT_BRANCH} src=origin/${EGIT_BRANCH}
185 reavertm 1.47 if [[ "${EGIT_COMMIT}" != "${EGIT_BRANCH}" ]]; then
186 scarabeus 1.36 branchname=tree-${EGIT_COMMIT}
187     src=${EGIT_COMMIT}
188     fi
189     debug-print "git checkout -b ${branchname} ${src}"
190     git checkout -b ${branchname} ${src} &> /dev/null
191    
192     unset branchname src
193     }
194    
195 scarabeus 1.17 # @FUNCTION: git_fetch
196     # @DESCRIPTION:
197     # Gets repository from EGIT_REPO_URI and store it in specified EGIT_STORE_DIR
198     git_fetch() {
199     debug-print-function ${FUNCNAME} "$@"
200 ferdy 1.1
201 mgorny 1.57 eqawarn "git.eclass is deprecated."
202     eqawarn "Please update your ebuilds to use git-2 instead. For details, see"
203     eqawarn "http://archives.gentoo.org/gentoo-dev/msg_b7ba363cae580845819ae3501fb157e9.xml"
204    
205 abcd 1.42 local GIT_DIR EGIT_CLONE_DIR oldsha1 cursha1 extra_clone_opts upstream_branch
206 reavertm 1.45 [[ -z ${EGIT_HAS_SUBMODULES} ]] && export GIT_DIR
207 ferdy 1.1
208 scarabeus 1.17 # choose if user wants elog or just einfo.
209 reavertm 1.45 if [[ -n ${EGIT_QUIET} ]]; then
210 scarabeus 1.17 elogcmd="einfo"
211     else
212     elogcmd="elog"
213     fi
214 ferdy 1.1
215 scarabeus 1.17 # If we have same branch and the tree we can do --depth 1 clone
216     # which outputs into really smaller data transfers.
217 scarabeus 1.21 # Sadly we can do shallow copy for now because quite a few packages need .git
218 scarabeus 1.17 # folder.
219 scarabeus 1.32 #[[ ${EGIT_COMMIT} = ${EGIT_BRANCH} ]] && \
220 scarabeus 1.17 # EGIT_FETCH_CMD="${EGIT_FETCH_CMD} --depth 1"
221 reavertm 1.47 if [[ -n ${EGIT_TREE} ]] ; then
222 scarabeus 1.32 EGIT_COMMIT=${EGIT_TREE}
223 scarabeus 1.37 ewarn "QA: Usage of deprecated EGIT_TREE variable detected."
224     ewarn "QA: Use EGIT_COMMIT variable instead."
225 scarabeus 1.32 fi
226 ferdy 1.1
227     # EGIT_REPO_URI is empty.
228     [[ -z ${EGIT_REPO_URI} ]] && die "${EGIT}: EGIT_REPO_URI is empty."
229    
230 ferdy 1.4 # check for the protocol or pull from a local repo.
231     if [[ -z ${EGIT_REPO_URI%%:*} ]] ; then
232     case ${EGIT_REPO_URI%%:*} in
233 scarabeus 1.17 git*|http|https|rsync|ssh) ;;
234     *) die "${EGIT}: protocol for fetch from "${EGIT_REPO_URI%:*}" is not yet implemented in eclass." ;;
235 ferdy 1.4 esac
236     fi
237 ferdy 1.1
238 scarabeus 1.17 # initial clone, we have to create master git storage directory and play
239     # nicely with sandbox
240 ferdy 1.1 if [[ ! -d ${EGIT_STORE_DIR} ]] ; then
241     debug-print "${FUNCNAME}: initial clone. creating git directory"
242     addwrite /
243 vapier 1.58 mkdir -m 775 -p "${EGIT_STORE_DIR}" \
244 ferdy 1.1 || die "${EGIT}: can't mkdir ${EGIT_STORE_DIR}."
245     export SANDBOX_WRITE="${SANDBOX_WRITE%%:/}"
246     fi
247    
248     cd -P "${EGIT_STORE_DIR}" || die "${EGIT}: can't chdir to ${EGIT_STORE_DIR}"
249     EGIT_STORE_DIR=${PWD}
250    
251 scarabeus 1.17 # allow writing into EGIT_STORE_DIR
252 ferdy 1.1 addwrite "${EGIT_STORE_DIR}"
253    
254     [[ -z ${EGIT_REPO_URI##*/} ]] && EGIT_REPO_URI="${EGIT_REPO_URI%/}"
255     EGIT_CLONE_DIR="${EGIT_PROJECT}"
256    
257     debug-print "${FUNCNAME}: EGIT_OPTIONS = \"${EGIT_OPTIONS}\""
258    
259 scarabeus 1.32 GIT_DIR="${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}"
260 scarabeus 1.21 # we also have to remove all shallow copied repositories
261     # and fetch them again
262 scarabeus 1.32 if [[ -e "${GIT_DIR}/shallow" ]]; then
263     rm -rf "${GIT_DIR}"
264 scarabeus 1.21 einfo "The ${EGIT_CLONE_DIR} was shallow copy. Refetching."
265     fi
266 scarabeus 1.32 # repack from bare copy to normal one
267 reavertm 1.47 if [[ -n ${EGIT_HAS_SUBMODULES} ]] && [[ -d ${GIT_DIR} && ! -d ${GIT_DIR}/.git ]]; then
268 scarabeus 1.32 rm -rf "${GIT_DIR}"
269     einfo "The ${EGIT_CLONE_DIR} was bare copy. Refetching."
270     fi
271 reavertm 1.45 if [[ -z ${EGIT_HAS_SUBMODULES} ]] && [[ -d ${GIT_DIR} && -d ${GIT_DIR}/.git ]]; then
272 abcd 1.42 rm -rf "${GIT_DIR}"
273     einfo "The ${EGIT_CLONE_DIR} was not a bare copy. Refetching."
274     fi
275    
276 reavertm 1.45 if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then
277 abcd 1.42 upstream_branch=origin/${EGIT_BRANCH}
278     else
279     upstream_branch=${EGIT_BRANCH}
280     extra_clone_opts=--bare
281     fi
282 scarabeus 1.21
283 scarabeus 1.32 if [[ ! -d ${GIT_DIR} ]] ; then
284 ferdy 1.1 # first clone
285 scarabeus 1.17 ${elogcmd} "GIT NEW clone -->"
286     ${elogcmd} " repository: ${EGIT_REPO_URI}"
287 ferdy 1.1
288 abcd 1.42 debug-print "${EGIT_FETCH_CMD} ${extra_clone_opts} ${EGIT_OPTIONS} \"${EGIT_REPO_URI}\" ${GIT_DIR}"
289     ${EGIT_FETCH_CMD} ${extra_clone_opts} ${EGIT_OPTIONS} "${EGIT_REPO_URI}" ${GIT_DIR} \
290 ferdy 1.1 || die "${EGIT}: can't fetch from ${EGIT_REPO_URI}."
291 abcd 1.42
292 scarabeus 1.32 pushd "${GIT_DIR}" &> /dev/null
293 abcd 1.42 cursha1=$(git rev-parse ${upstream_branch})
294 scarabeus 1.32 ${elogcmd} " at the commit: ${cursha1}"
295 ferdy 1.1
296 scarabeus 1.37 git_submodules
297 scarabeus 1.32 popd &> /dev/null
298 robbat2 1.9 elif [[ -n ${EGIT_OFFLINE} ]] ; then
299 scarabeus 1.32 pushd "${GIT_DIR}" &> /dev/null
300 abcd 1.42 cursha1=$(git rev-parse ${upstream_branch})
301 scarabeus 1.17 ${elogcmd} "GIT offline update -->"
302     ${elogcmd} " repository: ${EGIT_REPO_URI}"
303 scarabeus 1.26 ${elogcmd} " at the commit: ${cursha1}"
304 scarabeus 1.32 popd &> /dev/null
305 ferdy 1.1 else
306 scarabeus 1.32 pushd "${GIT_DIR}" &> /dev/null
307 ferdy 1.7 # Git urls might change, so unconditionally set it here
308     git config remote.origin.url "${EGIT_REPO_URI}"
309    
310 ferdy 1.1 # fetch updates
311 scarabeus 1.17 ${elogcmd} "GIT update -->"
312     ${elogcmd} " repository: ${EGIT_REPO_URI}"
313 ferdy 1.1
314 abcd 1.42 oldsha1=$(git rev-parse ${upstream_branch})
315    
316 reavertm 1.45 if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then
317 abcd 1.42 debug-print "${EGIT_UPDATE_CMD} ${EGIT_OPTIONS}"
318     # fix branching
319     git checkout ${EGIT_MASTER}
320     for x in $(git branch |grep -v "* ${EGIT_MASTER}" |tr '\n' ' '); do
321     git branch -D ${x}
322     done
323     ${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} \
324     || die "${EGIT}: can't update from ${EGIT_REPO_URI}."
325     else
326     debug-print "${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} origin ${EGIT_BRANCH}:${EGIT_BRANCH}"
327     ${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} origin ${EGIT_BRANCH}:${EGIT_BRANCH} \
328     || die "${EGIT}: can't update from ${EGIT_REPO_URI}."
329     fi
330 ferdy 1.1
331 scarabeus 1.37 git_submodules
332 abcd 1.42 cursha1=$(git rev-parse ${upstream_branch})
333 scarabeus 1.17
334     # write out message based on the revisions
335 reavertm 1.47 if [[ "${oldsha1}" != "${cursha1}" ]]; then
336 scarabeus 1.17 ${elogcmd} " updating from commit: ${oldsha1}"
337     ${elogcmd} " to commit: ${cursha1}"
338     else
339     ${elogcmd} " at the commit: ${cursha1}"
340 vapier 1.56 # @ECLASS-VARIABLE: LIVE_FAIL_FETCH_IF_REPO_NOT_UPDATED
341 scarabeus 1.28 # @DESCRIPTION:
342     # If this variable is set to TRUE in make.conf or somewhere in
343     # enviroment the package will fail if there is no update, thus in
344     # combination with --keep-going it would lead in not-updating
345     # pakcages that are up-to-date.
346     # TODO: this can lead to issues if more projects/packages use same repo
347     [[ ${LIVE_FAIL_FETCH_IF_REPO_NOT_UPDATED} = true ]] && \
348     debug-print "${FUNCNAME}: Repository \"${EGIT_REPO_URI}\" is up-to-date. Skipping." && \
349     die "${EGIT}: Repository \"${EGIT_REPO_URI}\" is up-to-date. Skipping."
350 scarabeus 1.17 fi
351 abcd 1.42 ${EGIT_DIFFSTAT_CMD} ${oldsha1}..${upstream_branch}
352 scarabeus 1.32 popd &> /dev/null
353 ferdy 1.1 fi
354 abcd 1.42
355 scarabeus 1.32 pushd "${GIT_DIR}" &> /dev/null
356 reavertm 1.45 if [[ -n ${EGIT_REPACK} ]] || [[ -n ${EGIT_PRUNE} ]]; then
357 ferdy 1.6 ebegin "Garbage collecting the repository"
358 reavertm 1.46 local args
359     [[ -n ${EGIT_PRUNE} ]] && args='--prune'
360     git gc ${args}
361 ferdy 1.1 eend $?
362     fi
363 scarabeus 1.32 popd &> /dev/null
364 maekke 1.30
365 scarabeus 1.26 # export the git version
366     export EGIT_VERSION="${cursha1}"
367 ferdy 1.1
368 scarabeus 1.37 # log the repo state
369 reavertm 1.47 [[ "${EGIT_COMMIT}" != "${EGIT_BRANCH}" ]] && ${elogcmd} " commit: ${EGIT_COMMIT}"
370 scarabeus 1.17 ${elogcmd} " branch: ${EGIT_BRANCH}"
371 scarabeus 1.34 ${elogcmd} " storage directory: \"${GIT_DIR}\""
372    
373 reavertm 1.45 if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then
374 abcd 1.42 pushd "${GIT_DIR}" &> /dev/null
375 hkbst 1.53 debug-print "rsync -rlpgo . \"${EGIT_UNPACK_DIR:-${S}}\""
376     time rsync -rlpgo . "${EGIT_UNPACK_DIR:-${S}}"
377 abcd 1.42 popd &> /dev/null
378     else
379     unset GIT_DIR
380 hkbst 1.53 debug-print "git clone -l -s -n \"${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}\" \"${EGIT_UNPACK_DIR:-${S}}\""
381     git clone -l -s -n "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" "${EGIT_UNPACK_DIR:-${S}}"
382 abcd 1.42 fi
383 scarabeus 1.37
384 hkbst 1.53 pushd "${EGIT_UNPACK_DIR:-${S}}" &> /dev/null
385 scarabeus 1.37 git_branch
386     # submodules always reqire net (thanks to branches changing)
387 reavertm 1.47 [[ -z ${EGIT_OFFLINE} ]] && git_submodules
388 scarabeus 1.34 popd &> /dev/null
389 vapier 1.5
390 hkbst 1.53 echo ">>> Unpacked to ${EGIT_UNPACK_DIR:-${S}}"
391 ferdy 1.1 }
392    
393 scarabeus 1.17 # @FUNCTION: git_bootstrap
394     # @DESCRIPTION:
395     # Runs bootstrap command if EGIT_BOOTSTRAP variable contains some value
396     # Remember that what ever gets to the EGIT_BOOTSTRAP variable gets evaled by bash.
397 ferdy 1.1 git_bootstrap() {
398 scarabeus 1.17 debug-print-function ${FUNCNAME} "$@"
399 ferdy 1.1
400 scarabeus 1.17 if [[ -n ${EGIT_BOOTSTRAP} ]] ; then
401     pushd "${S}" > /dev/null
402     einfo "Starting bootstrap"
403 ferdy 1.1
404 scarabeus 1.17 if [[ -f ${EGIT_BOOTSTRAP} ]]; then
405     # we have file in the repo which we should execute
406     debug-print "$FUNCNAME: bootstraping with file \"${EGIT_BOOTSTRAP}\""
407    
408     if [[ -x ${EGIT_BOOTSTRAP} ]]; then
409     eval "./${EGIT_BOOTSTRAP}" \
410     || die "${EGIT}: bootstrap script failed"
411 ferdy 1.1 else
412 scarabeus 1.17 eerror "\"${EGIT_BOOTSTRAP}\" is not executable."
413     eerror "Report upstream, or bug ebuild maintainer to remove bootstrap command."
414     die "${EGIT}: \"${EGIT_BOOTSTRAP}\" is not executable."
415 ferdy 1.1 fi
416 scarabeus 1.17 else
417     # we execute some system command
418     debug-print "$FUNCNAME: bootstraping with commands \"${EGIT_BOOTSTRAP}\""
419 ferdy 1.1
420 scarabeus 1.17 eval "${EGIT_BOOTSTRAP}" \
421     || die "${EGIT}: bootstrap commands failed."
422 ferdy 1.1
423     fi
424 scarabeus 1.17
425     einfo "Bootstrap finished"
426     popd > /dev/null
427 ferdy 1.1 fi
428 scarabeus 1.17 }
429 ferdy 1.1
430 scarabeus 1.17 # @FUNCTION: git_apply_patches
431     # @DESCRIPTION:
432     # Apply patches from EGIT_PATCHES bash array.
433 reavertm 1.47 # Preferred is using the variable as bash array but for now it allows to write
434 scarabeus 1.17 # it also as normal space separated string list. (This part of code should be
435     # removed when all ebuilds get converted on bash array).
436     git_apply_patches() {
437     debug-print-function ${FUNCNAME} "$@"
438    
439 hkbst 1.53 pushd "${EGIT_UNPACK_DIR:-${S}}" > /dev/null
440 scarabeus 1.17 if [[ ${#EGIT_PATCHES[@]} -gt 1 ]] ; then
441     for i in "${EGIT_PATCHES[@]}"; do
442     debug-print "$FUNCNAME: git_autopatch: patching from ${i}"
443     epatch "${i}"
444     done
445 reavertm 1.47 elif [[ -n ${EGIT_PATCHES} ]]; then
446 scarabeus 1.17 # no need for loop if space separated string is passed.
447     debug-print "$FUNCNAME: git_autopatch: patching from ${EGIT_PATCHES}"
448     epatch "${EGIT_PATCHES}"
449     fi
450    
451     popd > /dev/null
452 ferdy 1.1 }
453    
454 scarabeus 1.17 # @FUNCTION: git_src_unpack
455     # @DESCRIPTION:
456     # src_upack function, calls src_prepare one if EAPI!=2.
457     git_src_unpack() {
458     debug-print-function ${FUNCNAME} "$@"
459 ferdy 1.1
460 scarabeus 1.17 git_fetch || die "${EGIT}: unknown problem in git_fetch()."
461 ferdy 1.1
462 scarabeus 1.17 has src_prepare ${EXPORTED_FUNCTIONS} || git_src_prepare
463     }
464 ferdy 1.1
465 scarabeus 1.17 # @FUNCTION: git_src_prepare
466     # @DESCRIPTION:
467     # src_prepare function for git stuff. Patches, bootstrap...
468     git_src_prepare() {
469     debug-print-function ${FUNCNAME} "$@"
470 maekke 1.30
471 scarabeus 1.17 git_apply_patches
472     git_bootstrap
473 ferdy 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.20