From d4731a3f7dbd6aac8ae8dbf5187a72654c3b5733 Mon Sep 17 00:00:00 2001
From: Beth Flanagan <elizabeth.flanagan@intel.com>
Date: Tue, 4 Jan 2011 17:22:45 -0800
Subject: Adding check for DL_DIR permissions: sanity.bbclass

Check to ensure that DL_DIR is set and that if it exists that it
is user writeable.

Signed-off-by: Beth Flanagan <elizabeth.flanagan@intel.com>
---
 meta/classes/sanity.bbclass | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 46c6ec26e..315fc3472 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -124,6 +124,14 @@ def check_sanity(e):
     if data.getVar('MACHINE', e.data, True):
         if not check_conf_exists("conf/machine/${MACHINE}.conf", e.data):
             messages = messages + 'Please set a valid MACHINE in your local.conf\n'
+
+    # Check that DL_DIR is set, exists and is writable. In theory, we should never even hit the check if DL_DIR isn't 
+    # set, since so much relies on it being set.
+    dldir = data.getVar('DL_DIR', e.data, True)
+    if not dldir:
+        messages = messages + "DL_DIR is not set. Your environment is misconfigured, check that DL_DIR is set, and if the directory exists, that it is writable. \n"
+    if os.path.exists(dldir) and not os.access(dldir, os.W_OK):
+        messages = messages + "DL_DIR: %s exists but you do not appear to have write access to it. \n" % dldir
     
     # Check that the DISTRO is valid
     # need to take into account DISTRO renaming DISTRO
@@ -303,7 +311,7 @@ def check_sanity(e):
 
     oeroot = data.getVar('POKYBASE', e.data)
     if oeroot.find ('+') != -1:
-        messages = messages + "Error, you have an invalid character (+) in your POKYBASE directory path. Please more Poky to a directory which doesn't include a +."
+        messages = messages + "Error, you have an invalid character (+) in your POKYBASE directory path. Please move Poky to a directory which doesn't include a +."
     elif oeroot.find (' ') != -1:
         messages = messages + "Error, you have a space in your POKYBASE directory path. Please move Poky to a directory which doesn't include a space."
 
-- 
cgit v1.2.3