1 |
>>>>> On Sat, 25 Sep 2021, Michał Górny wrote: |
2 |
|
3 |
>> +EBZR="bzr.eclass" |
4 |
|
5 |
> Why do we need this? It seems as if someone is reinventing ${ECLASS}. |
6 |
|
7 |
Replaced by ${ECLASS}. |
8 |
|
9 |
>> +# @ECLASS-VARIABLE: EBZR_STORE_DIR |
10 |
|
11 |
> @USER_VARIABLE? |
12 |
|
13 |
Added. |
14 |
|
15 |
>> +# @DESCRIPTION: |
16 |
>> +# The directory to store all fetched Bazaar live sources. |
17 |
>> +: ${EBZR_STORE_DIR:=${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/bzr-src} |
18 |
>> + |
19 |
>> +# @ECLASS-VARIABLE: EBZR_UNPACK_DIR |
20 |
>> +# @DESCRIPTION: |
21 |
>> +# The working directory where the sources are copied to. |
22 |
>> +: ${EBZR_UNPACK_DIR:=${WORKDIR}/${P}} |
23 |
>> + |
24 |
>> +# @ECLASS-VARIABLE: EBZR_INIT_REPO_CMD |
25 |
>> +# @DESCRIPTION: |
26 |
>> +# The Bazaar command to initialise a shared repository. |
27 |
>> +: ${EBZR_INIT_REPO_CMD:="bzr init-repository --no-trees"} |
28 |
>> + |
29 |
>> +# @ECLASS-VARIABLE: EBZR_FETCH_CMD |
30 |
>> +# @DESCRIPTION: |
31 |
>> +# The Bazaar command to fetch the sources. |
32 |
>> +: ${EBZR_FETCH_CMD:="bzr branch --no-tree"} |
33 |
>> + |
34 |
>> +# @ECLASS-VARIABLE: EBZR_UPDATE_CMD |
35 |
>> +# @DESCRIPTION: |
36 |
>> +# The Bazaar command to update the sources. |
37 |
>> +: ${EBZR_UPDATE_CMD:="bzr pull --overwrite-tags"} |
38 |
>> + |
39 |
>> +# @ECLASS-VARIABLE: EBZR_EXPORT_CMD |
40 |
>> +# @DESCRIPTION: |
41 |
>> +# The Bazaar command to export a branch. |
42 |
>> +: ${EBZR_EXPORT_CMD:="bzr export"} |
43 |
>> + |
44 |
>> +# @ECLASS-VARIABLE: EBZR_CHECKOUT_CMD |
45 |
>> +# @DESCRIPTION: |
46 |
>> +# The Bazaar command to checkout a branch. |
47 |
>> +: ${EBZR_CHECKOUT_CMD:="bzr checkout --lightweight -q"} |
48 |
>> + |
49 |
>> +# @ECLASS-VARIABLE: EBZR_REVNO_CMD |
50 |
>> +# @DESCRIPTION: |
51 |
>> +# The Bazaar command to list a revision number of the branch. |
52 |
>> +: ${EBZR_REVNO_CMD:="bzr revno"} |
53 |
|
54 |
> Are you sure that having these overrides is a good idea? |
55 |
|
56 |
Yes. Ebuilds had used them in the past. |
57 |
|
58 |
> Your followup patch pretty much proves that every ebuild redefining |
59 |
> them would get broken by switch to breezy. |
60 |
|
61 |
The only one where syntax has changed is EBZR_INIT_REPO_CMD (which has |
62 |
init-shared-repository instead of init-repository). |
63 |
|
64 |
>> +# @ECLASS-VARIABLE: EBZR_OPTIONS |
65 |
>> +# @DEFAULT_UNSET |
66 |
>> +# @DESCRIPTION: |
67 |
>> +# The options passed to the fetch and update commands. |
68 |
|
69 |
> Is this intended to be set by ebuild or by user? |
70 |
|
71 |
Ebuild. |
72 |
|
73 |
>> +# @ECLASS-VARIABLE: EBZR_OFFLINE |
74 |
|
75 |
> @USER_VARIABLE? |
76 |
|
77 |
>> +# @ECLASS-VARIABLE: EVCS_UMASK |
78 |
|
79 |
> @USER_VARIABLE? |
80 |
|
81 |
Both added. |
82 |
|
83 |
>> +# @FUNCTION: bzr_initial_fetch |
84 |
|
85 |
> @INTERNAL? |
86 |
|
87 |
Added, and renamed to _bzr_initial_fetch. |
88 |
|
89 |
>> + if [[ -n "${EBZR_OFFLINE}" ]]; then |
90 |
>> + ewarn "EBZR_OFFLINE cannot be used when there is no local branch yet." |
91 |
|
92 |
> I dare say this is incorrect. If user says "no online operations", then |
93 |
> the eclass should just fail, not ignore the user. |
94 |
|
95 |
Fixed. |
96 |
|
97 |
>> + ${EBZR_FETCH_CMD} ${EBZR_OPTIONS} "${repo_uri}" "${branch_dir}" \ |
98 |
>> + || die "${EBZR}: can't branch from ${repo_uri}" |
99 |
|
100 |
> You can replace the backslash with '||'. |
101 |
|
102 |
I think that splitting the line before the operator is clearer. (It is |
103 |
also what GNU coding standards recommend for C.) |
104 |
|
105 |
>> +# @FUNCTION: bzr_update |
106 |
|
107 |
> @INTERNAL? |
108 |
|
109 |
Added, and renamed to _bzr_update. |
110 |
|
111 |
>> +bzr_fetch() { |
112 |
>> + local repo_dir branch_dir |
113 |
>> + local save_sandbox_write=${SANDBOX_WRITE} save_umask |
114 |
>> + |
115 |
>> + [[ -n ${EBZR_REPO_URI} ]] || die "${EBZR}: EBZR_REPO_URI is empty" |
116 |
>> + |
117 |
>> + if [[ ! -d ${EBZR_STORE_DIR} ]] ; then |
118 |
>> + addwrite / |
119 |
>> + mkdir -p "${EBZR_STORE_DIR}" \ |
120 |
>> + || die "${EBZR}: can't mkdir ${EBZR_STORE_DIR}" |
121 |
>> + SANDBOX_WRITE=${save_sandbox_write} |
122 |
|
123 |
> Looks like abusing implementation details. |
124 |
|
125 |
Replaced by subshell. |
126 |
|
127 |
>> + if [[ -z ${EBZR_INITIAL_URI} ]]; then |
128 |
>> + bzr_initial_fetch "${EBZR_REPO_URI}" "${branch_dir}" |
129 |
>> + else |
130 |
>> + # Workaround for faster initial download. This clones the |
131 |
>> + # branch from a fast server (which may be out of date), and |
132 |
>> + # subsequently pulls from the slow original repository. |
133 |
>> + bzr_initial_fetch "${EBZR_INITIAL_URI}" "${branch_dir}" |
134 |
>> + if [[ ${EBZR_REPO_URI} != "${EBZR_INITIAL_URI}" ]]; then |
135 |
>> + EBZR_UPDATE_CMD="${EBZR_UPDATE_CMD} --remember --overwrite" \ |
136 |
>> + EBZR_OFFLINE="" \ |
137 |
|
138 |
> Why do you override EBZR_OFFLINE here? |
139 |
|
140 |
The whole else clause is dropped in a followup commit. |
141 |
|
142 |
Ulrich |