Patchwork [6/6] sstate.bbclass: fix detection of owners matching sstate files

login
register
mail settings
Submitter Martin Jansa
Date Dec. 4, 2012, 1:31 a.m.
Message ID <8e7d8383609d7cfb2c2681d6890a248b841d9898.1354584580.git.Martin.Jansa@gmail.com>
Download mbox | patch
Permalink /patch/40103/
State Accepted
Commit 381c4b69c7e8b452f4d3de2f8214e6e5f6a9abe7
Headers show

Comments

Martin Jansa - Dec. 4, 2012, 1:31 a.m.
* without this patch:
  Python 2.7.3
  >>> sstate_search_cmd = "grep -rl /OE/jansa-test/shr-core/tmp-eglibc/pkgdata/armv7a-vfp-neon-oe-linux-gnueabi/runtime-reverse/vim-common /OE/jansa-test/shr-core/tmp-eglibc/sstate-control --exclude=master.list | sed -e 's:^.*/::' -e 's:\.populate-sysroot::'"
  >>> cmd_array = sstate_search_cmd.split(' ')
  >>> search_output = subprocess.Popen(cmd_array, stdout=subprocess.PIPE).communicate()[0]
  grep: |: No such file or directory
  grep: sed: No such file or directory

* Adding shell=True and using cmd string instead of array makes it work:
  >>> search_output = subprocess.Popen(sstate_search_cmd, shell=True, stdout=subprocess.PIPE).communicate()[0]
  >>> print search_output
  manifest-armv7a-vfp-neon-gvim.package
  manifest-armv7a-vfp-neon-vim-tiny.package
  manifest-armv7a-vfp-neon-vim.package

  But still isn't 100% reliable, I guess it's caused by some other package
  being removed from sstate while grep is already running.
  So sometimes grep can show error on STDERR
  >>> search_output = subprocess.Popen(sstate_search_cmd, shell=True, stdout=subprocess.PIPE).communicate()[0]
  grep: /OE/jansa-test/shr-core/tmp-eglibc/sstate-control/manifest-armv7a-vfp-neon-systemtap.package: No such file or directory

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta/classes/sstate.bbclass | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch

diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 967ae9b..832b39e 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -169,8 +169,7 @@  def sstate_install(ss, d):
             if realmatch:
                 match.append(f)
                 sstate_search_cmd = "grep -rl %s %s --exclude=master.list | sed -e 's:^.*/::' -e 's:\.populate-sysroot::'" % (f, d.expand("${SSTATE_MANIFESTS}"))
-                cmd_array = sstate_search_cmd.split(' ')
-                search_output = subprocess.Popen(cmd_array, stdout=subprocess.PIPE).communicate()[0]
+                search_output = subprocess.Popen(sstate_search_cmd, shell=True, stdout=subprocess.PIPE).communicate()[0]
                 if search_output != "":
                     match.append("Matched in %s" % search_output.rstrip())
     if match: