Saturday, September 02, 2023

Re: Update or Remove textproc/ruby-kramdown ?

On Fri, Sep 01, 2023 at 08:44:24PM +0000, Jeremy Evans wrote:
> Here's a diff to update textproc/ruby-kramdown to 2.4.0. However, I
> found the port to be fairly broken since rexml was removed from the Ruby
> standard library in Ruby 3.0. There were already comments in the port
> related to this. We either need to add a port for rexml, or we should
> remove kramdown.
>
> The test framework shipped with Kramdown is somewhat broken; this
> includes a patch to update them so that more of them pass, but there
> are still some failures.
>
> OKs to update kramdown and import rexml, or alternatively to remove
> kramdown? I recommend removal. kramdown is a pure ruby port that
> doesn't benefit from being packaged, IMO.

I'm ok with removing it.

>
> Thanks,
> Jeremy
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/textproc/ruby-kramdown/Makefile,v
> retrieving revision 1.15
> diff -u -p -u -p -r1.15 Makefile
> --- Makefile 11 Mar 2022 20:03:28 -0000 1.15
> +++ Makefile 1 Sep 2023 20:22:07 -0000
> @@ -1,6 +1,6 @@
> COMMENT= fast, pure Ruby Markdown parser
>
> -DISTNAME= kramdown-2.3.1
> +DISTNAME= kramdown-2.4.0
>
> CATEGORIES= textproc
>
> @@ -9,14 +9,15 @@ HOMEPAGE= https://kramdown.gettalong.org
> # MIT
> PERMIT_PACKAGE= Yes
>
> -# After Ruby 3.0 is added to ports tree
> -#RUN_DEPENDS= textproc/ruby-rexml
> +RUN_DEPENDS= textproc/ruby-rexml,${MODRUBY_FLAVOR}
>
> MODULES= lang/ruby
>
> CONFIGURE_STYLE=ruby gem
>
> +TEST_DEPENDS = ${RUN_DEPENDS} \
> + textproc/ruby-rouge,${MODRUBY_FLAVOR}
> MODRUBY_TEST= ruby
> -MODRUBY_TEST_TARGET = ${WRKSRC}/test/run_tests.rb
> +MODRUBY_TEST_TARGET = -C ${WRKSRC} -Ku -v -I lib test/run_tests.rb
>
> .include <bsd.port.mk>
> Index: distinfo
> ===================================================================
> RCS file: /cvs/ports/textproc/ruby-kramdown/distinfo,v
> retrieving revision 1.7
> diff -u -p -u -p -r1.7 distinfo
> --- distinfo 18 Mar 2021 08:40:41 -0000 1.7
> +++ distinfo 1 Sep 2023 20:21:43 -0000
> @@ -1,2 +1,2 @@
> -SHA256 (kramdown-2.3.1.gem) = Wek4z6QqPWFpspVyf+CcTJHXQjNsj70QQlKfTbZkq0k=
> -SIZE (kramdown-2.3.1.gem) = 122368
> +SHA256 (kramdown-2.4.0.gem) = ti5by9bqIMemcw67sqEHI3hW4U8pzr9bEMh2zBokgcU=
> +SIZE (kramdown-2.4.0.gem) = 122368
> Index: patches/patch-_metadata
> ===================================================================
> RCS file: patches/patch-_metadata
> diff -N patches/patch-_metadata
> --- patches/patch-_metadata 11 Mar 2022 20:03:28 -0000 1.2
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,15 +0,0 @@
> -Don't require runtime dependency on rexml, not needed
> -in Ruby 2.5-2.7 where it is in stdlib.
> -
> -Index: .metadata
> ---- .metadata.orig
> -+++ .metadata
> -@@ -17,7 +17,7 @@ dependencies:
> - - - ">="
> - - !ruby/object:Gem::Version
> - version: '0'
> -- type: :runtime
> -+ type: :development
> - prerelease: false
> - version_requirements: !ruby/object:Gem::Requirement
> - requirements:
> Index: patches/patch-test_run_tests_rb
> ===================================================================
> RCS file: /cvs/ports/textproc/ruby-kramdown/patches/patch-test_run_tests_rb,v
> retrieving revision 1.3
> diff -u -p -u -p -r1.3 patch-test_run_tests_rb
> --- patches/patch-test_run_tests_rb 11 Mar 2022 20:03:28 -0000 1.3
> +++ patches/patch-test_run_tests_rb 1 Sep 2023 20:20:09 -0000
> @@ -3,19 +3,24 @@ Fix tests so they run.
> Index: test/run_tests.rb
> --- test/run_tests.rb.orig
> +++ test/run_tests.rb
> -@@ -32,9 +32,9 @@ Dir[arg].each {|f| fwidth = [fwidth, f.length + 10].ma
> +@@ -32,15 +32,19 @@ Dir[arg].each {|f| fwidth = [fwidth, f.length + 10].ma
> html_file = file.sub('.text', '.html')
> opts_file = file.sub('.text', '.options')
> opts_file = File.join(File.dirname(file), 'options') unless File.exist?(opts_file)
> - options = File.exist?(opts_file) ? YAML.safe_load(File.read(opts_file)) : {auto_ids: false, footnote_nr: 1}
> - doc = Kramdown::Document.new(File.read(file), options)
> ++ unless File.exist?(html_file)
> ++ puts 'SKIPPED'
> ++ next
> ++ end
> begin
> -+ options = File.exist?(opts_file) ? YAML.safe_load(File.read(opts_file)) : {auto_ids: false, footnote_nr: 1}
> ++ options = File.exist?(opts_file) ? YAML.safe_load(File.read(opts_file), permitted_classes: [Symbol]) : {auto_ids: false, footnote_nr: 1, permitted_classes: [Symbol]}
> + doc = Kramdown::Document.new(File.read(file), options)
> assert_equal(File.read(html_file), doc.to_html)
> puts 'PASSED'
> - rescue StandardError
> -@@ -42,5 +42,5 @@ Dir[arg].each {|f| fwidth = [fwidth, f.length + 10].ma
> +- rescue StandardError
> ++ rescue StandardError, LoadError
> + puts ' FAILED'
> puts $!.message if $VERBOSE
> puts $!.backtrace if $DEBUG
> end

No comments:

Post a Comment