All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] Doing uname without subprocess: buildstats.bbclass
@ 2011-02-16  2:44 Elizabeth Flanagan
  0 siblings, 0 replies; only message in thread
From: Elizabeth Flanagan @ 2011-02-16  2:44 UTC (permalink / raw)
  To: yocto@yoctoproject.org


Instead of using subprocess which is problematic, we should use platform
instead.

Signed-off-by: Beth Flanagan <elizabeth.flanagan@intel.com>
---
 meta/classes/buildstats.bbclass |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass
index f042dd3..0acf516 100644
--- a/meta/classes/buildstats.bbclass
+++ b/meta/classes/buildstats.bbclass
@@ -67,7 +67,7 @@ python run_buildstats () {
     import bb.build
     import bb.event
     import bb.data
-    import time, subprocess
+    import time, subprocess, platform

     if isinstance(e, bb.event.BuildStarted):
         ##############################################
@@ -90,9 +90,12 @@ python run_buildstats () {
         build_time = os.path.join(bsdir, "build_stats")
         # write start of build into build_time
         file = open(build_time,"a")
-        # We do this here because subprocess within BuildStarted is messy
-        #host_info = subprocess.Popen(["uname", "-a"], stdout=subprocess.PIPE).stdout.read()
-        #file.write("Host Info: %s" % host_info)
+        host_info = platform.uname()
+        file.write("Host Info: ")
+        for x in host_info:
+            if x:
+                file.write(x + " ")
+        file.write("\n")
         file.write("Build Started: %0.2f \n" % time.time())
         file.close()

-- 
1.7.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-02-16  2:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-16  2:44 [PATCH 1/1] Doing uname without subprocess: buildstats.bbclass Elizabeth Flanagan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.