summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLPOBJ.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/TeXLive/TLPOBJ.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLPOBJ.pm37
1 files changed, 23 insertions, 14 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;
}
}