summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-12-10 19:24:29 +0000
committerKarl Berry <karl@freefriends.org>2008-12-10 19:24:29 +0000
commita5debc181fdd5c81cbc800cf5d469b204c51e042 (patch)
tree560d53d433654504682765c1d8a8271a7fe79b15 /Master
parente4c4c4e6294d42e476b5faa2c108d23d4ee35de7 (diff)
check that packages belong to at least one collection.
git-svn-id: svn://tug.org/texlive/trunk@11584 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/tlpkg/bin/check-depend-consistency77
1 files changed, 54 insertions, 23 deletions
diff --git a/Master/tlpkg/bin/check-depend-consistency b/Master/tlpkg/bin/check-depend-consistency
index 2859a3118d2..cfd25d64fb3 100755
--- a/Master/tlpkg/bin/check-depend-consistency
+++ b/Master/tlpkg/bin/check-depend-consistency
@@ -1,10 +1,11 @@
#!/usr/bin/env perl
# $Id: check-depend-consistency 0 2007-10-14 20:32:44Z karl $
-# Copyright 2007 Norbert Preining
+# Copyright 2007, 2008 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
#
-# Check that all package are contained in some collection.
+# Check that all packages are contained in at least one collection, and
+# that all depend statements refer to an existing package.
BEGIN {
$^W = 1;
@@ -15,62 +16,86 @@ BEGIN {
our $mydir;
use strict;
+use Getopt::Long;
+use Pod::Usage;
+use File::Path;
use TeXLive::TLConfig;
use TeXLive::TLUtils;
use TeXLive::TLPOBJ;
use TeXLive::TLPDB;
-use Getopt::Long;
-use Pod::Usage;
-use File::Path;
my $help = 0;
TeXLive::TLUtils::process_logging_options();
-
GetOptions("help|?" => \$help) or pod2usage(1);
-pod2usage(-exitstatus => 0, -verbose => 2) if $help;
+pod2usage("-exitstatus" => 0, "-verbose" => 2) if $help;
exit (&main ());
+
sub main
{
+ my $ret = 0;
+
# get the db.
- chomp (my $Master = `cd $mydir/../.. && pwd`); # xx TLPDB should default
- my $tlpdb = TeXLive::TLPDB->new ("root" => "$Master");
- die("Cannot find tlpdb in $Master!\n") unless defined($tlpdb);
+ chomp (my $Master = `cd $mydir/../.. && pwd`);
+ my $tlpdb = TeXLive::TLPDB->new("root" => $Master);
+ die "$0: Cannot find tlpdb in $Master.\n" unless defined($tlpdb);
+
my %presentpkg;
- my %wrongdep;
for my $pkg ($tlpdb->list_packages) {
$presentpkg{$pkg} = 1;
}
+
+ # list of collections.
+ my @colls = $tlpdb->collections;
+ my @coll_deps = $tlpdb->expand_dependencies("-no-collections",$tlpdb,@colls);
+ my %coll_deps;
+ @coll_deps{@coll_deps} = (); # initialize hash with keys from list
+
+ my (%wrong_dep, @no_dep);
for my $pkg ($tlpdb->list_packages) {
- # do not check any package starting with 00texlive
+ # do not check any package starting with 00texlive.
next if $pkg =~ m/^00texlive/;
- #next if ($pkg =~ m/^00texlive\.config$/);
- #next if ($pkg =~ m/^00texlive-installation\.config$/);
+
+ # For each package, check that it is a dependency of some collection.
+ # Whatever is left in %coll_deps after this loop will be the problem
+ if (! exists $coll_deps{$pkg}) {
+ # Except that schemes and our special .win32 packages are ok.
+ push (@no_dep, $pkg) unless $pkg =~/^scheme-|\.win32$/;
+ }
+
+ # For each dependency, check that we have a package.
for my $d ($tlpdb->get_package($pkg)->depends) {
next if ($d =~ m/\.ARCH$/);
if (!defined($presentpkg{$d})) {
- push @{$wrongdep{$d}}, $pkg;
+ push (@{$wrong_dep{$d}}, $pkg);
}
}
}
- if (keys %wrongdep) {
+
+ if (keys %wrong_dep) {
+ $ret++;
print "DEPENDS WITHOUT PACKAGES:\n";
- for my $d (keys %wrongdep) {
- print "$d occurring in ", @{$wrongdep{$d}}, "\n";
+ for my $d (keys %wrong_dep) {
+ print "$d occurring in ", @{$wrong_dep{$d}}, "\n";
}
}
-}
-
+ if (@no_dep) {
+ $ret++;
+ print "PACKAGES NOT IN ANY COLLECTION: @no_dep\n";
+ }
+
+ return $ret;
+}
__END__
=head1 NAME
-check-depend-consistency - check that all depends actually exist as packages
+check-depend-consistency - check that all dependencies exist as packages
=head1 SYNOPSIS
@@ -84,8 +109,14 @@ function in L<TeXLive::TLUtils> for details.
=head1 DESCRIPTION
-Check consistency of C<depend> statements in all TeX Live packages,
-including collections and schemes.
+Check that all C<depend> statements in all TeX Live packages
+(collections, schemes, and normal packages) refer to existing packages.
+
+Also check that every package is a dependency of at least one collection.
+
+These checks are made according to the tlpdb that is within the
+hierarchy from which this script is invoked; the actual file tree is not
+inspected.
=head1 AUTHORS AND COPYRIGHT