summaryrefslogtreecommitdiff
path: root/Build/tools
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-05-30 17:48:45 +0000
committerKarl Berry <karl@freefriends.org>2006-05-30 17:48:45 +0000
commit60b30f94ad3de107dc47f344365cfbe5915b6044 (patch)
tree93db8b30cb0caeff3750a07f93af751e8194374d /Build/tools
parent2534976919d6181d8269b184da08b1ae425b9dd3 (diff)
extract ctan-dir-finding to a common subprogram
git-svn-id: svn://tug.org/texlive/trunk@1621 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/tools')
-rwxr-xr-xBuild/tools/ctan2tl53
-rwxr-xr-xBuild/tools/tlpkginfo131
-rwxr-xr-xBuild/tools/tpm-ctan-check90
3 files changed, 162 insertions, 112 deletions
diff --git a/Build/tools/ctan2tl b/Build/tools/ctan2tl
index 5545a7e8099..6047a4b7342 100755
--- a/Build/tools/ctan2tl
+++ b/Build/tools/ctan2tl
@@ -5,14 +5,16 @@
# Initial attempt at pushing a ctan directory into TL.
# See ./README for a bit more info.
#
-# Basic usage: ctan2tl /path/to/ctan/package
+# Basic usage: ctan2tl TLPKGNAME
# --place to include final `place' invocation (repository adds/removes).
# --no-ctan if already have files in ../cdbuild/raw/PKG.
# Unlikely to work without GNU utilities.
#
-# This does not actually commit anything to the repository.
+# This does not actually commit anything to the repository. Without
+# --place, it doesn't even create any files in the repository outside of
+# cdbuild/{raw,cooked}.
-mydir=`dirname $0` # Build/tools
+mydir=`cd \`dirname $0\` && pwd` # Build/tools
raw=$mydir/../cdbuild/raw
test -d $raw || mkdir $raw
cd $raw || exit 1
@@ -31,47 +33,20 @@ else
copy_from_ctan=true
fi
-if test ! -d $1; then
- echo "$0: $1 not a (CTAN) directory." >&2
+pkg=$1
+if test -z "$pkg"; then
+ echo "$0: no TL package name specified." >&2
exit 1
fi
-# xx this should be a separate script, also used by tpm-ctan-check.
-ctan_dir1=$1
-pkg=`basename $1`
+ctan_dir1=`tlpkginfo --ctan-dir $pkg`
+if test -z "$ctan_dir1"; then
+ echo "$0: can't find CTAN directory for $pkg." >&2
+ exit 1
+fi
+echo "$0: ctan dir for $1 is $ctan_dir1"
if $copy_from_ctan; then
-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 is in an unpacked subdir.
-test "$pkg" = unpacked && test "$up" = vntex && pkg=vntex
-
-# similarly for powerdot.
-test "$pkg" = distrib && test "$up" = powerdot && pkg=powerdot
-
-# 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
-
# annoyingly, tugboat plain and tugboat latex are stored in two
# different places on ctan. we'll assume we're invoked with the latex
# dir, and now arrange to also copy in the plain stuff to a `plain'
diff --git a/Build/tools/tlpkginfo b/Build/tools/tlpkginfo
new file mode 100755
index 00000000000..0fde8a13af3
--- /dev/null
+++ b/Build/tools/tlpkginfo
@@ -0,0 +1,131 @@
+#!/usr/bin/env perl
+# $Id$
+# Return information given a TL package name (i.e., a tpm file name).
+# Currently just the ctan directory for package, but maybe we'll do more
+# later.
+#
+exit (&main ());
+
+sub main
+{
+ $CTAN = $ENV{"CTAN"} || "/home/ftp/tex-archive";
+ if ($ARGV[0] eq "--ctan-dir") {
+ return &find_ctan_dir ($ARGV[1]);
+ } else {
+ die "$0: only know about --ctan-dir PKGNAME.\n";
+ }
+}
+
+
+#
+# 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.
+#
+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 = "";
+
+ 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/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/gothic/$me", # blacklettert1
+ "fonts/cyrillic/$me/texmf", # lh
+ "fonts/greek/$me", # lfb
+ "fonts/ps-type1/$me", # cm-super
+ "fonts/ps-type1/$menotype1", # esint-type1
+ "fonts/utilities/$me", # accfonts
+ "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;
+
+ 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
+
diff --git a/Build/tools/tpm-ctan-check b/Build/tools/tpm-ctan-check
index 8e4b18a2b40..fe01316c524 100755
--- a/Build/tools/tpm-ctan-check
+++ b/Build/tools/tpm-ctan-check
@@ -3,8 +3,8 @@
# Public domain. Originally written 2005, Karl Berry.
# Check if a package in TL has any changes on CTAN. Just the beginnings.
-$CTAN = $ENV{"CTAN"} || "/home/ftp/tex-archive";
chomp (my $mydir = `dirname $0`);
+chomp ($mydir = `cd $mydir && pwd`);
chomp ($TL = `cd $mydir/../../Master && pwd`);
chdir ($TL) || die "chdir($TL) failed: $!";
@@ -41,7 +41,7 @@ sub main
"genmisc", "glossary", "gost", "graphics", "graphicx-psmin",
"hyphen-base", "hyphen-basque", "hyphen-german", "hyphen-greek",
"hyphen-norwegian", "hyphen-ukenglish", "hyphen-usorbian",
- "ibygrk", "iopart-num",
+ "ibygrk", "iopart-num", "itamsldoc",
"koma-script",
"labelcase", "ledmac", "lewis", "lfb", "lh", "lineno",
"lshort-bulgarian", "lshort-dutch", "lshort-english",
@@ -113,10 +113,11 @@ sub do_tpm
my $needed = 0;
my %tpm = &read_tpm ($tpm);
+ my @tpm_files = @{$tpm{"files"}};
my @compared = ();
-
- for my $file (@{$tpm{"files"}}) {
+ for my $file (@tpm_files) {
+#warn "checking file $file\n";
my $tl_file = "$TL/$file";
if (! -e $tl_file) {
warn "$tl_file: TL file missing\n";
@@ -124,15 +125,17 @@ sub do_tpm
}
(my $basefile = $file) =~ s,^.*/,,;
- chomp (my @ctan_files = `find $CTAN/$tpm{CTANDir}/ -name $basefile`);
+ chomp (my @ctan_files = `find $tpm{CTANdir}/ -name $basefile`);
+#warn "ctan find $basefile: @ctan_files\n";
# the trailing / is so if we happen to hit a symlink on CTAN, it'll
# go through.
next if @ctan_files > 1; # if more than one file by same name, skip
my $ctan_file = $ctan_files[0];
+#warn "ctan file is $ctan_file\n";
if (! -e $ctan_file) {
# maybe it'll be there with a case change in the name
- chomp (@ctan_files = `find $CTAN/$tpm{CTANDir}/ -iname $basefile`);
+ chomp (@ctan_files = `find $tpm{CTANdir}/ -iname $basefile`);
next if @ctan_files > 1; # if more than one file by same name, skip
$ctan_file = $ctan_files[0];
@@ -146,9 +149,9 @@ sub do_tpm
push (@compared, $basefile);
if (&files_differ ($tl_file, $ctan_file)) {
- # we mostly regenerate pdf's for TL (sebastian thinks we should :), so
- # don't complain if they are different. On the other hand, we
- # don't always regenerate them, so might as well check first.
+ # we sometimes regenerate pdf's for TL, so we don't complain if
+ # they are different. On the other hand, we don't always
+ # regenerate them, so might as well check first.
next if $tl_file =~ /\.pdf$/;
print "# $tpm\ndiff $ctan_file $tl_file\n";
@@ -160,7 +163,8 @@ sub do_tpm
# xx check ctan dir for new files
if (@compared == 0) {
- warn "\n$tpm: no files to compare in $CTAN/$tpm{CTANDir}, fixme!\n";
+ warn "\n$tpm: no files to compare in $tpm{CTANdir}, fixme!\n";
+ warn "(tpm_files = @tpm_files)\n";
} elsif ($needed == 0) {
print "ok, " . (@compared + 0) . " compared (@compared)\n"
if $OPT{"verbose"};
@@ -203,70 +207,10 @@ sub read_tpm
(my $me = $tpm) =~ s,.*/,,;
$me =~ s/\.tpm$//;
+ chomp (my $ctan_dir = `$mydir/tlpkginfo --ctan-dir '$me'`);
- (my $menobin = $me) =~ s,^bin-,,;
- (my $menodash = $me) =~ s,^.*-,,;
- (my $menopowerdot = $me) =~ s,^powerdot-,,;
- (my $menotype1 = $me) =~ s,-type1$,,;
-
- # xx how to really figure this out?
- 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/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/gothic/$me", # blacklettert1
- "fonts/cyrillic/$me/texmf", # lh
- "fonts/greek/$me", # lfb
- "fonts/ps-type1/$me", # cm-super
- "fonts/ps-type1/$menotype1", # esint-type1
- "fonts/utilities/$me", # accfonts
- "biblio/bibtex/contrib/$me", # dk-bib
- ) {
- if (-d "$CTAN/$dir") {
- $ret{"CTANDir"} = $dir;
- last;
- }
- }
-
- # names totally dissimilar
- $ret{"CTANDir"} = "fonts/fourier-GUT" if $me eq "fourier";
- $ret{"CTANDir"} = "info/biblio" if $me eq "beebe";
- $ret{"CTANDir"} = "info/tex-references" if $me eq "tex-refs";
- $ret{"CTANDir"} = "language/basque" if $me eq "hyphen-basque";
- $ret{"CTANDir"} = "language/devanagari/velthuis" if $me eq "devanagr";
- $ret{"CTANDir"} = "language/hyphenation" if $me eq "hyphen-german";
- $ret{"CTANDir"} = "language/hyphenation/elhyphen" if $me eq "hyphen-greek";
- $ret{"CTANDir"} = "macros/latex/contrib/misc" if $me eq "ltxmisc";
- $ret{"CTANDir"} = "macros/generic" if $me eq "genmisc";
-
- # do last, for sake of subdirs above.
- $ret{"CTANDir"} = "language/hyphenation"
- if $me =~ /^hyphen-/ && ! $ret{"CTANDir"};
-
- die "$0: no CTAN directory for $me\n" if ! exists $ret{"CTANDir"};
+ die "$0: no CTAN directory for $me\n" if ! $ctan_dir;
+ $ret{"CTANdir"} = $ctan_dir;
return %ret;
}