Gentoo Archives: gentoo-dev

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-dev@l.g.o
Cc: arthurzam@g.o, "Ulrich Müller" <ulm@g.o>
Subject: [gentoo-dev] [PATCH v2 3/6] bzr.eclass: Names of internal functions, eclassdoc, messages
Date: Sat, 25 Sep 2021 12:29:52
Message-Id: 20210925122834.18686-3-ulm@gentoo.org
In Reply to: [gentoo-dev] [PATCH v2 1/6] bzr.eclass: Reinstate eclass by "Ulrich Müller"
1 This should not make any functional difference.
2
3 Signed-off-by: Ulrich Müller <ulm@g.o>
4 ---
5 eclass/bzr.eclass | 47 +++++++++++++++++++++++++----------------------
6 1 file changed, 25 insertions(+), 22 deletions(-)
7
8 diff --git a/eclass/bzr.eclass b/eclass/bzr.eclass
9 index e76af5d41d57..d5ac999aeb8c 100644
10 --- a/eclass/bzr.eclass
11 +++ b/eclass/bzr.eclass
12 @@ -19,11 +19,9 @@
13 # Note: Just set EBZR_REPO_URI to the URI of the branch and src_unpack()
14 # of this eclass will export the branch to ${WORKDIR}/${P}.
15
16 -EBZR="bzr.eclass"
17 -
18 case ${EAPI} in
19 7|8) ;;
20 - *) die "${EBZR}: EAPI ${EAPI:-0} is not supported" ;;
21 + *) die "${ECLASS}: EAPI ${EAPI:-0} is not supported" ;;
22 esac
23
24 PROPERTIES+=" live"
25 @@ -33,6 +31,7 @@ BDEPEND="dev-vcs/breezy"
26 EXPORT_FUNCTIONS src_unpack
27
28 # @ECLASS-VARIABLE: EBZR_STORE_DIR
29 +# @USER_VARIABLE
30 # @DESCRIPTION:
31 # The directory to store all fetched Bazaar live sources.
32 : ${EBZR_STORE_DIR:=${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/bzr-src}
33 @@ -125,6 +124,7 @@ EXPORT_FUNCTIONS src_unpack
34 # Revision to fetch, defaults to the latest (see brz help revisionspec).
35
36 # @ECLASS-VARIABLE: EBZR_OFFLINE
37 +# @USER_VARIABLE
38 # @DESCRIPTION:
39 # Set this variable to a non-empty value to disable automatic updating
40 # of a bzr source tree. This is intended to be set outside the ebuild
41 @@ -132,6 +132,7 @@ EXPORT_FUNCTIONS src_unpack
42 : ${EBZR_OFFLINE=${EVCS_OFFLINE}}
43
44 # @ECLASS-VARIABLE: EVCS_UMASK
45 +# @USER_VARIABLE
46 # @DEFAULT_UNSET
47 # @DESCRIPTION:
48 # Set this variable to a custom umask. This is intended to be set by
49 @@ -148,12 +149,13 @@ EXPORT_FUNCTIONS src_unpack
50 # If this variable is set to a non-empty value, EBZR_CHECKOUT_CMD will
51 # be used instead of EBZR_EXPORT_CMD to copy the sources to WORKDIR.
52
53 -# @FUNCTION: bzr_initial_fetch
54 +# @FUNCTION: _bzr_initial_fetch
55 # @USAGE: <repository URI> <branch directory>
56 +# @INTERNAL
57 # @DESCRIPTION:
58 # Internal function, retrieves the source code from a repository for the
59 # first time, using ${EBZR_FETCH_CMD}.
60 -bzr_initial_fetch() {
61 +_bzr_initial_fetch() {
62 local repo_uri=$1 branch_dir=$2
63
64 if [[ -n "${EBZR_OFFLINE}" ]]; then
65 @@ -165,15 +167,16 @@ bzr_initial_fetch() {
66 einfo " repository: ${repo_uri} => ${branch_dir}"
67
68 ${EBZR_FETCH_CMD} ${EBZR_OPTIONS} "${repo_uri}" "${branch_dir}" \
69 - || die "${EBZR}: can't branch from ${repo_uri}"
70 + || die "${ECLASS}: can't branch from ${repo_uri}"
71 }
72
73 -# @FUNCTION: bzr_update
74 +# @FUNCTION: _bzr_update
75 # @USAGE: <repository URI> <branch directory>
76 +# @INTERNAL
77 # @DESCRIPTION:
78 # Internal function, updates the source code from a repository, using
79 # ${EBZR_UPDATE_CMD}.
80 -bzr_update() {
81 +_bzr_update() {
82 local repo_uri=$1 branch_dir=$2
83
84 if [[ -n "${EBZR_OFFLINE}" ]]; then
85 @@ -185,10 +188,10 @@ bzr_update() {
86 einfo " repository: ${repo_uri}"
87
88 pushd "${branch_dir}" > /dev/null \
89 - || die "${EBZR}: can't chdir to ${branch_dir}"
90 + || die "${ECLASS}: can't chdir to ${branch_dir}"
91 ${EBZR_UPDATE_CMD} ${EBZR_OPTIONS} "${repo_uri}" \
92 - || die "${EBZR}: can't pull from ${repo_uri}"
93 - popd > /dev/null || die "${EBZR}: popd failed"
94 + || die "${ECLASS}: can't pull from ${repo_uri}"
95 + popd > /dev/null || die "${ECLASS}: popd failed"
96 fi
97 }
98
99 @@ -201,17 +204,17 @@ bzr_fetch() {
100 local repo_dir branch_dir
101 local save_sandbox_write=${SANDBOX_WRITE} save_umask
102
103 - [[ -n ${EBZR_REPO_URI} ]] || die "${EBZR}: EBZR_REPO_URI is empty"
104 + [[ -n ${EBZR_REPO_URI} ]] || die "${ECLASS}: EBZR_REPO_URI is empty"
105
106 if [[ ! -d ${EBZR_STORE_DIR} ]] ; then
107 addwrite /
108 mkdir -p "${EBZR_STORE_DIR}" \
109 - || die "${EBZR}: can't mkdir ${EBZR_STORE_DIR}"
110 + || die "${ECLASS}: can't mkdir ${EBZR_STORE_DIR}"
111 SANDBOX_WRITE=${save_sandbox_write}
112 fi
113
114 pushd "${EBZR_STORE_DIR}" > /dev/null \
115 - || die "${EBZR}: can't chdir to ${EBZR_STORE_DIR}"
116 + || die "${ECLASS}: can't chdir to ${EBZR_STORE_DIR}"
117
118 repo_dir=${EBZR_STORE_DIR}/${EBZR_PROJECT}
119 branch_dir=${repo_dir}${EBZR_BRANCH:+/${EBZR_BRANCH}}
120 @@ -226,16 +229,16 @@ bzr_fetch() {
121 if [[ ${repo_dir} != "${branch_dir}" && ! -d ${repo_dir}/.bzr ]]; then
122 einfo "creating shared bzr repository: ${repo_dir}"
123 ${EBZR_INIT_REPO_CMD} "${repo_dir}" \
124 - || die "${EBZR}: can't create shared repository"
125 + || die "${ECLASS}: can't create shared repository"
126 fi
127
128 if [[ -z ${EBZR_INITIAL_URI} ]]; then
129 - bzr_initial_fetch "${EBZR_REPO_URI}" "${branch_dir}"
130 + _bzr_initial_fetch "${EBZR_REPO_URI}" "${branch_dir}"
131 else
132 # Workaround for faster initial download. This clones the
133 # branch from a fast server (which may be out of date), and
134 # subsequently pulls from the slow original repository.
135 - bzr_initial_fetch "${EBZR_INITIAL_URI}" "${branch_dir}"
136 + _bzr_initial_fetch "${EBZR_INITIAL_URI}" "${branch_dir}"
137 if [[ ${EBZR_REPO_URI} != "${EBZR_INITIAL_URI}" ]]; then
138 EBZR_UPDATE_CMD="${EBZR_UPDATE_CMD} --remember --overwrite" \
139 EBZR_OFFLINE="" \
140 @@ -243,7 +246,7 @@ bzr_fetch() {
141 fi
142 fi
143 else
144 - bzr_update "${EBZR_REPO_URI}" "${branch_dir}"
145 + _bzr_update "${EBZR_REPO_URI}" "${branch_dir}"
146 fi
147
148 # Restore sandbox environment and umask
149 @@ -252,7 +255,7 @@ bzr_fetch() {
150 umask "${save_umask}" || die
151 fi
152
153 - cd "${branch_dir}" || die "${EBZR}: can't chdir to ${branch_dir}"
154 + cd "${branch_dir}" || die "${ECLASS}: can't chdir to ${branch_dir}"
155
156 # Save revision number in environment. #311101
157 export EBZR_REVNO=$(${EBZR_REVNO_CMD})
158 @@ -260,16 +263,16 @@ bzr_fetch() {
159 if [[ -n ${EBZR_WORKDIR_CHECKOUT} ]]; then
160 einfo "checking out ..."
161 ${EBZR_CHECKOUT_CMD} ${EBZR_REVISION:+-r ${EBZR_REVISION}} \
162 - . "${EBZR_UNPACK_DIR}" || die "${EBZR}: checkout failed"
163 + . "${EBZR_UNPACK_DIR}" || die "${ECLASS}: checkout failed"
164 else
165 einfo "exporting ..."
166 ${EBZR_EXPORT_CMD} ${EBZR_REVISION:+-r ${EBZR_REVISION}} \
167 - "${EBZR_UNPACK_DIR}" . || die "${EBZR}: export failed"
168 + "${EBZR_UNPACK_DIR}" . || die "${ECLASS}: export failed"
169 fi
170 einfo \
171 "revision ${EBZR_REVISION:-${EBZR_REVNO}} is now in ${EBZR_UNPACK_DIR}"
172
173 - popd > /dev/null || die "${EBZR}: popd failed"
174 + popd > /dev/null || die "${ECLASS}: popd failed"
175 }
176
177 # @FUNCTION: bzr_src_unpack
178 --
179 2.33.0