diff options
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r-- | Master/tlpkg/TeXLive/TeXCatalogue.pm | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Master/tlpkg/TeXLive/TeXCatalogue.pm b/Master/tlpkg/TeXLive/TeXCatalogue.pm index 3ac22876c93..10ca161ff83 100644 --- a/Master/tlpkg/TeXLive/TeXCatalogue.pm +++ b/Master/tlpkg/TeXLive/TeXCatalogue.pm @@ -169,6 +169,7 @@ sub new { bless $self, $class; if (defined($self->{'location'})) { $self->initialize(); + $self->quest4texlive(); } return $self; } @@ -191,11 +192,41 @@ sub initialize { chdir($cwd) || die ("Cannot change back to $cwd: $!"); } +# Copy every catalogue $entry under the name $entry->{'texlive'} +# if it makes sense. +# +sub quest4texlive +{ + my $self = shift; + + # The catalogue has a partial mapping from catalogue entries to + # texlive packages: $id --> $texcat->{$id}{'texlive'} + my $texcat = $self->{'entries'}; + + # Try to build the inverse mapping: + my (%inv, %count); + for my $id (keys %{$texcat}) { + if (defined($texcat->{$id}{'texlive'})) { + $count{$texcat->{$id}{'texlive'}}++; + $inv{$texcat->{$id}{'texlive'}} = $id; + } + } + # Go through texlive names + for my $name (keys %inv) { + # If this name is free and there is only one corresponding catalogue + # entry then copy the entry under this name + if (!exists($texcat->{$name}) && $count{$name} == 1) { + $texcat->{$name} = $texcat->{$inv{$name}}; + } + } +} + sub location { my $self = shift; if (@_) { $self->{'location'} = shift } return $self->{'location'}; } + sub entries { my $self = shift; my %newentries = @_; |