Call "patch" with the -f option, and handle an error condition
authorWayne Davison <wayned@samba.org>
Sat, 7 Jul 2007 05:27:32 +0000 (05:27 +0000)
committerWayne Davison <wayned@samba.org>
Sat, 7 Jul 2007 05:27:32 +0000 (05:27 +0000)
where the whole file fails.

verify-patches

index 6c77581..64ae506 100755 (executable)
@@ -90,7 +90,7 @@ foreach my $diff (@ARGV) {
            my $dep = $1;
            $has_dependencies = 1;
            print "\nApplying dependency patch $dep...\n";
-           if (system("patch -d cvsdir -p1 -b -Vt <patches/$dep") != 0) {
+           if (system("patch -f -d cvsdir -p1 -b -Vt <patches/$dep") != 0) {
                print "Unable to cleanly apply dependency patch -- skipping $diff\n";
                system "rm -f cvsdir/*.rej cvsdir/*/*.rej";
                &restore_cvsdir;
@@ -214,7 +214,7 @@ sub apply_patch
     print "\nApplying patch $diff...\n";
     undef @rejects;
     my($saw_offset, $saw_fuzz);
-    open(IN, "patch -d workdir -p1 --no-backup-if-mismatch <patches/$diff |") or die $!;
+    open(IN, "patch -f -d workdir -p1 --no-backup-if-mismatch <patches/$diff |") or die $!;
     while (<IN>) {
        print $_;
        chomp;
@@ -222,6 +222,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;