diff options
Diffstat (limited to 'Build/tools/ctan2tl')
-rwxr-xr-x | Build/tools/ctan2tl | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/Build/tools/ctan2tl b/Build/tools/ctan2tl new file mode 100755 index 00000000000..05eeaee2212 --- /dev/null +++ b/Build/tools/ctan2tl @@ -0,0 +1,124 @@ +#!/bin/sh +# $Id: //depot/Master/Tools/ctan2tl#23 $ +# Public domain. Originally written 2005, Karl Berry. +# +# Takes a ctan directory, pushes it into TL. Just an initial attempt. +# --no-place to avoid final place invocation (p4 operations). +# See ./README for a bit more info. + +mydir=`dirname $0` # Master/Tools +cd $mydir/../../Build/cdbuild/raw || exit 1 + +if test "x$1" = x--place; then + place=true + shift +else + place=false +fi + +if test "x$1" = x--no-ctan; then + copy_from_ctan=false + shift +else + copy_from_ctan=true +fi + +if test ! -d $1; then + echo "$0: $1 not a directory." >&2 + exit 1 +fi + +# xx this should be a separate script, also used by tpm-ctan-check. +pkg=`basename $1` + +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 $1` +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 + + +# remove whatever old stuff we might have. +rm -rf $pkg + +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 + cp -p \ + `find $1/* '(' -type d -o -type l ')' -prune -o \ + '(' -name '*.sty' -o -name *.tex ')' -print` \ + $pkg +else + # normal case + cp -pr $1 $pkg +fi + +fi # end of copying from CTAN. + + +printf "\n\f ctan2tds\n" +rm -rf ../cooked/$pkg +test -d ../cooked || mkdir ../cooked +../ctan2tds.pl $pkg || exit 1 + +cd ../cooked || exit 1 +printf "\n\f cooked\n" +find -depth -type d | xargs rmdir 2>/dev/null +find $pkg \! -type d -printf "%TY%Tm%Td.%TH%TM %p\n" | sort +1 + +# compare to tpm. +Master=../../../Master +tpmfile=`ls $Master/texmf*/tpm/$pkg.tpm 2>/dev/null` +if test -z "$tpmfile"; then + echo "$0: no tpm file for $pkg in `cd $Master; pwd`." >&2 +else + printf "\n\f compared to current tpm $tpmfile\n" + rm -f /tmp/pkgfiles.* + # remove leading text in case of lines starting with texmf. + # Then assume all actual files do start with texmf. + sed -n -e '/TPM:.*Files/,$s,^texmf,./texmf,p' $tpmfile \ + | grep -v '\.tpm$' \ + | sort >/tmp/pkgfiles.tpm + # + # list of files in the new package we've just cooked. + (cd $pkg && find \! -type d -print) | grep -v '/cooked/' \ + | sort >/tmp/pkgfiles.tl + # + comm -3 /tmp/pkgfiles.tpm /tmp/pkgfiles.tl +fi + +$place || exit 0 + +printf "\n\f place\n" +rm -rf $pkg.done +../place $pkg +p4 revert -a + +rm -rf ../raw/$pkg |