1 |
Here is a patch that adds support for shared repositories. Since bzr |
2 |
is still a bit slow this is quite useful when using multiple branches. |
3 |
|
4 |
For example I have modified the live emacs(-cvs) ebuild to use the bzr |
5 |
mirror of emacs instead of cvs. I also have my own emacs branches, and |
6 |
sometimes want to install from one of these and at other times from |
7 |
trunk. Without support for shared repositories this would require the |
8 |
standalone branches to be manually moved out of the way everytime I |
9 |
want to switch branches. (Or worse the complete tree to be checked out |
10 |
from scratch every time I switch branches.) |
11 |
|
12 |
Please consider these changes |
13 |
|
14 |
Jonas |
15 |
|
16 |
--- /usr/local/portage/layman/emacs/eclass/bzr.eclass 2008-10-05 |
17 |
22:40:18.000000000 +0200 |
18 |
+++ /usr/portage/eclass/bzr.eclass 2008-10-05 10:22:12.000000000 +0200 |
19 |
@@ -9,6 +9,7 @@ |
20 |
# @DESCRIPTION: |
21 |
# The bzr.eclass provides support for apps using the bazaar DSCM |
22 |
(distributed source control management system). |
23 |
# The eclass was originally derived from the git eclass. |
24 |
+# Shared repository support added by Jonas Bernoulli <jonas@×××××××××.cc>. |
25 |
# |
26 |
# Note: Just set EBZR_REPO_URI to the url of the branch and the src_unpack |
27 |
# this eclass provides will put an export of the branch in ${WORKDIR}/${PN}. |
28 |
@@ -22,13 +23,23 @@ |
29 |
HOMEPAGE="http://bazaar-vcs.org/" |
30 |
DESCRIPTION="Based on the ${EBZR} eclass" |
31 |
|
32 |
-DEPEND=">=dev-util/bzr-0.92" |
33 |
+DEPEND=">=dev-util/bzr-1.6" |
34 |
|
35 |
# @ECLASS-VARIABLE: EBZR_STORE_DIR |
36 |
# @DESCRIPTION: |
37 |
# The dir to store the bzr sources. |
38 |
EBZR_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/bzr-src" |
39 |
|
40 |
+# @ECLASS-VARIABLE: EBZR_SHARED_REPO |
41 |
+# @DESCRIPTION: |
42 |
+# Whether to use a shared repository (see bzr help repositories). |
43 |
+EBZR_SHARED_REPO="${EBZR_SHARED_REPO:-}" |
44 |
+ |
45 |
+# @ECLASS-VARIABLE: EBZR_INIT_REPO_CMD |
46 |
+# @DESCRIPTION: |
47 |
+# The bzr command to initialize the shared repository. |
48 |
+EBZR_INIT_REPO_CMD="bzr init-repo" |
49 |
+ |
50 |
# @ECLASS-VARIABLE: EBZR_FETCH_CMD |
51 |
# @DESCRIPTION: |
52 |
# The bzr command to fetch the sources. |
53 |
@@ -54,9 +65,24 @@ |
54 |
# The bzr command to list revision number of the branch. |
55 |
EBZR_REVNO_CMD="bzr revno" |
56 |
|
57 |
+# @ECLASS-VARIABLE: EBZR_INIT_REPO_OPTS |
58 |
+# @DESCRIPTION: |
59 |
+# Options passed to the init-repo commands. |
60 |
+EBZR_INIT_REPO_OPTS="${EBZR_INIT_REPO_OPTS:-}" |
61 |
+ |
62 |
+# @ECLASS-VARIABLE: EBZR_FETCH_OPTS |
63 |
+# @DESCRIPTION: |
64 |
+# Options passed to the fetch commands in additon to EBZR_OPTIONS. |
65 |
+EBZR_FETCH_OPTS="${EBZR_FETCH_OPTS:-}" |
66 |
+ |
67 |
+# @ECLASS-VARIABLE: EBZR_UPDATE_OPTS |
68 |
+# @DESCRIPTION: |
69 |
+# Options passed to the update commands in additon to EBZR_OPTIONS. |
70 |
+EBZR_UPDATE_OPTS="${EBZR_UPDATE_OPTS:-}" |
71 |
+ |
72 |
# @ECLASS-VARIABLE: EBZR_OPTIONS |
73 |
# @DESCRIPTION: |
74 |
-# The options passed to the fetch and update commands. |
75 |
+# The common options passed to the fetch and update commands. |
76 |
EBZR_OPTIONS="${EBZR_OPTIONS:-}" |
77 |
|
78 |
# @ECLASS-VARIABLE: EBZR_REPO_URI |
79 |
@@ -72,7 +98,7 @@ |
80 |
# - lp:// |
81 |
# @CODE |
82 |
# |
83 |
-# Note: lp = https://launchpad.net |
84 |
+# Note: lp = http://launchpad.net |
85 |
EBZR_REPO_URI="${EBZR_REPO_URI:-}" |
86 |
|
87 |
# @ECLASS-VARIABLE: EBZR_BOOTSTRAP |
88 |
@@ -93,21 +119,26 @@ |
89 |
# @ECLASS-VARIABLE: EBZR_BRANCH |
90 |
# @DESCRIPTION: |
91 |
# The branch to fetch in bzr_fetch(). |
92 |
-# |
93 |
-# default: trunk |
94 |
-EBZR_BRANCH="${EBZR_BRANCH:-trunk}" |
95 |
+EBZR_BRANCH="${EBZR_BRANCH:-}" |
96 |
|
97 |
# @ECLASS-VARIABLE: EBZR_REVISION |
98 |
# @DESCRIPTION: |
99 |
# Revision to get, if not latest (see http://bazaar-vcs.org/BzrRevisionSpec) |
100 |
EBZR_REVISION="${EBZR_REVISION:-}" |
101 |
|
102 |
-# @ECLASS-VARIABLE: EBZR_CACHE_DIR |
103 |
+# @ECLASS-VARIABLE: EBZR_CACHE_REPO_DIR |
104 |
# @DESCRIPTION: |
105 |
-# The dir to store the source for the package, relative to EBZR_STORE_DIR. |
106 |
+# The dir name of the local shared repository (if any). |
107 |
# |
108 |
# default: ${PN} |
109 |
-EBZR_CACHE_DIR="${EBZR_CACHE_DIR:-${PN}}" |
110 |
+EBZR_CACHE_REPO_DIR="${EBZR_CACHE_REPO_DIR:-}" |
111 |
+ |
112 |
+# @ECLASS-VARIABLE: EBZR_CACHE_BRANCH_DIR |
113 |
+# @DESCRIPTION: |
114 |
+# The dir name of the local branch. |
115 |
+# |
116 |
+# default: ${EBZR_BRANCH} when using a shared repository or ${PN} otherwise |
117 |
+EBZR_CACHE_BRANCH_DIR="${EBZR_CACHE_BRANCH_DIR:-}" |
118 |
|
119 |
# @FUNCTION: bzr_fetch |
120 |
# @DESCRIPTION: |
121 |
@@ -143,37 +174,64 @@ |
122 |
|
123 |
cd -P "${EBZR_STORE_DIR}" || die "${EBZR}: can't chdir to ${EBZR_STORE_DIR}" |
124 |
|
125 |
- EBZR_BRANCH_DIR="${EBZR_STORE_DIR}/${EBZR_CACHE_DIR}" |
126 |
- |
127 |
addwrite "${EBZR_STORE_DIR}" |
128 |
- addwrite "${EBZR_BRANCH_DIR}" |
129 |
|
130 |
- debug-print "${FUNCNAME}: EBZR_OPTIONS = ${EBZR_OPTIONS}" |
131 |
+ if [[ -n ${EBZR_SHARED_REPO} ]]; then |
132 |
+ # using shared repository |
133 |
+ EBZR_REPO_DIR="${EBZR_STORE_DIR}/${EBZR_CACHE_REPO_DIR:-${PN}}" |
134 |
+ EBZR_BRANCH_DIR="${EBZR_REPO_DIR}/${EBZR_CACHE_BRANCH_DIR:-${EBZR_BRANCH}}" |
135 |
+ |
136 |
+ addwrite "${EBZR_REPO_DIR}" |
137 |
+ else |
138 |
+ # using stand-alone branch |
139 |
+ EBZR_BRANCH_DIR="${EBZR_STORE_DIR}/${EBZR_CACHE_BRANCH_DIR:-${PN}}" |
140 |
+ fi |
141 |
+ |
142 |
+ addwrite "${EBZR_BRANCH_DIR}" |
143 |
|
144 |
- local repository |
145 |
+ local branch |
146 |
|
147 |
- if [[ ${EBZR_REPO_URI} == */* ]]; then |
148 |
- repository="${EBZR_REPO_URI}${EBZR_BRANCH}" |
149 |
+ if [[ -n ${EBZR_BRANCH} ]] ; then |
150 |
+ branch="${EBZR_REPO_URI}/${EBZR_BRANCH}" |
151 |
else |
152 |
- repository="${EBZR_REPO_URI}" |
153 |
+ branch="${EBZR_REPO_URI}" |
154 |
+ fi |
155 |
+ |
156 |
+ if [[ ${EBZR_SHARED_REPO} && ! -d ${EBZR_REPO_DIR} ]] ; then |
157 |
+ # create shared repository |
158 |
+ debug-print "${FUNCNAME}: EBZR_INIT_REPO_OPTS = ${EBZR_INIT_REPO_OPTS}" |
159 |
+ |
160 |
+ ${EBZR_INIT_REPO_CMD} ${EBZR_INIT_REPO_OPTS} ${EBZR_REPO_DIR} \ |
161 |
+ || die "${EBZR}: can't initialize shared repository." |
162 |
+ fi |
163 |
+ |
164 |
+ if [[ ${EBZR_BRANCH} == */* && ! -f $(dirname ${EBZR_BRANCH}) ]]; then |
165 |
+ # prepare path to branch |
166 |
+ mkdir -p "${EBZR_REPO_DIR}/$(dirname ${EBZR_BRANCH})" |
167 |
fi |
168 |
|
169 |
if [[ ! -d ${EBZR_BRANCH_DIR} ]] ; then |
170 |
# fetch branch |
171 |
einfo "bzr branch start -->" |
172 |
- einfo " repository: ${repository} => ${EBZR_BRANCH_DIR}" |
173 |
+ einfo " branch: ${branch} => ${EBZR_BRANCH_DIR}" |
174 |
+ |
175 |
+ EBZR_OPTIONS="${EBZR_OPTIONS} ${EBZR_FETCH_OPTS}" |
176 |
+ debug-print "${FUNCNAME}: EBZR_OPTIONS = ${EBZR_OPTIONS}" |
177 |
|
178 |
- ${EBZR_FETCH_CMD} ${EBZR_OPTIONS} "${repository}" "${EBZR_BRANCH_DIR}" \ |
179 |
- || die "${EBZR}: can't branch from ${repository}." |
180 |
+ ${EBZR_FETCH_CMD} ${EBZR_OPTIONS} "${branch}" "${EBZR_BRANCH_DIR}" \ |
181 |
+ || die "${EBZR}: can't branch from ${branch}." |
182 |
|
183 |
else |
184 |
# update branch |
185 |
einfo "bzr pull start -->" |
186 |
- einfo " repository: ${repository}" |
187 |
+ einfo " branch: ${branch} => ${EBZR_BRANCH_DIR}" |
188 |
+ |
189 |
+ EBZR_OPTIONS="${EBZR_OPTIONS} ${EBZR_UPDATE_OPTS}" |
190 |
+ debug-print "${FUNCNAME}: EBZR_OPTIONS = ${EBZR_OPTIONS}" |
191 |
|
192 |
cd "${EBZR_BRANCH_DIR}" |
193 |
- ${EBZR_UPDATE_CMD} ${EBZR_OPTIONS} "${repository}" \ |
194 |
- || die "${EBZR}: can't merge from ${repository}." |
195 |
+ ${EBZR_UPDATE_CMD} ${EBZR_OPTIONS} "${branch}" \ |
196 |
+ || die "${EBZR}: can't merge from ${branch}." |
197 |
${EBZR_DIFFSTAT_CMD} |
198 |
fi |
199 |
|
200 |
On Sun, Oct 5, 2008 at 7:26 PM, Ulrich Mueller <ulm@g.o> wrote: |
201 |
>>>>>> On Fri, 21 Mar 2008, Christian Faulhammer wrote: |
202 |
> |
203 |
>> "Jorge Manuel B. S. Vicetto" <jmbsvicetto@g.o>: |
204 |
>>> With the help of Ingmar we did some cleanup and added support for |
205 |
>>> eclass-manpages at |
206 |
>>> http://git.overlays.gentoo.org/gitweb/?p=proj/desktop-effects.git;a=blob_plain;f=eclass/bzr.eclass;hb=bzr. |
207 |
>>> I'll be moving the updated eclass to the master branch, testing and |
208 |
>>> asking users to try it out during this weekend. |
209 |
>>> This eclass is used in the overlay for the live |
210 |
>>> avant-window-navigator ebuilds, so it's probably not as used/tested |
211 |
>>> as the remaining packages. It has provided us the support we needed |
212 |
>>> for awn, but you might need additional features or to review existing |
213 |
>>> ones. Please test the updated eclass on your overlay, feel free to |
214 |
>>> maintain it and, when you think its ready, add it to the tree. When |
215 |
>>> you do so, I'll remove it from our overlay and we'll use the eclass |
216 |
>>> on the tree. |
217 |
> |
218 |
>> We have a prior version for some time now in the Emacs overlay for |
219 |
>> two live ebuilds...so we go and merge your changed (ulm already |
220 |
>> did), test it and report any problems. |
221 |
> |
222 |
> As I just learned there are (at least) three overlays using |
223 |
> bzr.eclass, namely desktop-effects, emacs, and ltsp. |
224 |
> |
225 |
> So I think it is justified to move bzr.eclass to the Portage tree. |
226 |
> Currect version of bzr.eclass is attached. |
227 |
> |
228 |
> Please raise your objections *now*. |
229 |
> |
230 |
> Ulrich |