#!/usr/bin/env perl # $Id$ # Originally written by Karl Berry. Public domain. # # Convenience front-end script to run ctan2tl. It rearranges the output # so error messages come first, then the list of changed files. Also # accepts platform abbreviations to run tl-update-bindir, etc. Don't # take it too seriously; it surely needs generalizing. use Cwd; use File::Basename; $| = 1; exit (&main ()); sub main { my $real0 = Cwd::abs_path ($0); my $scriptdir = File::Basename::dirname ($real0); # .../Master/tlpkg/bin my $TLROOT = Cwd::abs_path ("$scriptdir/../../.."); # ... # platform abbrev my $arg = $ARGV[0]; if ($arg eq "asy") { exec ("tl-update-asy --build"); } elsif ($arg eq "aarch") { $arg = "aarch64-linux"; } elsif ($arg eq "alpha") { $arg = "alpha-linux"; } elsif ($arg eq "armel") { $arg = "armel-linux"; } elsif ($arg eq "armhf") { $arg = "armhf-linux"; } elsif ($arg eq "cygwin") { $arg = "i386-cygwin"; } elsif ($arg eq "dar32") { $arg = "i386-darwin"; } elsif ($arg eq "darwin" || $arg eq "dar" || $arg eq "mac") { $arg = "x86_64-darwin"; } elsif ($arg eq "darleg") { $arg = "x86_64-darwinlegacy"; } elsif ($arg eq "irix") { $arg = "mips-irix"; } elsif ($arg eq "kfreebsd") { exec ("tl-update-bindir i386-kfreebsd && tl-update-bindir amd64-kfreebsd"); } elsif ($arg eq "linux32" || $arg eq "lin32") { $arg = "i386-linux"; } elsif ($arg eq "mipsel") { $arg = "mipsel-linux"; } elsif ($arg eq "netbsd") { exec ("tl-update-bindir i386-netbsd && tl-update-bindir amd64-netbsd"); } elsif ($arg eq "powdar") { $arg = "powerpc-darwin"; } elsif ($arg eq "powlin") { $arg = "powerpc-linux"; } elsif ($arg eq "sol") { exec ("tl-update-bindir i386-solaris && tl-update-bindir x86_64-solaris"); } elsif ($arg eq "sparc") { $arg = "sparc-solaris"; } elsif ($arg eq "linux64" || $arg eq "lin64") { $arg = "x86_64-linux"; } elsif ($arg eq "musl") { $arg = "x86_64-linuxmusl"; } elsif ($arg eq "norbert" || $arg eq "nor") { for my $p (qw(i386-linux x86_64-linux x86_64-linuxmusl)) { system ("$0 $p") && die "norbert/$p failed"; } print "$0: norbert updates done.\n"; exit 0; } elsif ($arg eq "cg" || $arg eq "moj" || $arg eq "mojca") { for my $p (qw(i386-freebsd amd64-freebsd x86_64-darwinlegacy i386-solaris x86_64-solaris)) { system ("$0 $p") && die "cg/$p failed"; } print "$0: cg (contextgarden) updates done.\n"; exit 0; } elsif ($arg eq "all") { for my $p (qw(aarch dar cg norbert armhf)) { system ("$0 $p") && die "all/$p failed"; } print "$0: all updates done.\n"; exit 0; } if (-d "$TLROOT/Master/bin/$arg") { print ("tl-update-bindir $arg\n"); exec ("tl-update-bindir", $arg); } $ARGV[0] = "-p" if $ARGV[0] eq "p"; print "$0: running ctan2tl @ARGV\n"; # we want our exit status to be from ctan2tl, not tee, hence the # pipefail bash-ism. my @lines = `set -o pipefail; ctan2tl @ARGV &1 | tee /tmp/cl.out`; my $status = $?; my $cooked = "$TLROOT/Build/tmp.cooked"; -d $cooked && system ("cp /tmp/cl.out $cooked/$ARGV[$#ARGV].out"); # *** and other notable messages. my @msgs = grep { /^\*\*\*.* \S/ && ! /\* Generating / } @lines; push (@msgs, grep { /at \/.* line / } @lines); # perl errors push (@msgs, grep { /^svn: E/ } @lines); # svn errors push (@msgs, grep { /: no hit for pattern/ } @lines); # tlpsrc updates # map file changes; should do better, check .tlpsrc for existing ... push (@msgs, grep { /(svn .*|^ )[A-z]*\.map$/ } @lines); print map { (/^\*/ ? "" : "*** ") . $_ } @msgs; if ($status != 0) { warn "*** ctan2tl exit status: $status\n"; print STDERR @lines; return 1; } my $whole_string = join ("", @lines); my @page = split (/\f */, $whole_string); my $diff_list = `test -s /tmp/$<.tlplace.diff && sed -n -e 's/^--- //' \\ -e 's/[ \\t].*//' \\ -e 's,/home/texlive/karl/, ,p' \\ /tmp/$<.tlplace.diff`; $diff_list = ""; # page 0: build stuff. # page 1: cooked hierarchy. # page 2: new vs. present. # page 3: place output. print "$page[2]$diff_list\n\f$page[1]\n\f$page[0]\n\f$page[3]\n"; return 0; }