diff options
Diffstat (limited to 'Master/tlpkg/bin')
-rwxr-xr-x | Master/tlpkg/bin/htmltext | 23 | ||||
-rwxr-xr-x | Master/tlpkg/bin/svnchangelog | 97 | ||||
-rwxr-xr-x | Master/tlpkg/bin/svnchangelog.sed | 43 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tl-update-auto | 179 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tl-update-docindex | 167 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tl-update-lsr | 22 |
6 files changed, 531 insertions, 0 deletions
diff --git a/Master/tlpkg/bin/htmltext b/Master/tlpkg/bin/htmltext new file mode 100755 index 00000000000..c41eb2490fe --- /dev/null +++ b/Master/tlpkg/bin/htmltext @@ -0,0 +1,23 @@ +#!/bin/sh +# $Id$ +# Public domain. Originally written 2003, Karl Berry. +# Dump a url (or -stdin) to text using lynx. + +PATH=/usr/local/bin:$PATH + +HOME=/tmp; export HOME +TERM=vt100; export TERM +: ${LYNX_CFG=/home/tug/.lynxcfg}; export LYNX_CFG +# just contains the line JUSTIFY:FALSE. + +test $# -eq 0 && set - -stdin + +for url in "$@"; do + # when we add -width=79, tables are formatted badly. + # -dump lists url's like this with -stdin (lynx 2.8.4, linux): + # file://localhost/tmp/89inmk/FAQ/german + # Since the reference list is useful, we fix it up by hand instead of + # using -nolist. + lynx -dump -nocolor -hiddenlinks=ignore "$url" \ + | sed 's,file://localhost/tmp/[a-zA-Z0-9]*/,,' +done diff --git a/Master/tlpkg/bin/svnchangelog b/Master/tlpkg/bin/svnchangelog new file mode 100755 index 00000000000..930751fe629 --- /dev/null +++ b/Master/tlpkg/bin/svnchangelog @@ -0,0 +1,97 @@ +#!/bin/sh +# $Id$ +# Public domain. Originally written 2004, Karl Berry. +# Get change info from svn log. (see now-deleted p4changelog for the +# previous code using p4.) + +umask 0 + +debug=true +chicken=${OVERRIDE_CHICKEN-false} + +# to get started, ran svn log and put the first thousand changes in log. + +mydir=`dirname $0` # Build/tools +outdir=`cd $mydir/../logs && pwd` +outfile=$outdir/svnlog +test ! -f $outfile && exit 2 # error probably given by the cd + +# get the revision number we last logged +line=`grep '^r[0-9]' $outfile | head -1 | sed 's/^r//'` +lastlogged=`echo "$line" | awk '{print $1}'` +echo "$lastlogged" | egrep '^[0-9]+$' >/dev/null \ +|| { echo "$0: no change number in r line of $outfile: $line"; + exit 1; } + +nextneeded=`expr $lastlogged + 1` +$debug && echo "lastlogged=$lastlogged, nextneeded=$nextneeded" +if test -z "$nextneeded"; then + echo "$0: empty nextneeded?!" + exit 1 +fi + +# get the log info since then. +tlroot=`cd $mydir/../.. && pwd` +newlogs=$outdir/newlogdata +svn log -v -r HEAD:$nextneeded $tlroot >$newlogs || exit 1 +# with HEAD:next we get the entries newest first, as we want them. +$debug && ls -l $newlogs + +line=`grep '^r[0-9]* |' $newlogs | head -1 | sed 's/^r//'` +latestchange=`echo "$line" | awk '{print $1}'` +$debug && echo "latestchange=$latestchange" +if test -z "$latestchange"; then + echo "$0: empty latestchange?!" + exit 1 +fi + +# done if nothing submitted since last change. +# or if only one commit has been made, because we ourselves do a commit, +# so otherwise we'd add a useless entry every time we're run. +test $latestchange -le $nextneeded && exit 0 + +# rotate logs if crossed a 1000-change mark. +rotate=false +for c in `seq $latestchange -1 $nextneeded`; do + echo $c | grep '001$' >/dev/null && rotate=true +done +$debug && echo "rotate=$rotate" + +if ! $chicken && $rotate; then + mv -v $outfile $outfile.$lastlogged + gzip -v $outfile.$lastlogged + chmod 444 $outfile.$lastlogged.gz + ls -l $outfile.$lastlogged.gz + svn add $outfile.$lastlogged.gz + cp /dev/null $outfile +fi + +# prepend new changes to current log, and put log messages first. +$mydir/svnchangelog.sed $newlogs >$outfile.new +cat $outfile >>$outfile.new + +if $debug; then # really debug + # show first and last change number in each file. + for f in $newlogs $outfile $outfile.new; do + echo + (cd `dirname $f` && ls -l `basename $f`) + grep '^r[0-9]* |' $f | head -1 + grep '^r[0-9]* |' $f | tail -1 + done +fi + + +if ! $chicken; then + mv $outfile.new $outfile + echo "svn commit..." + svn commit -m"regenerated by $0" $outdir +fi + +$mydir/svnchangelog.sed $newlogs # show it to me +rm -f $newlogs $outfile.new + +exit 0 + +# to get things started: +svn log -v -r 1000:1 /home/texlive/trunk/ >svnlog +svn add svnlog diff --git a/Master/tlpkg/bin/svnchangelog.sed b/Master/tlpkg/bin/svnchangelog.sed new file mode 100755 index 00000000000..699cacce1f9 --- /dev/null +++ b/Master/tlpkg/bin/svnchangelog.sed @@ -0,0 +1,43 @@ +#! /bin/sed -nf +# $Id$ +# Written by Werner Lemberg, 25may06. Public domain. +# svn log outputs the paths first, then the log message. This sed +# script reverses that. + +:main +/------------------------------------------------------------------------/ { + p + n + /r[0-9][0-9]* / { + p + n + /^Changed paths:$/ { + h + n + + :loop1 + /^$/! { + H + n + bloop1 + } + + :loop2 + /------------------------------------------------------------------------/! { + p + n + bloop2 + } + + i\ + + x + p + g + bmain + } + } + bmain +} + +p diff --git a/Master/tlpkg/bin/tl-update-auto b/Master/tlpkg/bin/tl-update-auto new file mode 100755 index 00000000000..24a98a46c32 --- /dev/null +++ b/Master/tlpkg/bin/tl-update-auto @@ -0,0 +1,179 @@ +#!/bin/sh +# $Id$ +# Public domain. Originally written 2003, Karl Berry. +# +# Deal with files that are automatically updated in one way or another. +# New files need to be added manually, doesn't happen often enough. + +PATH=/usr/local/bin:$PATH; export PATH +umask 0 + +chicken=echo +chicken= +cp="cp -fv" +diff="diff -U 2" + +tools=`cd \`dirname $0\` && /bin/pwd` + +# most stuff is in Master. +Master=`cd $tools/../../Master && /bin/pwd` +cd $Master || exit 1 + +temp=/tmp/ua$$ +trap "rm -f $temp*" 0 1 2 15 + +update_list= + +# autogenerate README.EN from readme.html. +# +$tools/htmltext <readme.en.html >$temp +if $diff README.EN $temp >$temp.en.diff; then + echo " README.EN ok." +else + echo "will update README.EN." + $chicken $cp $temp README.EN + update_list="$update_list README.EN" +fi + + +# English FAQ from ctan mirror on tug.org. +# +faqmaster=/home/ftp/tex-archive/help/uk-tex-faq +faqslave=texmf-doc/doc/english/FAQ-en +for f in $faqmaster/*; do + # ignore some of the generated files + echo $f | egrep '(tar.gz|dvi|ps|letterfaq.pdf)$' >/dev/null \ + && continue + + basef=`basename $f` + faqslavef=$faqslave/$basef + if $diff $faqslavef $f >$temp.$basef.diff; then + echo " $faqslavef ok." + else + $chicken $cp $f $faqslavef + update_list="$update_list $faqslavef" + fi +done +# for now, don't bother auto-updating the html files. + + +# modes.mf from elsewhere on tug.org. +# +modesmaster=/home/ftp/tex/modes.mf +modesslave=texmf-dist/metafont/misc/modes.mf +# +if $diff $modesslave $modesmaster >$temp.modes.diff; then + echo " $modesslave ok." +else + $chicken $cp $modesmaster $modesslave + update_list="$update_list $modesslave" +fi + + +# texinfo.tex from elsewhere on tug.org. +# +tximaster=/home/ftp/tex/texinfo.tex +txislave=texmf-dist/tex/texinfo/texinfo.tex +# +if $diff $txislave $tximaster >$temp.txi.diff; then + echo " $txislave ok." +else + $chicken $cp $tximaster $txislave + update_list="$update_list $txislave" +fi + + +# fontname from elsewhere on tug.org. +# +fontnamemaster=/home/httpd/html/fontname +fontnamedocslave=texmf-dist/doc/fontname +# +for basef in ChangeLog Makefile bitstrea.aka \ + fontname.pdf fontname.html fontname.texi; do + fontnameslavef=$fontnamedocslave/$basef + if $diff $fontnamemaster/$basef $fontnameslavef >$temp.$basef.diff; then + echo " $fontnameslavef ok." + else + $chicken $cp $fontnamemaster/$basef $fontnameslavef + update_list="$update_list $fontnameslavef" + fi +done + +# fontname runtime files. +# +fontnamemapslave=texmf-dist/fonts/map/fontname +# +files=`cd $fontnamemaster && ls *.map` +for basef in $files; do + test $basef = wolfram.map && continue # obsolete for TL + fontnamemapslavef=$fontnamemapslave/$basef + if $diff $fontnamemaster/$basef $fontnamemapslavef >$temp.$basef.diff; then + echo " $fontnamemapslavef ok." + else + $chicken $cp $fontnamemaster/$basef $fontnamemapslavef + update_list="$update_list $fontnamemapslavef" + fi +done + +fontnameencslave=texmf-dist/fonts/enc/dvips/base +# +files=`cd $fontnamemaster && ls *.enc | egrep -vw '(groff|t5).enc'` +for basef in $files; do + fontnameencslavef=$fontnameencslave/$basef + if $diff $fontnameencslavef $fontnamemaster/$basef >$temp.$basef.diff; then + echo " $fontnameencslavef ok." + else + $chicken $cp $fontnamemaster/$basef $fontnameencslavef + update_list="$update_list $fontnameencslavef" + fi +done + + +# config.{guess,sub} from GNU. +# +for gnuconf in config.guess config.sub; do + url="http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/$gnuconf?rev=HEAD&content-type=text/plain" + wget -O $temp $url >$temp.2 2>&1 + if test ! -s $temp; then + echo "$0: skipping, could not retrieve $gnuconf:" >&2 + cat $temp.2 + continue + fi + if $diff $gnuconf $temp >$temp.$gnuconf.diff; then + echo " $gnuconf ok." + else + $chicken $cp $temp $gnuconf + update_list="$update_list $gnuconf" + + # find all copies in source. + alldev="`find ../Build/source -name $gnuconf`" + for f in $alldev; do + $chicken $cp $gnuconf $f + done + update_list="$update_list $alldev" + fi +done + + +# doc.html. +# +$tools/mkdocindex | tee $temp.doc | grep -v '<small>Generated' >$temp.doc.new +# +grep -v '<small>Generated' doc.html >$temp.doc.cur +if $diff $temp.doc.cur $temp.doc.new >$temp.doc.diff; then + echo " doc.html ok." +else + $chicken cp -v $temp.doc.new doc.html + update_list="$update_list doc.html" +fi + + +if test -z "$update_list"; then + echo "$0: nothing to update." +else + test x"$chicken" != xecho && echo "$0: committing $update_list" + $chicken svn commit --force-log -m$0 $update_list +fi + +echo "$0: done `date`." +exit 0 diff --git a/Master/tlpkg/bin/tl-update-docindex b/Master/tlpkg/bin/tl-update-docindex new file mode 100755 index 00000000000..4e7630686f4 --- /dev/null +++ b/Master/tlpkg/bin/tl-update-docindex @@ -0,0 +1,167 @@ +#!/usr/local/bin/perl +# $Id: //depot/Master/Tools/mkdocindex#2 $ +# Make index file of all HTML and PDF documentation. +# Originally written 2004, Karl Berry. Public domain. + +exit (&main ()); + +sub main +{ + (my $progname = $0) =~ s,^.*/,,; + umask (0); + + chomp (my $mydir = `dirname $0`); # Tools + chdir ("$mydir/../../Master") || exit 1; # Master + + # shell fragment we use to find doc files in a directory. + $ENV{"_POSIX2_VERSION"} = 0; # POSIX likes to be backward-incompatible + $FIND_POST = " \\( -name \\*.html -o -name \\*.pdf \\) " + . " | tee /tmp/doclist" + . " | sort -f -t/ +2 |"; + + print <<END_HEADER; +<html> +<body> +<h1>TeX Live documentation</h2> + +<a name="packagedoc"></a> +<h2>1. Package documentation</h2> + +<p>This section lists links to all HTML and PDF files for packages (in +the <a href="texmf/">texmf</a> and <a href="texmf-dist/">texmf-dist</a> +directories), sorted by package name. + +<p><a href="#guidedoc">Jump to guide documentation</a>. +END_HEADER + + &do_package_list (); + + print <<END_BETWEEN; +<a name="guidedoc"></a> +<h2>2. Guide documentation</h2> + +<p>This section lists links to all guides, that is, packages consisting +only of documentation (in the <a href="texmf-doc/">texmf-doc</a> +directory), sorted by language. + +<p><a href="#packagedoc">Jump to package documentation</a>. +END_BETWEEN + + &do_guide_list (); + + chomp (my $date = `date`); + print <<END_TRAILER; +<hr> +<small>Generated $date by $progname.</small> +</body></html> +END_TRAILER + + return 0; +} + + + +# Package doc (texmf and texmf-dist), by package. +# +sub do_package_list +{ + &do_filelist ("find texmf/doc texmf-dist/doc $FIND_POST"); +} + + + +# Guide doc (texmf-doc), by language. In order to generate a list of +# all the languages at the beginning, we generate everything before +# writing anything. +# +sub do_guide_list +{ + # each subdir in texmf-doc is a language, except general. + my @langs = map { s,.*/,,; $_ } glob ("texmf-doc/doc/*"); + my @langs = grep { $_ ne "general" } @langs; + + print "\n<p>Languages:\n<ul>\n"; + print map { qq!<li><a href="#$_">$_</a>\n! } @langs; + print "</ul>\n"; + + $count = 0; # for subsection numbers + for my $lang (@langs) { + $count++; + print qq!<a name="#$lang"></a>\n!; + print qq!<h3>2.$count <a href="texmf-doc/doc/$lang/">$lang</a></h3>\n!; + + &do_filelist ("find texmf-doc/doc/$lang $FIND_POST"); + } +} + + + +# Process all files resulting from OPENCMD. +# +sub do_filelist +{ + my ($opencmd) = @_; + + print "\n<ol>\n"; + my $prevdir = ""; + my @entries = (); + + $FILELIST = $opencmd; + open (FILELIST) || die "open($FILELIST) failed: $!"; + while (<FILELIST>) { + chomp; + # collect all files for a given directory + (my $thisdir = $_) =~ s,/[^/]*$,,; + + if ($thisdir eq $prevdir) { + push (@entries, $_); + } else { + &do_directory ($prevdir, @entries) if $prevdir; # avoid first empty + $prevdir = $thisdir; + @entries = ($_); + } + } + close (FILELIST) || warn "close($FILELIST) failed: $!"; + + &do_directory ($prevdir, @entries); # include last + + print "\n</ol>\n"; +} + + + +# Print doc ENTRIES in DIR. +# +sub do_directory +{ + my ($dir,@entries) = @_; + + # $dir includes the texmf tree, e.g., + # texmf-dist/doc/allrunes + # This is too ugly. We just want to show allrunes, especially since + # that's what we sorted by. + my (undef,undef,$nicename) = split (/\//, $dir, 3); + + print qq!<li><b><a href="$dir">$nicename</a>!; + + # if we have an index.html or a live.html, make things nicer. + if (grep { m,/(index|live)\.html$, } @entries) { + # first remove all .html's. + @entries = grep { $_ !~ /\.html$/ + || $_ =~ m,/(index|live)\.html, } @entries; + + # if only one entry left, remove it, the directory link suffices. + @entries = () if $entries[0] =~ m,/index\.html$, && @entries == 1; + } + + # if we're going to print anything, insert punctuation. + print ":" if @entries; + print "</b><small>\n"; + + for my $e (@entries) { + (my $basename = $e) =~ s,.*/,,; + print qq! <a href="$e">$basename</a>\n!; + } + + print " </small>\n\n"; +} diff --git a/Master/tlpkg/bin/tl-update-lsr b/Master/tlpkg/bin/tl-update-lsr new file mode 100755 index 00000000000..90a761d570a --- /dev/null +++ b/Master/tlpkg/bin/tl-update-lsr @@ -0,0 +1,22 @@ +#!/bin/sh +# $Id$ +# Originally written 2004, Karl Berry. Public domain. +# +# Update ls-R files. Called from tlrebuild and also karl@tug's cron. + +mydir=`dirname $0` +tools=`cd $mydir && pwd` +PATH=$tools:$PATH; export PATH +umask 0 + +master=`cd $mydir/../../Master && pwd` +cd $master || exit 1 + +# generate new. +./bin/i386-linux/mktexlsr + +# if texmf-var exists, it's not part of the distribution. +test -f texmf-var/ls-R && svn revert texmf-var/ls-R + +# if we have changes, submit to repository (frightening but necessary). +svn commit -m'update-lsr autoupdate' texmf*/ls-R |