Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH] bzr.eclass: Drop bzr_bootstrap and bzr_src_prepare.
Date: Wed, 07 Feb 2018 07:34:32
Message-Id: 1517988858.1228.1.camel@gentoo.org
In Reply to: [gentoo-dev] [PATCH] bzr.eclass: Drop bzr_bootstrap and bzr_src_prepare. by "Ulrich Müller"
1 W dniu śro, 07.02.2018 o godzinie 00∶24 +0100, użytkownik Ulrich Müller
2 napisał:
3 > No ebuild in the Gentoo repository uses the bzr_bootstrap
4 > functionality. Therefore drop the function along with bzr_src_prepare
5 > (which would not have worked in EAPI 6 anyway, due to missing call to
6 > eapply_user). After this change, inheriting eutils is not needed any
7 > more.
8 >
9 > Drop support for EAPIs 0 and 1 for further simplification.
10 > ---
11 >
12 > This is to be applied on top of the patch posted earlier today.
13 >
14 > We could go for bzr-r1.eclass instead. However, the functionality
15 > associated with EBZR_PATCHES and EBZR_BOOTSTRAP is not used in the
16 > tree, and overall the eclass is little used. Therefore I think that
17 > applying these changes in-place is acceptable here.
18 >
19 > eclass/bzr.eclass | 99 ++++++++-----------------------------------------------
20 > 1 file changed, 13 insertions(+), 86 deletions(-)
21 >
22 > diff --git a/eclass/bzr.eclass b/eclass/bzr.eclass
23 > index 9b3e0b6cf4dc..710b64db28c0 100644
24 > --- a/eclass/bzr.eclass
25 > +++ b/eclass/bzr.eclass
26 > @@ -18,21 +18,20 @@
27 > # Note: Just set EBZR_REPO_URI to the URI of the branch and src_unpack()
28 > # of this eclass will export the branch to ${WORKDIR}/${P}.
29 >
30 > -inherit eutils
31 > -
32 > EBZR="bzr.eclass"
33 >
34 > -case "${EAPI:-0}" in
35 > - 0|1) EXPORT_FUNCTIONS src_unpack ;;
36 > - *) EXPORT_FUNCTIONS src_unpack src_prepare ;;
37 > +case ${EAPI:-0} in
38 > + 2|3|4|5|6) ;;
39 > + *) die "${EBZR}: EAPI ${EAPI:-0} is not supported" ;;
40 > esac
41 >
42 > -DEPEND=">=dev-vcs/bzr-2.6.0"
43 > -case "${EAPI:-0}" in
44 > - 0|1) ;;
45 > - *) [[ ${EBZR_REPO_URI%%:*} = sftp ]] \
46 > - && DEPEND=">=dev-vcs/bzr-2.6.0[sftp]" ;;
47 > -esac
48 > +EXPORT_FUNCTIONS src_unpack
49 > +
50 > +if [[ ${EBZR_REPO_URI%%:*} = sftp ]]; then
51 > + DEPEND=">=dev-vcs/bzr-2.6.0[sftp]"
52 > +else
53 > + DEPEND=">=dev-vcs/bzr-2.6.0"
54 > +fi
55 >
56 > # @ECLASS-VARIABLE: EBZR_STORE_DIR
57 > # @DESCRIPTION:
58 > @@ -85,9 +84,8 @@ esac
59 > # @DESCRIPTION:
60 > # The repository URI for the source package.
61 > #
62 > -# Note: If the ebuild uses an sftp:// URI, then in EAPI 0 or 1 it must
63 > -# make sure that dev-vcs/bzr was built with USE="sftp". In EAPI 2 or
64 > -# later, the eclass will depend on dev-vcs/bzr[sftp].
65 > +# Note: If the ebuild uses an sftp:// URI, then the eclass will depend
66 > +# on dev-vcs/bzr[sftp].
67 >
68 > # @ECLASS-VARIABLE: EBZR_INITIAL_URI
69 > # @DEFAULT_UNSET
70 > @@ -100,21 +98,6 @@ esac
71 > #
72 > # Normally, this variable needs not be set.
73 >
74 > -# @ECLASS-VARIABLE: EBZR_BOOTSTRAP
75 > -# @DEFAULT_UNSET
76 > -# @DESCRIPTION:
77 > -# Bootstrap script or command like autogen.sh or etc.
78 > -
79 > -# @ECLASS-VARIABLE: EBZR_PATCHES
80 > -# @DEFAULT_UNSET
81 > -# @DESCRIPTION:
82 > -# bzr.eclass can apply patches in bzr_bootstrap(). You can use regular
83 > -# expressions in this variable like *.diff or *.patch and the like.
84 > -# Note: These patches will be applied before EBZR_BOOTSTRAP is processed.
85 > -#
86 > -# Patches are searched both in ${PWD} and ${FILESDIR}. If not found in
87 > -# either location, the installation dies.
88 > -
89 > # @ECLASS-VARIABLE: EBZR_PROJECT
90 > # @DESCRIPTION:
91 > # The project name of your ebuild. Normally, the branch will be stored
92 > @@ -276,65 +259,9 @@ bzr_fetch() {
93 > popd > /dev/null
94 > }
95 >
96 > -# @FUNCTION: bzr_bootstrap
97 > -# @DESCRIPTION:
98 > -# Apply patches in ${EBZR_PATCHES} and run ${EBZR_BOOTSTRAP} if specified.
99 > -bzr_bootstrap() {
100 > - local patch lpatch
101 > -
102 > - pushd "${S}" > /dev/null || die "${EBZR}: can't chdir to ${S}"
103 > -
104 > - if [[ -n ${EBZR_PATCHES} ]] ; then
105 > - einfo "apply patches -->"
106 > -
107 > - for patch in ${EBZR_PATCHES} ; do
108 > - if [[ -f ${patch} ]] ; then
109 > - epatch "${patch}"
110 > - else
111 > - # This loop takes care of wildcarded patches given via
112 > - # EBZR_PATCHES in an ebuild
113 > - for lpatch in "${FILESDIR}"/${patch} ; do
114 > - if [[ -f ${lpatch} ]] ; then
115 > - epatch "${lpatch}"
116 > - else
117 > - die "${EBZR}: ${patch} is not found"
118 > - fi
119 > - done
120 > - fi
121 > - done
122 > - fi
123 > -
124 > - if [[ -n ${EBZR_BOOTSTRAP} ]] ; then
125 > - einfo "begin bootstrap -->"
126 > -
127 > - if [[ -f ${EBZR_BOOTSTRAP} ]] && [[ -x ${EBZR_BOOTSTRAP} ]] ; then
128 > - einfo " bootstrap with a file: ${EBZR_BOOTSTRAP}"
129 > - "./${EBZR_BOOTSTRAP}" \
130 > - || die "${EBZR}: can't execute EBZR_BOOTSTRAP"
131 > - else
132 > - einfo " bootstrap with commands: ${EBZR_BOOTSTRAP}"
133 > - "${EBZR_BOOTSTRAP}" \
134 > - || die "${EBZR}: can't eval EBZR_BOOTSTRAP"
135 > - fi
136 > - fi
137 > -
138 > - popd > /dev/null
139 > -}
140 > -
141 > # @FUNCTION: bzr_src_unpack
142 > # @DESCRIPTION:
143 > -# Default src_unpack(), calls bzr_fetch. For EAPIs 0 and 1, also calls
144 > -# bzr_src_prepare.
145 > +# Default src_unpack(), calls bzr_fetch.
146 > bzr_src_unpack() {
147 > bzr_fetch
148 > - case "${EAPI:-0}" in
149 > - 0|1) bzr_src_prepare ;;
150 > - esac
151 > -}
152 > -
153 > -# @FUNCTION: bzr_src_prepare
154 > -# @DESCRIPTION:
155 > -# Default src_prepare(), calls bzr_bootstrap.
156 > -bzr_src_prepare() {
157 > - bzr_bootstrap
158 > }
159
160 Hmm, unless I'm mistaken, this can cause another definition
161 of src_prepare to start applying to ebuilds. You can submit a PR with
162 this change to get md5-cache with exported phase data suitable for
163 comparison.
164
165 Or... given the popularity of the eclass, you can check by hand ;-P.
166
167 --
168 Best regards,
169 Michał Górny

Replies