1 |
commit: 61fb360f9ed69f19ee2d8143070602523e05bc97 |
2 |
Author: Hans de Graaff <graaff <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jun 2 07:40:38 2019 +0000 |
4 |
Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jun 2 07:40:53 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=61fb360f |
7 |
|
8 |
dev-ruby/rubygems: new Gentoo defaults |
9 |
|
10 |
This revision has pretty much completely rewritten Gentoo defaults for |
11 |
ruby. The old defaults were broken with the introduction of default gems |
12 |
in rubygems 3.0.0. The new defaults should be backward compatible with |
13 |
the old defaults, but they use defined hooks for the most part to do the |
14 |
work. |
15 |
|
16 |
Bug: https://bugs.gentoo.org/676946 |
17 |
Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org> |
18 |
Package-Manager: Portage-2.3.66, Repoman-2.3.11 |
19 |
|
20 |
dev-ruby/rubygems/files/gentoo-defaults-3.rb | 57 +++++++++++++ |
21 |
dev-ruby/rubygems/rubygems-3.0.3-r1.ebuild | 120 +++++++++++++++++++++++++++ |
22 |
2 files changed, 177 insertions(+) |
23 |
|
24 |
diff --git a/dev-ruby/rubygems/files/gentoo-defaults-3.rb b/dev-ruby/rubygems/files/gentoo-defaults-3.rb |
25 |
new file mode 100644 |
26 |
index 00000000000..b8ad8f1227c |
27 |
--- /dev/null |
28 |
+++ b/dev-ruby/rubygems/files/gentoo-defaults-3.rb |
29 |
@@ -0,0 +1,57 @@ |
30 |
+# frozen_string_literal: true |
31 |
+ |
32 |
+# Gentoo defaults for rubygems 3.x |
33 |
+# |
34 |
+# Gentoo policy is to install all manually installed code into |
35 |
+# /usr/local and to keep /usr managed by Gentoo. This policy file |
36 |
+# ensures that all manually installed gems using "gem install" are |
37 |
+# installed in /usr/local. Gentoo gems are installed in /usr. |
38 |
+ |
39 |
+# TODO: We used to manipulate the default_dir, but this no longer |
40 |
+# works since this is now the base for the new "default" gems that |
41 |
+# ruby 2.6 uses with irb. So default_dir should refer to the system |
42 |
+# default now. rubygems also provides various hooks so we may be able |
43 |
+# to use those to install gems in /usr/local by default in a less |
44 |
+# intrusive way. |
45 |
+module Gem |
46 |
+ |
47 |
+ class << self |
48 |
+ def portage_gems_dir |
49 |
+ ConfigMap[:sitelibdir].gsub('site_ruby', 'gems') |
50 |
+ end |
51 |
+ |
52 |
+ def local_dir |
53 |
+ portage_gems_dir.gsub('@GENTOO_PORTAGE_EPREFIX@/usr', |
54 |
+ '@GENTOO_PORTAGE_EPREFIX@/usr/local') |
55 |
+ end |
56 |
+ |
57 |
+ def install_dir |
58 |
+ Process.euid.zero? ? local_dir : user_dir |
59 |
+ end |
60 |
+ |
61 |
+ undef :default_path |
62 |
+ def default_path |
63 |
+ path = [] |
64 |
+ path << user_dir if user_home && File.exist?(user_home) |
65 |
+ path << default_dir |
66 |
+ path << vendor_dir if vendor_dir && File.directory?(vendor_dir) |
67 |
+ path << local_dir |
68 |
+ path << portage_gems_dir |
69 |
+ end |
70 |
+ |
71 |
+ def system_config_path |
72 |
+ '@GENTOO_PORTAGE_EPREFIX@/etc' |
73 |
+ end |
74 |
+ |
75 |
+ # Set Gentoo defaults for gem commands |
76 |
+ undef :operating_system_defaults |
77 |
+ def operating_system_defaults |
78 |
+ { |
79 |
+ 'install' => "--install-dir #{install_dir}", |
80 |
+ 'uninstall' => "--install-dir #{install_dir}", |
81 |
+ 'update' => "--install-dir #{install_dir}" |
82 |
+ } |
83 |
+ end |
84 |
+ |
85 |
+ end |
86 |
+end |
87 |
|
88 |
diff --git a/dev-ruby/rubygems/rubygems-3.0.3-r1.ebuild b/dev-ruby/rubygems/rubygems-3.0.3-r1.ebuild |
89 |
new file mode 100644 |
90 |
index 00000000000..8c6d1f49acf |
91 |
--- /dev/null |
92 |
+++ b/dev-ruby/rubygems/rubygems-3.0.3-r1.ebuild |
93 |
@@ -0,0 +1,120 @@ |
94 |
+# Copyright 1999-2019 Gentoo Authors |
95 |
+# Distributed under the terms of the GNU General Public License v2 |
96 |
+ |
97 |
+EAPI=6 |
98 |
+ |
99 |
+USE_RUBY="ruby24 ruby25 ruby26" |
100 |
+ |
101 |
+inherit ruby-ng prefix |
102 |
+ |
103 |
+DESCRIPTION="Centralized Ruby extension management system" |
104 |
+HOMEPAGE="https://rubygems.org/" |
105 |
+LICENSE="GPL-2 || ( Ruby MIT )" |
106 |
+ |
107 |
+SRC_URI="https://rubygems.org/rubygems/${P}.tgz" |
108 |
+ |
109 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
110 |
+SLOT="0" |
111 |
+IUSE="server test" |
112 |
+ |
113 |
+PDEPEND="server? ( =dev-ruby/builder-3* )" |
114 |
+ |
115 |
+ruby_add_bdepend " |
116 |
+ test? ( |
117 |
+ dev-ruby/json |
118 |
+ dev-ruby/minitest:5 |
119 |
+ dev-ruby/rdoc |
120 |
+ )" |
121 |
+ |
122 |
+all_ruby_prepare() { |
123 |
+ |
124 |
+ mkdir -p lib/rubygems/defaults || die |
125 |
+ cp "${FILESDIR}/gentoo-defaults-3.rb" lib/rubygems/defaults/operating_system.rb || die |
126 |
+ |
127 |
+ eprefixify lib/rubygems/defaults/operating_system.rb |
128 |
+ |
129 |
+ # Disable broken tests when changing default values: |
130 |
+ sed -i -e '/test_default_path/,/^ end/ s:^:#:' test/rubygems/test_gem.rb || die |
131 |
+ sed -i -e '/assert_self_install_permissions/,/^ end/ s/^.*RUBY_INSTALL_NAME.*//' test/rubygems/test_gem.rb || die |
132 |
+ |
133 |
+ # Skip tests for default gems that all fail |
134 |
+# sed -i -e '/test_default_gems_use_full_paths/,/^ end/ s:^:#:' test/rubygems/test_gem.rb || die |
135 |
+# sed -i -e '/test_execute_ignore_default_gem_verbose/,/^ end/ s:^:#:' test/rubygems/test_gem_commands_cleanup_command.rb || die |
136 |
+# sed -i -e '/test_execute_default_gem/,/^ end/ s:^:#:' test/rubygems/test_gem_commands_contents_command.rb test/rubygems/test_gem_commands_pristine_command.rb || die |
137 |
+# sed -i -e '/test_execute_\(default_details\|show_default_gems\)/,/^ end/ s:^:#:' test/rubygems/test_gem_commands_query_command.rb || die |
138 |
+# sed -i -e '/test_execute_all/,/^ end/ s:^:#:' test/rubygems/test_gem_commands_uninstall_command.rb || die |
139 |
+# sed -i -e '/\(test_default_gem\|test_check_executable_overwrite\|test_require_works_after_cleanup\)/,/^ end/ s:^:#:' \ |
140 |
+# test/rubygems/test_{gem_installer,require}.rb || die |
141 |
+# sed -i -e '/test_\(load_default_gem\|default_spec_stub\|self_stubs\)/,/^ end/ s:^:#:' test/rubygems/test_gem_specification.rb || die |
142 |
+# sed -i -e '/test_uninstall_default_gem/,/^ end/ s:^:#:' test/rubygems/test_gem_uninstaller.rb || die |
143 |
+# rm -f test/rubygems/test_gem_indexer.rb || die |
144 |
+# sed -i -e '/test_\(require_when_gem_defined\|realworld_default_gem\)/,/^ end/ s:^:#:' test/rubygems/test_require.rb || die |
145 |
+# rm -f test/rubygems/test_gem_commands_setup_command.rb || die |
146 |
+ |
147 |
+ # Avoid tests playing tricks with ruby engine that don't seem to |
148 |
+ # work for us. |
149 |
+ rm test/rubygems/test_gem_request_set_gem_dependency_api.rb || die |
150 |
+ |
151 |
+ # Avoid test requiring network access |
152 |
+ sed -i -e '/test_download_to_cache/askip "requires network access"' test/rubygems/test_gem_remote_fetcher.rb || die |
153 |
+ |
154 |
+ # Avoid test requiring file system permission changes |
155 |
+ sed -i -e '/test_traverse_parents_does_not_crash_on_permissions_error/,/^ end/ s:^:#:' test/rubygems/test_gem_util.rb || die |
156 |
+ |
157 |
+ # Avoid uninvestigated test failure in favor of security release |
158 |
+ sed -i -e '/test_self_install_permissions_with_format_executable/askip "uninvestigated failure"' test/rubygems/test_gem.rb || die |
159 |
+} |
160 |
+ |
161 |
+each_ruby_compile() { |
162 |
+ # Not really a build but... |
163 |
+ sed -i -e 's:#!.*:#!'"${RUBY}"':' bin/gem |
164 |
+} |
165 |
+ |
166 |
+each_ruby_test() { |
167 |
+ # Unset RUBYOPT to avoid interferences, bug #158455 et. al. |
168 |
+ #unset RUBYOPT |
169 |
+ |
170 |
+ if [[ "${EUID}" -ne "0" ]]; then |
171 |
+ RUBYLIB="$(pwd)/lib${RUBYLIB+:${RUBYLIB}}" ${RUBY} --disable-gems -I.:lib:test:bundler/lib \ |
172 |
+ -e 'require "rubygems"; gem "minitest", "~>5.0"; Dir["test/**/test_*.rb"].each { |tu| require tu }' || die "tests failed" |
173 |
+ else |
174 |
+ ewarn "The userpriv feature must be enabled to run tests, bug 408951." |
175 |
+ eerror "Testsuite will not be run." |
176 |
+ fi |
177 |
+} |
178 |
+ |
179 |
+each_ruby_install() { |
180 |
+ # Unset RUBYOPT to avoid interferences, bug #158455 et. al. |
181 |
+ unset RUBYOPT |
182 |
+ export RUBYLIB="$(pwd)/lib${RUBYLIB+:${RUBYLIB}}" |
183 |
+ |
184 |
+ pushd lib &>/dev/null |
185 |
+ doruby -r * |
186 |
+ popd &>/dev/null |
187 |
+ |
188 |
+ local sld=$(ruby_rbconfig_value 'sitelibdir') |
189 |
+ insinto "${sld#${EPREFIX}}" # bug #320813 |
190 |
+ newins "${FILESDIR}/auto_gem.rb.ruby19" auto_gem.rb || die |
191 |
+ |
192 |
+ newbin bin/gem $(basename ${RUBY} | sed -e 's:ruby:gem:') || die |
193 |
+} |
194 |
+ |
195 |
+all_ruby_install() { |
196 |
+ dodoc History.txt README.md |
197 |
+ |
198 |
+ if use server; then |
199 |
+ newinitd "${FILESDIR}/init.d-gem_server2" gem_server || die "newinitd failed" |
200 |
+ newconfd "${FILESDIR}/conf.d-gem_server" gem_server || die "newconfd failed" |
201 |
+ fi |
202 |
+} |
203 |
+ |
204 |
+pkg_postinst() { |
205 |
+ if [[ ! -n $(readlink "${ROOT}"usr/bin/gem) ]] ; then |
206 |
+ eselect ruby set $(eselect --brief --colour=no ruby show | head -n1) |
207 |
+ fi |
208 |
+ |
209 |
+ ewarn |
210 |
+ ewarn "To switch between available Ruby profiles, execute as root:" |
211 |
+ ewarn "\teselect ruby set ruby(23|24|...)" |
212 |
+ ewarn |
213 |
+} |