diff options
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 03a695eee03..01350f641aa 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -201,11 +201,11 @@ sub platform { # explicitly because sometimes the 'noexec' flag is set in # /etc/fstab for ISO9660 file systems. chomp (my $guessed_platform = `/bin/sh $config_guess`); - + # For example, if the disc or reader has hardware problems. die "$0: could not run $config_guess, cannot proceed, sorry" if ! $guessed_platform; - + $guessed_platform =~ s/^x86_64-(.*)-freebsd/amd64-$1-freebsd/; my $CPU; # CPU type as reported by config.guess. my $OS; # O/S type as reported by config.guess. @@ -218,7 +218,7 @@ sub platform { if ($OS eq "darwin") { $CPU = "universal"; # TL provides universal binaries } elsif ($CPU =~ /^i.86$/) { - $CPU =~ "i386"; # 586, 686, whatever + $CPU = "i386"; # 586, 686, whatever } unless (defined $OS) { ($OS = $guessed_platform) =~ s/.*-(.*)/$1/; @@ -389,7 +389,7 @@ sub get_system_tmpdir { =item C<tl_tmpdir> -Create a temporary directory which is cleaned up as soon as the program +Create a temporary directory which is cleaned up as soon as the program is terminated. =cut @@ -856,7 +856,7 @@ are created. sub touch { my @files=@_; - + foreach my $file (@_) { if (-e $file) { utime time, time, $file; @@ -907,7 +907,7 @@ sub collapse_dirs my (@files) = @_; my @ret = (); my %by_dir; - + # construct hash of all directories mentioned, values are lists of the # files in that directory. for my $f (@files) { @@ -918,7 +918,7 @@ sub collapse_dirs push (@a, $abs_f); $by_dir{$d} = \@a; } - + # for each of our directories, see if we are given everything in # the directory. if so, return the directory; else return the # individual files. @@ -926,7 +926,7 @@ sub collapse_dirs opendir (DIR, $d) || die "opendir($d) failed: $!"; my @dirents = readdir (DIR); closedir (DIR) || warn "closedir($d) failed: $!"; - + # initialize test hash with all the files we saw in this dir. # (These idioms are due to "Finding Elements in One Array and Not # Another" in the Perl Cookbook.) @@ -945,10 +945,10 @@ sub collapse_dirs last; # no need to keep looking after the first. } } - + push (@ret, $ok_to_collapse ? $d : @{$by_dir{$d}}); } - + if (@ret != @files) { @ret = &collapse_dirs (@ret); } @@ -984,7 +984,7 @@ sub removed_dirs # what should we do with not existing entries???? next if (! -r "$f"); my $abs_f = Cwd::abs_path ($f); - # the following is necessary because on win32, + # the following is necessary because on win32, # abs_path("tl-portable") # returns # c:\tl test\... @@ -1078,7 +1078,7 @@ sub install_packages { $tlpsizes{$p} += $tlpobjs{$p}->srccontainersize if $opt_src; $tlpsizes{$p} += $tlpobjs{$p}->doccontainersize if $opt_doc; } else { - # we have to add the respective sizes, that is checking for + # we have to add the respective sizes, that is checking for # installation of src and doc file $tlpsizes{$p} = $tlpobjs{$p}->runsize; $tlpsizes{$p} += $tlpobjs{$p}->srcsize if $opt_src; @@ -1154,8 +1154,8 @@ sub install_packages { } elsif ($media eq 'NET') { $container = "$root/$Archive/$package.$DefaultContainerExtension"; } - if (!install_package($container, $reloc, $tlpobj->containersize, - $tlpobj->containermd5, \@installfiles, + if (!install_package($container, $reloc, $tlpobj->containersize, + $tlpobj->containermd5, \@installfiles, $totlpdb->root, $vars{'this_platform'})) { # we already warn in install_package that something bad happened, # so only return here @@ -1220,7 +1220,7 @@ sub install_packages { my $totaltime = time() - $starttime; my $totmin = int ($totaltime/60); my $totsec = $totaltime % 60; - info(sprintf("Time used for installing the packages: %02d:%02d\n", + info(sprintf("Time used for installing the packages: %02d:%02d\n", $totmin, $totsec)); $totlpdb->save; return 1; @@ -1374,10 +1374,10 @@ sub install_package { tlwarn("Un-tarring $tarfile did not succeed.\n"); return 0; } - # we remove the created .tlpobj it is recreated anyway in + # we remove the created .tlpobj it is recreated anyway in # install_packages above in the right place. This way we also # get rid of the $pkg.source.tlpobj which are useless - unlink ("$target/tlpkg/tlpobj/$pkg.tlpobj") + unlink ("$target/tlpkg/tlpobj/$pkg.tlpobj") if (-r "$target/tlpkg/tlpobj/$pkg.tlpobj"); if ($what =~ m,http://|ftp://,) { # we downloaded the original .tar.lzma from the net, so we keep it @@ -1438,7 +1438,7 @@ sub do_postaction { sub _do_postaction_fileassoc { my ($how, $mode, $tlpobj, $pa) = @_; return 1 unless win32(); - my ($errors, %keyval) = + my ($errors, %keyval) = parse_into_keywords($pa, qw/extension filetype/); if ($errors) { @@ -1459,8 +1459,8 @@ sub _do_postaction_fileassoc { return 0; } my $filetype = $keyval{'filetype'}; - - &log("postaction $how fileassoc for " . $tlpobj->name . + + &log("postaction $how fileassoc for " . $tlpobj->name . ": $extension, $filetype\n"); if ($how eq "install") { TeXLive::TLWinGoo::register_extension($mode, $extension, $filetype); @@ -1475,7 +1475,7 @@ sub _do_postaction_fileassoc { sub _do_postaction_filetype { my ($how, $tlpobj, $pa) = @_; return 1 unless win32(); - my ($errors, %keyval) = + my ($errors, %keyval) = parse_into_keywords($pa, qw/name cmd/); if ($errors) { @@ -1502,7 +1502,7 @@ sub _do_postaction_filetype { my $texdir_bsl = conv_to_w32_path($texdir); $cmd =~ s!^TEXDIR/!$texdir/!g; - &log("postaction $how filetype for " . $tlpobj->name . + &log("postaction $how filetype for " . $tlpobj->name . ": $name, $cmd\n"); if ($how eq "install") { TeXLive::TLWinGoo::register_file_type($name, $cmd); @@ -1517,7 +1517,7 @@ sub _do_postaction_filetype { sub _do_postaction_script { my ($how, $tlpobj, $pa) = @_; - my ($errors, %keyval) = + my ($errors, %keyval) = parse_into_keywords($pa, qw/file filew32/); if ($errors) { @@ -1562,7 +1562,7 @@ sub _do_postaction_script { sub _do_postaction_shortcut { my ($how, $tlpobj, $pa) = @_; return 1 unless win32(); - my ($errors, %keyval) = + my ($errors, %keyval) = parse_into_keywords($pa, qw/type name icon cmd args hide/); if ($errors) { @@ -1599,7 +1599,7 @@ sub _do_postaction_shortcut { tlwarn("hide of shortcut postaction $hide is unknown (0, 1)\n"); return 0; } - + &log("postaction $how shortcut for " . $tlpobj->name . "\n"); if ($how eq "install") { my $texdir = `kpsewhich -var-value=SELFAUTOPARENT`; @@ -1614,7 +1614,7 @@ sub _do_postaction_shortcut { } if ($type eq "menu") { TeXLive::TLWinGoo::add_menu_shortcut( - $TeXLive::TLConfig::WindowsMainMenuName, + $TeXLive::TLConfig::WindowsMainMenuName, $name, $icon, $cmd, $args, $hide); } elsif ($type eq "desktop") { TeXLive::TLWinGoo::add_desktop_shortcut( @@ -1666,7 +1666,7 @@ sub parse_into_keywords { =item C<announce_execute_actions($how, $tlpobj)> -Announces that the actions given in C<$tlpobj> should be executed +Announces that the actions given in C<$tlpobj> should be executed after all packages have been unpacked. =cut @@ -1834,7 +1834,7 @@ sub remove_symlinks { These two functions try to add/remove the binary directory $bindir on Windows to the registry PATH variable. -If running as admin user and $multiuser is set, the system path will +If running as admin user and $multiuser is set, the system path will be adjusted, otherwise the user path. After calling these functions TeXLive::TLWinGoo::broadcast_env() should @@ -1903,12 +1903,12 @@ sub untar { my $ret; my $tar = $::progs{'tar'}; # assume it's been set up - + # don't use the -C option to tar since Solaris tar et al. don't support it. # don't use system("cd ... && $tar ...") since that opens us up to # quoting issues. # so fall back on chdir in Perl. - # + # debug("unpacking $tarfile in $targetdir\n"); my $cwd = cwd(); chdir($targetdir) || die "chdir($targetdir) failed: $!"; @@ -1928,10 +1928,10 @@ sub untar { =item C<tlcmp($file, $file)> -Compare two files considering CR, LF, and CRLF as equivalent. +Compare two files considering CR, LF, and CRLF as equivalent. Returns 1 if different, 0 if the same. -=cut +=cut sub tlcmp { @@ -1945,19 +1945,19 @@ END_USAGE } my $file1 = &read_file_ignore_cr ($filea); my $file2 = &read_file_ignore_cr ($fileb); - + return $file1 eq $file2 ? 0 : 1; } # Return contents of FNAME as a string, converting all of CR, LF, and # CRLF to just LF. -# +# sub read_file_ignore_cr { my ($fname) = @_; my $ret = ""; - + local *FILE; open (FILE, $fname) || die "open($fname) failed: $!"; while (<FILE>) { @@ -1988,7 +1988,7 @@ Return 0 if failure, nonzero if success. sub setup_programs { my ($bindir, $platform) = @_; my $ok = 1; - + $::progs{'wget'} = "wget"; $::progs{'xzdec'} = "xzdec"; $::progs{'xz'} = "xz"; @@ -2043,7 +2043,7 @@ sub setup_programs { # # fallback: # if prog is found in PATH and can be executed, use it. -# +# # Return 0 if failure, 1 if success. # sub setup_unix_one { @@ -2078,7 +2078,7 @@ sub setup_unix_one { # # create tmp dir only when necessary $tmp = TeXLive::TLUtils::tl_tmpdir() unless defined($tmp); - # probably we are running from DVD and want to copy it to + # probably we are running from DVD and want to copy it to # some temporary location copy($def, $tmp); my $bn = basename($def); @@ -2113,7 +2113,7 @@ sub setup_unix_one { $test_fallback = 1; } if ($test_fallback) { - # all our playing around and copying did not succeed, try the + # all our playing around and copying did not succeed, try the # fallback $::progs{$p} = $p; if ($arg ne "notest") { @@ -2562,7 +2562,7 @@ sub texdir_check { # no newlines or spaces are added, multiple args are just concatenated. -# +# sub logit { my ($out, $level, @rest) = @_; _logit($out, $level, @rest) unless $::opt_quiet; @@ -2810,11 +2810,11 @@ sub process_logging_options { "vvv" => \$opt_VERBOSITY, "q" => \$::opt_quiet); Getopt::Long::Configure($oldconfig); - + # verbosity level, forcing -v -v instead of -vv is too annoying. $::opt_verbosity = 2 if $opt_Verbosity; $::opt_verbosity = 3 if $opt_VERBOSITY; - + # open log file if one was requested. if ($opt_logfile) { open(TLUTILS_LOGFILE, ">$opt_logfile") || die "open(>$opt_logfile) failed: $!\n"; @@ -2833,9 +2833,9 @@ Return the welcome message. sub welcome { my $welcome=<<"EOF"; - See + See $::vars{'TEXDIR'}/index.html - for links to documentation. The TeX Live web site (http://tug.org/texlive/) + for links to documentation. The TeX Live web site (http://tug.org/texlive/) contains any updates and corrections. TeX Live is a joint project of the TeX user groups around the world; @@ -2859,9 +2859,9 @@ and C<INFOPATH>. sub welcome_paths { my $welcome=<<"EOF"; - See - $::vars{'TEXDIR'}/index.html - for links to documentation. The TeX Live web site (http://tug.org/texlive/) + See + $::vars{'TEXDIR'}/index.html + for links to documentation. The TeX Live web site (http://tug.org/texlive/) contains any updates and corrections. TeX Live is a joint project of the TeX user groups around the world; @@ -2941,7 +2941,7 @@ sub give_ctan_mirror_base tlwarn ("give_ctan_mirror: Programs not set up, trying wget\n"); $wget = "wget"; } - + # we need the verbose output, so no -q. # do not reduce retries here, but timeout still seems desirable. my $cmd = "$wget $TeXLiveServerURL --timeout=60 -O " |