summaryrefslogtreecommitdiff
path: root/Build/tools
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-06-01 15:29:02 +0000
committerKarl Berry <karl@freefriends.org>2006-06-01 15:29:02 +0000
commit6b7f46c4bc8a521a767b2abe62568763be826aa5 (patch)
tree17c87b1b5a1fd2cb9e4729cd30ddfeff079547cd /Build/tools
parentafd95eeeab13dfd49516a72dcad2768c0773d7ae (diff)
(catalogue_find_ctan_path): look for ctan path in
catalogue first. git-svn-id: svn://tug.org/texlive/trunk@1632 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/tools')
-rwxr-xr-xBuild/tools/tlpkginfo185
1 files changed, 89 insertions, 96 deletions
diff --git a/Build/tools/tlpkginfo b/Build/tools/tlpkginfo
index 11123269fd1..3630f31ac52 100755
--- a/Build/tools/tlpkginfo
+++ b/Build/tools/tlpkginfo
@@ -9,6 +9,8 @@ exit (&main ());
sub main
{
$CTAN = $ENV{"CTAN"} || "/home/ftp/tex-archive";
+ $CATALOGUE = $ENV{"TEX_CATALOGUE"} || "/home/httpd/html/catalogue/entries";
+
if ($ARGV[0] eq "--ctan-dir") {
return &find_ctan_dir ($ARGV[1]);
} else {
@@ -18,8 +20,6 @@ sub main
#
-# The CTAN path to a package is sometimes stored in the TeX Catalogue,
-# but old entries don't have it, etc. Still, we should use it if present.xx
# Return 0 for success if we find a path (and print it on stdout), else
# return 1.
#
@@ -28,106 +28,99 @@ sub find_ctan_dir
my ($me) = @_;
return 1 unless $me;
- (my $menobin = $me) =~ s,^bin-,,;
- (my $menodash = $me) =~ s,^.*-,,;
- (my $menopowerdot = $me) =~ s,^powerdot-,,;
- (my $menotype1 = $me) =~ s,-type1$,,;
-
- my $ctan_dir = "";
+ # The CTAN path to a package is sometimes stored in the TeX Catalogue,
+ # but old entries don't have it, etc. Still, we want to use it if present.
+ my $ctan_dir = &catalogue_find_ctan_path ($me);
+ if (! $ctan_dir) {
+ # fall back on many special cases
+ (my $menobin = $me) =~ s,^bin-,,;
+ (my $menodash = $me) =~ s,^.*-,,;
+ (my $menopowerdot = $me) =~ s,^powerdot-,,;
+ (my $menotype1 = $me) =~ s,-type1$,,;
- for my $dir (
- "macros/latex/contrib/$me", # most everything
- "macros/latex/contrib/\L$me", # HA-prosper
- "macros/latex/contrib/powerdot/contrib/$menopowerdot", # powerdot-doc-vn
- "macros/latex/exptl/$me", # semioneside
- "macros/latex/required/$me", # babel
- "macros/plain/$me", # plnfss
- "macros/xetex/latex/$me", # xetex
- "macros/generic/$me", # abbr
- "macros/generic/diagrams/$me", # circ
- "macros/$me", # eplain
- "support/$me", # thumbpdf
- "support/$menobin", # bin-thumbpdf
- "language/vietnamese/$me/unpacked", # vntex
- "language/hyphenation/$me", # bghyphen
- "language/hebrew/$me", # cjhebrew
- "language/greek/package-babel/$me", # ibycus-babel
- "language/coptic/$me", # cbcoptic
- "info/math/voss/$me", # mathmode
- "info/lshort/$menodash", # lshort-english
- "info/bibtex/$me", # tamethebeast
- "info/symbols/$me", # comprehensive
- "info/$me", # Type1fonts
- "graphics/$me", # sparklines
- "graphics/metapost/contrib/macros/$me", # mpattern
- "graphics/pstricks/contrib/pedigree/$me", # pst-pdgr
- "graphics/pstricks/contrib/$me", # pstricks-add
- "fonts/$me", # MnSymbol
- "fonts/utilities/$me", # accfonts
- "fonts/ps-type1/$me", # cm-super
- "fonts/ps-type1/$menotype1", # esint-type1
- "fonts/greek/$me", # lfb
- "fonts/gothic/$me", # blacklettert1
- "fonts/cyrillic/$me/texmf", # lh
- "fonts/chess/$me", # skaknew
- "biblio/bibtex/contrib/$me", # dk-bib
- ) {
- if (-d "$CTAN/$dir") {
- $ctan_dir = $dir;
- last;
+ for my $dir (
+ "macros/latex/contrib/$me", # most everything
+ "macros/latex/contrib/\L$me", # HA-prosper
+ "macros/latex/contrib/powerdot/contrib/$menopowerdot", # powerdot-doc-vn
+ "macros/latex/exptl/$me", # semioneside
+ "macros/latex/required/$me", # babel
+ "macros/plain/$me", # plnfss
+ "macros/xetex/latex/$me", # xetex
+ "macros/generic/$me", # abbr
+ "macros/generic/diagrams/$me", # circ
+ "macros/$me", # eplain
+ "support/$me", # thumbpdf
+ "support/$menobin", # bin-thumbpdf
+ "language/vietnamese/$me/unpacked", # vntex
+ "language/hyphenation/$me", # bghyphen
+ "language/hebrew/$me", # cjhebrew
+ "language/greek/package-babel/$me", # ibycus-babel
+ "language/coptic/$me", # cbcoptic
+ "info/math/voss/$me", # mathmode
+ "info/lshort/$menodash", # lshort-english
+ "info/bibtex/$me", # tamethebeast
+ "info/symbols/$me", # comprehensive
+ "info/$me", # Type1fonts
+ "graphics/$me", # sparklines
+ "graphics/metapost/contrib/macros/$me", # mpattern
+ "graphics/pstricks/contrib/pedigree/$me", # pst-pdgr
+ "graphics/pstricks/contrib/$me", # pstricks-add
+ "fonts/$me", # MnSymbol
+ "fonts/utilities/$me", # accfonts
+ "fonts/ps-type1/$me", # cm-super
+ "fonts/ps-type1/$menotype1", # esint-type1
+ "fonts/greek/$me", # lfb
+ "fonts/gothic/$me", # blacklettert1
+ "fonts/cyrillic/$me/texmf", # lh
+ "fonts/chess/$me", # skaknew
+ "biblio/bibtex/contrib/$me", # dk-bib
+ ) {
+ if (-d "$CTAN/$dir") {
+ $ctan_dir = $dir;
+ last;
+ }
}
- }
-
- # names totally dissimilar
- $ctan_dir = "fonts/fourier-GUT" if $me eq "fourier";
- $ctan_dir = "info/biblio" if $me eq "beebe";
- $ctan_dir = "info/italian/amsldoc" if $me eq "amsldoc-it";
- $ctan_dir = "info/italian/amsthdoc" if $me eq "amsthdoc-it";
- $ctan_dir = "info/tex-references" if $me eq "tex-refs";
- $ctan_dir = "language/basque" if $me eq "hyphen-basque";
- $ctan_dir = "language/devanagari/velthuis" if $me eq "devanagr";
- $ctan_dir = "language/hyphenation" if $me eq "hyphen-german";
- $ctan_dir = "language/hyphenation/elhyphen" if $me eq "hyphen-greek";
- $ctan_dir = "macros/latex/contrib/misc" if $me eq "ltxmisc";
- $ctan_dir = "macros/generic" if $me eq "genmisc";
- # do last, for sake of subdirs above.
- $ctan_dir = "language/hyphenation"
- if $me =~ /^hyphen-/ && ! $ctan_dir;
+ # names totally dissimilar
+ $ctan_dir = "fonts/fourier-GUT" if $me eq "fourier";
+ $ctan_dir = "info/biblio" if $me eq "beebe";
+ $ctan_dir = "info/italian/amsldoc" if $me eq "amsldoc-it";
+ $ctan_dir = "info/italian/amsthdoc" if $me eq "amsthdoc-it";
+ $ctan_dir = "info/tex-references" if $me eq "tex-refs";
+ $ctan_dir = "language/basque" if $me eq "hyphen-basque";
+ $ctan_dir = "language/devanagari/velthuis" if $me eq "devanagr";
+ $ctan_dir = "language/hyphenation" if $me eq "hyphen-german";
+ $ctan_dir = "language/hyphenation/elhyphen" if $me eq "hyphen-greek";
+ $ctan_dir = "macros/latex/contrib/misc" if $me eq "ltxmisc";
+ $ctan_dir = "macros/generic" if $me eq "genmisc";
+ # do last, for sake of subdirs above.
+ $ctan_dir = "language/hyphenation"
+ if $me =~ /^hyphen-/ && ! $ctan_dir;
+ }
+
print "$CTAN/$ctan_dir\n" if $ctan_dir;
return $ctan_dir ? 0 : 1;
}
-# this was the inverse code from ctan2tl, saving for a while until i get
-# a better grip.
-## case "$pkg" in
-## biblio) pkg=beebe;;
-## fourier-GUT) pkg=fourier;;
-## generic) pkg=genmisc;; # $ctan/macros/generic
-## ha-prosper) pkg=HA-prosper;;
-## misc) pkg=ltxmisc;; # until we do real misc package.
-## tex-references) pkg=tex-refs;;
-## velthuis) pkg=devanagr;;
-## voss) pkg=voss-de;;
-## esac
-##
-## # lshort is arranged by language.
-## pkgdir=`dirname $ctan_dir1`
-## up=`basename $pkgdir`
-## test "$up" = lshort && pkg=lshort-$pkg
-##
-## # esint is split into two.
-## test "$pkg" = esint && test "$up" = ps-type1 && pkg=esint-type1
-##
-## # vntex, powerdot, lh aare in unpacked subdirs.
-## test "$pkg" = unpacked && test "$up" = vntex && pkg=vntex
-## test "$pkg" = distrib && test "$up" = powerdot && pkg=powerdot
-## test "$pkg" = texmf && test "$up" = lh && pkg=lh
-##
-## # powerdot-doc-vn is a couple subdirs down.
-## test "$pkg" = doc-vn && test "$up" = contrib && pkg=powerdot-doc-vn
-##
-## # amslatex/vietnamese.
-## test "$pkg" = vietnamese && test "$up" = amslatex && pkg=amsldoc-vn
+
+# look up ctan path for given package name in catalogue entry.
+# xml is too hard to parse, so just look for the <ctan path...> entry.
+# Sometimes there is a single file, but worry about that later.
+#
+# Return the ctan path if found (without leading /), or undef.
+#
+sub catalogue_find_ctan_path
+{
+ my ($pkgname) = @_;
+
+ my $firstchar = substr ($pkgname, 0, 1);
+ my $catfile = "$CATALOGUE/$firstchar/$pkgname.xml";
+ return undef unless -r $catfile;
+
+ my $ctan_path = `sed -n -e "s,'/>,," -e "s,^ *<ctan path='/,,p" $catfile`;
+ return undef unless $ctan_path;
+ chomp ($ctan_path);
+ return $ctan_path;
+}