X-Git-Url: https://mattmccutchen.net/rsync/rsync-patches.git/blobdiff_plain/96e2f104d36d4990789ce30df363cc92edf5ac3e..e2b0842aedc76f71ce67a901d5d3fa95058efcc9:/verify-patches diff --git a/verify-patches b/verify-patches index 807c584..d6d7c3a 100755 --- a/verify-patches +++ b/verify-patches @@ -2,6 +2,7 @@ use strict; use Getopt::Long; +use Cwd; my @generated_files = qw( proto.h configure config.h.in rsync.1 rsyncd.conf.5 ); @@ -31,15 +32,19 @@ from inside the patches subdir. EOT } +my $patches_dir = Cwd::cwd(); + $ENV{'LC_COLLATE'} = 'C'; $| = 1; -my $CONF_OPTS = '-C'; +my $CONF_OPTS = '--cache-file=../config.cache'; my($has_dependencies, @new, @rejects); END { &restore_cvsdir; system "rsync -a --del cvsdir/ workdir/" if -d 'cvsdir'; + my $pid = readlink('lock') || 0; + unlink('lock') if $pid == $$; }; my $root; @@ -49,6 +54,10 @@ close IN; mkdir('tmp', 0777) unless -d 'tmp'; chdir('tmp') or die "Unable to chdir to 'tmp'"; +unlink('patches'); +symlink($patches_dir, 'patches'); + +symlink($$, 'lock') or die "Unable to create lock file: $!\n"; mkdir('workdir') unless -d 'workdir'; open(OUT, '>exclude') or die $!; @@ -58,9 +67,18 @@ close OUT; unless ($no_cvs) { print "Using CVS to update the tmp/cvsdir copy of the source.\n"; system qq|cvs -qd "$root" co -P -d cvsdir rsync|; + @_ = qw( configure configure.in config.h.in configure.in + rsync.1 rsync.yo rsyncd.conf.5 rsyncd.conf.yo ); + while (@_) { + my $gen = 'cvsdir/' . shift(@_); + my $src = 'cvsdir/' . shift(@_); + if ((-M $gen) > (-M $src)) { + system "touch $gen"; + } + } } -@ARGV = glob('../*.diff') unless @ARGV; +@ARGV = glob('patches/*.diff') unless @ARGV; DIFF: foreach my $diff (@ARGV) { @@ -69,20 +87,20 @@ foreach my $diff (@ARGV) { $diff =~ s#^(patches|\.\.)/##; my $conf_opts; - open(IN, "../$diff") or die $!; + open(IN, "patches/$diff") or die $!; while () { last if /^--- /; - if (/^Depends-On-Patch: (\S+.diff)$/) { + if (m#^\s+patch -p1 ) { print $_; chomp; @@ -208,6 +226,8 @@ sub apply_patch push(@new, $_) unless -f "cvsdir/$_"; } elsif (s/.* saving rejects to file //) { push(@rejects, $_); + } elsif (/No file to patch\.\s+Skipping patch/) { + push(@rejects, 'skipped.file'); } elsif (/^Hunk #\d+ succeeded at \d+( with fuzz $interesting_fuzz)?/o) { $saw_fuzz ||= defined $1; $saw_offset = 1; @@ -240,19 +260,19 @@ sub generate_new_patch foreach (@new) { system "touch -r workdir/$_ cvsdir/$_"; } - open(IN, "../$diff") or die $!; + open(IN, "patches/$diff") or die $!; open(OUT, '>new.patch') or die $!; while () { last if /^--- /; print OUT $_; } close IN; - &filter_diff('diff --exclude-from=exclude -upr cvsdir workdir'); + &filter_diff('diff --exclude-from=exclude -dupr cvsdir workdir'); if ($prepare_source) { # These are not included in the diff above so that patch will give # generated files a later timestamp than the source files. foreach my $fn (@generated_files) { - &filter_diff("diff -up cvsdir/$fn workdir"); + &filter_diff("diff -dupW128 cvsdir/$fn workdir"); } } close OUT; @@ -260,7 +280,7 @@ sub generate_new_patch unlink("cvsdir/$_"); } print "\nDiffing... "; - if (system("diff ../$diff new.patch >/dev/null") == 0) { + if (system("diff patches/$diff new.patch >/dev/null") == 0) { print "new patch is identical to old.\n"; return 'N'; }