summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/c2l
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/bin/c2l')
-rwxr-xr-xMaster/tlpkg/bin/c2l131
1 files changed, 131 insertions, 0 deletions
diff --git a/Master/tlpkg/bin/c2l b/Master/tlpkg/bin/c2l
new file mode 100755
index 00000000000..d919c56aa99
--- /dev/null
+++ b/Master/tlpkg/bin/c2l
@@ -0,0 +1,131 @@
+#!/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 need generalizing for use by anyone
+# else. Uses various personal environment variables, etc.
+
+$| = 1;
+exit (&main ());
+
+sub main {
+ # 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 eq "mactex") {
+ $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") { # 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 "$ENV{xb}/$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";
+ # assume bash until we don't have to.
+ my @lines = `set -o pipefail; ctan2tl @ARGV </dev/null 2>&1 | tee /tmp/cl.out`;
+ my $status = $?;
+
+ -d "$ENV{B}/tmp.cooked"
+ && system ("cp /tmp/cl.out $ENV{B}/tmp.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;
+}