All of lore.kernel.org
 help / color / mirror / Atom feed
From: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
To: "yocto@yoctoproject.org" <yocto@yoctoproject.org>
Subject: [PATCH 1/1] Doing uname without subprocess: buildstats.bbclass
Date: Tue, 15 Feb 2011 18:44:13 -0800	[thread overview]
Message-ID: <4D5B39FD.1060606@intel.com> (raw)


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


                 reply	other threads:[~2011-02-16  2:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D5B39FD.1060606@intel.com \
    --to=elizabeth.flanagan@intel.com \
    --cc=yocto@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.