summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2009-09-17 14:38:36 +0000
committerNorbert Preining <preining@logic.at>2009-09-17 14:38:36 +0000
commit7dcca4169af060615f07f1a139046273e3c7c63d (patch)
treef2b241f39d59958e90b3eaf38120faf5b448c388 /Master
parent482768568642607b7c1f3ca7dc7b05f7405decc4 (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')
-rwxr-xr-xMaster/tlpkg/bin/tl-compare-tlpdbs101
-rwxr-xr-xMaster/tlpkg/bin/tl-update-tlpdb60
2 files changed, 62 insertions, 99 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
diff --git a/Master/tlpkg/bin/tl-update-tlpdb b/Master/tlpkg/bin/tl-update-tlpdb
index 4984088cede..b7707a15b0c 100755
--- a/Master/tlpkg/bin/tl-update-tlpdb
+++ b/Master/tlpkg/bin/tl-update-tlpdb
@@ -35,6 +35,8 @@ my $opt_norevisioncheck = 0;
my $opt_tlpsrc_from_cmdline = 0;
my $opt_output;
my $opt_fix_reverse_revisions = 0; # needs svn commit
+my $opt_no_commit = 0; # do/don't commit the changes
+my $opt_save_anyway = 0;
TeXLive::TLUtils::process_logging_options();
GetOptions(
@@ -45,6 +47,8 @@ GetOptions(
"no-revision-check" => \$opt_norevisioncheck,
"from-files" => \$opt_fromfiles,
"fix-reverse-revisions" => \$opt_fix_reverse_revisions,
+ "no-commit" => \$opt_no_commit,
+ "save-anyway" => \$opt_save_anyway,
"tlpsrc-from-cmdline" => \$opt_tlpsrc_from_cmdline,
"with-win-pattern-warning" => \$opt_winwarning,
"output=s" => \$opt_output,
@@ -108,27 +112,43 @@ sub main
# compare_tlpdbs returns true if some reversed revisions have been found.
# If in addition the option --fix-reverse-revisions is given it tries
# to fix that, by committing changes.
+ my $buggy_tlpdb = 0;
if (compare_and_fix_tlpdbs($oldtlpdb, $newtlpdb)) {
+ $buggy_tlpdb = 1;
# there have been reversed revision that have already been warned about
# and that have been (hopefully) fixed by compared_tlpdbs if
# --fix-reverse-revisions has been given
#
# if we are running from svn (no --from-files is given) and we try
- # to fix revisions (--fix-reverse-revisions) is given, then we recreate
- # the tlpdb
- if (!$opt_fromfiles && $opt_fix_reverse_revisions) {
+ # to fix revisions (--fix-reverse-revisions) is given, and we do
+ # commit the changes (!$opt_no_commit), then we recreate the tlpdb
+ #
+ if (!$opt_fromfiles && $opt_fix_reverse_revisions && !$opt_no_commit) {
($newtlpdb, $pkgcount) = create_tlpdb($tlc);
#
# now recheck, but do NOT try to check in changes again by unsetting
# $opt_fix_reverse_revisions
$opt_fix_reverse_revisions = 0;
if (compare_and_fix_tlpdbs($oldtlpdb, $newtlpdb)) {
- tldie("$progname: That should not happen, after one iteration of compare_tlpdbs\nthe newly created tlpdb is still going backwards in time.\nPlease check output above!\n");
+ tlwarn("$progname: That should not happen, after one iteration of compare_tlpdbs\nthe newly created tlpdb is still going backwards in time.\nPlease check output above!\n");
+ # $buggy_tlpdb is already set to 1
+ } else {
+ # fixing did succeed
+ $buggy_tlpdb = 0;
}
}
}
# new $newtlpdb points to the right one
- finish ($newtlpdb, $pkgcount);
+ if ($buggy_tlpdb) {
+ tlwarn("$progname: the newly created tlpdb seems to be buggy.\n");
+ if ($opt_save_anyway) {
+ tlwarn("$progname: saving it anyway due to --save-anyway\n");
+ $buggy_tlpdb = 0;
+ } else {
+ tlwarn("$progname: not saving it, you might use --save-anyway\n");
+ }
+ }
+ finish ($newtlpdb, $pkgcount) if (!$buggy_tlpdb);
}
sub compare_and_fix_tlpdbs {
@@ -194,6 +214,15 @@ sub compare_and_fix_tlpdbs {
TeXLive::TLUtils::xsystem($cmd);
}
}
+ if ($opt_no_commit) {
+ if ($commitit) {
+ tlwarn("$progname: tlpsrc files have been change but not committed.\n");
+ tlwarn("$progname: svn status output follows:\n");
+ my $r = `svn status $opt_master/tlpkg/tlpsrc 2>&1`;
+ tlwarn($r . "\n");
+ }
+ $commitit = 0;
+ }
if ($commitit) {
tlwarn("$progname: committing changes to tlpsrc files:\n");
TeXLive::TLUtils::xsystem("svn commit "
@@ -312,15 +341,18 @@ tl-update-tlpdb [OPTION]... [TLPSRC]...
=over 4
=item B<-catalogue> I<Catalogue_dir>
+
The location given by B<-catalogue> must point to a valid TeX Catalogue.
No default value. If given, the generated tlpobj files will contain
information gathered from the TeX Catalogue.
=item B<-master> I<Master/dir>
+
The location I<Master/dir> must point to a valid svn repository of TeX
Live's Master directory. Defaults to C<../..> of C<$0>.
=item B<-no-bin-split>
+
Do NOT split files with binaries into several packages (one for the arch
independent and one for each of the architectures with only the respective
binaries). There is no reason to use this option.
@@ -337,24 +369,42 @@ by default, B<tl-update-tlpdb> saves/updates the tlpdb in the default
place. This option specifies the place where the output should go to.
=item B<-with-win-pattern-warning>
+
Normally, this program issues a warning for all patterns without a matching
file, but does I<not> warn for binpatterns when working on the win32
architecture. Giving this option makes it issues all warnings, i.e., also
those where a binpattern on win32 does not hit.
=item B<-from-files>
+
Use find instead of svn -status to create the list of files.
=item B<-no-revision-check>
+
By default, B<tl-update-tlpdb> checks that in the generated tlpdb the
revision numbers of packages are not going backward compared to the
previous version. This option disables this check.
=item B<-fix-reverse-revisions>
+
If a package with revisions going backward is found, this option makes
tl-update-tlpdb try to check in some dummy changes to the package's tlpsrc
file to artificially increase the version number.
+=item B<-no-commit>
+
+If changes have been made to the tlpsrc files (because reversed revisions
+have been found and B<-fix-reverse-revisions> was given) these changes
+will by default committed using C<svn commit> on the tlpsrc directory. Giving
+this option the commit step is skipped.
+
+=item B<-save-anyway>
+
+If the newly created tlpdb is in considered buggy due to reversed revisions
+it will normally not be saved. This switch allows saving it anyway. It can
+be useful in combination with the B<-from-files> option where the revision
+numbers will be adjusted afterwards by an external program.
+
=back
The standard options B<-q>, B<-v>, and B<-logfile>=I<file> are also