diff options
Diffstat (limited to 'Master')
-rwxr-xr-x | Master/tlpkg/bin/ctan2tds | 4 | ||||
-rwxr-xr-x | Master/tlpkg/bin/ctan2tl | 34 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 6 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkginfo | 126 |
4 files changed, 93 insertions, 77 deletions
diff --git a/Master/tlpkg/bin/ctan2tds b/Master/tlpkg/bin/ctan2tds index 18eca61487f..a5563883380 100755 --- a/Master/tlpkg/bin/ctan2tds +++ b/Master/tlpkg/bin/ctan2tds @@ -55,10 +55,7 @@ chdir $startdir || die "chdir($startdir) failed: $!"; # back to raw 'algorithmicx',"&MAKEnosymlinks", 'allrunes', "&MAKEflatten", 'alphabib', "die 'skipping, shell script, and no doc source?'", - 'ams', "&MAKEamslatex", - 'amsmath', "&MAKEamslatex", 'amsldoc-vn', "&MAKEflatten", - 'amsrefs', "&MAKEamslatex", 'antomega', "&MAKEflatten", 'antt', "&MAKEcopy", 'apacite', "&MAKEflatten", @@ -72,7 +69,6 @@ chdir $startdir || die "chdir($startdir) failed: $!"; # back to raw 'augie', "&MAKEaugie", 'aurical', "&MAKEaurical", 'aurora', "die 'skipping, nocommercial license'", - 'babel', "&MAKEcopy", # we use latex-tds/babel.zip 'bangtex', "&MAKEflatten", 'bardiag', "&MAKEbardiag", # bbm is split into bbm (fonts) and bbm-macros (macros) diff --git a/Master/tlpkg/bin/ctan2tl b/Master/tlpkg/bin/ctan2tl index 8f1f6896d31..600c7ff6f08 100755 --- a/Master/tlpkg/bin/ctan2tl +++ b/Master/tlpkg/bin/ctan2tl @@ -51,7 +51,7 @@ if test -z "$pkg"; then exit 1 fi -ctan_dir1=`tlpkginfo --ctan-dir-tds $pkg` +ctan_dir1=`tlpkginfo --prepare $pkg` if test -z "$ctan_dir1"; then echo "$0: can't find CTAN directory for $pkg." >&2 exit 1 @@ -70,37 +70,7 @@ if $copy_from_ctan; then # remove whatever dregs in raw that might be lying around. rm -rf $pkg -# An important special case: the latex-tds project contains tds-ready -# zip files for the base latex distribution and amslatex. -# We want to use them. -corelatex_tds_pkglist="babel|cyrillic|graphics|latex|psnfss|tools" -amslatex_tds_pkglist="ams|amsrefs|amsmath" # dup in tlpkginfo -latex_tds_pkglist="latex-tds|$amslatex_tds_pkglist|$corelatex_tds_pkglist" - -if echo "$pkg" | egrep "^($latex_tds_pkglist)\$" >/dev/null; then - mkdir $pkg - ctan_root=`tlpkginfo --ctan-root` - # - # complications: the latex-tds package, for our purposes, is the - # sources for the tools that do the process; that's in the zip file - # source.zip, in the latex-tds directory. Similarly, the zip file for - # latex itself is named "base.zip". Finally, amslatex.zip actually - # contains several packages (= directories) -- such as ams, amscls, - # etc. AMS sets it up that way. - # - if test $pkg = latex-tds; then - zipname=source.tds.zip - elif test $pkg = latex; then - zipname=base.tds.zip - elif echo "$pkg" | egrep "^($amslatex_tds_pkglist)\$" >/dev/null; then - zipname=amslatex.tds.zip - else - zipname=$pkg.tds.zip - fi - echo "$0: but overriding ctan dir with latex-tds/$zipname" - (cd $pkg && unzip -qq $ctan_root/macros/latex/contrib/latex-tds/$zipname) - -elif test "$pkg" = genmisc; then +if test "$pkg" = genmisc; then # do not copy subdirs, symlinks, or any files but .sty and .tex # (that is, no patch.doc or pmat.zip). mkdir -p $pkg diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 39bca88e036..03997643f44 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -259,7 +259,7 @@ sub do_tlp return 1; } - chomp (my $ctan_dir = `$mydir/tlpkginfo --ctan-dir-tds '$tlpn'`); + chomp (my $ctan_dir = `$mydir/tlpkginfo --prepare '$tlpn'`); if (! $ctan_dir) { warn "$0: oops, no CTAN directory for $tlpn, fix fix\n"; return (); @@ -309,7 +309,7 @@ sub do_tlp # regenerate them, so might as well check first. next if $tl_file =~ /\.pdf$/; - print "# $tpm\ndiff $ctan_file $tl_file\n"; + print "# $tlpn\ndiff $ctan_file $tl_file\n"; $needed = 1; last; } @@ -318,7 +318,7 @@ sub do_tlp # xx check ctan dir for new files if (@compared == 0) { - warn "\n$tpm: no files to compare in $ctan_dir, fixme!\n"; + warn "\n$tlpn: no files to compare in $ctan_dir, fixme!\n"; warn "(tpm_files = @tpm_files)\n"; } elsif ($needed == 0) { print "ok, " . (@compared + 0) . " compared (@compared)\n" diff --git a/Master/tlpkg/bin/tlpkginfo b/Master/tlpkg/bin/tlpkginfo index ea9eb27d462..c21a2ddf255 100755 --- a/Master/tlpkg/bin/tlpkginfo +++ b/Master/tlpkg/bin/tlpkginfo @@ -16,28 +16,40 @@ sub main || die "$0: TEX_CATALOGUE ($CATALOGUE) must point to entries/ subdir" . " of a TeX Catalogue checkout.\n"; + # special packages from latex-tds project (used by prepare()) + $corelatex_tds_pkgs = "babel|cyrillic|graphics|latex|psnfss|tools"; + $amslatex_tds_pkgs = "ams|amsrefs|amsmath"; # for tlpsrc_find_catalogue() too + $latex_tds_pkgs = "latex-tds|$amslatex_tds_pkgs|$corelatex_tds_pkgs"; + $latex_tds_dir = "$CTAN/macros/latex/contrib/latex-tds"; + + # erroneous tds files (warn Robin about them) + $erroneus_tds = "lcyw"; # list format: pkg1|pkg2|etc + if ($ARGV[0] eq "--ctan-dir") { - return &find_ctan_dir ($ARGV[1]); + my $output = &find_ctan_dir ($ARGV[1]); + print "$output\n"; + return $output ? 0 : 1; - } elsif ($ARGV[0] eq "--ctan-dir-tds") { - $want_tds = 1; - return &find_ctan_dir ($ARGV[1]); + } elsif ($ARGV[0] eq "--prepare") { + my $output = &prepare ($ARGV[1]); + print "$output\n"; + return $output ? 0 : 1; } elsif ($ARGV[0] eq "--ctan-root") { print "$CTAN\n"; return 0; } else { - die "Usage: $0 --ctan-dir[-tds] PKGNAME or --ctan-root (not \"@ARGV\").\n"; + die "Usage: $0 --ctan-dir PKGNAME or --prepare PKGNAME + or --ctan-root (not \"@ARGV\").\n"; } } - # # Return 0 for success if we find a path (and print it on stdout), else # return 1. # -sub find_ctan_dir +sub find_ctan_dir { my ($me) = @_; return 1 unless $me; @@ -45,12 +57,9 @@ sub find_ctan_dir # use explicit catalogue name if given in tlpsrc. $me = &tlpsrc_find_catalogue ($me) || $me; - # regrettably, this list of amslatex packages is duplicated in ctan2tl. - # unavoidable since ctan throws them all together, but we don't want - # to, to preserve the package-per-directory name. - if ($me =~ /^(ams|amsrefs|amsmath)$/) { - $me = "amslatex"; - } + # ctan (and latex-tds) bundles all ams packages together, + # but we use separate tlp names + $me = "amslatex" if me =~ /^($amslatex_tds_pkgs)$/; # 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. @@ -131,8 +140,7 @@ sub find_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; + return $ctan_dir } @@ -180,21 +188,6 @@ sub catalogue_find_ctan_path $ctan_loc =~ s,' .*,,; chomp ($ctan_loc); - # if the package claims to have tds-ready .zip file, use it. - if ($want_tds) { - my $tds_path = "$CTAN/install/$ctan_loc.tds.zip"; - # don't use erroneous tds. - if (-s $tds_path && $pkgname !~ /^(lcyw)$/) { - $ctan_loc = ©_to_tmpdir ($pkgname, $tds_path); - # unzip it so that tlpkg-ctan-check has files to compare. - system ("unzip -q -a $ctan_loc/$pkgname.tds.zip -d $ctan_loc"); - # remove the zip and put a flag for ctan2tds to know. - system ("rm $ctan_loc/$pkgname.tds.zip"); - system ("touch $ctan_loc/TDS_READY"); - return $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 @@ -204,15 +197,73 @@ sub catalogue_find_ctan_path # various reasons.) # if ($ctan_path =~ /file='true'/) { - return $ctan_path =~ m,/$pkgname/, # pkg dir somewhere in path? - ? undef - : ©_to_tmpdir ($pkgname, "$CTAN/$ctan_loc"); + if ($ctan_path =~ m,/$pkgname/,) { # pkg dir somewhere in path? + return undef; + } else { + return $do_copy # are we called by prepare() or not? + ? ©_to_tmpdir ($pkgname, "$CTAN/$ctan_loc") + : "$CTAN/$ctan_loc"; + } } - # no tds.zip, not a single file, so use the regular ctan location. + # not a single file, so use the regular ctan location. return $ctan_loc; } +# +# Create a tmpdir with the tds-ready tree unpacked if any, +# else return the normal ctan dir. +# +sub prepare +{ + my ($pkg) = @_; + return undef unless $pkg; + + # find the real ctan dir and return it if our tds is erroneous + # (warn Robin Fairbairns about buggy tds zips) + $do_copy = 1; # ask find_catalogue() to copy single files, too + my $ctan_loc = &find_ctan_dir ("$pkg"); + return $ctan_loc if ($pkg =~ /^($erroneous_tds)$/); + + # tds path is usually in ctan/install... + my $tds_path = "$ctan_loc.tds.zip"; + $tds_path =~ s#^$CTAN#$CTAN/install#; + + # ...except for files in latex-tds... + if ($pkg =~ /^($latex_tds_pkgs)$/) { + $tds_path = "$latex_tds_dir/$pkg.tds.zip"; + # ...and some exceptions in latex-tds itself. + $tds_path = "$latex_tds_dir/source.tds.zip" if ($pkg eq "latex-tds"); + $tds_path = "$latex_tds_dir/base.tds.zip" if ($pkg eq "latex"); + $tds_path = "$latex_tds_dir/amslatex.tds.zip" + if ($pkg =~ /^($amslatex_tds_pkgs)$/); + } + + return $ctan_loc unless (-s $tds_path); + + # now we have a tds, so unzip it in a tmpdir + my $tmpdir = ©_to_tmpdir ($pkg); + system ("unzip -q -a $tds_path -d $tmpdir"); + # put a flag for ctan2tds' donormal() to work + system ("touch $tmpdir/TDS_READY"); + + # more problems with amsmath: we got all three packages together, + # we now have to remove the unwanted ones... + if ($pkg =~ /^($amslatex_tds_pkgs)$/) { + chdir ($tmpdir); + my @deldir = (); + # List of subsubdirectories, at the package level. + chomp (my @dirlist = `find */*/* -type d | sort -u`); + for my $dir (@dirlist) { + next if $dir =~ m!$pkg$!; # keep matching directories + push (@deldir, $dir); + } + system ("rm -rf @deldir"); # discard the rest + } + + return $tmpdir; +} + # copy file to temp dir and return that for ctan2tl to use. # sub copy_to_tmpdir @@ -224,10 +275,9 @@ sub copy_to_tmpdir mkdir ($pkgdir, 0777); # warn "$0: copying single file $src\n"; - unless (system ("cp -p '$src' '$pkgdir/'") == 0) { - warn "$0: copy of $src to $pkgdir failed?!\n"; - return undef; - } + + system ("cp -p '$src' '$pkgdir/'") if $src; return $pkgdir; } + |