#!/bin/sh # $Id$ # Public domain. Originally written 2005, Karl Berry. # # Attempt to push a package from CTAN into TL. unset CDPATH # avoid extraneous output mydir=`cd \`dirname $0\` && pwd` # Master/tlpkg/bin PATH=$mydir:$PATH # we call lots of our other tools Build=`cd $mydir/../../../Build && pwd` raw=$Build/tmp.raw test -d $raw || mkdir $raw cd $raw || exit 1 if test "x$1" = x--help; then echo "Usage: $0 [--place] [--no-ctan] TLPKGNAME" echo echo "Install a package from CTAN into TeX Live." echo echo "--place execute place to do repository adds/removes." echo "--no-ctan if already have files in Build/tmp.raw/PKG." echo echo "This never actually commits anything to the repository." echo "Without --place, it doesn't even touch anything in the repository" echo "outside of Build/tmp.{raw,cooked}." echo echo "Read and understand http://tug.org/texlive/pkgupdate.html" echo "before running this." exit 0 fi if test "x$1" = x--place; then place_chicken= shift else place_chicken=-n fi if test "x$1" = x--no-ctan; then copy_from_ctan=false shift else copy_from_ctan=true fi pkg=$1 if test -z "$pkg"; then echo "$0: no TL package name specified." >&2 exit 1 fi 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 $pkg" echo "$0: is $ctan_dir1" if egrep " $pkg"'( |$)' $mydir/tlpkg-ctan-check >/dev/null; then :; else echo echo "*** $0: $pkg not in $mydir/tlpkg-ctan-check, add?" fi # 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 # 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 $ctan_dir1/* '(' -type d -o -type l ')' -prune -o \ '(' -name '*.sty' -o -name *.tex ')' -print` \ $pkg else # normal case (/. to deref symlinks, e.g., arabtex) cp -pr $ctan_dir1/. $pkg fi fi # end of copying from CTAN. # printf "\n$0: calling ctan2tds\n" cooked=$Build/tmp.cooked rm -rf $cooked/$pkg test -d $cooked || mkdir $cooked ctan2tds --ctan-dir=$ctan_dir1 $pkg || exit 1 cd $cooked || exit 1 printf "\n\f cooked\n" find -depth -type d | xargs rmdir 2>/dev/null # remove empty directories find $pkg \! -type d -printf "%TY%Tm%Td.%TH%TM %p\n" | sort -r -k1 printf "\n$0: calling place $place_chicken $pkg\n" rm -rf $pkg.done place $place_chicken $pkg status=$? $copy_from_ctan && rm -rf $raw/$pkg exit $status