Description: The Debian way of handling ParserDetails.ini
Use update-perl-sax-parsers(8) instead. . * SAX.pm: the meat of the modifications + add XML::SAX->save_parsers_debian(), used by update-perl-sax-parsers + disable XML::SAX->save_parsers() with a helpful error message for users trying to install SAX parsers manually from CPAN * Makefile.PL: Don't try to modify ParserDetails.ini when building the package * t/01known.t, t/99cleanup.t: Skip tests related to XML::SAX->save_parsers() Author: Originally by Ardo van Rangelrooij <ardo@debian.org> Author: Cleanups and quilt conversion by Niko Tyni <ntyni@iki.fi> Author: Ansgar Burchardt <ansgar@43-1.org> (XML::SAX::Debian)
This commit is contained in:
parent
ad85ee1946
commit
651f7b946b
|
@ -27,6 +27,10 @@ sub MY::install {
|
||||||
package MY;
|
package MY;
|
||||||
my $script = shift->SUPER::install(@_);
|
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
|
# Only modify existing ParserDetails.ini if user agrees
|
||||||
|
|
||||||
my $write_ini_ok = 0;
|
my $write_ini_ok = 0;
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
libxml-sax-perl (1.02-ok2) yangtze; urgency=medium
|
||||||
|
|
||||||
|
* Add parserdetails-debian.
|
||||||
|
|
||||||
|
-- sufang <sufang@kylinos.cn> Wed, 14 Sep 2022 14:48:33 +0800
|
||||||
|
|
||||||
libxml-sax-perl (1.02-ok1) yangtze; urgency=medium
|
libxml-sax-perl (1.02-ok1) yangtze; urgency=medium
|
||||||
|
|
||||||
* Build for openkylin.
|
* Build for openkylin.
|
||||||
|
|
|
@ -179,6 +179,15 @@ sub add_parser {
|
||||||
sub save_parsers {
|
sub save_parsers {
|
||||||
my $class = shift;
|
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
|
# get directory from wherever XML::SAX is installed
|
||||||
my $dir = $INC{'XML/SAX.pm'};
|
my $dir = $INC{'XML/SAX.pm'};
|
||||||
$dir = dirname($dir);
|
$dir = dirname($dir);
|
||||||
|
@ -212,6 +221,10 @@ sub do_warn {
|
||||||
warn(@_) unless $ENV{HARNESS_ACTIVE};
|
warn(@_) unless $ENV{HARNESS_ACTIVE};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub _is_vendor_supplied {
|
||||||
|
1;
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
__END__
|
__END__
|
||||||
|
|
||||||
|
|
|
@ -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;
|
|
@ -1,6 +1,9 @@
|
||||||
use Test;
|
use Test::More;
|
||||||
BEGIN { plan tests => 3 }
|
BEGIN { plan tests => 3 }
|
||||||
|
SKIP: {
|
||||||
|
skip 'Tests skipped due to Debian modifications', 3;
|
||||||
use XML::SAX;
|
use XML::SAX;
|
||||||
ok(XML::SAX->save_parsers);
|
ok(XML::SAX->save_parsers);
|
||||||
ok(XML::SAX->load_parsers);
|
ok(XML::SAX->load_parsers);
|
||||||
ok(@{XML::SAX->parsers}, 0);
|
ok(@{XML::SAX->parsers}, 0);
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use Test;
|
use Test;
|
||||||
BEGIN { plan tests => 1 }
|
BEGIN { plan tests => 1 }
|
||||||
use File::Spec;
|
use File::Spec;
|
||||||
ok(unlink(
|
skip('Test skipped due to Debian modifications', unlink(
|
||||||
File::Spec->catdir(qw(blib lib XML SAX ParserDetails.ini))),
|
File::Spec->catdir(qw(blib lib XML SAX ParserDetails.ini))),
|
||||||
1,
|
1,
|
||||||
'delete ParserDetails.ini'
|
'delete ParserDetails.ini'
|
||||||
|
|
Loading…
Reference in New Issue