commit:     aa780303ae90c6268e4b42026b2acb1ff7db9c99
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Apr  7 14:19:57 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Apr  7 14:25:25 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa780303

app-text/ronn-ng: enable ruby31, enable ruby32; drop unnecessary man page build

- Enable ruby31, enable ruby32

  This only takes one patch and it's just for tests to work
  with newer psych. Fedora is just using that same patch too, no others.

- Drop unnecessary man page build. They're included in the gem,
  so we don't need to build it again (which causes a problem
  when invoking rake directly/calling unwrapped ronn, as e.g.
  nokogiri isn't necessarily installed for it anymore.)

Closes: https://bugs.gentoo.org/835156
Closes: https://bugs.gentoo.org/898414
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/ronn-ng-0.9.1-psych-4-tests.patch        | 40 ++++++++++++++
 app-text/ronn-ng/ronn-ng-0.9.1-r3.ebuild           | 62 ++++++++++++++++++++++
 2 files changed, 102 insertions(+)

diff --git a/app-text/ronn-ng/files/ronn-ng-0.9.1-psych-4-tests.patch 
b/app-text/ronn-ng/files/ronn-ng-0.9.1-psych-4-tests.patch
new file mode 100644
index 000000000000..b9e05cfff455
--- /dev/null
+++ b/app-text/ronn-ng/files/ronn-ng-0.9.1-psych-4-tests.patch
@@ -0,0 +1,40 @@
+https://github.com/apjanke/ronn-ng/commit/e194bf62b1d0c0828cc83405e60dc5ece829e62f
+
+From e194bf62b1d0c0828cc83405e60dc5ece829e62f Mon Sep 17 00:00:00 2001
+From: Andrew Janke <and...@apjanke.net>
+Date: Fri, 6 Jan 2023 07:25:48 -0500
+Subject: [PATCH] Workaround for Psych 4.0+ in tests
+
+Psych 4.0, shipped with Ruby 3.1, switched to a "safe load" by default, and 
requires you to explicitly set allowed classes. But previous Psych versions 
didn't support this kwarg, so the call needs to be made differently depending 
on which version of Psych/Ruby this is running under.
+
+Co-authored-by: Takuya Noguchi <takninnovationresea...@gmail.com>
+---
+ test/test_ronn_document.rb  | 7 ++++++-
+ 2 files changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/test/test_ronn_document.rb b/test/test_ronn_document.rb
+index 75788dc..cd573fe 100644
+--- a/test/test_ronn_document.rb
++++ b/test/test_ronn_document.rb
+@@ -137,6 +137,11 @@ def canonicalize(text)
+ 
+     test 'converting to yaml' do
+       require 'yaml'
++      actual = begin
++        YAML.load(@doc.to_yaml, permitted_classes: [Time])
++      rescue ArgumentError # Remove this line when Ruby 3.0.x support is 
dropped
++        YAML.load(@doc.to_yaml)
++      end
+       assert_equal({
+                      'section'      => '1',
+                      'name'         => 'hello',
+@@ -146,7 +151,7 @@ def canonicalize(text)
+                      'toc'          => [['NAME', 'NAME']],
+                      'organization' => nil,
+                      'manual'       => nil
+-                   }, YAML.load(@doc.to_yaml))
++                   }, actual)
+     end
+ 
+     test 'converting to json' do
+

diff --git a/app-text/ronn-ng/ronn-ng-0.9.1-r3.ebuild 
b/app-text/ronn-ng/ronn-ng-0.9.1-r3.ebuild
new file mode 100644
index 000000000000..b7217b3bf77f
--- /dev/null
+++ b/app-text/ronn-ng/ronn-ng-0.9.1-r3.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+USE_RUBY="ruby26 ruby27 ruby30 ruby31 ruby32"
+
+RUBY_FAKEGEM_EXTRADOC="AUTHORS CHANGES README.md"
+RUBY_FAKEGEM_GEMSPEC="ronn-ng.gemspec"
+
+inherit ruby-fakegem
+
+DESCRIPTION="Builds manuals in HTML and Unix man page format from Markdown"
+HOMEPAGE="https://github.com/apjanke/ronn-ng";
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~riscv ~sparc ~x86"
+
+IUSE=""
+
+RDEPEND+="!app-text/ronn"
+
+DEPS="
+       >=dev-ruby/kramdown-2.1:2
+       >=dev-ruby/nokogiri-1.9.0:0
+"
+
+ruby_add_rdepend "
+       =dev-ruby/mustache-1*
+       ${DEPS}
+"
+
+ruby_add_bdepend "${DEPS}"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-psych-4-tests.patch
+)
+
+all_ruby_prepare() {
+       sed -i -e '/mustache/ s/0.7/1.0/' ${RUBY_FAKEGEM_GEMSPEC} || die
+}
+
+each_ruby_prepare() {
+       # Make sure that we always use the right interpreter during tests
+       sed -i -e "/output/ s:ronn:${RUBY} bin/ronn:" test/test_ronn.rb || die
+       # ... and during the man page build.
+       sed -i -e "/sh 'ronn/s:ronn:${RUBY} bin/ronn:" Rakefile || die
+}
+
+each_ruby_compile() {
+       #if ! [[ -f man/ronn.1 ]] ; then
+       #       einfo "Building man pages using ${RUBY}"
+       #       PATH="${S}/bin:${PATH}" ${RUBY} -S rake man || die
+       #fi
+       :;
+}
+
+all_ruby_install() {
+       all_fakegem_install
+
+       doman man/ronn.1 man/ronn-format.7
+}

Reply via email to