Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/4 V2] sanity.bbclass: TMPDIR and sanity_info related fixes
@ 2013-11-04 22:40 Robert Yang
  2013-11-04 22:40 ` [PATCH 1/4] sanity.bbclass: move conf/sanity_info into TMPDIR Robert Yang
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Robert Yang @ 2013-11-04 22:40 UTC (permalink / raw)
  To: openembedded-core

* V2:
- Move ${TOPDIR}/conf/sanity_info to ${TMPDIR}, we need update the document for
  this change.

// Robert

The following changes since commit 9160f376065752e2e92c8b37ee9a80d0eb86b53b:

  bitbake: toaster: enable required classes in the toaster startup script (2013-11-04 09:36:22 +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 (4):
  sanity.bbclass: move conf/sanity_info into TMPDIR
  sanity.bbclass: check that TMPDIR is not located on nfs
  sanity.bbclass: remove the obsolete variable last_tmpdir
  build-perf-test.sh: cleanup conf/sanity_info

 meta/classes/sanity.bbclass        | 26 ++++++++++++++++++++------
 scripts/contrib/build-perf-test.sh |  2 +-
 2 files changed, 21 insertions(+), 7 deletions(-)

-- 
1.8.3.1



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

* [PATCH 1/4] sanity.bbclass: move conf/sanity_info into TMPDIR
  2013-11-04 22:40 [PATCH 0/4 V2] sanity.bbclass: TMPDIR and sanity_info related fixes Robert Yang
@ 2013-11-04 22:40 ` Robert Yang
  2013-11-04 22:40 ` [PATCH 2/4] sanity.bbclass: check that TMPDIR is not located on nfs Robert Yang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Robert Yang @ 2013-11-04 22:40 UTC (permalink / raw)
  To: openembedded-core

Move conf/sanity_info into TMPDIR, otherwise, when we reset TMPDIR to
another dir, the SANITY_VERSION from conf/sanity_info and
sanity_data.getVar('SANITY_VERSION', True) are still the same, so that
the check_sanity_version_change() would not rerun.

Another fix is that we can move the TMPDIR/saved_tmpdir to conf dir, but
that will make we can't reset the TMPDIR.

[YOCTO #5442]

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

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index b8e5b02..5f085ee 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -694,7 +694,7 @@ def check_sanity(sanity_data):
     last_sanity_version = 0
     last_tmpdir = ""
     last_sstate_dir = ""
-    sanityverfile = sanity_data.expand("${TOPDIR}/conf/sanity_info")
+    sanityverfile = os.path.join(tmpdir, "sanity_info")
     if os.path.exists(sanityverfile):
         with open(sanityverfile, 'r') as f:
             for line in f:
-- 
1.8.3.1



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

* [PATCH 2/4] sanity.bbclass: check that TMPDIR is not located on nfs
  2013-11-04 22:40 [PATCH 0/4 V2] sanity.bbclass: TMPDIR and sanity_info related fixes Robert Yang
  2013-11-04 22:40 ` [PATCH 1/4] sanity.bbclass: move conf/sanity_info into TMPDIR Robert Yang
@ 2013-11-04 22:40 ` Robert Yang
  2013-11-04 22:40 ` [PATCH 3/4] sanity.bbclass: remove the obsolete variable last_tmpdir Robert Yang
  2013-11-04 22:40 ` [PATCH 4/4] build-perf-test.sh: cleanup conf/sanity_info Robert Yang
  3 siblings, 0 replies; 5+ messages in thread
From: Robert Yang @ 2013-11-04 22:40 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.

BTW., s/tmpdir/TMPDIR/ in the previous comment message to make them have
a uniform.

[YOCTO #5442]

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

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 5f085ee..c777e3a 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: %s can't be located on nfs.\n" % (name, path)
+    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
@@ -569,9 +584,12 @@ 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
+    # 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_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.
-- 
1.8.3.1



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

* [PATCH 3/4] sanity.bbclass: remove the obsolete variable last_tmpdir
  2013-11-04 22:40 [PATCH 0/4 V2] sanity.bbclass: TMPDIR and sanity_info related fixes Robert Yang
  2013-11-04 22:40 ` [PATCH 1/4] sanity.bbclass: move conf/sanity_info into TMPDIR Robert Yang
  2013-11-04 22:40 ` [PATCH 2/4] sanity.bbclass: check that TMPDIR is not located on nfs Robert Yang
@ 2013-11-04 22:40 ` Robert Yang
  2013-11-04 22:40 ` [PATCH 4/4] build-perf-test.sh: cleanup conf/sanity_info Robert Yang
  3 siblings, 0 replies; 5+ messages in thread
From: Robert Yang @ 2013-11-04 22:40 UTC (permalink / raw)
  To: openembedded-core

The variable last_tmpdir which is read from the sanity_info file had
been used by check_sanity_tmpdir_change(), but the function was removed,
the check had been moved into check_sanity_version_change(), so we can
remove last_tmpdir and we don't need to save the TMPDIR in the
sanity_info file anymore.

[YOCTO #5442]

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

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index c777e3a..5a17936 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -710,7 +710,6 @@ def check_sanity(sanity_data):
 
     # Check saved sanity info
     last_sanity_version = 0
-    last_tmpdir = ""
     last_sstate_dir = ""
     sanityverfile = os.path.join(tmpdir, "sanity_info")
     if os.path.exists(sanityverfile):
@@ -718,8 +717,6 @@ def check_sanity(sanity_data):
             for line in f:
                 if line.startswith('SANITY_VERSION'):
                     last_sanity_version = int(line.split()[1])
-                if line.startswith('TMPDIR'):
-                    last_tmpdir = line.split()[1]
                 if line.startswith('SSTATE_DIR'):
                     last_sstate_dir = line.split()[1]
 
@@ -737,7 +734,6 @@ def check_sanity(sanity_data):
     if os.path.exists(os.path.dirname(sanityverfile)) and not status.messages:
         with open(sanityverfile, 'w') as f:
             f.write("SANITY_VERSION %s\n" % sanity_version) 
-            f.write("TMPDIR %s\n" % tmpdir) 
             f.write("SSTATE_DIR %s\n" % sstate_dir) 
 
     sanity_handle_abichanges(status, sanity_data)
-- 
1.8.3.1



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

* [PATCH 4/4] build-perf-test.sh: cleanup conf/sanity_info
  2013-11-04 22:40 [PATCH 0/4 V2] sanity.bbclass: TMPDIR and sanity_info related fixes Robert Yang
                   ` (2 preceding siblings ...)
  2013-11-04 22:40 ` [PATCH 3/4] sanity.bbclass: remove the obsolete variable last_tmpdir Robert Yang
@ 2013-11-04 22:40 ` Robert Yang
  3 siblings, 0 replies; 5+ messages in thread
From: Robert Yang @ 2013-11-04 22:40 UTC (permalink / raw)
  To: openembedded-core

The conf/sanity_info is in TMPDIR now, it would be removed when TMPDIR
is removed.

[YOCTO #5442]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 scripts/contrib/build-perf-test.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/contrib/build-perf-test.sh b/scripts/contrib/build-perf-test.sh
index be3b648..ef9b826 100755
--- a/scripts/contrib/build-perf-test.sh
+++ b/scripts/contrib/build-perf-test.sh
@@ -227,7 +227,7 @@ bbnotime () {
 
 do_rmtmp() {
     log "   Removing tmp"
-    rm -rf bitbake.lock pseudodone conf/sanity_info cache tmp
+    rm -rf bitbake.lock pseudodone cache tmp
 }
 do_rmsstate () {
     log "   Removing sstate-cache"
-- 
1.8.3.1



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

end of thread, other threads:[~2013-11-04 14:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-04 22:40 [PATCH 0/4 V2] sanity.bbclass: TMPDIR and sanity_info related fixes Robert Yang
2013-11-04 22:40 ` [PATCH 1/4] sanity.bbclass: move conf/sanity_info into TMPDIR Robert Yang
2013-11-04 22:40 ` [PATCH 2/4] sanity.bbclass: check that TMPDIR is not located on nfs Robert Yang
2013-11-04 22:40 ` [PATCH 3/4] sanity.bbclass: remove the obsolete variable last_tmpdir Robert Yang
2013-11-04 22:40 ` [PATCH 4/4] build-perf-test.sh: cleanup conf/sanity_info Robert Yang

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