Skip to content

Commit 2552dcb

Browse files
authored
Bug 1802047 - Use system-installed libcmark-gfm to get latest Markdown improvements
1 parent 8dd4904 commit 2552dcb

File tree

8 files changed

+1637
-1817
lines changed

8 files changed

+1637
-1817
lines changed

Bugzilla/Markdown.pm

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,14 @@ has 'bugzilla_shorthand' => (
2525
);
2626

2727
sub _build_markdown_parser {
28-
if (Bugzilla->has_feature('alien_cmark')) {
29-
require Bugzilla::Markdown::GFM;
30-
require Bugzilla::Markdown::GFM::Parser;
31-
return Bugzilla::Markdown::GFM::Parser->new({
32-
hardbreaks => 1,
33-
validate_utf8 => 1,
34-
safe => 1,
35-
extensions => [qw( autolink tagfilter table strikethrough )],
36-
});
37-
}
38-
else {
39-
return undef;
40-
}
28+
require Bugzilla::Markdown::GFM;
29+
require Bugzilla::Markdown::GFM::Parser;
30+
return Bugzilla::Markdown::GFM::Parser->new({
31+
hardbreaks => 1,
32+
validate_utf8 => 1,
33+
safe => 1,
34+
extensions => [qw( autolink tagfilter table strikethrough )],
35+
});
4136
}
4237

4338
my $MARKDOWN_OFF = quotemeta '#[markdown(off)]';

Bugzilla/Markdown/GFM.pm

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ use 5.10.1;
44
use strict;
55
use warnings;
66

7-
use Alien::libcmark_gfm;
8-
use FFI::Platypus;
7+
use FFI::Platypus 2.00;
98
use FFI::Platypus::Buffer qw( scalar_to_buffer buffer_to_scalar );
9+
use FFI::CheckLib qw( find_lib );
1010
use Exporter qw(import);
1111

1212
use Bugzilla::Markdown::GFM::SyntaxExtension;
@@ -33,7 +33,12 @@ my %OPTIONS = (
3333
);
3434

3535
my $FFI = FFI::Platypus->new(
36-
lib => [grep { not -l $_ } Alien::libcmark_gfm->dynamic_libs],);
36+
api => 2,
37+
lib => [
38+
scalar find_lib(lib => 'cmark-gfm'),
39+
scalar find_lib(lib => 'cmark-gfm-extensions')
40+
]
41+
);
3742

3843
$FFI->custom_type(
3944
markdown_options_t => {

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ENV LOCALCONFIG_ENV=1
1717

1818
RUN apt-get update \
1919
&& apt-get upgrade -y \
20-
&& apt-get install -y rsync curl \
20+
&& apt-get install -y rsync curl libcmark-gfm-dev libcmark-gfm-extensions-dev \
2121
&& rm -rf /var/lib/apt/lists/*
2222

2323
WORKDIR /app

Dockerfile.bmo-slim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ RUN apt-get update \
4747
git \
4848
graphviz \
4949
libcap2-bin \
50+
libcmark-gfm-dev \
51+
libcmark-gfm-extensions-dev \
5052
rsync \
5153
$(cat /app/PACKAGES) \
5254
&& rm -rf /var/cache/apt/* /var/lib/apt/lists/*

Makefile.PL

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ my %requires = (
6262
'Email::MIME' => '1.904',
6363
'Email::MIME::ContentType' => 0,
6464
'Email::Sender' => 0,
65-
'FFI::Platypus' => 0,
65+
'FFI::Platypus' => '2.00',
6666
'Future' => '0.34',
6767
'Graph' => 0,
6868
'HTML::Escape' => '1.10',
@@ -133,10 +133,6 @@ my %optional_features = (
133133
prereqs =>
134134
{runtime => {requires => {'Mojolicious::Plugin::ForwardedFor' => 0}}}
135135
},
136-
alien_cmark => {
137-
description => 'Support GitHub-flavored markdown',
138-
prereqs => {runtime => {requires => {'Alien::libcmark_gfm' => '3'},},},
139-
},
140136
argon2 => {
141137
description => 'Support hashing passwords with Argon2',
142138
prereqs => {runtime => {requires => {'Crypt::Argon2' => '0.004',},},},

cpanfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
requires 'Algorithm::BloomFilter', '0.02';
2-
requires 'Alien::libcmark_gfm', '3';
32
requires 'Auth::GoogleAuth', '1.01';
43
requires 'Authen::SASL';
54
requires 'BSD::Resource';
@@ -45,7 +44,8 @@ requires 'Email::Reply';
4544
requires 'Email::Sender';
4645
requires 'Encode', '2.21';
4746
requires 'Encode::Detect';
48-
requires 'FFI::Platypus';
47+
requires 'FFI::CheckLib';
48+
requires 'FFI::Platypus', '2.00';
4949
requires 'File::Copy::Recursive';
5050
requires 'File::MimeInfo::Magic';
5151
requires 'File::Which';

0 commit comments

Comments
 (0)