diff options
author | Karl Berry <karl@freefriends.org> | 2008-12-01 01:45:57 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-12-01 01:45:57 +0000 |
commit | 81e79cc05b383d38bcf3c7627cfee9079a94f155 (patch) | |
tree | 69352bef7120f00ad755158721725de718866a1e | |
parent | f33d3e3a849c1da12b3681ea9459703b201befbf (diff) |
new utility fns xchdir and xsystem; use them in update-install-pkg; new option to avoid test install in update-tlnet
git-svn-id: svn://tug.org/texlive/trunk@11486 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 50 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tl-update-install-pkg | 40 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tl-update-tlnet | 18 |
3 files changed, 59 insertions, 49 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 061bb495a0e..9e4f80dd3e9 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -19,16 +19,18 @@ C<TeXLive::TLUtils> -- utilities used in the TeX Live infrastructure =head2 Platform Detection - TeXLive::TLUtils::platform; + TeXLive::TLUtils::platform(); TeXLive::TLUtils::platform_desc($platform); - TeXLive::TLUtils::win32; - TeXLive::TLUtils::unix; + TeXLive::TLUtils::win32(); + TeXLive::TLUtils::unix(); =head2 System Tools TeXLive::TLUtils::getenv($string); TeXLive::TLUtils::which($string); - TeXLive::TLUtils::get_system_tmpdir; + TeXLive::TLUtils::get_system_tmpdir(); + TeXLive::TLUtils::xchdir($dir); + TeXLive::TLUtils::xsystem(@args); =head2 File Utilities @@ -114,7 +116,7 @@ BEGIN { &tlmd5 ); @EXPORT = qw(setup_programs download_file info log debug ddebug dddebug - tlwarn process_logging_options win32); + tlwarn process_logging_options win32 xchdir xsystem); } use Cwd; @@ -124,9 +126,9 @@ use Getopt::Long; use TeXLive::TLConfig; $::opt_verbosity = 0; # see process_logging_options + =pod - =head2 Platform Detection =over 4 @@ -338,12 +340,10 @@ sub which { } =pod - =item C<get_system_tmpdir> Evaluate the environment variables C<TMPDIR>, C<TMP>, and C<TEMP> in order to find the system temporary directory. - =cut sub get_system_tmpdir { @@ -356,14 +356,44 @@ sub get_system_tmpdir { } =pod +=item C<xchdir($dir)> -=back +C<chdir($dir)> or die. +=cut + +sub xchdir +{ + my ($dir) = @_; + chdir($dir) || die "$0: chdir($dir) failed: $!"; + ddebug("xchdir($dir) ok\n"); +} + + +=pod +=item C<xsystem(@args)> + +Run C<system(@args)> and die if unsuccessfully. +=cut +sub xsystem +{ + my (@args) = @_; + ddebug("running system(@args)\n"); + my $retval = system(@args); + if ($retval != 0) { + $retval /= 256; + chomp (my $pwd = `pwd`); + die "$0: system(@args) failed in $pwd, status $retval"; + } +} + +=pod + +=back =head2 File Utulities =over 4 - =item C<dirname($path)> Return C<$path> with its trailing C</component> removed. diff --git a/Master/tlpkg/bin/tl-update-install-pkg b/Master/tlpkg/bin/tl-update-install-pkg index 2887999a231..9e1f429165e 100755 --- a/Master/tlpkg/bin/tl-update-install-pkg +++ b/Master/tlpkg/bin/tl-update-install-pkg @@ -24,15 +24,16 @@ BEGIN { unshift (@INC, "$::installerdir/tlpkg"); } -use TeXLive::TLUtils qw(mkdirhier copy get_system_tmpdir info); -use TeXLive::TLPDB; -use TeXLive::TLPOBJ; +use Cwd qw(abs_path); use Getopt::Long; -use Cwd 'abs_path'; $Getopt::Long::autoabbrev=0; -$opt_help=0; -$opt_verbose=0; +use TeXLive::TLPDB; +use TeXLive::TLPOBJ; +use TeXLive::TLUtils qw(:DEFAULT mkdirhier copy get_system_tmpdir); + +$opt_help = 0; +$opt_verbose = 0; $opt_texlivedocs = 0; sub usage @@ -223,37 +224,12 @@ sub install_files # move what we want (corresponds to the mv into savedir) and erase the rest. xsystem ("mv $junkdir/install-tl/install-tl* ."); + xsystem ("rm -rf tlpkg/TeXLive tlpkg/installer"); xsystem ("mv $junkdir/install-tl/tlpkg/* tlpkg/"); xsystem ("rm -rf $junkdir"); } -# chdir or die. -# -sub xchdir -{ - my ($dir) = @_; - chdir ($dir) || die "chdir($dir) failed: $!"; - #chomp (my $pwd = `pwd`); - #print "\t CHDIR $dir (now $pwd)\n"; -} - - -# system or die. -# -sub xsystem -{ - my (@args) = @_; - print "$0: running system(@args)\n"; - my $retval = system (@args); - if ($retval != 0) { - $retval /= 256; - chomp (my $pwd = `pwd`); - die "system(@args) failed in $pwd, status $retval"; - } -} - - ### Local Variables: ### perl-indent-level: 2 ### tab-width: 2 diff --git a/Master/tlpkg/bin/tl-update-tlnet b/Master/tlpkg/bin/tl-update-tlnet index 1d974550297..1327209c257 100755 --- a/Master/tlpkg/bin/tl-update-tlnet +++ b/Master/tlpkg/bin/tl-update-tlnet @@ -12,17 +12,19 @@ unset LS_COLORS chicken=false critical= recreate= +testinstall=true yyyy=2008 while test $# -gt 0; do case $1 in - --critical) critical=--all;; - --dry-run|-n) chicken=true;; - --master) shift; Master=$1;; - --recreate) recreate=--recreate;; - --testlocation) shift; tltrybase=$1;; - --help) echo "xxtodo. Sorry."; exit 0;; - --version) echo "$vc_id"; exit 0;; + --critical) critical=--all;; + --dry-run|-n) chicken=true;; + --master) shift; Master=$1;; + --no-testinstall|-N) testinstall=false;; + --recreate) recreate=--recreate;; + --testlocation) shift; tltrybase=$1;; + --help) echo "xxtodo. Sorry."; exit 0;; + --version) echo "$vc_id"; exit 0;; --*) echo "$0: unrecognized option \`$1'." >&2 exit 1;; *) tlweb=$1;; @@ -71,6 +73,8 @@ echo "$0: Running tl-update-install-pkg..." $Master/tlpkg/bin/tl-update-install-pkg -o $tltry END_COW +# if not doing the test installation, never push anything out. +$testinstall || exit 0 # # Now we have an updated tlweb in $tltry where only the changed files |