Openembedded Core Discussions
 help / color / mirror / Atom feed
* Re: [PATCH 1/2] sanity.bbclass: move check_path_length(TMPDIR) to check_sanity_everybuild
  2013-11-01 17:26 ` [PATCH 1/2] sanity.bbclass: move check_path_length(TMPDIR) to check_sanity_everybuild Robert Yang
@ 2013-11-01 10:39   ` Richard Purdie
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Purdie @ 2013-11-01 10:39 UTC (permalink / raw)
  To: Robert Yang; +Cc: openembedded-core

On Sat, 2013-11-02 at 01:26 +0800, Robert Yang wrote:
> We may change the TMPDIR in different builds, so that the
> check_path_length(TMPDIR) should be in check_sanity_everybuild().
> 
> [YOCTO #5442]
> 
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> ---
>  meta/classes/sanity.bbclass | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

No.

The stamp than controls these checks is in tmpdir. We detect if tmpdir
moves and error. If we change to a new tmpdir, there will be no stamp
and the check reruns. There is no need to do this every build.

Cheers,

Richard

> diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
> index b8e5b02..c4827f4 100644
> --- a/meta/classes/sanity.bbclass
> +++ b/meta/classes/sanity.bbclass
> @@ -569,9 +569,6 @@ def check_sanity_version_change(status, d):
>      if not oes_bb_conf:
>          status.addresult('You are not using the OpenEmbedded version of conf/bitbake.conf. This means your environment is misconfigured, in particular check BBPATH.\n')
>  
> -    # The length of tmpdir can't be longer than 410
> -    status.addresult(check_path_length(tmpdir, "TMPDIR", 410))
> -
>  def check_sanity_everybuild(status, d):
>      # Sanity tests which test the users environment so need to run at each build (or are so cheap
>      # it makes sense to always run them.
> @@ -672,6 +669,9 @@ def check_sanity_everybuild(status, d):
>          with open(checkfile, "w") as f:
>              f.write(tmpdir)
>  
> +    # The length of TMPDIR can't be longer than 410
> +    status.addresult(check_path_length(tmpdir, "TMPDIR", 410))
> +
>  def check_sanity(sanity_data):
>      import subprocess
>  




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] sanity.bbclass: check that TMPDIR is not located on nfs
  2013-11-01 17:26 ` [PATCH 2/2] sanity.bbclass: check that TMPDIR is not located on nfs Robert Yang
@ 2013-11-01 10:40   ` Richard Purdie
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Purdie @ 2013-11-01 10:40 UTC (permalink / raw)
  To: Robert Yang; +Cc: openembedded-core

On Sat, 2013-11-02 at 01:26 +0800, Robert Yang wrote:
> There would be some unexpected errors when the whole TMPDIR is located
> on nfs, so add a test for it in sanity.bbclass.
> 
> Note:
> The better way to get the filesystem id should be get f_fsid from struct
> statvfs, but there is no f_fsid in os.stat() or os.statvfs(), so we use
> 'stat -f -c "%t"' here.
> 
> [YOCTO #5442]
> 
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> ---
>  meta/classes/sanity.bbclass | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)

Why does this need to run every build? It doesn't so don't do that
please.

Cheers,

Richard

> diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
> index c4827f4..7517120 100644
> --- a/meta/classes/sanity.bbclass
> +++ b/meta/classes/sanity.bbclass
> @@ -198,6 +198,21 @@ def check_path_length(filepath, pathname, limit):
>          return "The length of %s is longer than 410, this would cause unexpected errors, please use a shorter path.\n" % pathname
>      return ""
>  
> +def get_filesystem_id(path):
> +    status, result = oe.utils.getstatusoutput("stat -f -c '%s' %s" % ("%t", path))
> +    if status == 0:
> +        return result
> +    else:
> +        bb.warn("Can't get the filesystem id of: %s" % path)
> +        return None
> +
> +# Check that the path isn't located on nfs.
> +def check_not_nfs(path, name):
> +    # The nfs' filesystem id is 6969
> +    if get_filesystem_id(path) == "6969":
> +        return "The %s can't be located on nfs.\n" % name
> +    return ""
> +
>  def check_connectivity(d):
>      # URI's to check can be set in the CONNECTIVITY_CHECK_URIS variable
>      # using the same syntax as for SRC_URI. If the variable is not set
> @@ -672,6 +687,9 @@ def check_sanity_everybuild(status, d):
>      # The length of TMPDIR can't be longer than 410
>      status.addresult(check_path_length(tmpdir, "TMPDIR", 410))
>  
> +    # Check that TMPDIR isn't located on nfs
> +    status.addresult(check_not_nfs(tmpdir, "TMPDIR"))
> +
>  def check_sanity(sanity_data):
>      import subprocess
>  




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 0/2] sanity.bbclass: check that TMPDIR is not located on nfs
@ 2013-11-01 17:26 Robert Yang
  2013-11-01 17:26 ` [PATCH 1/2] sanity.bbclass: move check_path_length(TMPDIR) to check_sanity_everybuild Robert Yang
  2013-11-01 17:26 ` [PATCH 2/2] sanity.bbclass: check that TMPDIR is not located on nfs Robert Yang
  0 siblings, 2 replies; 5+ messages in thread
From: Robert Yang @ 2013-11-01 17:26 UTC (permalink / raw)
  To: openembedded-core

The following changes since commit 523f2a9ea970713fb775bc48f84b67420b1106a0:

  cross-canadian: Improve comment (2013-10-30 18:01:34 +0000)

are available in the git repository at:

  git://git.pokylinux.org/poky-contrib rbty/nfs_check
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=rbty/nfs_check

Robert Yang (2):
  sanity.bbclass: move check_path_length(TMPDIR) to
    check_sanity_everybuild
  sanity.bbclass: check that TMPDIR is not located on nfs

 meta/classes/sanity.bbclass | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] sanity.bbclass: move check_path_length(TMPDIR) to check_sanity_everybuild
  2013-11-01 17:26 [PATCH 0/2] sanity.bbclass: check that TMPDIR is not located on nfs Robert Yang
@ 2013-11-01 17:26 ` Robert Yang
  2013-11-01 10:39   ` Richard Purdie
  2013-11-01 17:26 ` [PATCH 2/2] sanity.bbclass: check that TMPDIR is not located on nfs Robert Yang
  1 sibling, 1 reply; 5+ messages in thread
From: Robert Yang @ 2013-11-01 17:26 UTC (permalink / raw)
  To: openembedded-core

We may change the TMPDIR in different builds, so that the
check_path_length(TMPDIR) should be in check_sanity_everybuild().

[YOCTO #5442]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/classes/sanity.bbclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index b8e5b02..c4827f4 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -569,9 +569,6 @@ def check_sanity_version_change(status, d):
     if not oes_bb_conf:
         status.addresult('You are not using the OpenEmbedded version of conf/bitbake.conf. This means your environment is misconfigured, in particular check BBPATH.\n')
 
-    # The length of tmpdir can't be longer than 410
-    status.addresult(check_path_length(tmpdir, "TMPDIR", 410))
-
 def check_sanity_everybuild(status, d):
     # Sanity tests which test the users environment so need to run at each build (or are so cheap
     # it makes sense to always run them.
@@ -672,6 +669,9 @@ def check_sanity_everybuild(status, d):
         with open(checkfile, "w") as f:
             f.write(tmpdir)
 
+    # The length of TMPDIR can't be longer than 410
+    status.addresult(check_path_length(tmpdir, "TMPDIR", 410))
+
 def check_sanity(sanity_data):
     import subprocess
 
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] sanity.bbclass: check that TMPDIR is not located on nfs
  2013-11-01 17:26 [PATCH 0/2] sanity.bbclass: check that TMPDIR is not located on nfs Robert Yang
  2013-11-01 17:26 ` [PATCH 1/2] sanity.bbclass: move check_path_length(TMPDIR) to check_sanity_everybuild Robert Yang
@ 2013-11-01 17:26 ` Robert Yang
  2013-11-01 10:40   ` Richard Purdie
  1 sibling, 1 reply; 5+ messages in thread
From: Robert Yang @ 2013-11-01 17:26 UTC (permalink / raw)
  To: openembedded-core

There would be some unexpected errors when the whole TMPDIR is located
on nfs, so add a test for it in sanity.bbclass.

Note:
The better way to get the filesystem id should be get f_fsid from struct
statvfs, but there is no f_fsid in os.stat() or os.statvfs(), so we use
'stat -f -c "%t"' here.

[YOCTO #5442]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/classes/sanity.bbclass | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index c4827f4..7517120 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -198,6 +198,21 @@ def check_path_length(filepath, pathname, limit):
         return "The length of %s is longer than 410, this would cause unexpected errors, please use a shorter path.\n" % pathname
     return ""
 
+def get_filesystem_id(path):
+    status, result = oe.utils.getstatusoutput("stat -f -c '%s' %s" % ("%t", path))
+    if status == 0:
+        return result
+    else:
+        bb.warn("Can't get the filesystem id of: %s" % path)
+        return None
+
+# Check that the path isn't located on nfs.
+def check_not_nfs(path, name):
+    # The nfs' filesystem id is 6969
+    if get_filesystem_id(path) == "6969":
+        return "The %s can't be located on nfs.\n" % name
+    return ""
+
 def check_connectivity(d):
     # URI's to check can be set in the CONNECTIVITY_CHECK_URIS variable
     # using the same syntax as for SRC_URI. If the variable is not set
@@ -672,6 +687,9 @@ def check_sanity_everybuild(status, d):
     # The length of TMPDIR can't be longer than 410
     status.addresult(check_path_length(tmpdir, "TMPDIR", 410))
 
+    # Check that TMPDIR isn't located on nfs
+    status.addresult(check_not_nfs(tmpdir, "TMPDIR"))
+
 def check_sanity(sanity_data):
     import subprocess
 
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-11-01 10:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-01 17:26 [PATCH 0/2] sanity.bbclass: check that TMPDIR is not located on nfs Robert Yang
2013-11-01 17:26 ` [PATCH 1/2] sanity.bbclass: move check_path_length(TMPDIR) to check_sanity_everybuild Robert Yang
2013-11-01 10:39   ` Richard Purdie
2013-11-01 17:26 ` [PATCH 2/2] sanity.bbclass: check that TMPDIR is not located on nfs Robert Yang
2013-11-01 10:40   ` Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox