summaryrefslogtreecommitdiffstats
path: root/meta/classes/distrodata.bbclass
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2012-05-29 22:53:08 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-30 12:04:45 +0100
commit5996b2b58e36864edc077326a942795ca12f48da (patch)
tree5f67615a25685f4b0d4a8150f51932a5b478ccfa /meta/classes/distrodata.bbclass
parentd760fb97f52c705944a259be267e0ea8516074e3 (diff)
downloadpoky-5996b2b58e36864edc077326a942795ca12f48da.tar.gz
meta: replace os.popen with subprocess.Popen
Replace os.popen with subprocess.Popen since the older function would fail (more or less) silently if the executed program cannot be found There are both bb.process.run() and bb.process.Popen() which wraps the subprocess module, use it for simplifying the code. Note: We don't need the "2>/dev/null" or "2>&1" since bb.process.run() can handle it, it will raise exception when error occurs, we should handle the exception ourselves if we want to ignore the error. More info: http://docs.python.org/library/subprocess.html#subprocess-replacements [YOCTO #2454] (From OE-Core rev: e83d8e58a6b107eea87df0ec233a1bc932b2c6ea) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/distrodata.bbclass')
-rw-r--r--meta/classes/distrodata.bbclass12
1 files changed, 6 insertions, 6 deletions
diff --git a/meta/classes/distrodata.bbclass b/meta/classes/distrodata.bbclass
index df6d300666..7f9c83e7c7 100644
--- a/meta/classes/distrodata.bbclass
+++ b/meta/classes/distrodata.bbclass
@@ -564,10 +564,10 @@ python do_checkpkg() {
564 gitproto = parm['protocol'] 564 gitproto = parm['protocol']
565 else: 565 else:
566 gitproto = "git" 566 gitproto = "git"
567 gitcmd = "git ls-remote %s://%s%s%s *tag* 2>&1" % (gitproto, gituser, host, path) 567 gitcmd = "git ls-remote %s://%s%s%s *tag*" % (gitproto, gituser, host, path)
568 gitcmd2 = "git ls-remote %s://%s%s%s HEAD 2>&1" % (gitproto, gituser, host, path) 568 gitcmd2 = "git ls-remote %s://%s%s%s HEAD" % (gitproto, gituser, host, path)
569 tmp = os.popen(gitcmd).read() 569 tmp = bb.process.run(gitcmd)[0]
570 tmp2 = os.popen(gitcmd2).read() 570 tmp2 = bb.process.run(gitcmd2)[0]
571 #This is for those repo have tag like: refs/tags/1.2.2 571 #This is for those repo have tag like: refs/tags/1.2.2
572 if tmp: 572 if tmp:
573 tmpline = tmp.split("\n") 573 tmpline = tmp.split("\n")
@@ -613,9 +613,9 @@ python do_checkpkg() {
613 if 'rev' in parm: 613 if 'rev' in parm:
614 pcurver = parm['rev'] 614 pcurver = parm['rev']
615 615
616 svncmd = "svn info %s %s://%s%s/%s/ 2>&1" % (" ".join(options), svnproto, host, path, parm["module"]) 616 svncmd = "svn info %s %s://%s%s/%s/" % (" ".join(options), svnproto, host, path, parm["module"])
617 print svncmd 617 print svncmd
618 svninfo = os.popen(svncmd).read() 618 svninfo = bb.process.run(svncmd)[0]
619 for line in svninfo.split("\n"): 619 for line in svninfo.split("\n"):
620 if re.search("^Last Changed Rev:", line): 620 if re.search("^Last Changed Rev:", line):
621 pupver = line.split(" ")[-1] 621 pupver = line.split(" ")[-1]