diff options
-rwxr-xr-x | Master/tlpkg/bin/tl-dump-for-ctan | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/Master/tlpkg/bin/tl-dump-for-ctan b/Master/tlpkg/bin/tl-dump-for-ctan index 4975767c89e..a0d24951da0 100755 --- a/Master/tlpkg/bin/tl-dump-for-ctan +++ b/Master/tlpkg/bin/tl-dump-for-ctan @@ -3,10 +3,9 @@ # This file is licensed under the GNU General Public License version 2 # or any later version. # -# From an email from Karl: -# Jim Hefferon could use a dump of TL packages for CTAN with one line per -# package, showing the package name, collection it belongs to, and all its -# schemes. +# Output a dump of TL packages with one line per package, showing the +# package name, collection it belongs to, and all its schemes. This is +# used on the CTAN web pages. Run from cron. my $mydir; @@ -43,32 +42,38 @@ sub main } } foreach my $pkg ($tlpdb->list_packages) { - next if ($pkg =~ m/^00texlive/); - # ignore *all* arch dep pacakges (also tlpsv etc etc) + next if ($pkg =~ m/^00texlive/); # ignore internal pkgs. + # ignore *all* arch dep pacakges (also tlpsv etc.) next if ($pkg =~ m/\./); + my $tlp = $tlpdb->get_package($pkg); if (!defined($tlp)) { - printf STDERR "strange, $pkg not found but listed, continuing anyway.\n"; + warn "strange, $pkg not found but listed, continuing anyway"; + next; + } + + # For schemes and collections, output their dependencies. + if ($tlp->category =~ /^(Scheme|Collection)$/) { + my @depends = $tlp->depends; + print "$pkg @depends\n"; next; } - next if ($tlp->category eq "Scheme"); - next if ($tlp->category eq "Collection"); - # TODO ??? What to do with TLCore??? - # get the list of packages that depend on that one: + + # For regular packages, output the collection/schemes which include them. my @deps = $tlpdb->needed_by($pkg); my @schemes; my $collection = undef; for my $p (@deps) { my $tlpo = $tlpdb->get_package($p); if (!defined($tlpo)) { - printf STDERR "$p seems to depend on $pkg, but $p cannot be found?\n"; + warn "$p seems to depend on $pkg, but $p cannot be found?"; next; } if ($tlpo->category eq "Scheme") { push @schemes, $p; } elsif ($tlpo->category eq "Collection") { if (defined($collection)) { - printf STDERR "$pkg is asked for in more than one collection: $collection, $p\n"; + warn "$pkg asked for in more than one collection: $collection, $p"; next; } else { $collection = $p; @@ -82,11 +87,14 @@ sub main push @schemes, @{$col_to_schemes{$collection}}; } @schemes = TeXLive::TLUtils::sort_uniq(@schemes); + + my $catname = $tlp->catalogue; # so ctan can map back to their names + print "($catname)" if $catname; + print "$pkg $collection @schemes\n"; } } - __END__ ### Local Variables: |