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

Contents of /eclass/git-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.19 - (hide annotations) (download)
Fri Sep 23 13:57:42 2011 UTC (2 years, 6 months ago) by mgorny
Branch: MAIN
Changes since 1.18: +1 -2 lines
Drop redundant EGIT_LOCAL_NONBARE setting.

It is set later in the function anyway.

1 scarabeus 1.1 # Copyright 1999-2011 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 mgorny 1.19 # $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.18 2011/09/23 13:57:28 mgorny Exp $
4 scarabeus 1.1
5     # @ECLASS: git-2.eclass
6     # @MAINTAINER:
7 dberkholz 1.11 # Donnie Berkholz <dberkholz@gentoo.org>
8 scarabeus 1.1 # @BLURB: Eclass for fetching and unpacking git repositories.
9     # @DESCRIPTION:
10     # Eclass for easing maitenance of live ebuilds using git as remote repository.
11     # Eclass support working with git submodules and branching.
12    
13     # This eclass support all EAPIs
14     EXPORT_FUNCTIONS src_unpack
15    
16     DEPEND="dev-vcs/git"
17    
18     # @ECLASS-VARIABLE: EGIT_SOURCEDIR
19     # @DESCRIPTION:
20     # This variable specifies destination where the cloned
21     # data are copied to.
22     #
23     # EGIT_SOURCEDIR="${S}"
24    
25     # @ECLASS-VARIABLE: EGIT_STORE_DIR
26     # @DESCRIPTION:
27     # Storage directory for git sources.
28     #
29     # EGIT_STORE_DIR="${DISTDIR}/egit-src"
30    
31     # @ECLASS-VARIABLE: EGIT_HAS_SUBMODULES
32     # @DEFAULT_UNSET
33     # @DESCRIPTION:
34     # If non-empty this variable enables support for git submodules in our
35     # checkout. Also this makes the checkout to be non-bare for now.
36    
37     # @ECLASS-VARIABLE: EGIT_OPTIONS
38     # @DEFAULT_UNSET
39     # @DESCRIPTION:
40     # Variable specifying additional options for fetch command.
41    
42     # @ECLASS-VARIABLE: EGIT_MASTER
43     # @DESCRIPTION:
44     # Variable for specifying master branch.
45     # Usefull when upstream don't have master branch or name it differently.
46     #
47     # EGIT_MASTER="master"
48    
49 scarabeus 1.6 # @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    
57 scarabeus 1.1 # @ECLASS-VARIABLE: EGIT_DIR
58     # @DESCRIPTION:
59     # Directory where we want to store the git data.
60 scarabeus 1.13 # This variable should not be overriden.
61 scarabeus 1.1 #
62 scarabeus 1.6 # EGIT_DIR="${EGIT_STORE_DIR}/${EGIT_PROJECT}"
63 scarabeus 1.1
64     # @ECLASS-VARIABLE: EGIT_REPO_URI
65     # @REQUIRED
66     # @DEFAULT_UNSET
67     # @DESCRIPTION:
68     # URI for the repository
69     # e.g. http://foo, git://bar
70     #
71     # Support multiple values:
72     # EGIT_REPO_URI="git://a/b.git http://c/d.git"
73    
74     # @ECLASS-VARIABLE: EVCS_OFFLINE
75     # @DEFAULT_UNSET
76     # @DESCRIPTION:
77     # If non-empty this variable prevents performance of any online
78     # operations.
79    
80     # @ECLASS-VARIABLE: EGIT_BRANCH
81     # @DESCRIPTION:
82     # Variable containing branch name we want to check out.
83     # It can be overriden via env using packagename_LIVE_BRANCH
84     # variable.
85     #
86     # EGIT_BRANCH="${EGIT_MASTER}"
87    
88     # @ECLASS-VARIABLE: EGIT_COMMIT
89     # @DESCRIPTION:
90     # Variable containing commit hash/tag we want to check out.
91     # It can be overriden via env using packagename_LIVE_COMMIT
92     # variable.
93     #
94 scarabeus 1.4 # EGIT_COMMIT="${EGIT_BRANCH}"
95 scarabeus 1.1
96     # @ECLASS-VARIABLE: EGIT_REPACK
97     # @DEFAULT_UNSET
98     # @DESCRIPTION:
99     # If non-empty this variable specifies that repository will be repacked to
100     # save space. However this can take a REALLY LONG time with VERY big
101     # repositories.
102    
103     # @ECLASS-VARIABLE: EGIT_PRUNE
104     # @DEFAULT_UNSET
105     # @DESCRIPTION:
106     # If non-empty this variable enables pruning all loose objects on each fetch.
107     # This is useful if upstream rewinds and rebases branches often.
108    
109     # @ECLASS-VARIABLE: EGIT_NONBARE
110     # @DEFAULT_UNSET
111     # @DESCRIPTION:
112     # If non-empty this variable specifies that all checkouts will be done using
113     # non bare repositories. This is useful if you can't operate with bare
114     # checkouts for some reason.
115    
116 scarabeus 1.13 # @ECLASS-VARIABLE: EGIT_NOUNPACK
117     # @DEFAULT_UNSET
118     # @DESCRIPTION:
119     # If non-empty this variable bans unpacking of ${A} content into the srcdir.
120     # Default behaviour is to unpack ${A} content.
121    
122 scarabeus 1.1 # @FUNCTION: git-2_init_variables
123     # @DESCRIPTION:
124     # Internal function initializing all git variables.
125     # We define it in function scope so user can define
126     # all the variables before and after inherit.
127     git-2_init_variables() {
128     debug-print-function ${FUNCNAME} "$@"
129    
130 mgorny 1.15 local esc_pn liverepo livebranch livecommit
131     esc_pn=${PN//[-+]/_}
132 scarabeus 1.1
133     : ${EGIT_SOURCEDIR="${S}"}
134    
135     : ${EGIT_STORE_DIR:="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/egit-src"}
136    
137     : ${EGIT_HAS_SUBMODULES:=}
138    
139     : ${EGIT_OPTIONS:=}
140    
141     : ${EGIT_MASTER:=master}
142    
143 mgorny 1.15 liverepo=${esc_pn}_LIVE_REPO
144     EGIT_REPO_URI=${!liverepo:-${EGIT_REPO_URI}}
145 mgorny 1.17 [[ ${EGIT_REPO_URI} ]] || die "EGIT_REPO_URI must have some value"
146 scarabeus 1.1
147     : ${EVCS_OFFLINE:=}
148    
149 mgorny 1.15 livebranch=${esc_pn}_LIVE_BRANCH
150 mgorny 1.17 [[ ${!livebranch} ]] && ewarn "QA: using \"${esc_pn}_LIVE_BRANCH\" variable, you won't get any support"
151 mgorny 1.15 EGIT_BRANCH=${!livebranch:-${EGIT_BRANCH:-${EGIT_MASTER}}}
152    
153     livecommit=${esc_pn}_LIVE_COMMIT
154 mgorny 1.17 [[ ${!livecommit} ]] && ewarn "QA: using \"${esc_pn}_LIVE_COMMIT\" variable, you won't get any support"
155 mgorny 1.15 EGIT_COMMIT=${!livecommit:-${EGIT_COMMIT:-${EGIT_BRANCH}}}
156 scarabeus 1.1
157     : ${EGIT_REPACK:=}
158    
159     : ${EGIT_PRUNE:=}
160     }
161    
162     # @FUNCTION: git-2_submodules
163     # @DESCRIPTION:
164     # Internal function wrapping the submodule initialisation and update.
165     git-2_submodules() {
166     debug-print-function ${FUNCNAME} "$@"
167 mgorny 1.17 if [[ ${EGIT_HAS_SUBMODULES} ]]; then
168     if [[ ${EVCS_OFFLINE} ]]; then
169 scarabeus 1.1 # for submodules operations we need to be online
170     debug-print "${FUNCNAME}: not updating submodules in offline mode"
171     return 1
172     fi
173    
174     debug-print "${FUNCNAME}: working in \"${1}\""
175     pushd "${EGIT_DIR}" > /dev/null
176    
177     debug-print "${FUNCNAME}: git submodule init"
178     git submodule init || die
179     debug-print "${FUNCNAME}: git submodule sync"
180     git submodule sync || die
181     debug-print "${FUNCNAME}: git submodule update"
182     git submodule update || die
183    
184     popd > /dev/null
185     fi
186     }
187    
188     # @FUNCTION: git-2_branch
189     # @DESCRIPTION:
190     # Internal function that changes branch for the repo based on EGIT_COMMIT and
191     # EGIT_BRANCH variables.
192     git-2_branch() {
193     debug-print-function ${FUNCNAME} "$@"
194    
195 scarabeus 1.13 local branchname src
196    
197 scarabeus 1.1 debug-print "${FUNCNAME}: working in \"${EGIT_SOURCEDIR}\""
198     pushd "${EGIT_SOURCEDIR}" > /dev/null
199    
200     local branchname=branch-${EGIT_BRANCH} src=origin/${EGIT_BRANCH}
201     if [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]]; then
202     branchname=tree-${EGIT_COMMIT}
203     src=${EGIT_COMMIT}
204     fi
205     debug-print "${FUNCNAME}: git checkout -b ${branchname} ${src}"
206     git checkout -b ${branchname} ${src} \
207     || die "${FUNCNAME}: changing the branch failed"
208    
209     popd > /dev/null
210     }
211    
212     # @FUNCTION: git-2_gc
213     # @DESCRIPTION:
214     # Internal function running garbage collector on checked out tree.
215     git-2_gc() {
216     debug-print-function ${FUNCNAME} "$@"
217    
218 scarabeus 1.13 local args
219    
220 scarabeus 1.1 pushd "${EGIT_DIR}" > /dev/null
221 mgorny 1.17 if [[ ${EGIT_REPACK} || ${EGIT_PRUNE} ]]; then
222 scarabeus 1.1 ebegin "Garbage collecting the repository"
223 mgorny 1.17 [[ ${EGIT_PRUNE} ]] && args='--prune'
224 scarabeus 1.1 debug-print "${FUNCNAME}: git gc ${args}"
225     git gc ${args}
226     eend $?
227     fi
228     popd > /dev/null
229     }
230    
231     # @FUNCTION: git-2_prepare_storedir
232     # @DESCRIPTION:
233     # Internal function preparing directory where we are going to store SCM
234     # repository.
235     git-2_prepare_storedir() {
236     debug-print-function ${FUNCNAME} "$@"
237    
238     local clone_dir
239    
240     # initial clone, we have to create master git storage directory and play
241     # nicely with sandbox
242     if [[ ! -d ${EGIT_STORE_DIR} ]]; then
243     debug-print "${FUNCNAME}: Creating git main storage directory"
244     addwrite /
245     mkdir -p "${EGIT_STORE_DIR}" \
246     || die "${FUNCNAME}: can't mkdir \"${EGIT_STORE_DIR}\""
247     fi
248    
249     # allow writing into EGIT_STORE_DIR
250     addwrite "${EGIT_STORE_DIR}"
251     # calculate the proper store dir for data
252 scarabeus 1.6 # If user didn't specify the EGIT_DIR, we check if he did specify
253     # the EGIT_PROJECT or get the folder name from EGIT_REPO_URI.
254 mgorny 1.16 EGIT_REPO_URI=${EGIT_REPO_URI%/}
255 mgorny 1.17 if [[ ! ${EGIT_DIR} ]]; then
256     if [[ ${EGIT_PROJECT} ]]; then
257 scarabeus 1.6 clone_dir=${EGIT_PROJECT}
258     else
259     clone_dir=${EGIT_REPO_URI##*/}
260     fi
261 scarabeus 1.1 EGIT_DIR=${EGIT_STORE_DIR}/${clone_dir}
262     fi
263     export EGIT_DIR=${EGIT_DIR}
264     debug-print "${FUNCNAME}: Storing the repo into \"${EGIT_DIR}\"."
265     }
266    
267     # @FUNCTION: git-2_move_source
268     # @DESCRIPTION:
269     # Internal function moving sources from the EGIT_DIR to EGIT_SOURCEDIR dir.
270     git-2_move_source() {
271     debug-print-function ${FUNCNAME} "$@"
272    
273     debug-print "${FUNCNAME}: ${MOVE_COMMAND} \"${EGIT_DIR}\" \"${EGIT_SOURCEDIR}\""
274     pushd "${EGIT_DIR}" > /dev/null
275     mkdir -p "${EGIT_SOURCEDIR}" \
276     || die "${FUNCNAME}: failed to create ${EGIT_SOURCEDIR}"
277     ${MOVE_COMMAND} "${EGIT_SOURCEDIR}" \
278     || die "${FUNCNAME}: sync to \"${EGIT_SOURCEDIR}\" failed"
279     popd > /dev/null
280     }
281    
282     # @FUNCTION: git-2_initial_clone
283     # @DESCRIPTION:
284     # Internal function running initial clone on specified repo_uri.
285     git-2_initial_clone() {
286     debug-print-function ${FUNCNAME} "$@"
287    
288     local repo_uri
289    
290     EGIT_REPO_URI_SELECTED=""
291     for repo_uri in ${EGIT_REPO_URI}; do
292 scarabeus 1.13 debug-print "${FUNCNAME}: git clone ${EGIT_LOCAL_OPTIONS} \"${repo_uri}\" \"${EGIT_DIR}\""
293 mgorny 1.18 if git clone ${EGIT_LOCAL_OPTIONS} "${repo_uri}" "${EGIT_DIR}"; then
294 scarabeus 1.1 # global variable containing the repo_name we will be using
295     debug-print "${FUNCNAME}: EGIT_REPO_URI_SELECTED=\"${repo_uri}\""
296     EGIT_REPO_URI_SELECTED="${repo_uri}"
297     break
298     fi
299     done
300    
301 mgorny 1.17 [[ ${EGIT_REPO_URI_SELECTED} ]] \
302     || die "${FUNCNAME}: can't fetch from ${EGIT_REPO_URI}"
303 scarabeus 1.1 }
304    
305     # @FUNCTION: git-2_update_repo
306     # @DESCRIPTION:
307     # Internal function running update command on specified repo_uri.
308     git-2_update_repo() {
309     debug-print-function ${FUNCNAME} "$@"
310    
311     local repo_uri
312    
313 mgorny 1.17 if [[ ${EGIT_LOCAL_NONBARE} ]]; then
314 scarabeus 1.1 # checkout master branch and drop all other local branches
315     git checkout ${EGIT_MASTER} || die "${FUNCNAME}: can't checkout master branch ${EGIT_MASTER}"
316     for x in $(git branch | grep -v "* ${EGIT_MASTER}" | tr '\n' ' '); do
317     debug-print "${FUNCNAME}: git branch -D ${x}"
318     git branch -D ${x} > /dev/null
319     done
320     fi
321    
322     EGIT_REPO_URI_SELECTED=""
323     for repo_uri in ${EGIT_REPO_URI}; do
324     # git urls might change, so reset it
325     git config remote.origin.url "${repo_uri}"
326    
327 scarabeus 1.3 debug-print "${EGIT_UPDATE_CMD}"
328 mgorny 1.18 if ${EGIT_UPDATE_CMD} > /dev/null; then
329 scarabeus 1.1 # global variable containing the repo_name we will be using
330     debug-print "${FUNCNAME}: EGIT_REPO_URI_SELECTED=\"${repo_uri}\""
331     EGIT_REPO_URI_SELECTED="${repo_uri}"
332     break
333     fi
334     done
335    
336 mgorny 1.17 [[ ${EGIT_REPO_URI_SELECTED} ]] \
337     || die "${FUNCNAME}: can't update from ${EGIT_REPO_URI}"
338 scarabeus 1.1 }
339    
340     # @FUNCTION: git-2_fetch
341     # @DESCRIPTION:
342     # Internal function fetching repository from EGIT_REPO_URI and storing it in
343     # specified EGIT_STORE_DIR.
344     git-2_fetch() {
345     debug-print-function ${FUNCNAME} "$@"
346    
347     local oldsha cursha repo_type
348    
349 mgorny 1.17 [[ ${EGIT_LOCAL_NONBARE} ]] && repo_type="non-bare repository" || repo_type="bare repository"
350 scarabeus 1.1
351     if [[ ! -d ${EGIT_DIR} ]]; then
352     git-2_initial_clone
353     pushd "${EGIT_DIR}" > /dev/null
354     cursha=$(git rev-parse ${UPSTREAM_BRANCH})
355     echo "GIT NEW clone -->"
356     echo " repository: ${EGIT_REPO_URI_SELECTED}"
357     echo " at the commit: ${cursha}"
358    
359     popd > /dev/null
360 mgorny 1.17 elif [[ ${EVCS_OFFLINE} ]]; then
361 scarabeus 1.1 pushd "${EGIT_DIR}" > /dev/null
362     cursha=$(git rev-parse ${UPSTREAM_BRANCH})
363     echo "GIT offline update -->"
364     echo " repository: $(git config remote.origin.url)"
365     echo " at the commit: ${cursha}"
366     popd > /dev/null
367     else
368     pushd "${EGIT_DIR}" > /dev/null
369     oldsha=$(git rev-parse ${UPSTREAM_BRANCH})
370     git-2_update_repo
371     cursha=$(git rev-parse ${UPSTREAM_BRANCH})
372    
373     # fetch updates
374     echo "GIT update -->"
375     echo " repository: ${EGIT_REPO_URI_SELECTED}"
376     # write out message based on the revisions
377 mgorny 1.5 if [[ "${oldsha}" != "${cursha}" ]]; then
378 scarabeus 1.1 echo " updating from commit: ${oldsha}"
379     echo " to commit: ${cursha}"
380     else
381     echo " at the commit: ${cursha}"
382     fi
383    
384     # print nice statistic of what was changed
385     git --no-pager diff --stat ${oldsha}..${UPSTREAM_BRANCH}
386     popd > /dev/null
387     fi
388     # export the version the repository is at
389 mgorny 1.5 export EGIT_VERSION="${cursha}"
390 scarabeus 1.1 # log the repo state
391     [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]] \
392     && echo " commit: ${EGIT_COMMIT}"
393     echo " branch: ${EGIT_BRANCH}"
394     echo " storage directory: \"${EGIT_DIR}\""
395     echo " checkout type: ${repo_type}"
396     }
397    
398     # @FUNCTION: git_bootstrap
399     # @DESCRIPTION:
400     # Internal function that runs bootstrap command on unpacked source.
401     git-2_bootstrap() {
402     debug-print-function ${FUNCNAME} "$@"
403    
404 vapier 1.14 # @ECLASS-VARIABLE: EGIT_BOOTSTRAP
405 scarabeus 1.1 # @DESCRIPTION:
406     # Command to be executed after checkout and clone of the specified
407     # repository.
408     # enviroment the package will fail if there is no update, thus in
409     # combination with --keep-going it would lead in not-updating
410     # pakcages that are up-to-date.
411 mgorny 1.17 if [[ ${EGIT_BOOTSTRAP} ]]; then
412 scarabeus 1.1 pushd "${EGIT_SOURCEDIR}" > /dev/null
413     einfo "Starting bootstrap"
414    
415     if [[ -f ${EGIT_BOOTSTRAP} ]]; then
416     # we have file in the repo which we should execute
417     debug-print "${FUNCNAME}: bootstraping with file \"${EGIT_BOOTSTRAP}\""
418    
419     if [[ -x ${EGIT_BOOTSTRAP} ]]; then
420     eval "./${EGIT_BOOTSTRAP}" \
421     || die "${FUNCNAME}: bootstrap script failed"
422     else
423     eerror "\"${EGIT_BOOTSTRAP}\" is not executable."
424     eerror "Report upstream, or bug ebuild maintainer to remove bootstrap command."
425     die "\"${EGIT_BOOTSTRAP}\" is not executable"
426     fi
427     else
428     # we execute some system command
429     debug-print "${FUNCNAME}: bootstraping with commands \"${EGIT_BOOTSTRAP}\""
430    
431     eval "${EGIT_BOOTSTRAP}" \
432     || die "${FUNCNAME}: bootstrap commands failed"
433     fi
434    
435     einfo "Bootstrap finished"
436     popd > /dev/null
437     fi
438     }
439    
440     # @FUNCTION: git-2_migrate_repository
441     # @DESCRIPTION:
442     # Internal function migrating between bare and normal checkout repository.
443     # This is based on usage of EGIT_SUBMODULES, at least until they
444     # start to work with bare checkouts sanely.
445 scarabeus 1.13 # This function also set some global variables that differ between
446     # bare and non-bare checkout.
447 scarabeus 1.1 git-2_migrate_repository() {
448     debug-print-function ${FUNCNAME} "$@"
449    
450     local target returnstate
451    
452     # first find out if we have submodules
453 mgorny 1.17 if [[ ! ${EGIT_HAS_SUBMODULES} ]]; then
454 scarabeus 1.1 target="bare"
455     else
456     target="full"
457     fi
458 scarabeus 1.13 # check if user didn't specify that we want non-bare repo
459 mgorny 1.17 if [[ ${EGIT_NONBARE} ]]; then
460 scarabeus 1.13 target="full"
461     fi
462 scarabeus 1.1
463     # test if we already have some repo and if so find out if we have
464     # to migrate the data
465     if [[ -d ${EGIT_DIR} ]]; then
466     if [[ ${target} == bare && -d ${EGIT_DIR}/.git ]]; then
467     debug-print "${FUNCNAME}: converting \"${EGIT_DIR}\" to bare copy"
468    
469     ebegin "Converting \"${EGIT_DIR}\" from non-bare to bare copy"
470     mv "${EGIT_DIR}/.git" "${EGIT_DIR}.bare"
471     export GIT_DIR="${EGIT_DIR}.bare"
472     git config core.bare true > /dev/null
473     returnstate=$?
474     unset GIT_DIR
475     rm -rf "${EGIT_DIR}"
476     mv "${EGIT_DIR}.bare" "${EGIT_DIR}"
477     eend ${returnstate}
478     fi
479     if [[ ${target} == full && ! -d ${EGIT_DIR}/.git ]]; then
480     debug-print "${FUNCNAME}: converting \"${EGIT_DIR}\" to non-bare copy"
481    
482     ebegin "Converting \"${EGIT_DIR}\" from bare to non-bare copy"
483     git clone -l "${EGIT_DIR}" "${EGIT_DIR}.nonbare" > /dev/null
484     returnstate=$?
485     rm -rf "${EGIT_DIR}"
486     mv "${EGIT_DIR}.nonbare" "${EGIT_DIR}"
487     eend ${returnstate}
488     fi
489     fi
490     if [[ ${returnstate} -ne 0 ]]; then
491     debug-print "${FUNCNAME}: converting \"${EGIT_DIR}\" failed, removing to start from scratch"
492    
493     # migration failed, remove the EGIT_DIR to play it safe
494     einfo "Migration failed, removing \"${EGIT_DIR}\" to start from scratch."
495     rm -rf "${EGIT_DIR}"
496     fi
497    
498     # set various options to work with both targets
499     if [[ ${target} == bare ]]; then
500     debug-print "${FUNCNAME}: working in bare repository for \"${EGIT_DIR}\""
501 scarabeus 1.13 EGIT_LOCAL_OPTIONS+="${EGIT_OPTIONS} --bare"
502 scarabeus 1.1 MOVE_COMMAND="git clone -l -s -n ${EGIT_DIR// /\\ }"
503 scarabeus 1.2 EGIT_UPDATE_CMD="git fetch -t -f -u origin ${EGIT_BRANCH}:${EGIT_BRANCH}"
504 scarabeus 1.1 UPSTREAM_BRANCH="${EGIT_BRANCH}"
505     else
506     debug-print "${FUNCNAME}: working in bare repository for non-bare \"${EGIT_DIR}\""
507     MOVE_COMMAND="cp -pPR ."
508 scarabeus 1.13 EGIT_LOCAL_OPTIONS="${EGIT_OPTIONS}"
509 scarabeus 1.1 EGIT_UPDATE_CMD="git pull -f -u ${EGIT_OPTIONS}"
510     UPSTREAM_BRANCH="origin/${EGIT_BRANCH}"
511 scarabeus 1.13 EGIT_LOCAL_NONBARE="true"
512 scarabeus 1.1 fi
513     }
514    
515 scarabeus 1.13 # @FUNCTION: git-2_cleanup
516     # @DESCRIPTION:
517     # Internal function cleaning up all the global variables
518     # that are not required after the unpack has been done.
519     git-2_cleanup() {
520     debug-print-function ${FUNCNAME} "$@"
521    
522     # Here we can unset only variables that are GLOBAL
523     # defined by the eclass, BUT NOT subject to change
524     # by user (like EGIT_PROJECT).
525     # If ebuild writer polutes his environment it is
526     # his problem only.
527     unset EGIT_DIR
528     unset MOVE_COMMAND
529     unset EGIT_LOCAL_OPTIONS
530     unset EGIT_UPDATE_CMD
531     unset UPSTREAM_BRANCH
532     unset EGIT_LOCAL_NONBARE
533     }
534    
535 scarabeus 1.1 # @FUNCTION: git-2_src_unpack
536     # @DESCRIPTION:
537 scarabeus 1.7 # Default git src_unpack function.
538 scarabeus 1.1 git-2_src_unpack() {
539     debug-print-function ${FUNCNAME} "$@"
540    
541     git-2_init_variables
542     git-2_prepare_storedir
543     git-2_migrate_repository
544     git-2_fetch "$@"
545     git-2_gc
546     git-2_submodules
547     git-2_move_source
548     git-2_branch
549     git-2_bootstrap
550 scarabeus 1.13 git-2_cleanup
551 scarabeus 1.1 echo ">>> Unpacked to ${EGIT_SOURCEDIR}"
552 scarabeus 1.9
553     # Users can specify some SRC_URI and we should
554     # unpack the files too.
555 mgorny 1.17 if [[ ! ${EGIT_NOUNPACK} ]]; then
556 scarabeus 1.13 if has ${EAPI:-0} 0 1; then
557 mgorny 1.17 [[ ${A} ]] && unpack ${A}
558 scarabeus 1.13 else
559     default_src_unpack
560     fi
561 mgorny 1.12 fi
562 scarabeus 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.20