summaryrefslogtreecommitdiff
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
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
-rw-r--r--Master/tlpkg/TeXLive/TLPOBJ.pm37
-rw-r--r--Master/tlpkg/TeXLive/TeXCatalogue.pm12
-rwxr-xr-xMaster/tlpkg/bin/tl-update-tlpdb23
3 files changed, 42 insertions, 30 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;
}
diff --git a/Master/tlpkg/bin/tl-update-tlpdb b/Master/tlpkg/bin/tl-update-tlpdb
index 98dc06e519f..562da3af3e8 100755
--- a/Master/tlpkg/bin/tl-update-tlpdb
+++ b/Master/tlpkg/bin/tl-update-tlpdb
@@ -2,7 +2,7 @@
# $Id$
# convert a set of tlpsrc files (given as arguments) into tlpdb
#
-# Copyright 2007-2012 Norbert Preining
+# Copyright 2007-2014 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
@@ -446,20 +446,18 @@ tl-update-tlpdb [OPTION]... [TLPSRC]...
=over 4
-=item B<--catalogue> I<Catalogue_file>
+=item B<--catalogue> I<Catalogue_dir>
-The I<Catalogue_file> must point to a valid TeX Catalogue as a Perl data
-dump; default is C<Master/texmf-dist/scripts/texlive/var/texcatalogue.data>,
-where C<Master> is the master directory described below. That file is
-update nightly by the C<tl-update-auto> script. If this file is given
-and readable, the generated tlpobj files will contain information
-gathered from the TeX Catalogue.
+The I<Catalogue_file> must point to a valid TeX Catalogue checkout; the
+default is C</home/httpd/html/catalogue>. If the directory is readable,
+the generated tlpobj files will contain information gathered from the
+TeX Catalogue.
=item B<--fix-reverse-revisions>
If a package with revisions going backward is found, this option makes
C<tl-update-tlpdb> try to check in a dummy change to the package's
-tlpsrc file to artificially increase the version number.
+tlpsrc file to artificially increase its version number.
=item B<--from-files>
@@ -519,8 +517,11 @@ omits adding anything to the configs set in the tlpsrc file.
By default, C<tl-update-tlpdb> recreates the tlpdb from all the tlpsrc
files present in the current tree. If this option is given, the tlpsrc
-file(s) have to be given on the command line. If you're trying to debug
-the conversion of one particular package, this is the option to use.
+file(s), or package names, are given on the command line. If you're
+trying to debug the conversion of one particular package, this is the
+option to use (along with C<-n>, most likely). Indeed, if any
+non-option arguments are given, the program assumes you meant to specify
+this option.
=item B<--with-w32-pattern-warning>