summaryrefslogtreecommitdiff
path: root/Master/setuptl/TLPM/check.pm
diff options
context:
space:
mode:
authorStaszek Wawrykiewicz <staw@gust.org.pl>2006-12-27 17:58:42 +0000
committerStaszek Wawrykiewicz <staw@gust.org.pl>2006-12-27 17:58:42 +0000
commit8a7c60c46ef0b8e1eb91b1cfbf28fafa75f6c4f7 (patch)
treec9391cde76a718202b476e95f4f5f7de2fd845c7 /Master/setuptl/TLPM/check.pm
parent8991be85597c075fe49bd4c860a4f525eaa5441a (diff)
setuptl installers added
git-svn-id: svn://tug.org/texlive/trunk@2984 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/setuptl/TLPM/check.pm')
-rw-r--r--Master/setuptl/TLPM/check.pm67
1 files changed, 67 insertions, 0 deletions
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;