Subject: [PATCH 19/25] Opportunisticly create the changes directory in the lab

From: Adam D. Barratt <[email-masked]>
Date: Tue, 23 Mar 2010 15:50:56 +0000

To allow older laboratories to continue to be used, is_lab()
no longer verifies the existence of the directory. setup() will
create the directory if a static lab is being used and it does not
already exist.
---
 lib/Lab.pm |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/lib/Lab.pm b/lib/Lab.pm
index 565d38d..9227f50 100644
--- a/lib/Lab.pm
+++ b/lib/Lab.pm
@@ -50,7 +50,6 @@ sub is_lab {
     return -d "$self->{dir}/binary"
 	&& -d "$self->{dir}/udeb"
 	&& -d "$self->{dir}/source"
-	&& -d "$self->{dir}/changes"
 	&& -d "$self->{dir}/info";
 }
 
@@ -61,6 +60,11 @@ sub setup {
 	$self->{mode} = 'static';
 	$self->{dir} = $dir;
 	$self->{dist} = $dist;
+	
+	if (-d "$dir" && ! -d "$dir/changes") {
+	    mkdir("$dir/changes", 0777)
+		or fail("cannot create lab directory $dir/changes");
+	}
     } else {
 	$self->{mode} = 'temporary';
 
-- 
1.6.6