From 8a7c60c46ef0b8e1eb91b1cfbf28fafa75f6c4f7 Mon Sep 17 00:00:00 2001 From: Staszek Wawrykiewicz Date: Wed, 27 Dec 2006 17:58:42 +0000 Subject: setuptl installers added git-svn-id: svn://tug.org/texlive/trunk@2984 c570f23f-e606-0410-a88d-b1316a301751 --- Master/setuptl/TLPM/check.pm | 67 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Master/setuptl/TLPM/check.pm (limited to 'Master/setuptl/TLPM/check.pm') diff --git a/Master/setuptl/TLPM/check.pm b/Master/setuptl/TLPM/check.pm new file mode 100644 index 00000000000..9000369dd3b --- /dev/null +++ b/Master/setuptl/TLPM/check.pm @@ -0,0 +1,67 @@ +# This file belongs to TLPM v2.14, TeX Live Package Manager +# Public Domain, P.Jackowski@gust.org.pl + +# check [-pf] +# check the installation consistency + +sub check +{ + my $arg; + local $tl_target_new; + $check_method = \&check_pkges; + while(defined($arg = shift)) + { + $arg eq '' and next + or &is_opt($arg,'f','files') and $check_method = \&check_files + or &is_opt($arg,'p','packages') and $check_method = \&check_pkges + or &is_opt($arg,'d','directory') and do {$tl_target_new = shift;1} + or &is_opt($arg,'h','help') and return $heeelp -> ('check') + or &rem_opt($arg) and return $error{'wrong_opt'} -> ($arg,'check --help'); + }# force reading the target, even if already defined + $tl_target_new ||= $tl_target; + $tl_target_indeed = $false; + return if &read_target(); + return if &open_log(); + $check_method -> (); + &close_log(); +} + +sub check_files +{ + my ($fcount,$pcount) = (0,0); + my $pkg; + my @miss; + foreach $pkg (&get_pkg_all($target_pkges)) + { + @miss = grep {not(-f "$tl_target$chr_dirsep$_")} &get_pkg_contains($pkg,$target_pkges); + next unless scalar @miss; + ++$pcount; + $fcount += scalar @miss; + $messf -> ($row_fmt . "missing %s\n",$pkg,join(",\n" . ' ' x ($row_skip + 8),@miss)); + } + if($tlpm_redir < 2) + { + $message -> (&one_or_more($fcount,'missing file','missing files') . ' in ' . + &one_or_more($pcount,'package','packages')); + } +} + +sub check_pkges +{ + my $pcount = 0; + my $pkg; + my @miss; + foreach $pkg (&get_pkg_all($target_pkges)) + { + @miss = &get_pkg_miss($pkg,$target_pkges); + next unless scalar @miss; + ++$pcount; + $messf -> ($row_fmt . "missing %s\n",$pkg,join(",\n" . ' ' x ($row_skip + 8),@miss)); + } + if($tlpm_redir < 2) + { + $message -> ("$pcount missing " . ($pcount == 1 ? "package" : "packages")); + } +} + +1; -- cgit v1.2.3