ruby/ruby-2.7.0-Initialize-ABRT-hook.patch
Jarek Prokop c670682a97 Upgrade to Ruby 4.0.0.
* Define different expected archives macros for development.

When revision was defined, there was also timestamp appended.
That does not seem necessary for preview tarballs from upstream.

Instead split it into their own separate conditionals.

* irb and rdoc are now a bundled gem
Don't ship the %ruby_libdir parts and the symlinking for irb and rdoc.
The rdoc rubygems plugin should now be correctly present. Remove the
additional source.

* Multiple gems are now bundled gems.
Add them to ruby-bundled-gems subpackage instead of their own separate
packages.

* Split the rdoc support for ruby version directory from
  ruby-2.3.0-ruby_version.patch.
After Ruby moved RDoc to bundled gems from default gems, the directory
in which RDoc is in the upstream tarball is not in the upstream source,
necessitating a patch split for the Ruby version patch.
It cannot be fully re-created including the rdoc part in a single patch
with upstream ruby/ruby github.

Instead the part is created from ruby/rdoc github.

Add bundled provides for rubygem-json + the source into comments.
Source is as described in upstream commits and in the LEGAL file
upstream. Add the respective licenses for the subpackage.

RDoc includes a new doc generator that is under the MIT license,
update the license to reflect it.

Resolves: rhbz#2425358
2026-01-07 18:01:48 +01:00

86 lines
2.5 KiB
Diff

From 03b44a86b574dc0b63fd57c5f9b52b56ad3ced37 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Mon, 6 Jan 2020 13:56:04 +0100
Subject: [PATCH] Initialize ABRT hook.
The ABRT hook used to be initialized by preludes via patches [[1], [2]].
Unfortunately, due to [[3]] and especially since [[4]], this would
require boostrapping [[5]].
To keep the things simple for now, load the ABRT hook via C.
[1]: https://bugs.ruby-lang.org/issues/8566
[2]: https://bugs.ruby-lang.org/issues/15306
[3]: https://bugs.ruby-lang.org/issues/16254
[4]: https://github.com/ruby/ruby/pull/2735
[5]: https://lists.fedoraproject.org/archives/list/ruby-sig@lists.fedoraproject.org/message/LH6L6YJOYQT4Y5ZNOO4SLIPTUWZ5V45Q/
---
abrt.c | 12 ++++++++++++
common.mk | 1 +
ruby.c | 4 ++++
spec/ruby/core/kernel/require_spec.rb | 2 ++
4 files changed, 19 insertions(+)
create mode 100644 abrt.c
diff --git a/abrt.c b/abrt.c
new file mode 100644
index 0000000000..e99cb432e6
--- /dev/null
+++ b/abrt.c
@@ -0,0 +1,12 @@
+#include "internal.h"
+
+void
+Init_abrt(void)
+{
+ rb_eval_string(
+ " begin\n"
+ " require 'abrt'\n"
+ " rescue LoadError\n"
+ " end\n"
+ );
+}
diff --git a/common.mk b/common.mk
index 08fee9119a..dae7d9dc00 100644
--- a/common.mk
+++ b/common.mk
@@ -116,6 +116,7 @@ PRISM_FILES = prism/api_node.$(OBJEXT) \
prism_init.$(OBJEXT)
COMMONOBJS = \
+ abrt.$(OBJEXT) \
array.$(OBJEXT) \
ast.$(OBJEXT) \
bignum.$(OBJEXT) \
diff --git a/ruby.c b/ruby.c
index b00fc1502d..32b88f7496 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1773,10 +1773,14 @@ proc_options(long argc, char **argv, ruby_cmdline_options_t *opt, int envopt)
void Init_builtin_features(void);
+/* abrt.c */
+void Init_abrt(void);
+
static void
ruby_init_prelude(void)
{
Init_builtin_features();
+ Init_abrt();
}
void rb_call_builtin_inits(void);
diff --git a/spec/ruby/core/kernel/require_spec.rb b/spec/ruby/core/kernel/require_spec.rb
index 60d17242fe..a8f93b0db4 100644
--- a/spec/ruby/core/kernel/require_spec.rb
+++ b/spec/ruby/core/kernel/require_spec.rb
@@ -26,6 +26,8 @@
out = ruby_exe("puts $LOADED_FEATURES", options: '--disable-gems --disable-did-you-mean')
features = out.lines.map { |line| File.basename(line.chomp, '.*') }
+ # Ignore ABRT
+ features -= %w[abrt]
# Ignore CRuby internals
features -= %w[encdb transdb windows_1252 windows_31j]
features.reject! { |feature| feature.end_with?('-fake') }