texlive[52706] Master/tlpkg: TLUtils.pm (setup_programs): only use

commits+karl at tug.org commits+karl at tug.org
Sat Nov 9 18:42:02 CET 2019


Revision: 52706
          http://tug.org/svn/texlive?view=revision&revision=52706
Author:   karl
Date:     2019-11-09 18:42:02 +0100 (Sat, 09 Nov 2019)
Log Message:
-----------
TLUtils.pm (setup_programs): only use Data::Dumper if vv, not just v;
  indent debug output lines.
(copy): ddebug of every copy is too much; but ddebug dereferencing.

TLPDB.pm (not_virtual_install_package): show container files instead of
  meaningless array ref hex, and only if ddebug.

tl-try-install: placeholder for install-tl options.
tl-try-makeself: doc.
tl-update-nsis: remove tlpobj/ dir if we created it.
tl-update-tlcritical: new option --no-containers.
tltestnet: new convenience script for testing versioned containers.

Modified Paths:
--------------
    trunk/Master/tlpkg/TeXLive/TLPDB.pm
    trunk/Master/tlpkg/TeXLive/TLUtils.pm
    trunk/Master/tlpkg/bin/tl-try-install
    trunk/Master/tlpkg/bin/tl-try-makeself
    trunk/Master/tlpkg/bin/tl-update-nsis
    trunk/Master/tlpkg/bin/tl-update-tlcritical

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

Modified: trunk/Master/tlpkg/TeXLive/TLPDB.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLPDB.pm	2019-11-09 17:26:00 UTC (rev 52705)
+++ trunk/Master/tlpkg/TeXLive/TLPDB.pm	2019-11-09 17:42:02 UTC (rev 52706)
@@ -1825,17 +1825,24 @@
         }
       }
       if (!$container) {
-        tlwarn("TLPDB: cannot find package $pkg.tar.$CompressorExtRegexp in $root/$Archive\n");
+        tlwarn("TLPDB: cannot find package $pkg.tar.$CompressorExtRegexp"
+               . " in $root/$Archive\n");
         return(0);
       }
     } elsif (&media eq 'NET') {
-      $container = "$root/$Archive/$pkg.tar." . $Compressors{$DefaultCompressorFormat}{'extension'};
+      $container = "$root/$Archive/$pkg.tar."
+                   . $Compressors{$DefaultCompressorFormat}{'extension'};
     }
-    debug("TLPDB::not_virtual_install_package: trying to install $container\n");
-    $self->_install_data ($container, $reloc, \@installfiles, $totlpdb, $tlpobj->containersize, $tlpobj->containerchecksum)
+    my $container_str = ref $container eq "ARRAY"
+                        ? "[" . join (" ", @$container) . "]" : $container;
+    ddebug("TLPDB::not_virtual_install_package: installing container: ",
+          $container_str, "\n");
+    $self->_install_data($container, $reloc, \@installfiles, $totlpdb,
+                         $tlpobj->containersize, $tlpobj->containerchecksum)
       || return(0);
-    # if we are installing from local_compressed or NET we have to fetch the respective
-    # source and doc packages $pkg.source and $pkg.doc and install them, too
+    # if we are installing from local_compressed or NET we have to fetch
+    # respective source and doc packages $pkg.source and $pkg.doc and
+    # install them, too
     if (($media eq 'NET') || ($media eq 'local_compressed')) {
       # we install split containers under the following conditions:
       # - the container were split generated
@@ -1851,13 +1858,15 @@
       if ($container_src_split && $opt_src && $tlpobj->srcfiles) {
         my $srccontainer = $container;
         $srccontainer =~ s/\.tar\.$CompressorExtRegexp$/.source.tar.$1/;
-        $self->_install_data ($srccontainer, $reloc, \@installfiles, $totlpdb, $tlpobj->srccontainersize, $tlpobj->srccontainerchecksum)
+        $self->_install_data($srccontainer, $reloc, \@installfiles, $totlpdb,
+                      $tlpobj->srccontainersize, $tlpobj->srccontainerchecksum)
           || return(0);
       }
       if ($container_doc_split && $real_opt_doc && $tlpobj->docfiles) {
         my $doccontainer = $container;
         $doccontainer =~ s/\.tar\.$CompressorExtRegexp$/.doc.tar.$1/;
-        $self->_install_data ($doccontainer, $reloc, \@installfiles, $totlpdb, $tlpobj->doccontainersize, $tlpobj->doccontainerchecksum)
+        $self->_install_data($doccontainer, $reloc, \@installfiles,
+            $totlpdb, $tlpobj->doccontainersize, $tlpobj->doccontainerchecksum)
           || return(0);
       }
       #

Modified: trunk/Master/tlpkg/TeXLive/TLUtils.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLUtils.pm	2019-11-09 17:26:00 UTC (rev 52705)
+++ trunk/Master/tlpkg/TeXLive/TLUtils.pm	2019-11-09 17:42:02 UTC (rev 52706)
@@ -1130,7 +1130,7 @@
 =cut
 
 sub copy {
-  ddebug("TLUtils::copy(", join (",", @_), "\n");
+  #too verbose ddebug("TLUtils::copy(", join (",", @_), "\n");
   my $infile = shift;
   my $filemode = 0;
   my $dereference = 0;
@@ -1182,12 +1182,13 @@
     if ($linktarget !~ m,^/,) {
       $infile = Cwd::abs_path(dirname($infile)) . "/$linktarget";
     }
+    ddebug("TLUtils::copy: dereferencing symlink $infile -> $linktarget");
   }
 
   if (-l $infile) {
     my $linktarget = readlink($infile);
     my $dest = "$destdir/$filename";
-    debug("TLUtils::copy: doing symlink($linktarget,$dest)"
+    ddebug("TLUtils::copy: doing symlink($linktarget,$dest)"
           . " [from readlink($infile)]\n");
     symlink($linktarget, $dest) || die "symlink($linktarget,$dest) failed: $!";
   } else {
@@ -2523,7 +2524,7 @@
     $::progs{'compressor'} = $ENV{'TEXLIVE_COMPRESSOR'};
   }
 
-  if ($::opt_verbosity >= 1) {
+  if ($::opt_verbosity >= 2) {
     require Data::Dumper;
     use vars qw($Data::Dumper::Indent $Data::Dumper::Sortkeys
                 $Data::Dumper::Purity); # -w pain
@@ -2604,16 +2605,16 @@
   debug("(unix) trying to set up $p, default $def, arg $arg\n");
   if (-r $def) {
     if (-x $def) {
-      ddebug("default $def has executable permissions\n");
+      ddebug(" Default $def has executable permissions\n");
       # we have to check for actual "executability" since a "noexec"
       # mount option may interfere, which is not taken into account by -x.
       my $ret = system("'$def' $arg >/dev/null 2>&1" ); # we are on Unix
       if ($ret == 0) {
         $::progs{$p} = $def;
-        debug("Using shipped $def for $p (tested).\n");
+        debug(" Using shipped $def for $p (tested).\n");
         return(1);
       } else {
-        ddebug("Shipped $def has -x but cannot be executed, "
+        ddebug(" Shipped $def has -x but cannot be executed, "
                . "trying tmp copy.\n");
       }
     }
@@ -2634,7 +2635,7 @@
     if (! -x $tmpprog) {
       # hmm, something is going really bad, not even the copy is
       # executable. Fall back to normal path element
-      ddebug("Copied $p $tmpprog does not have -x bit, strange!\n");
+      ddebug(" Copied $p $tmpprog does not have -x bit, strange!\n");
       return(0);
     } else {
       # check again for executability
@@ -2641,12 +2642,12 @@
       my $ret = system("$tmpprog $arg > /dev/null 2>&1");
       if ($ret == 0) {
         # ok, the copy works
-        debug("Using copied $tmpprog for $p (tested).\n");
+        debug(" Using copied $tmpprog for $p (tested).\n");
         $::progs{$p} = $tmpprog;
         return(1);
       } else {
         # even the copied prog is not executable, strange
-        ddebug("Copied $p $tmpprog has x bit but not executable?!\n");
+        ddebug(" Copied $p $tmpprog has x bit but not executable?!\n");
         return(0);
       }
     }

Modified: trunk/Master/tlpkg/bin/tl-try-install
===================================================================
--- trunk/Master/tlpkg/bin/tl-try-install	2019-11-09 17:26:00 UTC (rev 52705)
+++ trunk/Master/tlpkg/bin/tl-try-install	2019-11-09 17:42:02 UTC (rev 52706)
@@ -1,7 +1,8 @@
 #!/bin/sh
-# Public domain.
+# Public domain. Originally written 2019, Karl Berry.
 # Try a TL installation into /tmp/ki (hardwired),
 # using install-tl with a given profile.
+
 vc_id='$Id$'
 
 renice 20 $$ >&/dev/null
@@ -15,6 +16,7 @@
 Master=`cd $mydir/../.. && pwd`
 profiledir=$Master/tlpkg/dev/profiles
 
+opt=-vv # -v -vv
 profile=$profiledir/TLinfra.pro
 repo=$Master
 
@@ -58,7 +60,7 @@
 
 set -x
 pro=--profile=$profile
-exec time $repo/install-tl $pro
+exec time $repo/install-tl $opt $pro
 
 cust=--custom-bin=$wb
 exec time $Master/install-tl $cust $pro

Modified: trunk/Master/tlpkg/bin/tl-try-makeself
===================================================================
--- trunk/Master/tlpkg/bin/tl-try-makeself	2019-11-09 17:26:00 UTC (rev 52705)
+++ trunk/Master/tlpkg/bin/tl-try-makeself	2019-11-09 17:42:02 UTC (rev 52706)
@@ -1,11 +1,14 @@
 #!/bin/sh -ex
 # $Id$
-# Test tl-makeself, e.g., with spaces in filenames. Public domain.
+# Public domain. Originally written 2018, Karl Berry.
 # 
-# Assumes $lc is set to the tlcritical dir; copies from there
-# to make the test directory in which we run makeself and then try the
-# update.
+# Test tl-makeself-from-tlnt, e.g., with spaces in filenames.
+# First arg is TL installation in which to run the updater [/tmp/ki];
+# second arg is test dir in which to create the updater [/tmp/krit].
 # 
+# Assumes $lc is set to the tlcritical dir; copies {archive,tlpkg} from
+# there to make the test directory in which we run makeself.
+# 
 # Although having the source in a spaceful directory is not
 # needed, might as well test that too unless inconvenient.
 
@@ -15,7 +18,7 @@
 mkdir "$testdir"
 rsync -a "$lc"/{archive,tlpkg} "$testdir"
 
-cd "$testdir"    # because makeself writes to the current directory
+cd "$testdir"    # because tl-makeself outputs to the current directory
 rm -f update*sh  # remove previous attempts
 tl-makeself-from-tlnet "$testdir"
 ls -l "$testdir"
@@ -26,5 +29,5 @@
 cd "$tl"
 
 # Now try running the updater in the installed tree.
-PATH=$tl/bin/x86_64-linux:/usr/local/bin:/usr/bin:/bin
+PATH=$tl/bin/x86_64-linux:/usr/bin
 "$testdir"/update-tlmgr-r*.sh #-- --debug

Modified: trunk/Master/tlpkg/bin/tl-update-nsis
===================================================================
--- trunk/Master/tlpkg/bin/tl-update-nsis	2019-11-09 17:26:00 UTC (rev 52705)
+++ trunk/Master/tlpkg/bin/tl-update-nsis	2019-11-09 17:42:02 UTC (rev 52706)
@@ -1,6 +1,6 @@
 #!/usr/bin/env perl
 # $Id$
-# Copyright 2008, 2009, 2010 Norbert Preining
+# Copyright 2008-2019 Norbert Preining
 # This file is licensed under the GNU General Public License version 2
 # or any later version.
 # 
@@ -34,44 +34,52 @@
 
 exit (&main ());
 
-sub main
-{
-  # get the db.
-  chomp (my $Master = `cd $mydir/../.. && pwd`);
-  my $tlpdb = TeXLive::TLPDB->new ("root" => $Master);
+sub main {
+  chomp(my $Master = `cd $mydir/../.. && pwd`);
+  my $tlpdb = TeXLive::TLPDB->new("root" => $Master);
   die("Cannot find tlpdb in $Master\n") unless defined($tlpdb);
+  
   my $texliveinfra = $tlpdb->get_package("texlive.infra");
   my $texliveinfraw32 = $tlpdb->get_package("texlive.infra.win32");
+  #
   my @allfiles = ();
-  push @allfiles, $texliveinfra->all_files;
-  push @allfiles, $texliveinfraw32->all_files if defined $texliveinfraw32;
+  push(@allfiles, $texliveinfra->all_files);
+  push(@allfiles, $texliveinfraw32->all_files) if defined $texliveinfraw32;
   
-  # create the tlpobj files
+  # create the tlpobj files, but if we have to create the tlpobj/ dir,
+  # don't leave it around after.
   my $tlpobjdir = "$InfraLocation/tlpobj";
-  my $removetlpobjdir = 0;
-  if (! -d "$Master/$tlpobjdir") {
-    &TeXLive::TLUtils::mkdirhier("$Master/$tlpobjdir");
-    $removetlpobjdir = 1;
+  my $abs_tlpobjdir = "$Master/$tlpobjdir";
+  my $rm_abs_tlpobjdir = 0;
+  if (! -d $abs_tlpobjdir) {
+    &TeXLive::TLUtils::mkdirhier($abs_tlpobjdir);
+    $rm_abs_tlpobjdir = 1;
   }
-  my $rev = 0; # we want the highest rev all these packages.
+  my $rev = 0; # get the highest rev of all our packages
   for my $p ($texliveinfra, $texliveinfraw32) {
     if (defined $p) {
       if ($p->revision > $rev) {
         $rev = $p->revision;
       }
-      open(TMP,">$Master/$tlpobjdir/$p->{'name'}.tlpobj") or die "Cannot create $Master/$tlpobjdir/$p->{'name'}.tlpobj";
+      open(TMP,">$abs_tlpobjdir/$p->{'name'}.tlpobj")
+      || die "open($abs_tlpobjdir/$p->{'name'}.tlpobj) failed: $!";
       $p->writeout(\*TMP);
       close(TMP);
-      push @allfiles, "$tlpobjdir/$p->{'name'}.tlpobj";
+      push(@allfiles, "$tlpobjdir/$p->{'name'}.tlpobj");
     }
   }
 
+  # remove the tlpobj/ dir if we created it.
+  if ($rm_abs_tlpobjdir) {
+    TeXLive::TLUtils::rmtree($abs_tlpobjdir);
+  }
+  
   my %dirtofiles;
   for my $f (@allfiles) {
     if ($f !~ m!/!) {
       $f = "./$f";
     }
-    my ($dn, $fn) = TeXLive::TLUtils::dirname_and_basename($f);
+    my ($dn,$fn) = TeXLive::TLUtils::dirname_and_basename($f);
     if (!defined($dirtofiles{$dn})) {
       @{$dirtofiles{$dn}} = ();
     }
@@ -163,12 +171,16 @@
 
 =head1 DESCRIPTION
 
-Creates a C<.nsi> file that can be used with NSIS to create an update
-executable for Windows, to work around Windows' inability to overwrite
-open files, and for disaster recovery.  It contains the tlmgr-related
-infrastructure files.  L<http://tug.org/texlive/tlmgr.html> explains
-more.
+Writes, to standard output, a C<.nsi> file that can be used with NSIS to
+create an update executable for Windows, to work around Windows'
+inability to overwrite open files, and for disaster recovery. It
+contains the tlmgr-related infrastructure files.
+L<http://tug.org/texlive/tlmgr.html> explains more.
 
+This is invoked by the C<tl-update-tlcritical> script, along with the
+sibling C<tl-makeself-from-tlnet> which creates a similar disaster
+recovery executable for Unix.
+
 =head1 AUTHORS AND COPYRIGHT
 
 This script and its documentation were written for the TeX Live

Modified: trunk/Master/tlpkg/bin/tl-update-tlcritical
===================================================================
--- trunk/Master/tlpkg/bin/tl-update-tlcritical	2019-11-09 17:26:00 UTC (rev 52705)
+++ trunk/Master/tlpkg/bin/tl-update-tlcritical	2019-11-09 17:42:02 UTC (rev 52706)
@@ -2,9 +2,10 @@
 # $Id$
 # Public domain.  Originally written 2008, Karl Berry.
 # Update the tlcritical mini-repository on tug with the critical
-# packages.  Also listed in tl-update-containers, unfortunately.
+# packages.  Listed both here and in TLConfig.pm, unfortunately.
 # Run from cron.tl.
 
+opt_do_containers=true
 tlcrit=/home/ftp/texlive/tlcritical
 recreate=
 
@@ -12,6 +13,7 @@
   case $1 in
   --tlcrit)         shift; tlcrit=$1;;
   --recreate)       recreate=--recreate;;
+  --no-containers)  opt_do_containers=false;;
   --help)           echo "Please read the script, sorry."; exit 0;;
   --*) echo "$0: unrecognized option: $1" >&2; exit 1;;
     *) echo "$0: too many arguments: $1" >&2; exit 1;;
@@ -76,11 +78,18 @@
   rm -rf $tlcrit/[^R]* # except README
 fi
 
-# update normal containers.
-echo "$0: running tl-update-containers (for critical packages)..."
-tl-update-containers -location $tlcrit $recreate -all \
-  00texlive.installation 00texlive.config texlive.infra tlperl.win32 \
-  $moredis
+if $opt_do_containers; then
+  # update normal containers.
+  echo "$0: running tl-update-containers (for critical packages)..."
+  tl-update-containers -location $tlcrit $recreate -all \
+    00texlive.installation 00texlive.config texlive.infra tlperl.win32 \
+    $moredis
+else
+  # this is an option so that if the repository already contains
+  # up-to-date containers, e.g., a test setup, we don't recreate them.
+  # (See doc/packages.txt.)
+  echo "$0: skipping tl-update-containers."
+fi
 
 # update Unix disaster recovery.
 echo "$0: running tl-makeself-from-tlnet $tlcrit..."
@@ -94,4 +103,5 @@
 rm -f $TMPDIR/updater.nsi
 do_updater exe
 
+echo $tlcrit:
 ls -lt $tlcrit

Added: trunk/Master/tlpkg/bin/tltestnet
===================================================================
--- trunk/Master/tlpkg/bin/tltestnet	                        (rev 0)
+++ trunk/Master/tlpkg/bin/tltestnet	2019-11-09 17:42:02 UTC (rev 52706)
@@ -0,0 +1,78 @@
+#!/bin/sh
+# $Id$
+# Public domain.  Originally written 2019, Karl Berry.
+# 
+# Convenience script for the 2019 change to versioned containers.
+# See tlpkg/doc/packages.txt for some info. Assumes variables
+# in ~karl/.bash_login and plenty more, sorry.
+
+renice 20 $$ >&/dev/null
+cd $HOME
+
+if test "x$1" = x-s; then
+  svn=/usr/local/bin/svn
+  for f in $xx/tlmgr.pl $pp/TLPOBJ.pm $pb/tl-update-containers; do
+    test -z "`$svn status $f`" || { echo "$f modified, goodbye"; exit 1; }
+    cp -pv $f.new $f || exit 1
+  done
+  exit 0
+
+elif test "x$1" = x-S; then
+  svn=/usr/local/bin/svn
+  for f in $xx/tlmgr.pl $pp/TLPOBJ.pm $pb/tl-update-containers; do
+    cmp -s $f $f.new || { echo "modified $f, goodbye"; exit 1; }
+    mv $f $f.new || exit 1
+    $svn update $f
+  done
+  exit 0
+
+elif test "x$1" = x-d; then
+  for f in $xx/tlmgr.pl $pp/TLPOBJ.pm $pb/tl-update-containers; do
+    diff -u1 $f $f.new
+  done >/tmp/dif
+  exit 0
+
+elif test "x$1" = x-i; then
+  dest=/tmp/ki
+  PATH=$dest/bin/x86_64-linux:/usr/bin; export PATH
+  rm -rf $dest*
+  #
+  TEXLIVE_INSTALL_ENV_NOCHECK=1; export TEXLIVE_INSTALL_ENV_NOCHECK
+  TEXLIVE_INSTALL_NO_WELCOME=1;  export TEXLIVE_INSTALL_NO_WELCOME
+  #
+  pro=--profile=/home/texlive/trunk/Master/tlpkg/dev/profiles/TLinfra.pro
+  #
+  thisrel=/usr/local/texlive/`date +%Y` 
+  $thisrel/install-tl $pro || exit 1 # make throwaway test install
+  exit $?
+
+elif test "x$1" = x-u || test "x$1" = x--all || test "x$1" = x--self; then
+  if test "x$1" = x-u || test "x$1" = x--all; then
+    uarg=--all
+  elif test "x$1" = x--self; then
+    uarg=--self
+  else
+    echo "$0: impossible update arg: $1" >&2
+    exit 1
+  fi
+  for i in tlftp tldsk tldev tla; do
+    bin=/tmp/$i/bin/x86_64-linux
+    printf "\n\f $bin\n"
+    env PATH=$bin:/usr/bin tlmgr update $uarg
+  done
+
+else
+  echo "$0: what to do? ($*)" >&2
+  exit 1
+fi
+
+##repo=--repo=/home/ftp/texlive/test-tlnet
+##repo=--repo=/home/ftp/texlive/tlnet
+##repo=--repo=/home/ftp/texlive/tlcritical
+##repo=--repo=/home/ftp/texlive/tlverpkg
+##repo=--repo=ftp://fm.tug.org/texlive/test-tlnet
+#
+#set -x
+#tlmgr version
+#tlmgr -v $repo update --self
+##tlmgr $repo update


Property changes on: trunk/Master/tlpkg/bin/tltestnet
___________________________________________________________________
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


More information about the tex-live-commits mailing list