texlive[64220] trunk: c2a: new script to automatically run place if

commits+karl at tug.org commits+karl at tug.org
Sun Aug 28 23:09:00 CEST 2022


Revision: 64220
          http://tug.org/svn/texlive?view=revision&revision=64220
Author:   karl
Date:     2022-08-28 23:08:59 +0200 (Sun, 28 Aug 2022)
Log Message:
-----------
c2a: new script to automatically run place if no changes.
tlpkg-ctan-check: do not check magicwatermark (author never updates) or
m-tx (binaries).
releng.tex: make texlive-rel unwritable.
place: sort directory lists.
others: doc tweaks, sync.

Modified Paths:
--------------
    trunk/Build/source/doc/ChangeLog
    trunk/Build/source/texk/tests/TeXLive/TLConfig.pm
    trunk/Build/source/texk/tests/TeXLive/TLUtils.pm
    trunk/Build/source/texk/texlive/tl_support/fmtutil.cnf
    trunk/Master/tlpkg/bin/tl-check-fmtshare
    trunk/Master/tlpkg/bin/tl-update-tlnet
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/doc/releng.txt
    trunk/Master/tlpkg/libexec/place

Added Paths:
-----------
    trunk/Master/tlpkg/bin/c2a

Modified: trunk/Build/source/doc/ChangeLog
===================================================================
--- trunk/Build/source/doc/ChangeLog	2022-08-28 19:54:12 UTC (rev 64219)
+++ trunk/Build/source/doc/ChangeLog	2022-08-28 21:08:59 UTC (rev 64220)
@@ -1,3 +1,7 @@
+2022-05-29  Karl Berry  <karl at tug.org>
+
+	*  (mv): r
+
 2022-05-28  Karl Berry  <karl at tug.org>
 
 	* tlbuild.texi (Build one package): typo, buil -> build.

Modified: trunk/Build/source/texk/tests/TeXLive/TLConfig.pm
===================================================================
--- trunk/Build/source/texk/tests/TeXLive/TLConfig.pm	2022-08-28 19:54:12 UTC (rev 64219)
+++ trunk/Build/source/texk/tests/TeXLive/TLConfig.pm	2022-08-28 21:08:59 UTC (rev 64220)
@@ -6,7 +6,7 @@
 use strict; use warnings;
 package TeXLive::TLConfig;
 
-my $svnrev = '$Revision: 62232 $';
+my $svnrev = '$Revision: 63068 $';
 my $_modulerevision = ($svnrev =~ m/: ([0-9]+) /) ? $1 : "unknown";
 sub module_revision { return $_modulerevision; }
 

Modified: trunk/Build/source/texk/tests/TeXLive/TLUtils.pm
===================================================================
--- trunk/Build/source/texk/tests/TeXLive/TLUtils.pm	2022-08-28 19:54:12 UTC (rev 64219)
+++ trunk/Build/source/texk/tests/TeXLive/TLUtils.pm	2022-08-28 21:08:59 UTC (rev 64220)
@@ -1,4 +1,3 @@
-# $Id: TLUtils.pm 62822 2022-03-20 08:34:54Z siepo $
 # TeXLive::TLUtils.pm - the inevitable utilities for TeX Live.
 # Copyright 2007-2022 Norbert Preining, Reinhard Kotucha
 # This file is licensed under the GNU General Public License version 2
@@ -8,7 +7,7 @@
 
 package TeXLive::TLUtils;
 
-my $svnrev = '$Revision: 62822 $';
+my $svnrev = '$Revision: 63645 $';
 my $_modulerevision = ($svnrev =~ m/: ([0-9]+) /) ? $1 : "unknown";
 sub module_revision { return $_modulerevision; }
 
@@ -43,6 +42,8 @@
   TeXLive::TLUtils::run_cmd($cmd [, @envvars ]);
   TeXLive::TLUtils::system_pipe($prog, $infile, $outfile, $removeIn, @args);
   TeXLive::TLUtils::diskfree($path);
+  TeXLive::TLUtils::get_user_home();
+  TeXLive::TLUtils::expand_tilde($str);
 
 =head2 File utilities
 
@@ -234,6 +235,8 @@
     &run_cmd
     &system_pipe
     &diskfree
+    &get_user_home
+    &expand_tilde
     &announce_execute_actions
     &add_symlinks
     &remove_symlinks
@@ -540,6 +543,7 @@
     return "$platform_name{$platform}";
   } else {
     my ($CPU,$OS) = split ('-', $platform);
+    $OS = "" if ! defined $OS; # e.g., -force-platform foo
     return "$CPU with " . ucfirst "$OS";
   }
 }
@@ -815,6 +819,43 @@
 
 sub diskfree {
   my $td = shift;
+  my ($output, $retval);
+  if (win32()) {
+    # the powershell one-liner only works from win8 on.
+    my @winver = Win32::GetOSVersion();
+    if ($winver[1]<=6 && $winver[2]<=1) {
+      return -1;
+    }
+    my $avl;
+    if ($td =~ /^[a-zA-Z]:/) {
+      my $drv = substr($td,0,1);
+      # ea ignore: error action ignore: no output at all
+      my $cmd = "powershell -nologo -noninteractive -noprofile -command " .
+       "\"get-psdrive -name $drv -ea ignore |select-object free |format-wide\"";
+      ($output, $retval) = run_cmd($cmd);
+      # ignore exit code, just parse the output, which should
+      # consist of empty lines and a number surrounded by spaces
+      my @lines = split(/\r*\n/, $output);
+      foreach (@lines) {
+        chomp $_;
+        if ($_ !~ /^\s*$/) {
+          $_ =~ s/^\s*//;
+          $_ =~ s/\s*$//;
+          $avl = $_;
+          last;
+        }
+      }
+      if ($avl !~ /^[0-9]+$/) {
+        return (-1);
+      } else {
+        return (int($avl/(1024*1024)));
+      }
+    } else {
+      # maybe UNC drive; do not try to handle this
+      return -1;
+    }
+  }
+  # now windows case has been taken care of
   return (-1) if (! $::progs{"df"});
   # drop final /
   $td =~ s!/$!!;
@@ -831,8 +872,8 @@
   }
   $td .= "/" if ($td !~ m!/$!);
   return (-1) if (! -e $td);
-  debug("Checking for free diskspace in $td\n");
-  my ($output, $retval) = run_cmd("df -P \"$td\"", POSIXLY_CORRECT => 1);
+  debug("checking diskfree() in $td\n");
+  ($output, $retval) = run_cmd("df -P \"$td\"", POSIXLY_CORRECT => 1);
   if ($retval == 0) {
     # Output format should be this:
     # Filesystem      512-blocks       Used  Available Capacity Mounted on
@@ -839,16 +880,47 @@
     # /dev/sdb3       6099908248 3590818104 2406881416      60% /home
     my ($h,$l) = split(/\n/, $output);
     my ($fs, $nrb, $used, $avail, @rest) = split(' ', $l);
-    debug("disk space: used=$used (512-block), avail=$avail (512-block)\n");
+    debug("diskfree: used=$used (512-block), avail=$avail (512-block)\n");
     # $avail is in 512-byte blocks, so we need to divide by 2*1024 to
     # obtain Mb. Require that at least 100M remain free.
     return (int($avail / 2048));
   } else {
-    # error in running df -P out of whatever reason
+    # error in running df -P for whatever reason
     return (-1);
   }
 }
 
+=item C<get_user_home()>
+
+Returns the current user's home directory (C<$HOME> on Unix,
+C<$USERPROFILE> on Windows, and C<~> if none of the two are
+set. Save in package variable C<$user_home_dir> after computing.
+
+=cut
+
+# only search for home directory once, and save expansion here
+my $user_home_dir;
+
+sub get_user_home {
+  return $user_home_dir if ($user_home_dir);
+  $user_home_dir = getenv (win32() ? 'USERPROFILE' : 'HOME') || '~';
+  return $user_home_dir;
+}
+
+=item C<expand_tilde($str)>
+
+Expands initial C<~> with the user's home directory in C<$str> if
+available, else leave C<~> in place.
+
+=cut
+
+sub expand_tilde {
+  my $str = shift;
+  my $h = get_user_home();
+  $str =~ s/^~/$h/;
+  return $str;
+}
+
 =back
 
 =head2 File utilities

Modified: trunk/Build/source/texk/texlive/tl_support/fmtutil.cnf
===================================================================
--- trunk/Build/source/texk/texlive/tl_support/fmtutil.cnf	2022-08-28 19:54:12 UTC (rev 64219)
+++ trunk/Build/source/texk/texlive/tl_support/fmtutil.cnf	2022-08-28 21:08:59 UTC (rev 64220)
@@ -1,4 +1,4 @@
-# Generated by /home/texlive/karl/Master/bin/x86_64-linux/tlmgr on Sun Mar 13 01:49:39 2022
+# Generated by /home/texlive/karl/Master/bin/x86_64-linux/tlmgr on Fri Jun 10 03:07:15 2022
 # Originally written by Thomas Esser, 1998. Public domain.
 #
 # For guidance on how to support local formats, see the man
@@ -69,7 +69,6 @@
 eplain pdftex language.dat -translate-file=cp227.tcx *eplain.ini
 #
 # from hitex:
-hilatex hitex language.dat -etex -ltx hilatex.ini
 hitex hitex language.def -etex -ltx hitex.ini
 #
 # from jadetex:

Added: trunk/Master/tlpkg/bin/c2a
===================================================================
--- trunk/Master/tlpkg/bin/c2a	                        (rev 0)
+++ trunk/Master/tlpkg/bin/c2a	2022-08-28 21:08:59 UTC (rev 64220)
@@ -0,0 +1,101 @@
+#!/usr/bin/env perl
+# $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.)
+
+use strict; use warnings;
+
+(my $prg = $0) =~ s,.*/,,;
+
+my $place_branch = 0;
+#my $chicken = "";
+my $chicken = "-p";
+
+exit (&main ());
+
+sub main {
+  my $place = 0;
+  if ($ARGV[$#ARGV] =~ /^-?p$/) {
+    pop (@ARGV);
+    $place = 1;
+  }
+  printf "$prg: running c2l...";
+  my @lines = `set -o pipefail; c2l @ARGV </dev/null 2>&1 | tee /tmp/c2l.out`;
+  if ($?) {
+    print "first c2l failed, exiting.\n";
+    print @lines;
+    exit $?;
+  }
+
+  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 @lines;
+	  $status = 0;
+          last;
+        } else {
+          $status = &do_place ("no new or removed files");
+          last;
+        }
+
+      } elsif ($place) {
+        $status = &do_place ("new/removed files, but p(lace) given");
+        last;
+      
+      } else {
+        print "have new/removed files, exiting.\n";
+        print @lines;
+        last;
+      }
+    }
+  }
+  
+  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;
+    }
+  }
+  
+  return $status;
+}
+
+

+sub do_place {
+  my ($desc,$c2cmd) = @_;
+
+  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 @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");
+  }
+  
+  return $status;
+}


Property changes on: trunk/Master/tlpkg/bin/c2a
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tl-check-fmtshare
===================================================================
--- trunk/Master/tlpkg/bin/tl-check-fmtshare	2022-08-28 19:54:12 UTC (rev 64219)
+++ trunk/Master/tlpkg/bin/tl-check-fmtshare	2022-08-28 21:08:59 UTC (rev 64220)
@@ -255,7 +255,7 @@
     exit 1
   fi
   #echo "$0: (`date`)"
-  echo "$0: built fmtfile: `ls -l $fmtfile`"
+  echo "$0: built fmtfile: `ls -l $fmtfile`" (on `hostname`)
   engineversion=`$enginedir/$engine --version | sed 1q`
   echo "$0:   with engine: $enginedir/$engine ($engineversion)"
 

Modified: trunk/Master/tlpkg/bin/tl-update-tlnet
===================================================================
--- trunk/Master/tlpkg/bin/tl-update-tlnet	2022-08-28 19:54:12 UTC (rev 64219)
+++ trunk/Master/tlpkg/bin/tl-update-tlnet	2022-08-28 21:08:59 UTC (rev 64220)
@@ -305,7 +305,7 @@
 if test -r $install_tl_log \
    && grep -i '^fmtutil.*error.*' $install_tl_log >/dev/null; then
   echo >&2
-  echo "$prg: seems fmtutil failed, check $install_tl_log." >&2
+  echo "$prg: seems fmtutil failed, check: $install_tl_log" >&2
   failure=true
 else
   : # appease -e

Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2022-08-28 19:54:12 UTC (rev 64219)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2022-08-28 21:08:59 UTC (rev 64220)
@@ -960,6 +960,8 @@
   "luatex",		# binary
   "luahbtex",		# binary
   "luajittex",		# binary
+  "m-tx",		# binary
+  "magicwatermark",	# 28aug22 awaiting upload with .dtx fix
   "makeindex",		# binary
   "malayalam-latex",	# binary
   "metafont",		# binary

Modified: trunk/Master/tlpkg/doc/releng.txt
===================================================================
--- trunk/Master/tlpkg/doc/releng.txt	2022-08-28 19:54:12 UTC (rev 64219)
+++ trunk/Master/tlpkg/doc/releng.txt	2022-08-28 21:08:59 UTC (rev 64220)
@@ -459,6 +459,7 @@
 mount /home/ftp/texlive/Contents/live
 cd
 umount /mnt/tl
+chmod -R a-w /usr/local/texlive-rel/ # make unwritable, we should never change
 
 - update ~www/texlive web pages (search for $prev and $prev-1):
   acquire* - general

Modified: trunk/Master/tlpkg/libexec/place
===================================================================
--- trunk/Master/tlpkg/libexec/place	2022-08-28 19:54:12 UTC (rev 64219)
+++ trunk/Master/tlpkg/libexec/place	2022-08-28 21:08:59 UTC (rev 64220)
@@ -267,9 +267,9 @@
 # detect that a package update has already been done by someone else.
 if ($opt_mode eq "svn") {
   print ("\nsvn status of those directories:\n");
-  system ("svn status `cat $dirlist_file`");
+  system ("svn status `sort -u $dirlist_file`");
   print ("\nsvn update of those directories:\n");
-  system ("svn update `cat $dirlist_file`");
+  system ("svn update `sort -u $dirlist_file`");
 }
 # do nothing in git mode
 



More information about the tex-live-commits mailing list.