From 409be3cd7916600b57782c79a90aba6d98775c45 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 4 Dec 2014 23:44:44 +0000 Subject: * 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 --- Master/tlpkg/TeXLive/TLPOBJ.pm | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'Master/tlpkg/TeXLive/TLPOBJ.pm') 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 # # - 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; } } -- cgit v1.2.3