Gentoo Archives: gentoo-dev

From: Anna Vyalkova <cyber+gentoo@×××××.in>
To: gentoo-dev@l.g.o
Cc: ruby@g.o
Subject: [gentoo-dev] [PATCH 1/3] ruby-ng.eclass: add debug-print-function calls
Date: Mon, 14 Feb 2022 17:38:35
Message-Id: 20220214173751.4023-2-cyber+gentoo@sysrq.in
In Reply to: [gentoo-dev] Add debug-print-function calls to Ruby eclasses by Anna Vyalkova
1 Signed-off-by: Anna Vyalkova <cyber+gentoo@×××××.in>
2 ---
3 eclass/ruby-ng.eclass | 52 ++++++++++++++++++++++++++++++++++++++++++-
4 1 file changed, 51 insertions(+), 1 deletion(-)
5
6 diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
7 index 90da695a04c2..8e7c7f76290b 100644
8 --- a/eclass/ruby-ng.eclass
9 +++ b/eclass/ruby-ng.eclass
10 @@ -1,4 +1,4 @@
11 -# Copyright 1999-2021 Gentoo Authors
12 +# Copyright 1999-2022 Gentoo Authors
13 # Distributed under the terms of the GNU General Public License v2
14
15 # @ECLASS: ruby-ng.eclass
16 @@ -102,6 +102,8 @@ esac
17 # Set `comparator' and `version' to include a comparator (=, >=, etc.) and a
18 # version string to the returned string
19 ruby_implementation_depend() {
20 + debug-print-function ${FUNCNAME} "${@}"
21 +
22 _ruby_implementation_depend $1
23 }
24
25 @@ -132,6 +134,8 @@ _ruby_get_all_impls() {
26 # ruby_add_bdepend(), but may also be useful in an ebuild to specify
27 # more complex dependencies.
28 ruby_samelib() {
29 + debug-print-function ${FUNCNAME} "${@}"
30 +
31 local res=
32 for _ruby_implementation in $(_ruby_get_all_impls); do
33 has -${_ruby_implementation} $@ || \
34 @@ -164,6 +168,8 @@ _ruby_atoms_samelib_generic() {
35 # Not all implementations have the same command basename as the
36 # target; This function translate between the two
37 ruby_implementation_command() {
38 + debug-print-function ${FUNCNAME} "${@}"
39 +
40 local _ruby_name=$1
41
42 # Add all USE_RUBY values where the flag name diverts from the binary here
43 @@ -203,6 +209,8 @@ _ruby_wrap_conditions() {
44 # Note: runtime dependencies are also added as build-time test
45 # dependencies.
46 ruby_add_rdepend() {
47 + debug-print-function ${FUNCNAME} "${@}"
48 +
49 case $# in
50 1) ;;
51 2)
52 @@ -248,6 +256,8 @@ ruby_add_rdepend() {
53 # dependencies instead of setting DEPEND or BDEPEND yourself. The list
54 # of atoms uses the same syntax as normal dependencies.
55 ruby_add_bdepend() {
56 + debug-print-function ${FUNCNAME} "${@}"
57 +
58 case $# in
59 1) ;;
60 2)
61 @@ -282,6 +292,8 @@ ruby_add_bdepend() {
62 # Adds the specified dependencies to DEPEND in EAPI7, similar to
63 # ruby_add_bdepend.
64 ruby_add_depend() {
65 + debug-print-function ${FUNCNAME} "${@}"
66 +
67 case ${EAPI} in
68 5|6) die "only available in EAPI 7 and newer" ;;
69 *) ;;
70 @@ -301,6 +313,8 @@ ruby_add_depend() {
71 # @DESCRIPTION:
72 # Gets an array of ruby use targets enabled by the user
73 ruby_get_use_implementations() {
74 + debug-print-function ${FUNCNAME} "${@}"
75 +
76 local i implementation
77 for implementation in $(_ruby_get_all_impls); do
78 use ruby_targets_${implementation} && i+=" ${implementation}"
79 @@ -312,6 +326,8 @@ ruby_get_use_implementations() {
80 # @DESCRIPTION:
81 # Gets an array of ruby use targets that the ebuild sets
82 ruby_get_use_targets() {
83 + debug-print-function ${FUNCNAME} "${@}"
84 +
85 local t implementation
86 for implementation in $(_ruby_get_all_impls); do
87 t+=" ruby_targets_${implementation}"
88 @@ -336,6 +352,8 @@ ruby_get_use_targets() {
89 # DEPEND="ruby? ( $(ruby_implementations_depend) )"
90 # RDEPEND="${DEPEND}"
91 ruby_implementations_depend() {
92 + debug-print-function ${FUNCNAME} "${@}"
93 +
94 local depend
95 for _ruby_implementation in $(_ruby_get_all_impls); do
96 depend="${depend}${depend+ }ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )"
97 @@ -430,6 +448,8 @@ _ruby_each_implementation() {
98 # @DESCRIPTION:
99 # Check whether at least one ruby target implementation is present.
100 ruby-ng_pkg_setup() {
101 + debug-print-function ${FUNCNAME} "${@}"
102 +
103 # This only checks that at least one implementation is present
104 # before doing anything; by leaving the parameters empty we know
105 # it's a special case.
106 @@ -440,6 +460,8 @@ ruby-ng_pkg_setup() {
107 # @DESCRIPTION:
108 # Unpack the source archive.
109 ruby-ng_src_unpack() {
110 + debug-print-function ${FUNCNAME} "${@}"
111 +
112 mkdir "${WORKDIR}"/all
113 pushd "${WORKDIR}"/all &>/dev/null || die
114
115 @@ -496,6 +518,8 @@ _ruby_source_copy() {
116 # Apply patches and prepare versions for each ruby target
117 # implementation. Also carry out common clean up tasks.
118 ruby-ng_src_prepare() {
119 + debug-print-function ${FUNCNAME} "${@}"
120 +
121 # Way too many Ruby packages are prepared on OSX without removing
122 # the extra data forks, we do it here to avoid repeating it for
123 # almost every other ebuild.
124 @@ -524,6 +548,8 @@ ruby-ng_src_prepare() {
125 # @DESCRIPTION:
126 # Configure the package.
127 ruby-ng_src_configure() {
128 + debug-print-function ${FUNCNAME} "${@}"
129 +
130 if type each_ruby_configure &>/dev/null; then
131 _ruby_each_implementation each_ruby_configure
132 fi
133 @@ -536,6 +562,8 @@ ruby-ng_src_configure() {
134 # @DESCRIPTION:
135 # Compile the package.
136 ruby-ng_src_compile() {
137 + debug-print-function ${FUNCNAME} "${@}"
138 +
139 if type each_ruby_compile &>/dev/null; then
140 _ruby_each_implementation each_ruby_compile
141 fi
142 @@ -548,6 +576,8 @@ ruby-ng_src_compile() {
143 # @DESCRIPTION:
144 # Run tests for the package.
145 ruby-ng_src_test() {
146 + debug-print-function ${FUNCNAME} "${@}"
147 +
148 if type each_ruby_test &>/dev/null; then
149 _ruby_each_implementation each_ruby_test
150 fi
151 @@ -589,6 +619,8 @@ _each_ruby_check_install() {
152 # @DESCRIPTION:
153 # Install the package for each ruby target implementation.
154 ruby-ng_src_install() {
155 + debug-print-function ${FUNCNAME} "${@}"
156 +
157 if type each_ruby_install &>/dev/null; then
158 _ruby_each_implementation each_ruby_install
159 fi
160 @@ -604,6 +636,8 @@ ruby-ng_src_install() {
161 # @USAGE: rbconfig item
162 # @RETURN: Returns the value of the given rbconfig item of the Ruby interpreter in ${RUBY}.
163 ruby_rbconfig_value() {
164 + debug-print-function ${FUNCNAME} "${@}"
165 +
166 echo $(${RUBY} --disable=did_you_mean -rrbconfig -e "puts RbConfig::CONFIG['$1']" || die "Could not read ruby configuration for '${1}'")
167 }
168
169 @@ -612,6 +646,8 @@ ruby_rbconfig_value() {
170 # @DESCRIPTION:
171 # Installs the specified file(s) into the sitelibdir of the Ruby interpreter in ${RUBY}.
172 doruby() {
173 + debug-print-function ${FUNCNAME} "${@}"
174 +
175 [[ -z ${RUBY} ]] && die "\$RUBY is not set"
176 ( # don't want to pollute calling env
177 sitelibdir=$(ruby_rbconfig_value 'sitelibdir')
178 @@ -624,12 +660,16 @@ doruby() {
179 # @FUNCTION: ruby_get_libruby
180 # @RETURN: The location of libruby*.so belonging to the Ruby interpreter in ${RUBY}.
181 ruby_get_libruby() {
182 + debug-print-function ${FUNCNAME} "${@}"
183 +
184 ${RUBY} -rrbconfig -e 'puts File.join(RbConfig::CONFIG["libdir"], RbConfig::CONFIG["LIBRUBY"])'
185 }
186
187 # @FUNCTION: ruby_get_hdrdir
188 # @RETURN: The location of the header files belonging to the Ruby interpreter in ${RUBY}.
189 ruby_get_hdrdir() {
190 + debug-print-function ${FUNCNAME} "${@}"
191 +
192 local rubyhdrdir=$(ruby_rbconfig_value 'rubyhdrdir')
193
194 if [[ "${rubyhdrdir}" = "nil" ]] ; then
195 @@ -642,6 +682,8 @@ ruby_get_hdrdir() {
196 # @FUNCTION: ruby_get_version
197 # @RETURN: The version of the Ruby interpreter in ${RUBY}, or what 'ruby' points to.
198 ruby_get_version() {
199 + debug-print-function ${FUNCNAME} "${@}"
200 +
201 local ruby=${RUBY:-$(type -p ruby 2>/dev/null)}
202
203 echo $(${ruby} -e 'puts RUBY_VERSION')
204 @@ -650,6 +692,8 @@ ruby_get_version() {
205 # @FUNCTION: ruby_get_implementation
206 # @RETURN: The implementation of the Ruby interpreter in ${RUBY}, or what 'ruby' points to.
207 ruby_get_implementation() {
208 + debug-print-function ${FUNCNAME} "${@}"
209 +
210 local ruby=${RUBY:-$(type -p ruby 2>/dev/null)}
211
212 case $(${ruby} --version) in
213 @@ -671,6 +715,8 @@ ruby_get_implementation() {
214 # rspec version that must be executed. It defaults to 2 for historical
215 # compatibility.
216 ruby-ng_rspec() {
217 + debug-print-function ${FUNCNAME} "${@}"
218 +
219 local version=${RSPEC_VERSION-2}
220 local files="$@"
221
222 @@ -711,6 +757,8 @@ ruby-ng_rspec() {
223 # This is simply a wrapper around the cucumber command (executed by $RUBY})
224 # which also respects TEST_VERBOSE and NOCOLOR environment variables.
225 ruby-ng_cucumber() {
226 + debug-print-function ${FUNCNAME} "${@}"
227 +
228 if [[ "${DEPEND}${BDEPEND}" != *"dev-util/cucumber"* ]]; then
229 ewarn "Missing test dependency dev-util/cucumber"
230 fi
231 @@ -745,6 +793,8 @@ ruby-ng_cucumber() {
232 # their script and we installed a broken wrapper for a while.
233 # This also respects TEST_VERBOSE and NOCOLOR environment variables.
234 ruby-ng_testrb-2() {
235 + debug-print-function ${FUNCNAME} "${@}"
236 +
237 if [[ "${DEPEND}${BDEPEND}" != *"dev-ruby/test-unit"* ]]; then
238 ewarn "Missing test dependency dev-ruby/test-unit"
239 fi
240 --
241 2.35.1