From acb37f8787486717b8fab68a9cacadb577eaf723 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 30 Dec 2019 23:43:21 +0000 Subject: check for broken symlinks under bin/, both source tree and after test installation git-svn-id: svn://tug.org/texlive/trunk@53274 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/bin/tl-check-symlinks | 30 +++++++++++++++++++++++ Master/tlpkg/bin/tl-update-tlnet | 50 +++++++++++++++++++++++--------------- 2 files changed, 61 insertions(+), 19 deletions(-) create mode 100755 Master/tlpkg/bin/tl-check-symlinks diff --git a/Master/tlpkg/bin/tl-check-symlinks b/Master/tlpkg/bin/tl-check-symlinks new file mode 100755 index 00000000000..b26ad4d3f90 --- /dev/null +++ b/Master/tlpkg/bin/tl-check-symlinks @@ -0,0 +1,30 @@ +#!/usr/bin/env perl +# $Id$ +# Check given directory tree(s) (default to .) for broken symlinks; +# report any found, and exit accordingly. + +use strict; +use warnings; +use File::Find; + +our $fail = 0; +$ARGV[0] = "." if ! @ARGV; +find(\&process_file, @ARGV); +exit $fail; + +# $File::Find::dir is the current directory name, +# $_ is the current filename within that directory +# $File::Find::name is the complete pathname to the file. +# +sub process_file { + return unless -l; + return if -r; + $fail = 1; + print "broken link $File::Find::name -> ", readlink($_), "\n"; +} + +# Doesn't get to the warning in Find.pm, dunno. Anyway, our warning is +# better since it includes the target. +#!/bin/sh +# exec perl -w -MFile::Find -e 'my $wanted=sub{}; +# find({wanted=>$wanted, dangling_symlinks=>1}, "/home/karl/bin");' diff --git a/Master/tlpkg/bin/tl-update-tlnet b/Master/tlpkg/bin/tl-update-tlnet index a3dc374e205..7125723bc01 100755 --- a/Master/tlpkg/bin/tl-update-tlnet +++ b/Master/tlpkg/bin/tl-update-tlnet @@ -42,7 +42,7 @@ while test $# -gt 0; do --help) echo "ustl. sorry."; exit 0;; --version) echo "$vc_id"; exit 0;; *) echo "$0: unrecognized option \`$1'; see source." >&2 - exit 1;; + exit 1;; esac shift done @@ -66,6 +66,11 @@ if test -z "$Master"; then Master=`cd $mydir/../.. && pwd` fi +# If there are broken symlinks anywhere in the bin directories, give up +# right away. The nightly cron checks that there no symlinks anywhere else. +# Below, we check for broken symlinks in the bin/ dir as installed. +$Master/tlpkg/bin/tl-check-symlinks $Master/bin + # Keep the default out of ~ftp/texlive, which CTAN mirrors much of test -z "$tltrybase" \ && tltrybase=`cd $tlweb/../.. && pwd`/tlnet-trial-`date +%y%m%d` @@ -205,7 +210,7 @@ if test -n "$unexpected_output"; then $ignore_unexpected_output || failure=true echo >&2 echo "$0: Test installation failed." >&2 - echo "$0: Here is the unexpected output from $tlnet_install_log:" >&2 + echo "$0: Here is the unexpected output, from $tlnet_install_log:" >&2 echo "$unexpected_output" >&2 echo "$0: (end of unexpected output)." >&2 fi @@ -215,6 +220,8 @@ if test $failure = false; then for cmd in \ "$tltryinst/$yyyy/bin/*/tlmgr --repository $tltry update --list" \ "$tltryinst/$yyyy/bin/*/updmap-sys -n" \ + "$tltryinst/$yyyy/bin/*/mktexlsr -n --verbose" \ + "$Master/tlpkg/bin/tl-check-symlinks $tltryinst/$yyyy/bin" \ "$Master/tlpkg/bin/tl-check-tlnet-consistency --location=$tltry" \ "$Master/tlpkg/bin/tl-compare-tlpdbs $critical $tltry/tlpkg/texlive.tlpdb" \ ; do @@ -252,32 +259,37 @@ fi cp -f $tlnet_install_log /tmp test ! -r $install_tl_log || cp -f $install_tl_log /tmp -if $failure; then +if $failure || $chicken; then echo >&2 echo "$0: Our transcript file: $tlnet_install_log" >&2 echo "$0: install-tl log file: $install_tl_log" >&2 echo "$0: Copies of both are in /tmp." >&2 echo "$0: Please rm -rf the trial dir." >&2 - exit 1 + if $failure; then + exit 1 + elif $chicken; then + echo + echo "$0: Chicken mode, not updating anything." + exit 0 + else + echo "$0: impossible non-failure non-chicken." >&2 + exit 2 + fi fi # # no unexpected output, so ship the new packages. cd $tltrybase -if $chicken; then - echo "$0: Chicken mode, not updating anything." -else - echo "$0: Updating $tlweb from $tltry." - # copy any mactex files since we didn't link them. - for f in $tlweb/*mactex*; do - test ! -r $f || cp -pf $f $tltry - done - - # mv then rm to avoid the mirmon probe from making the rm fail. - mv $tlweb $tltrybase/tlnet.old - mv $tltry $tlweb - rm -rf $tltrybase - echo "$0: Done." -fi +echo "$0: Updating $tlweb from $tltry." +# copy any mactex files since we didn't link them. +for f in $tlweb/*mactex*; do + test ! -r $f || cp -pf $f $tltry +done + +# mv then rm to avoid the mirmon probe from making the rm fail. +mv $tlweb $tltrybase/tlnet.old +mv $tltry $tlweb +rm -rf $tltrybase +echo "$0: Done." exit 0 -- cgit v1.2.3