Gentoo Archives: gentoo-commits

From: "Christoph Junghans (ottxor)" <ottxor@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog mercurial.eclass
Date: Wed, 26 Dec 2012 23:09:48
Message-Id: 20121226230853.30C032171D@flycatcher.gentoo.org
1 ottxor 12/12/26 23:08:53
2
3 Modified: ChangeLog mercurial.eclass
4 Log:
5 added EHG_BOOTSTRAP (bug #340153), EHG_REVISION defaults to 'defaults (bug #380947), set web.cacerts (bug #431220), use auth when pulling (bug #432364)
6
7 Revision Changes Path
8 1.576 eclass/ChangeLog
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.576&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.576&content-type=text/plain
12 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.575&r2=1.576
13
14 Index: ChangeLog
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
17 retrieving revision 1.575
18 retrieving revision 1.576
19 diff -u -r1.575 -r1.576
20 --- ChangeLog 24 Dec 2012 02:51:25 -0000 1.575
21 +++ ChangeLog 26 Dec 2012 23:08:53 -0000 1.576
22 @@ -1,6 +1,10 @@
23 # ChangeLog for eclass directory
24 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
25 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.575 2012/12/24 02:51:25 zmedico Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.576 2012/12/26 23:08:53 ottxor Exp $
27 +
28 + 26 Dec 2012; Christoph Junghans <ottxor@g.o> mercurial.eclass:
29 + added EHG_BOOTSTRAP (bug #340153), EHG_REVISION defaults to 'defaults (bug
30 + #380947), set web.cacerts (bug #431220), use auth when pulling (bug #432364)
31
32 24 Dec 2012; Zac Medico <zmedico@g.o> python-any-r1.eclass:
33 Fix python-any-r1_pkg_setup fallback logic.
34
35
36
37 1.20 eclass/mercurial.eclass
38
39 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/mercurial.eclass?rev=1.20&view=markup
40 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/mercurial.eclass?rev=1.20&content-type=text/plain
41 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/mercurial.eclass?r1=1.19&r2=1.20
42
43 Index: mercurial.eclass
44 ===================================================================
45 RCS file: /var/cvsroot/gentoo-x86/eclass/mercurial.eclass,v
46 retrieving revision 1.19
47 retrieving revision 1.20
48 diff -u -r1.19 -r1.20
49 --- mercurial.eclass 3 Apr 2012 19:16:29 -0000 1.19
50 +++ mercurial.eclass 26 Dec 2012 23:08:53 -0000 1.20
51 @@ -1,11 +1,14 @@
52 # Copyright 1999-2012 Gentoo Foundation
53 # Distributed under the terms of the GNU General Public License v2
54 -# $Header: /var/cvsroot/gentoo-x86/eclass/mercurial.eclass,v 1.19 2012/04/03 19:16:29 nelchael Exp $
55 +# $Header: /var/cvsroot/gentoo-x86/eclass/mercurial.eclass,v 1.20 2012/12/26 23:08:53 ottxor Exp $
56
57 # @ECLASS: mercurial.eclass
58 # @MAINTAINER:
59 -# Krzysztof Pawlik <nelchael@g.o>
60 +# Christoph Junghans <ottxor@g.o>
61 # Dirkjan Ochtman <djc@g.o>
62 +# @AUTHOR:
63 +# Next gen author: Krzysztof Pawlik <nelchael@g.o>
64 +# Original author: Aron Griffis <agriffis@g.o>
65 # @BLURB: This eclass provides generic mercurial fetching functions
66 # @DESCRIPTION:
67 # This eclass provides generic mercurial fetching functions. To fetch sources
68 @@ -29,7 +32,7 @@
69 #
70 # EHG_REVISION is passed as a value for --updaterev parameter, so it can be more
71 # than just a revision, please consult `hg help revisions' for more details.
72 -[[ -z "${EHG_REVISION}" ]] && EHG_REVISION="tip"
73 +: ${EHG_REVISION:="default"}
74
75 # @ECLASS-VARIABLE: EHG_STORE_DIR
76 # @DESCRIPTION:
77 @@ -74,12 +77,18 @@
78 #
79 # If repository URI is not passed it defaults to EHG_REPO_URI, if module is
80 # empty it defaults to basename of EHG_REPO_URI, sourcedir defaults to S.
81 -function mercurial_fetch {
82 - debug-print-function ${FUNCNAME} ${*}
83 +mercurial_fetch() {
84 + debug-print-function ${FUNCNAME} "${@}"
85 +
86 + has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
87
88 EHG_REPO_URI=${1-${EHG_REPO_URI}}
89 [[ -z "${EHG_REPO_URI}" ]] && die "EHG_REPO_URI is empty"
90
91 + local cert_opt=
92 + [[ -f ${EPREFIX}/etc/ssl/certs/ca-certificates.crt ]] && \
93 + cert_opt=( --config "web.cacerts=${EPREFIX}/etc/ssl/certs/ca-certificates.crt" )
94 +
95 local module="${2-$(basename "${EHG_REPO_URI}")}"
96 local sourcedir="${3-${S}}"
97
98 @@ -105,7 +114,7 @@
99 # Clone/update repository:
100 if [[ ! -d "${module}" ]]; then
101 einfo "Cloning ${EHG_REPO_URI} to ${EHG_STORE_DIR}/${EHG_PROJECT}/${module}"
102 - ${EHG_CLONE_CMD} "${EHG_REPO_URI}" "${module}" || {
103 + ${EHG_CLONE_CMD} "${cert_opt[@]}" "${EHG_REPO_URI}" "${module}" || {
104 rm -rf "${module}"
105 die "failed to clone ${EHG_REPO_URI}"
106 }
107 @@ -113,9 +122,7 @@
108 elif [[ -z "${EHG_OFFLINE}" ]]; then
109 einfo "Updating ${EHG_STORE_DIR}/${EHG_PROJECT}/${module} from ${EHG_REPO_URI}"
110 cd "${module}" || die "failed to cd to ${module}"
111 - ${EHG_PULL_CMD}
112 - # mercurial-2.1: hg pull returns 1 if there are no incoming changesets
113 - [[ $? -eq 0 || $? -eq 1 ]] || die "update failed"
114 + ${EHG_PULL_CMD} "${cert_opt[@]}" "${EHG_REPO_URI}" || die "update failed"
115 fi
116
117 # Checkout working copy:
118 @@ -131,12 +138,55 @@
119 local HG_REVDATA=($(hg identify -b -i "${sourcedir}"))
120 export HG_REV_ID=${HG_REVDATA[0]}
121 local HG_REV_BRANCH=${HG_REVDATA[1]}
122 - einfo "Work directory: ${sourcedir} global id: ${HG_REV_ID} branch: ${HG_REV_BRANCH}"
123 + einfo "Work directory: ${sourcedir} global id: ${HG_REV_ID} (was ${EHG_REVISION} branch: ${HG_REV_BRANCH}"
124 +}
125 +
126 +# @FUNCTION: mercurial_bootstrap
127 +# @INTERNAL
128 +# @DESCRIPTION:
129 +# Internal function that runs bootstrap command on unpacked source.
130 +mercurial_bootstrap() {
131 + debug-print-function ${FUNCNAME} "$@"
132 +
133 + # @ECLASS-VARIABLE: EHG_BOOTSTRAP
134 + # @DESCRIPTION:
135 + # Command to be executed after checkout and clone of the specified
136 + # repository.
137 + if [[ ${EHG_BOOTSTRAP} ]]; then
138 + pushd "${S}" > /dev/null
139 + einfo "Starting bootstrap"
140 +
141 + if [[ -f ${EHG_BOOTSTRAP} ]]; then
142 + # we have file in the repo which we should execute
143 + debug-print "${FUNCNAME}: bootstraping with file \"${EHG_BOOTSTRAP}\""
144 +
145 + if [[ -x ${EHG_BOOTSTRAP} ]]; then
146 + eval "./${EHG_BOOTSTRAP}" \
147 + || die "${FUNCNAME}: bootstrap script failed"
148 + else
149 + eerror "\"${EHG_BOOTSTRAP}\" is not executable."
150 + eerror "Report upstream, or bug ebuild maintainer to remove bootstrap command."
151 + die "\"${EHG_BOOTSTRAP}\" is not executable"
152 + fi
153 + else
154 + # we execute some system command
155 + debug-print "${FUNCNAME}: bootstraping with commands \"${EHG_BOOTSTRAP}\""
156 +
157 + eval "${EHG_BOOTSTRAP}" \
158 + || die "${FUNCNAME}: bootstrap commands failed"
159 + fi
160 +
161 + einfo "Bootstrap finished"
162 + popd > /dev/null
163 + fi
164 }
165
166 # @FUNCTION: mercurial_src_unpack
167 # @DESCRIPTION:
168 # The mercurial src_unpack function, which will be exported.
169 function mercurial_src_unpack {
170 + debug-print-function ${FUNCNAME} "$@"
171 +
172 mercurial_fetch
173 + mercurial_bootstrap
174 }