From 24bb9e4fa5f638d0e535c4cdd8a87ea482b11490 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 9 Nov 2019 17:42:02 +0000 Subject: 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. git-svn-id: svn://tug.org/texlive/trunk@52706 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLPDB.pm | 27 ++++++++---- Master/tlpkg/TeXLive/TLUtils.pm | 19 +++++---- Master/tlpkg/bin/tl-try-install | 6 ++- Master/tlpkg/bin/tl-try-makeself | 15 ++++--- Master/tlpkg/bin/tl-update-nsis | 56 +++++++++++++++---------- Master/tlpkg/bin/tl-update-tlcritical | 22 +++++++--- Master/tlpkg/bin/tltestnet | 78 +++++++++++++++++++++++++++++++++++ 7 files changed, 169 insertions(+), 54 deletions(-) create mode 100755 Master/tlpkg/bin/tltestnet (limited to 'Master') diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index 70a1deaa2f4..865e3c67ac4 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -1825,17 +1825,24 @@ sub not_virtual_install_package { } } 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'}; - } - debug("TLPDB::not_virtual_install_package: trying to install $container\n"); - $self->_install_data ($container, $reloc, \@installfiles, $totlpdb, $tlpobj->containersize, $tlpobj->containerchecksum) + $container = "$root/$Archive/$pkg.tar." + . $Compressors{$DefaultCompressorFormat}{'extension'}; + } + 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 @@ sub not_virtual_install_package { 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); } # diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index c8bb1256c9a..acdc9884f0b 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -1130,7 +1130,7 @@ that is a fatal error. =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 @@ sub copy { 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 @@ END_COMPRESSOR_BAD $::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 @@ sub setup_unix_tl_one { 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,19 +2635,19 @@ sub setup_unix_tl_one { 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 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); } } diff --git a/Master/tlpkg/bin/tl-try-install b/Master/tlpkg/bin/tl-try-install index fed5efb1d99..4d7a3e762d5 100755 --- a/Master/tlpkg/bin/tl-try-install +++ b/Master/tlpkg/bin/tl-try-install @@ -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 @@ mydir=`cd \`dirname "$real0"\` && pwd` # Master/tlpkg/bin Master=`cd $mydir/../.. && pwd` profiledir=$Master/tlpkg/dev/profiles +opt=-vv # -v -vv profile=$profiledir/TLinfra.pro repo=$Master @@ -58,7 +60,7 @@ rm -rf $instdir* && echo "removed $instdir*." 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 diff --git a/Master/tlpkg/bin/tl-try-makeself b/Master/tlpkg/bin/tl-try-makeself index 0c2482a926d..386873ae687 100755 --- a/Master/tlpkg/bin/tl-try-makeself +++ b/Master/tlpkg/bin/tl-try-makeself @@ -1,10 +1,13 @@ #!/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 @@ rm -rf "$testdir" 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 @@ tl=${1-"/tmp/ki"} # sp" 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 diff --git a/Master/tlpkg/bin/tl-update-nsis b/Master/tlpkg/bin/tl-update-nsis index 5f05ad7de97..7b41c32d9be 100755 --- a/Master/tlpkg/bin/tl-update-nsis +++ b/Master/tlpkg/bin/tl-update-nsis @@ -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 @@ pod2usage(-exitstatus => 0, -verbose => 2) if $opt_help; 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,11 +171,15 @@ function in L for details. =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 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 explains more. + +This is invoked by the C script, along with the +sibling C which creates a similar disaster +recovery executable for Unix. =head1 AUTHORS AND COPYRIGHT diff --git a/Master/tlpkg/bin/tl-update-tlcritical b/Master/tlpkg/bin/tl-update-tlcritical index c67617e1155..d172d196369 100755 --- a/Master/tlpkg/bin/tl-update-tlcritical +++ b/Master/tlpkg/bin/tl-update-tlcritical @@ -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 @@ while test $# -gt 0; do 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 @@ if test -n "$recreate"; then 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 @@ makensis $TMPDIR/updater.nsi >$TMPDIR/makensis.log rm -f $TMPDIR/updater.nsi do_updater exe +echo $tlcrit: ls -lt $tlcrit diff --git a/Master/tlpkg/bin/tltestnet b/Master/tlpkg/bin/tltestnet new file mode 100755 index 00000000000..38248e89a2f --- /dev/null +++ b/Master/tlpkg/bin/tltestnet @@ -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 -- cgit v1.2.3