summaryrefslogtreecommitdiff
path: root/Build/tools
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-05-16 15:40:15 +0000
committerKarl Berry <karl@freefriends.org>2007-05-16 15:40:15 +0000
commite8545dcc82770a4c1ae68195c604918545d5dab5 (patch)
tree385d9038dc3e47b85092fc530f9b0b5f05ca5f69 /Build/tools
parent05e9c729f7f69025d3a68dbca99ebec7b319258b (diff)
(catalogue_find_ctan_path): handle single-file case.
git-svn-id: svn://tug.org/texlive/trunk@4296 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/tools')
-rwxr-xr-xBuild/tools/tlpkginfo49
1 files changed, 35 insertions, 14 deletions
diff --git a/Build/tools/tlpkginfo b/Build/tools/tlpkginfo
index 8d4bce66c68..c4ffed26a1f 100755
--- a/Build/tools/tlpkginfo
+++ b/Build/tools/tlpkginfo
@@ -1,14 +1,14 @@
#!/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.
+# We use local copies of CTAN and the TeX Catalogue.
#
exit (&main ());
sub main
{
$CTAN = $ENV{"CTAN"} || "/home/ftp/tex-archive";
+ $TMPDIR = $ENV{"TMPDIR"} || "/tmp";
$CATALOGUE = $ENV{"TEX_CATALOGUE"} || "/home/httpd/html/catalogue/entries";
-d "$CATALOGUE/k"
|| die "$0: TEX_CATALOGUE ($CATALOGUE) must point to entries/ subdir"
@@ -119,7 +119,10 @@ sub find_ctan_dir
if $me =~ /^hyphen-/ && ! $ctan_dir;
}
- print "$CTAN/$ctan_dir\n" if $ctan_dir;
+ # prepend ctan root if not an absolute dir (this happens when we make
+ # a temp dir).
+ $ctan_dir = "$CTAN/$ctan_dir" if $ctan_dir =~ m,^[^/],;
+ print "$ctan_dir\n" if $ctan_dir;
return $ctan_dir ? 0 : 1;
}
@@ -142,16 +145,34 @@ sub catalogue_find_ctan_path
my $ctan_path = `sed -n "s,^ *<ctan path='/,,p" $catfile`;
return undef unless $ctan_path; # in case it's not present at all
- # if it's just a single file, we aren't prepared to deal with it.
- # ifxetex, for example, is given as a single file even though it has
- # its own directory, so we find it with the code above. (The
- # Catalogue maintainers do not consider this a problem for various reasons.)
- return undef if $ctan_path !~ /\.bst/ && $ctan_path =~ /file='true'/;
-
- # ok, we will use the ctan path. chop off any options, etc.
- $ctan_path =~ s,'/>,,;
- $ctan_path =~ s,' .*,,;
- chomp ($ctan_path);
+ # extract just the dir or file name, without options, etc.
+ (my $ctan_loc = $ctan_path) =~ s,'/>,,;
+ $ctan_loc =~ s,' .*,,;
+ chomp ($ctan_loc);
+
+ # if the Catalogue lists the path as a single file, there are two
+ # possibilities: (1) it really is a single file, e.g., texilikecover,
+ # in which case we copy that file into a temp dir and return that temp
+ # dir; (2) it is actually in its own directory, e.g., ifxetex, in
+ # which case we return undef here and let the code above find it.
+ # (The Catalogue maintainers do not consider this a problem for
+ # various reasons.)
+ #
+ if ($ctan_path =~ /file='true'/) {
+ return undef if $ctan_path =~ m,/$pkgname/,; # pkg dir somewhere in path
+
+ # ok, we will copy to temp dir.
+ my $pkgdir = "$TMPDIR/tl.$pkgname";
+ system ("rm -rf $pkgdir");
+ mkdir ($pkgdir, 0777);
+
+ unless (system ("cp -p '$CTAN/$ctan_loc' '$pkgdir/'") == 0) {
+ warn "$0: copy of $CTAN/$ctan_loc to $pkgdir failed.\n";
+ return undef;
+ }
+ return $pkgdir;
+ }
- return $ctan_path;
+ # ok, we will use the ctan path.
+ return $ctan_loc;
}