diff options
author | Karl Berry <karl@freefriends.org> | 2023-03-21 22:49:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-03-21 22:49:40 +0000 |
commit | 50a995b653ee3d8959f2418fa36f572c350fb462 (patch) | |
tree | d7b0d03d76b1fac11570f99f0aa4e63f474d7091 /Master/tlpkg/bin/c2a | |
parent | efcb20768a3c4b10e9be95c3a38cdf96e6859a63 (diff) |
clean up c2a, update release doc for 2023
git-svn-id: svn://tug.org/texlive/trunk@66642 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/bin/c2a')
-rwxr-xr-x | Master/tlpkg/bin/c2a | 88 |
1 files changed, 49 insertions, 39 deletions
diff --git a/Master/tlpkg/bin/c2a b/Master/tlpkg/bin/c2a index 8b4194b0138..d684c4dfceb 100755 --- a/Master/tlpkg/bin/c2a +++ b/Master/tlpkg/bin/c2a @@ -2,44 +2,59 @@ # $Id$ # Public domain. Originally written by Karl Berry, 2022. # -# Update from CTAN to TL. First, run the test import with c2l; then, if -# no files were added or removed (and it was an existing package), -# automatically run c2l -p to "place" the new package in svn. -# Do not run svn commit. (Code needs to be refactored for common calls.) +# Top-level script to update from CTAN to TL. +# +# First (unless placing was explicitly specified with [-]p), +# run a test import with c2l. +# Then, if no files were added or removed (and it was an existing +# package), or if placing was explicitly specified, automatically run +# c2l p to "place" the new package in svn with adds/removes. +# Do not run svn commit. +# +# By the way, we accept "p" as well as "-p" because it's convenient for +# word deletion on the command line not to have a - lying around. For +# the same reason, the [-]p is given after the package, so we can +# add/remove it without having to edit the package name. Since we run +# this command multiple times a day, must optimize every keystroke. use strict; use warnings; (my $prg = $0) =~ s,.*/,,; -my $place_branch = 0; -#my $chicken = ""; -my $chicken = "-p"; - exit (&main ()); sub main { - die "Usage: $0 PKGNAME [-][p]\n" if (@ARGV == 0 || @ARGV > 2); + die "Usage: $0 PKGNAME [-][p]\n" if (@ARGV == 0 || @ARGV > 2); # USTL + my $status = 1; # default to failure + my $place = 0; if ($ARGV[$#ARGV] =~ /^-?p$/) { pop (@ARGV); $place = 1; } + + if ($place) { + $status = &do_place ("$prg: p(lace) explicitly given"); + exit $status; + } + + # no explicit place, run c2l to check if we can do it implicitly. printf "$prg: running c2l..."; - my @lines = `set -o pipefail; c2l @ARGV </dev/null 2>&1 | tee /tmp/c2l.out`; - if ($?) { + my @lines; + ($status,@lines) = &run_c2l (""); + if ($status) { print "first c2l failed, exiting.\n"; print @lines; - exit $?; + exit $status; } - my $status = 1; my $i; for ($i = 0; $i < @lines; $i++) { if ($lines[$i] =~ /^current vs.\ new/) { my $nextline = $lines[$i+1]; if ($nextline =~ /^[0-9]+ common files, ([0-9]+) changed/) { if ($1 == 0) { - print "seems nothing changed, done.\n"; + print "seems nothing has changed, done.\n"; print @lines; $status = 0; last; @@ -61,42 +76,37 @@ sub main { } if ($i == @lines) { - if ($place) { - $status = &do_place ("no current vs. new, but p(lace) given"); - } else { - print "no current vs. new, exiting.\n"; # new package, presumably - print @lines; - } + print "no current vs. new, exiting.\n"; # new package, presumably + print @lines; } return $status; } +# Run c2l to "place" (svn add/remove, but not commit) file. +# Return exit status. +# sub do_place { - my ($desc,$c2cmd) = @_; + my ($desc) = @_; - my $msg; - if ($c2cmd && $c2cmd eq "c2b") { - $msg = "$prg: $desc"; # place on branch - } else { - $c2cmd = "c2l"; - my $branch_msg = $place_branch ? "(+branch)" : ""; - $msg = "$desc, rerunning for svn$branch_msg..."; - } - - print "$msg\n"; - my $cmd = "set -o pipefail;" - . "$c2cmd $chicken @ARGV </dev/null 2>&1 | tee /tmp/$c2cmd.out"; - my @placelines = `$cmd`; - my $status = $?; + print "$desc, running for svn.\n"; + my ($status,@placelines) = &run_c2l ("p"); print @placelines; if ($status) { - print "$prg: *** do_place($c2cmd) failed, exiting.\n"; - - } elsif ($c2cmd ne "c2b" && $place_branch) { - $status = &do_place ("running c2b for svn branch", "c2b"); + print "$prg: *** do_place failed, exiting.\n"; } return $status; } + + +# Run c2l, specifying ARG. Return a list with the exit status +# and then all output lines. +# +sub run_c2l { + my ($arg) = @_; + my $tmpfile = "/tmp/c2l$arg.out"; + my @ret = `set -o pipefail; c2l $arg @ARGV </dev/null 2>&1 | tee $tmpfile`; + return ($?, @ret); +} |