summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-12-04 23:44:44 +0000
committerKarl Berry <karl@freefriends.org>2014-12-04 23:44:44 +0000
commit409be3cd7916600b57782c79a90aba6d98775c45 (patch)
tree130b99d771920295920315b9da694ce8b0d5bc04 /Master/tlpkg/TeXLive
parent5fdfd4f530ddfc44ab9e2fcae25f3781eeb87aba (diff)
* TLPOBJ.pm (update_from_catalogue): compare true basename of ctan file,
resulting in some ~350 additional Catalogue details strings being found. Also prefer first match from Catalogue, for the sake of top-level README files. * TeXCatalogue.pm (initialize): show error when parse fails. * tl-update-tlpdb: doc fixes. git-svn-id: svn://tug.org/texlive/trunk@35744 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r--Master/tlpkg/TeXLive/TLPOBJ.pm37
-rw-r--r--Master/tlpkg/TeXLive/TeXCatalogue.pm12
2 files changed, 30 insertions, 19 deletions
diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm
index 5715a6e71e2..7bd98607626 100644
--- a/Master/tlpkg/TeXLive/TLPOBJ.pm
+++ b/Master/tlpkg/TeXLive/TLPOBJ.pm
@@ -720,8 +720,7 @@ sub total_size {
# Update the current TLPOBJ object with the information from the
# corresponding entry in C<$tlc->entries>.
#
-sub update_from_catalogue
-{
+sub update_from_catalogue {
my ($self, $tlc) = @_;
my $tlcname = $self->name;
if (defined($self->catalogue)) {
@@ -782,28 +781,38 @@ sub update_from_catalogue
# <documentation details='Package documentation' language='de'
# href='ctan:/macros/latex/contrib/juramisc/doc/jmgerdoc.pdf'/>
# <ctan path='/macros/latex/contrib/juramisc'/>
- my @tcdocfiles = keys %{$entry->docs};
- my @tlpdocfiles = $self->docfiles;
- foreach my $tcdocfile (@tcdocfiles) {
- # basename also kills the ctan: prefix!
+ my @tcdocfiles = keys %{$entry->docs}; # Catalogue doc files.
+ my %tcdocfilebasenames; # basenames of those, as we go.
+ my @tlpdocfiles = $self->docfiles; # TL doc files.
+ foreach my $tcdocfile (sort @tcdocfiles) { # sort so shortest first
+ #warn "looking at tcdocfile $tcdocfile\n";
my $tcdocfilebasename = $tcdocfile;
- # remove the ctan: prefix
- $tcdocfilebasename =~ s/^ctan://;
- # remove the ctan path if present
- my $tcctanpath = $entry->ctan ? $entry->ctan : "";
- $tcdocfilebasename =~ s/^$tcctanpath//;
+ $tcdocfilebasename =~ s/^ctan://; # remove ctan: prefix
+ $tcdocfilebasename =~ s,.*/,,; # remove all but the base file name
+ #warn " got basename $tcdocfilebasename\n";
+ #
+ # If we've already seen this basename, skip. This is for the sake
+ # of README files, which can exist in different directories but
+ # get renamed into different files in TL for various annoying reasons;
+ # e.g., ibygrk, rsfs, songbook. In these cases, it turns out we
+ # always prefer the first entry (top-level README).
+ next if exists $tcdocfilebasenames{$tcdocfilebasename};
+ $tcdocfilebasenames{$tcdocfilebasename} = 1;
+ #
foreach my $tlpdocfile (@tlpdocfiles) {
- if ($tlpdocfile =~ m/$tcdocfilebasename$/) {
- # update the language/detail tags if present!
+ warn "considering merge into tlpdocfile $tlpdocfile\n";
+ if ($tlpdocfile =~ m,/$tcdocfilebasename$,) {
+ # update the language/detail tags from Catalogue if present.
if (defined($entry->docs->{$tcdocfile}{'details'})) {
my $tmp = $entry->docs->{$tcdocfile}{'details'};
+ #warn "merging details for $tcdocfile: $tmp\n";
# remove all embedded quotes, they are just a pain
$tmp =~ s/"//g;
$self->{'docfiledata'}{$tlpdocfile}{'details'} = $tmp;
}
if (defined($entry->docs->{$tcdocfile}{'language'})) {
my $tmp = $entry->docs->{$tcdocfile}{'language'};
- $tmp =~ s/"//g;
+ #warn "merging lang for $tcdocfile: $tmp\n";
$self->{'docfiledata'}{$tlpdocfile}{'language'} = $tmp;
}
}
diff --git a/Master/tlpkg/TeXLive/TeXCatalogue.pm b/Master/tlpkg/TeXLive/TeXCatalogue.pm
index cdea8db9b47..2f5cdeb9d16 100644
--- a/Master/tlpkg/TeXLive/TeXCatalogue.pm
+++ b/Master/tlpkg/TeXLive/TeXCatalogue.pm
@@ -56,8 +56,9 @@ sub new {
sub initialize {
my $self = shift;
# parse all the files
- my $parser = new XML::XPath->new(ioref => $self->{'ioref'}, parser => $_parser) ||
- die "Failed to parse the given ioref";
+ my $parser
+ = new XML::XPath->new(ioref => $self->{'ioref'}, parser => $_parser)
+ || die "Failed to parse given ioref";
$self->{'entry'}{'id'} = $parser->findvalue('/entry/@id');
$self->{'entry'}{'date'} = $parser->findvalue('/entry/@datestamp');
$self->{'entry'}{'modder'} = $parser->findvalue('/entry/@modifier');
@@ -79,8 +80,8 @@ sub initialize {
foreach my $node ($docset->get_nodelist) {
my $docfile = $parser->find('./@href',$node);
# see comments at end of beautify()
- my $details = Text::Unidecode::unidecode(
- $parser->find('./@details',$node));
+ my $details
+ = Text::Unidecode::unidecode($parser->find('./@details',$node));
my $language = $parser->find('./@language',$node);
$self->{'docs'}{$docfile}{'available'} = 1;
if ($details) { $self->{'docs'}{$docfile}{'details'} = $details; }
@@ -186,13 +187,14 @@ sub initialize {
|| die "chdir($self->{location}/entries failed: $!";
# parse all the files
foreach (glob("?/*.xml")) {
+ # for debugging, nice to skip everything but: next unless /pst-node/;
open(my $io,"<$_") or die "open($_) failed: $!";
our $tce;
# the XML parser die's on malformed xml entries, so we catch
# that and continue, simply skipping the entry
eval { $tce = TeXLive::TeXCatalogue::Entry->new( 'ioref' => $io ); };
if ($@) {
- printf STDERR "TeXCatalogue.pm: cannot parse $_, skipping it!\n";
+ warn "TeXCatalogue.pm:$_: cannot parse, skipping: $@\n";
close($io);
next;
}