* [PATCH] sanity.bbclass: check user can read and write to SSTATE_DIR
@ 2012-05-12 1:00 Joshua Lock
2012-05-18 5:39 ` Saul Wold
0 siblings, 1 reply; 2+ messages in thread
From: Joshua Lock @ 2012-05-12 1:00 UTC (permalink / raw)
To: openembedded-core
The user needs read and write permissions to SSTATE_DIR, check
whether they have sufficient permissions and if not recommend
use of SSTATE_MIRRORS.
Signed-off-by: Joshua Lock <josh@linux.intel.com>
---
meta/classes/sanity.bbclass | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 05545f4..ff3c413 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -96,10 +96,16 @@ def check_conf_exists(fn, data):
def check_sanity_sstate_dir_change(sstate_dir, data):
# Sanity checks to be done when the value of SSTATE_DIR changes
- # Check that SSTATE_DIR isn't on a filesystem with limited filename length (eg. eCryptFS)
testmsg = ""
if sstate_dir != "":
- testmsg = check_create_long_filename(sstate_dir, "SSTATE_DIR")
+ # Check that the user can read and write to SSTATE_DIR
+ sstatemsg = check_can_read_write_directory(sstate_dir) or None
+ if sstatemsg:
+ sstatemsg = sstatemsg + ". You could try using it as an SSTATE_MIRRORS instead of SSTATE_CACHE.\n"
+ testmsg = testmsg + sstatemsg
+ # Check that SSTATE_DIR isn't on a filesystem with limited filename length (eg. eCryptFS)
+ testmsg = testmsg + check_create_long_filename(sstate_dir, "SSTATE_DIR")
+
return testmsg
def check_sanity_tmpdir_change(tmpdir, data):
@@ -150,7 +156,12 @@ def check_create_long_filename(filepath, pathname):
if errno == 36: # ENAMETOOLONG
return "Failed to create a file with a long name in %s. Please use a filesystem that does not unreasonably limit filename length.\n" % pathname
else:
- return "Failed to create a file in %s: %s" % (pathname, strerror)
+ return "Failed to create a file in %s: %s\n" % (pathname, strerror)
+ return ""
+
+def check_can_read_write_directory(directory):
+ if not os.access(directory, os.R_OK|os.W_OK):
+ return "Insufficient permissions for %s" % directory
return ""
def check_connectivity(d):
--
1.7.7.6
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] sanity.bbclass: check user can read and write to SSTATE_DIR
2012-05-12 1:00 [PATCH] sanity.bbclass: check user can read and write to SSTATE_DIR Joshua Lock
@ 2012-05-18 5:39 ` Saul Wold
0 siblings, 0 replies; 2+ messages in thread
From: Saul Wold @ 2012-05-18 5:39 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
On 05/12/2012 04:00 AM, Joshua Lock wrote:
> The user needs read and write permissions to SSTATE_DIR, check
> whether they have sufficient permissions and if not recommend
> use of SSTATE_MIRRORS.
>
> Signed-off-by: Joshua Lock<josh@linux.intel.com>
> ---
> meta/classes/sanity.bbclass | 17 ++++++++++++++---
> 1 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
> index 05545f4..ff3c413 100644
> --- a/meta/classes/sanity.bbclass
> +++ b/meta/classes/sanity.bbclass
> @@ -96,10 +96,16 @@ def check_conf_exists(fn, data):
> def check_sanity_sstate_dir_change(sstate_dir, data):
> # Sanity checks to be done when the value of SSTATE_DIR changes
>
> - # Check that SSTATE_DIR isn't on a filesystem with limited filename length (eg. eCryptFS)
> testmsg = ""
> if sstate_dir != "":
> - testmsg = check_create_long_filename(sstate_dir, "SSTATE_DIR")
> + # Check that the user can read and write to SSTATE_DIR
> + sstatemsg = check_can_read_write_directory(sstate_dir) or None
> + if sstatemsg:
> + sstatemsg = sstatemsg + ". You could try using it as an SSTATE_MIRRORS instead of SSTATE_CACHE.\n"
> + testmsg = testmsg + sstatemsg
> + # Check that SSTATE_DIR isn't on a filesystem with limited filename length (eg. eCryptFS)
> + testmsg = testmsg + check_create_long_filename(sstate_dir, "SSTATE_DIR")
> +
> return testmsg
>
> def check_sanity_tmpdir_change(tmpdir, data):
> @@ -150,7 +156,12 @@ def check_create_long_filename(filepath, pathname):
> if errno == 36: # ENAMETOOLONG
> return "Failed to create a file with a long name in %s. Please use a filesystem that does not unreasonably limit filename length.\n" % pathname
> else:
> - return "Failed to create a file in %s: %s" % (pathname, strerror)
> + return "Failed to create a file in %s: %s\n" % (pathname, strerror)
> + return ""
> +
> +def check_can_read_write_directory(directory):
> + if not os.access(directory, os.R_OK|os.W_OK):
> + return "Insufficient permissions for %s" % directory
> return ""
>
> def check_connectivity(d):
Merged into OE-Core along with the state.bbclass change
Thanks
Sau!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-05-18 5:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-12 1:00 [PATCH] sanity.bbclass: check user can read and write to SSTATE_DIR Joshua Lock
2012-05-18 5:39 ` Saul Wold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox