I ran into the same bug with apt-build 0.12.6.

Here is a patch to solve this problem.
It simply make the patch function return an exit code which is used in the patch loop to stop an the first failure.
--- /usr/bin/apt-build	2005-05-24 20:52:05.000000000 +0200
+++ /usr/bin/apt-build.new	2005-05-27 01:15:10.000000000 +0200
@@ -138,7 +138,8 @@
 sub patch
 {
 	print STDERR "-----> Patching (@_) <-----";
-	!system "patch -p$conf{patch_strip} < $_" or return while $_ = shift;
+	!system "patch -p$conf{patch_strip} < $_" or return !$? while $_ = shift;
+	return 1;
 }
 
 sub clean_build
@@ -287,21 +288,27 @@
 		system "debchange --append 'Patched with $_'";
     }
 	
+    my $r;
     # Patch if asked
-    patch($_) for @{$conf->patch};
+    for (@{$conf->patch})
+    {
+	$r = patch($_) or last;
+    }
 
-    # Add optimizations infos
-    my $buildoptions;
-    $buildoptions = "Build options: ".
-    $conf->Olevel." ".$conf->mcpu." ".$conf->options;
+    if ($r) {
+	# Add optimizations infos
+	my $buildoptions;
+	$buildoptions = "Build options: ".
+	    $conf->Olevel." ".$conf->mcpu." ".$conf->options;
 
-    system "debchange --append \"$buildoptions\"";
+	system "debchange --append \"$buildoptions\"";
 
-    # Now build
-    my  $r = !system $conf->build_command;
-    wait;
-	
+	# Now build
+	$r = !system $conf->build_command;
+	wait;
+    }	
+    
     if ($conf->cleanup)
     {
 	print STDERR "----> Cleaning up object files <-----";

Reply via email to