Package: cvs-autoreleasedeb
Version: 0.12-1

Attached patch number 7:
 In case there was a build failure, we don't want to remove the package
 directories (so we can debug the problem).

-- 
Oron Peled                                 Voice: +972-4-8228492
o...@actcom.co.il                  http://users.actcom.co.il/~oron
Hi! I'm a .signature virus! Copy me into your ~/.signature to help
me spread!
Index: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	(revision 305)
+++ trunk/debian/changelog	(revision 306)
@@ -1,3 +1,9 @@
+cvs-autoreleasedeb (0.12-1.6) unstable; urgency=low
+
+  * Do not remove svn and package directories on failure.
+
+ -- Oron Peled <o...@actcom.co.il>  Wed, 16 Dec 2009 17:25:26 +0200
+
 cvs-autoreleasedeb (0.12-1.5) unstable; urgency=low
 
   * Non-maintainer upload.
Index: trunk/svn-autoreleasedeb
===================================================================
--- trunk/svn-autoreleasedeb	(revision 305)
+++ trunk/svn-autoreleasedeb	(revision 306)
@@ -205,10 +205,20 @@
 			$failed_packages{$s}{$p} = 'FAILED(no-tag)';
 			next;
 		}
-		
+		my $prefix = $conf_struct->{$s}{$p}{prefix};
+		$prefix = '' unless defined $prefix;
+		{
+			my $cmd;
+			$cmd = "rm -rf ".$::SVNDIR.$s."/".${prefix}."/".$p;
+			print $cmd."\n";
+			system $cmd;
+			$cmd = "rm -rf ".$::PACKDIR.$s."/".$p;
+			print $cmd."\n";
+			system $cmd;
+		}
 		chdir($::SVNDIR.$s);
-                $cmd = "$::SVN checkout ".$conf_struct->{$s}{$p}{svnserver}.q(/).$conf_struct->{$s}{$p}{prefix}.
-                  q(/).$p.q(/).$conf_struct->{$s}{$p}{tag}."/ ".($conf_struct->{$s}{$p}{prefix}?$conf_struct->{$s}{$p}{prefix}.q(/):'').$p;
+                $cmd = "$::SVN checkout ".$conf_struct->{$s}{$p}{svnserver}.q(/).${prefix}.
+                  q(/).$p.q(/).$conf_struct->{$s}{$p}{tag}."/ ".${prefix}.$p;
 		print $cmd."\n";
 		unless (system($cmd) == 0) {
 			print "SVN Checkout failed. going to try again in the next run!\n";
@@ -220,7 +230,7 @@
 		mkdir($::PACKDIR.$s."/".$p);
 
 		my $buildopts = $conf_struct->{$s}{$p}{buildopts};
-		chdir($::SVNDIR.$s."/".$conf_struct->{$s}{$p}{prefix}."/".$p);
+		chdir($::SVNDIR.$s."/".${prefix}."/".$p);
 		$cmd = "svn-buildpackage --svn-override=buildArea=".$::PACKDIR.$s."/".$p." $buildopts ";
 
 		unless (system($cmd) == 0) {
@@ -255,14 +265,16 @@
 		}
 	}
 	# Clean the directories
-	my $cmd;
-	chdir($oldpwd);
-	$cmd = "rm -rf ".$::SVNDIR.$s;
-	print $cmd."\n";
-	system $cmd;
-	$cmd = "rm -rf ".$::PACKDIR.$s;
-	print $cmd."\n";
-	system $cmd;
+	if(!defined($failed_packages{$s})) {
+		my $cmd;
+		chdir($oldpwd);
+		$cmd = "rm -rf ".$::SVNDIR.$s;
+		print $cmd."\n";
+		system $cmd;
+		$cmd = "rm -rf ".$::PACKDIR.$s;
+		print $cmd."\n";
+		system $cmd;
+	}
 }
 
 # revert to the old state the failed packages, so they
@@ -406,7 +418,9 @@
 				print "Skipping $p, because no tag defined.\n";
 				next;
 			}
-			$cmd = "$::SVN cat ".$conf_struct->{$s}{$p}{svnserver}.q(/).$conf_struct->{$s}{$p}{prefix}.
+			my $prefix = $conf_struct->{$s}{$p}{prefix};
+			$prefix = '' unless defined $prefix;
+			$cmd = "$::SVN cat ".$conf_struct->{$s}{$p}{svnserver}.q(/).${prefix}.
                           q(/).$p.q(/).$conf_struct->{$s}{$p}{tag}."/debian/changelog";
                         print $cmd."\n";
 			my $changelog = `$cmd 2> /dev/null | head -1`;

Reply via email to