Gentoo Archives: gentoo-dev

From: Anna Vyalkova <cyber+gentoo@×××××.in>
To: gentoo-dev@l.g.o
Cc: ruby@g.o
Subject: [gentoo-dev] [PATCH 3/3] ruby-fakegem.eclass: add debug-print-function calls
Date: Mon, 14 Feb 2022 17:39:20
Message-Id: 20220214173751.4023-4-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-fakegem.eclass | 46 +++++++++++++++++++++++++++++++++++++-
4 1 file changed, 45 insertions(+), 1 deletion(-)
5
6 diff --git a/eclass/ruby-fakegem.eclass b/eclass/ruby-fakegem.eclass
7 index cafb5dc04788..8ec772f0261e 100644
8 --- a/eclass/ruby-fakegem.eclass
9 +++ b/eclass/ruby-fakegem.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-fakegem.eclass
16 @@ -218,6 +218,8 @@ esac
17 # This function returns the gems data directory for the ruby
18 # implementation in question.
19 ruby_fakegem_gemsdir() {
20 + debug-print-function ${FUNCNAME} "${@}"
21 +
22 local _gemsitedir=$(ruby_rbconfig_value 'sitelibdir')
23 _gemsitedir=${_gemsitedir//site_ruby/gems}
24 _gemsitedir=${_gemsitedir#${EPREFIX}}
25 @@ -235,6 +237,8 @@ ruby_fakegem_gemsdir() {
26 # @DESCRIPTION:
27 # Installs the specified file(s) into the gems directory.
28 ruby_fakegem_doins() {
29 + debug-print-function ${FUNCNAME} "${@}"
30 +
31 (
32 insinto $(ruby_fakegem_gemsdir)/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}
33 doins "$@"
34 @@ -246,6 +250,8 @@ ruby_fakegem_doins() {
35 # @DESCRIPTION:
36 # Installs the specified file into the gems directory using the provided filename.
37 ruby_fakegem_newins() {
38 + debug-print-function ${FUNCNAME} "${@}"
39 +
40 (
41 # Since newins does not accept full paths but just basenames
42 # for the target file, we want to extend it here.
43 @@ -265,6 +271,8 @@ ruby_fakegem_newins() {
44 # by the RUBY_FAKEGEM_GEMSPEC variable, or generate one using
45 # ruby_fakegem_genspec.
46 ruby_fakegem_install_gemspec() {
47 + debug-print-function ${FUNCNAME} "${@}"
48 +
49 local gemspec="${T}"/${RUBY_FAKEGEM_NAME}-${_ruby_implementation}
50
51 (
52 @@ -292,6 +300,8 @@ ruby_fakegem_install_gemspec() {
53 # RUBY_FAKEGEM_GEMSPEC. This file is eval'ed to produce a final specification
54 # in a way similar to packaging the gemspec file.
55 ruby_fakegem_gemspec_gemspec() {
56 + debug-print-function ${FUNCNAME} "${@}"
57 +
58 ${RUBY} --disable=did_you_mean -e "puts eval(File::open('$1').read).to_ruby" > $2
59 }
60
61 @@ -302,6 +312,8 @@ ruby_fakegem_gemspec_gemspec() {
62 # the metadata distributed by the gem itself. This is similar to how
63 # rubygems creates an installation from a .gem file.
64 ruby_fakegem_metadata_gemspec() {
65 + debug-print-function ${FUNCNAME} "${@}"
66 +
67 ${RUBY} --disable=did_you_mean -r yaml -e "puts Gem::Specification.from_yaml(File::open('$1', :encoding => 'UTF-8').read).to_ruby" > $2
68 }
69
70 @@ -319,6 +331,8 @@ ruby_fakegem_metadata_gemspec() {
71 # See RUBY_FAKEGEM_NAME and RUBY_FAKEGEM_VERSION for setting name and version.
72 # See RUBY_FAKEGEM_REQUIRE_PATHS for setting extra require paths.
73 ruby_fakegem_genspec() {
74 + debug-print-function ${FUNCNAME} "${@}"
75 +
76 case ${EAPI} in
77 5|6) ;;
78 *)
79 @@ -358,6 +372,8 @@ EOF
80 # to inject additional ruby code into the wrapper. This may be useful to
81 # e.g. force a specific version using the gem command.
82 ruby_fakegem_binwrapper() {
83 + debug-print-function ${FUNCNAME} "${@}"
84 +
85 (
86 local gembinary=$1
87 local newbinary=${2:-/usr/bin/$gembinary}
88 @@ -409,6 +425,8 @@ EOF
89 # @DESCRIPTION:
90 # Configure extensions defined in RUBY_FAKEGEM_EXTENSIONS, if any.
91 each_fakegem_configure() {
92 + debug-print-function ${FUNCNAME} "${@}"
93 +
94 tc-export PKG_CONFIG
95 for extension in "${RUBY_FAKEGEM_EXTENSIONS[@]}" ; do
96 CC=$(tc-getCC) ${RUBY} --disable=did_you_mean -C ${extension%/*} ${extension##*/} --with-cflags="${CFLAGS}" --with-ldflags="${LDFLAGS}" ${RUBY_FAKEGM_EXTENSION_OPTIONS} || die
97 @@ -419,6 +437,8 @@ each_fakegem_configure() {
98 # @DESCRIPTION:
99 # Run each_fakegem_configure for each ruby target
100 each_ruby_configure() {
101 + debug-print-function ${FUNCNAME} "${@}"
102 +
103 each_fakegem_configure
104 }
105
106 @@ -427,6 +447,8 @@ each_ruby_configure() {
107 # Build documentation for the package if indicated by the doc USE flag
108 # and if there is a documetation task defined.
109 all_fakegem_compile() {
110 + debug-print-function ${FUNCNAME} "${@}"
111 +
112 if [[ -n ${RUBY_FAKEGEM_DOCDIR} ]] && use doc; then
113 case ${RUBY_FAKEGEM_RECIPE_DOC} in
114 rake)
115 @@ -447,6 +469,8 @@ all_fakegem_compile() {
116 # @DESCRIPTION:
117 # Compile extensions defined in RUBY_FAKEGEM_EXTENSIONS, if any.
118 each_fakegem_compile() {
119 + debug-print-function ${FUNCNAME} "${@}"
120 +
121 for extension in "${RUBY_FAKEGEM_EXTENSIONS[@]}" ; do
122 emake V=1 -C ${extension%/*}
123 mkdir -p "${RUBY_FAKEGEM_EXTENSION_LIBDIR%/}"
124 @@ -458,6 +482,8 @@ each_fakegem_compile() {
125 # @DESCRIPTION:
126 # Run each_fakegem_compile for each ruby target
127 each_ruby_compile() {
128 + debug-print-function ${FUNCNAME} "${@}"
129 +
130 each_fakegem_compile
131 }
132
133 @@ -465,6 +491,8 @@ each_ruby_compile() {
134 # @DESCRIPTION:
135 # Unpack the source archive, including support for unpacking gems.
136 all_ruby_unpack() {
137 + debug-print-function ${FUNCNAME} "${@}"
138 +
139 # Special support for extracting .gem files; the file need to be
140 # extracted twice and the mtime from the archive _has_ to be
141 # ignored (it's always set to epoch 0).
142 @@ -511,6 +539,8 @@ all_ruby_unpack() {
143 # @DESCRIPTION:
144 # Compile the package.
145 all_ruby_compile() {
146 + debug-print-function ${FUNCNAME} "${@}"
147 +
148 all_fakegem_compile
149 }
150
151 @@ -518,6 +548,8 @@ all_ruby_compile() {
152 # @DESCRIPTION:
153 # Run tests for the package for each ruby target if the test task is defined.
154 each_fakegem_test() {
155 + debug-print-function ${FUNCNAME} "${@}"
156 +
157 case ${RUBY_FAKEGEM_RECIPE_TEST} in
158 rake)
159 ${RUBY} --disable=did_you_mean -S rake ${RUBY_FAKEGEM_TASK_TEST} || die "tests failed"
160 @@ -552,6 +584,8 @@ fi
161 # installed. This is normally done as part of the extension
162 # installation, but may be useful when we handle extensions manually.
163 ruby_fakegem_extensions_installed() {
164 + debug-print-function ${FUNCNAME} "${@}"
165 +
166 mkdir -p "${ED}$(ruby_fakegem_extensionsdir)" || die
167 touch "${ED}$(ruby_fakegem_extensionsdir)/gem.build_complete" || die
168 }
169 @@ -561,6 +595,8 @@ ruby_fakegem_extensions_installed() {
170 # The directory where rubygems expects extensions for this package
171 # version.
172 ruby_fakegem_extensionsdir() {
173 + debug-print-function ${FUNCNAME} "${@}"
174 +
175 # Using formula from ruby src/lib/rubygems/basic_specification.
176 extensions_dir=$(${RUBY} --disable=did_you_mean -e "puts File.join('extensions', Gem::Platform.local.to_s, Gem.extension_api_version)")
177
178 @@ -571,6 +607,8 @@ ruby_fakegem_extensionsdir() {
179 # @DESCRIPTION:
180 # Install the package for each ruby target.
181 each_fakegem_install() {
182 + debug-print-function ${FUNCNAME} "${@}"
183 +
184 ruby_fakegem_install_gemspec
185
186 local _gemlibdirs="${RUBY_FAKEGEM_EXTRAINSTALL}"
187 @@ -596,6 +634,8 @@ each_fakegem_install() {
188 # @DESCRIPTION:
189 # Install the package for each target.
190 each_ruby_install() {
191 + debug-print-function ${FUNCNAME} "${@}"
192 +
193 each_fakegem_install
194 }
195
196 @@ -603,6 +643,8 @@ each_ruby_install() {
197 # @DESCRIPTION:
198 # Install files common to all ruby targets.
199 all_fakegem_install() {
200 + debug-print-function ${FUNCNAME} "${@}"
201 +
202 if [[ -n ${RUBY_FAKEGEM_DOCDIR} ]] && use doc; then
203 for dir in ${RUBY_FAKEGEM_DOCDIR}; do
204 [[ -d ${dir} ]] || continue
205 @@ -636,5 +678,7 @@ all_fakegem_install() {
206 # @DESCRIPTION:
207 # Install files common to all ruby targets.
208 all_ruby_install() {
209 + debug-print-function ${FUNCNAME} "${@}"
210 +
211 all_fakegem_install
212 }
213 --
214 2.35.1