From 916dd3e4c2154b2da85ad3710d0438fa96f5baef Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Wed, 7 Jan 2026 10:32:32 +0100 Subject: [PATCH] Fix rdoc error when installing multiple document kinds. Sourced from Fedora: https://src.fedoraproject.org/rpms/rubygem-rdoc/pull-request/3 and deleted the portion of the patch that edited the rdoc's tests, because the upstream Ruby tar does not contain tests for rdoc. Fixes case where installling multiple documents: `gem install -V hocon --document=ri,rdoc` can result in an exception: ~~~ $ gem install -V hocon --document=ri,rdoc .... .... Successfully installed hocon-1.4.0 Parsing documentation for hocon-1.4.0 Parsing sources... 100% [88/88] lib/hocon/version.rb Installing ri documentation for hocon-1.4.0 Installing aliki documentation for hocon-1.4.0 ERROR: While executing gem ... (NoMethodError) undefined method 'empty?' for an instance of RDoc::Markup::Paragraph return '' unless first_comment && !first_comment.empty? ^^^^^^^ <...snip...> ~~~ See: https://github.com/ruby/rdoc/issues/1530 --- ...1-fix-mutilple-document-installation.patch | 28 +++++++++++++++++++ ruby.spec | 4 +++ 2 files changed, 32 insertions(+) create mode 100644 rdoc-pr1531-fix-mutilple-document-installation.patch diff --git a/rdoc-pr1531-fix-mutilple-document-installation.patch b/rdoc-pr1531-fix-mutilple-document-installation.patch new file mode 100644 index 0000000..192863f --- /dev/null +++ b/rdoc-pr1531-fix-mutilple-document-installation.patch @@ -0,0 +1,28 @@ +From 994ee4c17fb8c217ab0335df55620c6bdb5d5cbe Mon Sep 17 00:00:00 2001 +From: tompng +Date: Fri, 26 Dec 2025 04:57:12 +0900 +Subject: [PATCH] Fix comment_location for merged ClassModule + +--- + lib/rdoc/code_object/class_module.rb | 7 ++++++- + test/rdoc/code_object/class_module_test.rb | 6 ++++++ + 2 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/lib/rdoc/code_object/class_module.rb b/lib/rdoc/code_object/class_module.rb +index b6bed352a2..d7ee36f950 100644 +--- a/lib/rdoc/code_object/class_module.rb ++++ b/lib/rdoc/code_object/class_module.rb +@@ -477,7 +477,12 @@ def merge(class_module) + document = document.merge other_document + + @comment = RDoc::Comment.from_document(document) +- @comment_location = document ++ ++ @comment_location = if document.parts.first.is_a?(RDoc::Markup::Document) ++ document.parts.map { |doc| [doc, doc.file] } ++ else ++ [[document, document.file]] ++ end + end + + cm = class_module diff --git a/ruby.spec b/ruby.spec index bd11514..578b5cc 100644 --- a/ruby.spec +++ b/ruby.spec @@ -295,6 +295,9 @@ Patch7: ruby-3.3.0-Disable-syntax-suggest-test-case.patch # Add a way to provide %%build_rustflags to JIT's rustc. # https://github.com/ruby/ruby/pull/15695 Patch8: ruby-4.0.1-Support-customizable-rustc_flags-for-rustc-builds.patch +# https://github.com/ruby/rdoc/pull/1531 +# Fix error with `gem install --document=rdoc,ri` +Patch9: rdoc-pr1531-fix-mutilple-document-installation.patch Requires: %{name}-libs%{?_isa} = %{version}-%{release} %{?with_rubypick:Suggests: rubypick} @@ -797,6 +800,7 @@ analysis result in RBS format, a standard type description format for Ruby pushd .bundle/gems/rdoc-%{rdoc_version} %patch 1 -p1 +%patch 9 -p1 popd %patch 2 -p1