From 3a30b979a63395948bfc447548c5d6b80ee6ac84 Mon Sep 17 00:00:00 2001 From: su-fang Date: Fri, 16 Sep 2022 11:15:11 +0800 Subject: [PATCH] Modify debian/control. --- debian/changelog | 12 ++ debian/compat | 1 - debian/control | 6 +- .../patches/0001-Modify-debian-control.patch | 140 ++++++++++++++++++ debian/patches/series | 1 + 5 files changed, 156 insertions(+), 4 deletions(-) delete mode 100644 debian/compat create mode 100644 debian/patches/0001-Modify-debian-control.patch create mode 100644 debian/patches/series diff --git a/debian/changelog b/debian/changelog index e6fc17c..bc23d28 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +libxml-sax-perl (1.02-ok3) yangtze; urgency=medium + + * Modify debian/control. + + -- sufang Fri, 16 Sep 2022 11:13:35 +0800 + +libxml-sax-perl (1.02-ok2) yangtze; urgency=medium + + * Add parserdetails-debian. + + -- sufang Wed, 14 Sep 2022 14:48:33 +0800 + libxml-sax-perl (1.02-ok1) yangtze; urgency=medium * Build for openkylin. diff --git a/debian/compat b/debian/compat deleted file mode 100644 index b4de394..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -11 diff --git a/debian/control b/debian/control index 4bf43c3..6deb050 100644 --- a/debian/control +++ b/debian/control @@ -3,13 +3,13 @@ Section: perl Testsuite: autopkgtest-pkg-perl Priority: optional Maintainer: OpenKylin Developers -Build-Depends: debhelper (>=11~) +Build-Depends: debhelper-compat (= 13) Build-Depends-Indep: libxml-namespacesupport-perl , libxml-sax-base-perl , perl Standards-Version: 4.6.0 -Vcs-Browser: https://salsa.debian.org/perl-team/modules/packages/libxml-sax-perl -Vcs-Git: https://salsa.debian.org/perl-team/modules/packages/libxml-sax-perl.git +Vcs-Browser: https://gitee.com/openkylin/libxml-sax-perl +Vcs-Git: https://gitee.com/openkylin/libxml-sax-perl.git Homepage: https://metacpan.org/release/XML-SAX/ Rules-Requires-Root: no diff --git a/debian/patches/0001-Modify-debian-control.patch b/debian/patches/0001-Modify-debian-control.patch new file mode 100644 index 0000000..ce20943 --- /dev/null +++ b/debian/patches/0001-Modify-debian-control.patch @@ -0,0 +1,140 @@ +From: su-fang +Date: Fri, 16 Sep 2022 11:15:11 +0800 +Subject: Modify debian/control. + +--- + Makefile.PL | 4 ++++ + lib/XML/SAX.pm | 13 +++++++++++++ + lib/XML/SAX/Debian.pm | 47 +++++++++++++++++++++++++++++++++++++++++++++++ + t/01known.t | 5 ++++- + t/99cleanup.t | 2 +- + 5 files changed, 69 insertions(+), 2 deletions(-) + create mode 100644 lib/XML/SAX/Debian.pm + +diff --git a/Makefile.PL b/Makefile.PL +index e3ff75d..dc59cfc 100644 +--- a/Makefile.PL ++++ b/Makefile.PL +@@ -27,6 +27,10 @@ sub MY::install { + package MY; + my $script = shift->SUPER::install(@_); + ++ print STDERR "Debian build: won't modify ParserDetails.ini when installing.\n"; ++ print STDERR " (use update-perl-sax-parsers(8) instead.)\n"; ++ return $script; ++ + # Only modify existing ParserDetails.ini if user agrees + + my $write_ini_ok = 0; +diff --git a/lib/XML/SAX.pm b/lib/XML/SAX.pm +index 7cd93d2..5297a2b 100644 +--- a/lib/XML/SAX.pm ++++ b/lib/XML/SAX.pm +@@ -179,6 +179,15 @@ sub add_parser { + sub save_parsers { + my $class = shift; + ++ ### DEBIAN MODIFICATION ++ print "\n"; ++ print "Please use 'update-perl-sax-parsers(8) to register this parser.'\n"; ++ print "See /usr/share/doc/libxml-sax-perl/README.Debian.gz for more info.\n"; ++ print "\n"; ++ ++ return $class; # rest of the function is disabled on Debian. ++ ### END DEBIAN MODIFICATION ++ + # get directory from wherever XML::SAX is installed + my $dir = $INC{'XML/SAX.pm'}; + $dir = dirname($dir); +@@ -212,6 +221,10 @@ sub do_warn { + warn(@_) unless $ENV{HARNESS_ACTIVE}; + } + ++sub _is_vendor_supplied { ++ 1; ++} ++ + 1; + __END__ + +diff --git a/lib/XML/SAX/Debian.pm b/lib/XML/SAX/Debian.pm +new file mode 100644 +index 0000000..e767c73 +--- /dev/null ++++ b/lib/XML/SAX/Debian.pm +@@ -0,0 +1,47 @@ ++package XML::SAX::Debian; ++ ++use strict; ++use warnings; ++ ++use base "XML::SAX"; ++ ++use File::Spec (); ++ ++sub save_parsers_debian { ++ my $class = shift; ++ my ($parser_module,$directory, $priority) = @_; ++ ++ # add parser ++ { ++ # We do not want load_parsers to complain. ++ local $ENV{HARNESS_ACTIVE} = 1; ++ $class->load_parsers("/nonexistent"); ++ } ++ $class->add_parser($parser_module); ++ ++ # get parser's ParserDetails file ++ my $file = $parser_module; ++ $file = "${priority}-$file" if $priority != 0; ++ $file = File::Spec->catfile($directory, $file); ++ chmod 0644, $file; ++ unlink($file); ++ ++ open(my $fh, ">$file") || ++ die "Cannot write to $file: $!"; ++ ++ foreach my $p (@{ $class->parsers }) { ++ print $fh "[$p->{Name}]\n"; ++ foreach my $key (keys %{$p->{Features}}) { ++ print $fh "$key = $p->{Features}{$key}\n"; ++ } ++ print $fh "\n"; ++ } ++ ++ print $fh "\n"; ++ ++ close $fh; ++ ++ return $class; ++} ++ ++1; +diff --git a/t/01known.t b/t/01known.t +index a2db4f1..a9e2536 100644 +--- a/t/01known.t ++++ b/t/01known.t +@@ -1,6 +1,9 @@ +-use Test; ++use Test::More; + BEGIN { plan tests => 3 } ++SKIP: { ++skip 'Tests skipped due to Debian modifications', 3; + use XML::SAX; + ok(XML::SAX->save_parsers); + ok(XML::SAX->load_parsers); + ok(@{XML::SAX->parsers}, 0); ++} +diff --git a/t/99cleanup.t b/t/99cleanup.t +index 32e196c..72f8438 100644 +--- a/t/99cleanup.t ++++ b/t/99cleanup.t +@@ -1,7 +1,7 @@ + use Test; + BEGIN { plan tests => 1 } + use File::Spec; +-ok(unlink( ++skip('Test skipped due to Debian modifications', unlink( + File::Spec->catdir(qw(blib lib XML SAX ParserDetails.ini))), + 1, + 'delete ParserDetails.ini' diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..01df8f3 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +0001-Modify-debian-control.patch