- for pmap in prefixmap:
+ env = os.environ.copy()
+ env["LC_ALL"] = "C"
+
+ for pmap, prefix in prefixmap.items():
+ dstroot = dvar + prefix
# Ignore files from the recipe sysroots (target and native)
- cmd = "LC_ALL=C ; sort -z -u '%s' | egrep -v -z
'((<internal>|<built-in>)$|/.*recipe-sysroot.*/)' | " % sourcefile
+ sort_p = subprocess.Popen(["sort", "-z", "-u", "--", sourcefile],
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, env=env)
+ egrep_p = subprocess.Popen(["egrep", "-v", "-z", "-e",
r"((<internal>|<built-in>)$|/.*recipe-sysroot.*/)"], stdin=sort_p.stdout, stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL, env=env)
+ sort_p.stdout.close()
+
# We need to ignore files that are not actually ours
# we do this by only paying attention to items from this package
- cmd += "fgrep -zw '%s' | " % prefixmap[pmap]
+ fgrep_p = subprocess.Popen(["fgrep", "-zw", "-e", prefix],
stdin=egrep_p.stdout, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, env=env)
+ egrep_p.stdout.close()
+
# Remove prefix in the source paths
- cmd += "sed 's#%s/##g' | " % (prefixmap[pmap])
- cmd += "(cd '%s' ; cpio -pd0mlLu --no-preserve-owner '%s%s'
2>/dev/null)" % (pmap, dvar, prefixmap[pmap])
+ sed_p = subprocess.Popen(["sed", "s#%s/##g" % prefix],
stdin=fgrep_p.stdout, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, env=env)
+ fgrep_p.stdout.close()
+
+ cpio_p = subprocess.Popen(["cpio", "-pd0mlLu",
"--no-preserve-owner", dstroot], stdin=sed_p.stdout, cwd=pmap, stderr=subprocess.DEVNULL, env=env)
+ sed_p.stdout.close()
+
+ for proc in (cpio_p, sed_p, fgrep_p, egrep_p, sort_p):
+ proc.wait()