diff options
author | Norbert Preining <preining@logic.at> | 2009-09-17 14:38:36 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2009-09-17 14:38:36 +0000 |
commit | 7dcca4169af060615f07f1a139046273e3c7c63d (patch) | |
tree | f2b241f39d59958e90b3eaf38120faf5b448c388 /Master/tlpkg/bin/tl-compare-tlpdbs | |
parent | 482768568642607b7c1f3ca7dc7b05f7405decc4 (diff) |
simplify tl-compare-tlpdbs by using the TLUtils function, docs tl-update-tlpdb
git-svn-id: svn://tug.org/texlive/trunk@15337 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/bin/tl-compare-tlpdbs')
-rwxr-xr-x | Master/tlpkg/bin/tl-compare-tlpdbs | 101 |
1 files changed, 7 insertions, 94 deletions
diff --git a/Master/tlpkg/bin/tl-compare-tlpdbs b/Master/tlpkg/bin/tl-compare-tlpdbs index 9324b818fd5..7aedb79f731 100755 --- a/Master/tlpkg/bin/tl-compare-tlpdbs +++ b/Master/tlpkg/bin/tl-compare-tlpdbs @@ -14,13 +14,10 @@ BEGIN { } use strict; -use TeXLive::TLConfig; -use TeXLive::TLPOBJ; -use TeXLive::TLPDB; use TeXLive::TLUtils; +use TeXLive::TLPDB; use Getopt::Long; use Pod::Usage; -use File::Path; my @ignored_packs = qw/00texlive.installer 00texlive.image/; @@ -85,101 +82,17 @@ sub main $tlpdbA->from_file($tlpdbAsrc); $tlpdbB->from_file($tlpdbBsrc); - my @inAnotinB; - my @inBnotinA; - my @revision_differ; - - my %do_compare; - my %filedifferrors; - - for my $p ($tlpdbA->list_packages()) { - next if TeXLive::TLUtils::member($p, @ignored_packs); - my $tlpB = $tlpdbB->get_package($p); - if (!defined($tlpB)) { - push @inAnotinB, $p; - } else { - $do_compare{$p} = 1; - } - } - for my $p ($tlpdbB->list_packages()) { - next if TeXLive::TLUtils::member($p, @ignored_packs); - my $tlpA = $tlpdbA->get_package($p); - if (!defined($tlpA)) { - push @inBnotinA, $p; - } else { - $do_compare{$p} = 1; - } - } - for my $p (sort keys %do_compare) { - my $tlpA = $tlpdbA->get_package($p); - my $tlpB = $tlpdbB->get_package($p); - my $rA = $tlpA->revision; - my $rB = $tlpB->revision; - if ($rA != $rB) { - push @revision_differ, "$p rev differ: revision left $rA, revision right $rB\n"; - } else { - if ($tlpA->relocated) { - $tlpA->cancel_reloc_prefix; - } - if ($tlpB->relocated) { - $tlpB->cancel_reloc_prefix; - } - my @fA = $tlpA->all_files; - my @fB = $tlpB->all_files; - my @ret = compare_lists(\@fA, \@fB); - push @{$filedifferrors{$p}}, @ret if @ret; - } - } - - my $ret = 0; + my %ret = TeXLive::TLUtils::compare_tlpdbs($tlpdbA, $tlpdbB); - if (@revision_differ) { - $ret = 1; - print "packages with revision discrepancy:\n"; - for my $p (@revision_differ) { - print "$p"; - } + # anything reported here is a difference in tlpdbs which we do not want + if (keys %ret) { + TeXLive::TLUtils::report_tlpdb_differences(\%ret); + return 1; } - if (@inAnotinB) { - $ret = 1; - print "packages which occur in the left tlpdb but not in the right:\n"; - for my $p (@inAnotinB) { - print "$p\n"; - } - } - if (@inBnotinA) { - $ret = 1; - print "packages which occur in the right tlpdb but not in the left:\n"; - for my $p (@inBnotinA) { - print "$p\n"; - } - } - for my $pkg (keys %filedifferrors) { - $ret = 1; - print "file differences in $pkg:\n"; - for my $l (@{$filedifferrors{$pkg}}) { - print " $l\n"; - } - } - return($ret); + return 0; } -sub compare_lists { - my ($la, $lb) = @_; - my @la = @$la; - my @lb = @$lb; - my %onlyfirst; - my %onlysecond; - my @ret; - for my $f (@la) { $onlyfirst{$f} = 1; } - for my $f (@lb) { delete($onlyfirst{$f}); $onlysecond{$f} = 1; } - for my $f (@la) { delete($onlysecond{$f}); } - for my $f (sort keys %onlyfirst) { push @ret, "-$f"; } - for my $f (sort keys %onlysecond) { push @ret, "+$f"; } - return(@ret); -} - __END__ =head1 NAME |