summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-09-17 23:00:54 +0000
committerNorbert Preining <preining@logic.at>2008-09-17 23:00:54 +0000
commit75c3fbbc249c1eb661ea4e05507ec24a89ed5745 (patch)
tree216a337fed65ba1906daaa8fc88b0603f44512ff /Master
parent80f88e13a65969badb07bc818dbb7b5b7be1b0ab (diff)
start implement tlmgr check functionality
git-svn-id: svn://tug.org/texlive/trunk@10623 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr.pl80
1 files changed, 78 insertions, 2 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl
index 7a56b4dc1da..599cc5eafd7 100755
--- a/Master/texmf/scripts/texlive/tlmgr.pl
+++ b/Master/texmf/scripts/texlive/tlmgr.pl
@@ -11,12 +11,10 @@
# the depends closure operation
# . call TLMedia->install_package so that deps are NOT installed
# since all deps are actually installed from tlmgr itself
-# - check of consistency: all files mentioned are actually present
# - reinstall a package: assume that i want to donwgrade from a different
# mirror or I want to fix an accidentally removed file
# - ordering or collections removal (see below for details)
# - (?) removal does not remove created format files from TEXMFSYSVAR
-# - other features: dependency check?, ...?
# - after install/update show the number of bytes transfered
# (email Rolf Niepraschk)
# - merge tlmgrgui into tlmgr to reduce re-loading of tlpdb again and again
@@ -138,6 +136,8 @@ if ($action =~ m/^_include_tlpobj$/) {
merge_into(\%ret, action_list());
# should we do postinstall stuff?
exit(0);
+} elsif ($action =~ m/^check$/i) {
+ merge_into(\%ret, action_check());
} elsif ($action =~ m/^install$/i) {
merge_into(\%ret, action_install());
} elsif ($action =~ m/^update$/i) {
@@ -1232,6 +1232,64 @@ sub action_uninstall {
system("rmdir", "--ignore-fail-on-non-empty", "$texdir");
}
+
+sub action_check {
+ my $what = shift @ARGV;
+ $what || ($what = "all");
+ init_local_db();
+ my $ret = 0;
+ if ($what =~ m/^all/i) {
+ $ret ||= check_file();
+ $ret ||= check_collections();
+ } elsif ($what =~ m/^files/i) {
+ $ret ||= check_file();
+ } elsif ($what =~ m/^collections/i) {
+ $ret ||= check_collections();
+ } else {
+ print "No idea how to check that: $what\n";
+ }
+ exit $ret;
+}
+
+#
+# check file coverage, roughly equivalent to tlpkg/bin/check-file-coverage
+#
+sub check_file {
+ my @missing = ();
+ my $Master = $localtlpdb->root;
+ for my $p ($localtlpdb->list_packages()) {
+ my $tlp = $localtlpdb->get_package($p);
+ for my $f ($tlp->all_files) {
+ push @missing, "$f ($p)" if (! -r "$Master/$f");
+ }
+ }
+ return(0) if (!@missing);
+ print "Missing files (relative to $Master):\n";
+ for my $m (@missing) {
+ print "\t$m\n";
+ }
+ print "\n";
+}
+#
+# check collections
+#
+sub check_collections {
+ my @missing = ();
+ for my $p ($localtlpdb->collections()) {
+ my $col = $localtlpdb->get_package($p);
+ for my $d ($col->depends) {
+ push @missing, "$d ($p)" if (!defined($localtlpdb->get_package($d)));
+ }
+ }
+ return(0) if (!@missing);
+ print "Packages listed in collections but not present:\n";
+ for my $m (@missing) {
+ print "\t$m\n";
+ }
+ print "\n";
+}
+
+
#
# initialize the global $tlmediasrc object, or die.
# uses the global $location.
@@ -1618,6 +1676,24 @@ location, prefixing those already installed with C<i >.
With an argument lists only collections or schemes, as requested.
+=item B<check [files|collections|all]>
+
+Executes one (or all) check(s) on the consistency of the installation.
+
+=over 4
+
+=item B<files>
+
+Checks that all files listed in the TeX Live Database (texlive.tlpdb)
+are actually present, and lists those missing.
+
+=item B<collections>
+
+Lists those packages which occur as dependencies in an installed collections,
+but are themselves not installed.
+
+=back
+
=item B<uninstall>
Uninstalls the entire TeX Live installation. Options: