diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-05-30 14:20:04 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-05-30 14:21:29 +0100 |
commit | 0d9e89371158c4c329eebab3bc6609250b4c86c0 (patch) | |
tree | 3bc4b02ee601a1a4be6f7cf8c33a60251bde9032 /meta/classes | |
parent | bc386b89345d1a4c941744f911065d498028d9d3 (diff) | |
download | poky-0d9e89371158c4c329eebab3bc6609250b4c86c0.tar.gz |
Revert "meta: replace os.popen with subprocess.Popen"
This reverts commit e83d8e58a6b107eea87df0ec233a1bc932b2c6e as the conversion
is not correct. Its replacing readlines() calls which generate an array with
what are effectively strings. There are split("\n") calls missing in many
cases so this needs to be reverted until it gets fixed.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/debian.bbclass | 12 | ||||
-rw-r--r-- | meta/classes/distrodata.bbclass | 12 | ||||
-rw-r--r-- | meta/classes/icecc.bbclass | 6 | ||||
-rw-r--r-- | meta/classes/insane.bbclass | 31 | ||||
-rw-r--r-- | meta/classes/kernel.bbclass | 2 | ||||
-rw-r--r-- | meta/classes/metadata_scm.bbclass | 12 | ||||
-rw-r--r-- | meta/classes/package.bbclass | 16 |
7 files changed, 38 insertions, 53 deletions
diff --git a/meta/classes/debian.bbclass b/meta/classes/debian.bbclass index 963d11c129..3637e2ebe7 100644 --- a/meta/classes/debian.bbclass +++ b/meta/classes/debian.bbclass | |||
@@ -60,14 +60,10 @@ python debian_package_name_hook () { | |||
60 | for f in files: | 60 | for f in files: |
61 | if so_re.match(f): | 61 | if so_re.match(f): |
62 | fp = os.path.join(root, f) | 62 | fp = os.path.join(root, f) |
63 | cmd = (d.getVar('BUILD_PREFIX', True) or "") + "objdump -p " + fp | 63 | cmd = (d.getVar('BUILD_PREFIX', True) or "") + "objdump -p " + fp + " 2>/dev/null" |
64 | try: | 64 | fd = os.popen(cmd) |
65 | lines = "" | 65 | lines = fd.readlines() |
66 | lines = bb.process.run(cmd)[0] | 66 | fd.close() |
67 | # Some ".so" maybe ascii text, e.g: /usr/lib64/libpthread.so, | ||
68 | # ingore those errors. | ||
69 | except Exception: | ||
70 | sys.exc_clear() | ||
71 | for l in lines: | 67 | for l in lines: |
72 | m = re.match("\s+SONAME\s+([^\s]*)", l) | 68 | m = re.match("\s+SONAME\s+([^\s]*)", l) |
73 | if m and not m.group(1) in sonames: | 69 | if m and not m.group(1) in sonames: |
diff --git a/meta/classes/distrodata.bbclass b/meta/classes/distrodata.bbclass index 7f9c83e7c7..df6d300666 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*" % (gitproto, gituser, host, path) | 567 | gitcmd = "git ls-remote %s://%s%s%s *tag* 2>&1" % (gitproto, gituser, host, path) |
568 | gitcmd2 = "git ls-remote %s://%s%s%s HEAD" % (gitproto, gituser, host, path) | 568 | gitcmd2 = "git ls-remote %s://%s%s%s HEAD 2>&1" % (gitproto, gituser, host, path) |
569 | tmp = bb.process.run(gitcmd)[0] | 569 | tmp = os.popen(gitcmd).read() |
570 | tmp2 = bb.process.run(gitcmd2)[0] | 570 | tmp2 = os.popen(gitcmd2).read() |
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/" % (" ".join(options), svnproto, host, path, parm["module"]) | 616 | svncmd = "svn info %s %s://%s%s/%s/ 2>&1" % (" ".join(options), svnproto, host, path, parm["module"]) |
617 | print svncmd | 617 | print svncmd |
618 | svninfo = bb.process.run(svncmd)[0] | 618 | svninfo = os.popen(svncmd).read() |
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] |
diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass index 64a182e523..ae74050f6b 100644 --- a/meta/classes/icecc.bbclass +++ b/meta/classes/icecc.bbclass | |||
@@ -54,7 +54,7 @@ def create_path(compilers, bb, d): | |||
54 | staging += "-kernel" | 54 | staging += "-kernel" |
55 | 55 | ||
56 | #check if the icecc path is set by the user | 56 | #check if the icecc path is set by the user |
57 | icecc = d.getVar('ICECC_PATH') or bb.process.run("which icecc")[0][:-1] | 57 | icecc = d.getVar('ICECC_PATH') or os.popen("which icecc").read()[:-1] |
58 | 58 | ||
59 | # Create the dir if necessary | 59 | # Create the dir if necessary |
60 | try: | 60 | try: |
@@ -151,9 +151,9 @@ def icc_path(bb,d): | |||
151 | 151 | ||
152 | def icc_get_tool(bb, d, tool): | 152 | def icc_get_tool(bb, d, tool): |
153 | if icc_is_native(bb, d): | 153 | if icc_is_native(bb, d): |
154 | return bb.process.run("which %s" % tool)[0][:-1] | 154 | return os.popen("which %s" % tool).read()[:-1] |
155 | elif icc_is_kernel(bb, d): | 155 | elif icc_is_kernel(bb, d): |
156 | return bb.process.run("which %s" % get_cross_kernel_cc(bb, d))[0][:-1] | 156 | return os.popen("which %s" % get_cross_kernel_cc(bb, d)).read()[:-1] |
157 | else: | 157 | else: |
158 | ice_dir = d.expand('${STAGING_BINDIR_TOOLCHAIN}') | 158 | ice_dir = d.expand('${STAGING_BINDIR_TOOLCHAIN}') |
159 | target_sys = d.expand('${TARGET_SYS}') | 159 | target_sys = d.expand('${TARGET_SYS}') |
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index fa7b5f0bc2..4d139e813f 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass | |||
@@ -154,29 +154,14 @@ def package_qa_check_rpath(file,name, d, elf, messages): | |||
154 | if not bad_dirs[0] in d.getVar('WORKDIR', True): | 154 | if not bad_dirs[0] in d.getVar('WORKDIR', True): |
155 | bb.fatal("This class assumed that WORKDIR is ${TMPDIR}/work... Not doing any check") | 155 | bb.fatal("This class assumed that WORKDIR is ${TMPDIR}/work... Not doing any check") |
156 | 156 | ||
157 | output, errors = bb.process.run("%s -B -F%%r#F '%s'" % (scanelf,file)) | 157 | output = os.popen("%s -B -F%%r#F '%s'" % (scanelf,file)) |
158 | txt = output.split() | 158 | txt = output.readline().split() |
159 | for line in txt: | 159 | for line in txt: |
160 | for dir in bad_dirs: | 160 | for dir in bad_dirs: |
161 | if dir in line: | 161 | if dir in line: |
162 | messages.append("package %s contains bad RPATH %s in file %s" % (name, line, file)) | 162 | messages.append("package %s contains bad RPATH %s in file %s" % (name, line, file)) |
163 | 163 | ||
164 | QAPATHTEST[useless-rpaths] = "package_qa_check_useless_rpaths" | 164 | QAPATHTEST[useless-rpaths] = "package_qa_check_useless_rpaths" |
165 | |||
166 | def package_qa_get_objdump(d, path): | ||
167 | """ | ||
168 | Get the result of objdump, ignore the errors since not all files can be objdumped | ||
169 | """ | ||
170 | env_path = d.getVar('PATH', True) | ||
171 | objdump = d.getVar('OBJDUMP', True) | ||
172 | |||
173 | try: | ||
174 | lines = "" | ||
175 | lines = bb.process.run("LC_ALL=C PATH=%s %s -p '%s'" % (env_path, objdump, path))[0] | ||
176 | except Exception: | ||
177 | sys.exc_clear() | ||
178 | return lines | ||
179 | |||
180 | def package_qa_check_useless_rpaths(file, name, d, elf, messages): | 165 | def package_qa_check_useless_rpaths(file, name, d, elf, messages): |
181 | """ | 166 | """ |
182 | Check for RPATHs that are useless but not dangerous | 167 | Check for RPATHs that are useless but not dangerous |
@@ -184,12 +169,15 @@ def package_qa_check_useless_rpaths(file, name, d, elf, messages): | |||
184 | if not elf: | 169 | if not elf: |
185 | return | 170 | return |
186 | 171 | ||
172 | objdump = d.getVar('OBJDUMP', True) | ||
173 | env_path = d.getVar('PATH', True) | ||
174 | |||
187 | libdir = d.getVar("libdir", True) | 175 | libdir = d.getVar("libdir", True) |
188 | base_libdir = d.getVar("base_libdir", True) | 176 | base_libdir = d.getVar("base_libdir", True) |
189 | 177 | ||
190 | import re | 178 | import re |
191 | rpath_re = re.compile("\s+RPATH\s+(.*)") | 179 | rpath_re = re.compile("\s+RPATH\s+(.*)") |
192 | for line in package_qa_get_objdump(d, file): | 180 | for line in os.popen("LC_ALL=C PATH=%s %s -p '%s' 2> /dev/null" % (env_path, objdump, file), "r"): |
193 | m = rpath_re.match(line) | 181 | m = rpath_re.match(line) |
194 | if m: | 182 | if m: |
195 | rpath = m.group(1) | 183 | rpath = m.group(1) |
@@ -381,7 +369,7 @@ def package_qa_check_desktop(path, name, d, elf, messages): | |||
381 | """ | 369 | """ |
382 | if path.endswith(".desktop"): | 370 | if path.endswith(".desktop"): |
383 | desktop_file_validate = os.path.join(d.getVar('STAGING_BINDIR_NATIVE',True),'desktop-file-validate') | 371 | desktop_file_validate = os.path.join(d.getVar('STAGING_BINDIR_NATIVE',True),'desktop-file-validate') |
384 | output, errors = bb.process.run("%s %s" % (desktop_file_validate, path)) | 372 | output = os.popen("%s %s" % (desktop_file_validate, path)) |
385 | # This only produces output on errors | 373 | # This only produces output on errors |
386 | for l in output: | 374 | for l in output: |
387 | messages.append("Desktop file issue: " + l.strip()) | 375 | messages.append("Desktop file issue: " + l.strip()) |
@@ -404,11 +392,14 @@ def package_qa_hash_style(path, name, d, elf, messages): | |||
404 | if not gnu_hash: | 392 | if not gnu_hash: |
405 | return | 393 | return |
406 | 394 | ||
395 | objdump = d.getVar('OBJDUMP', True) | ||
396 | env_path = d.getVar('PATH', True) | ||
397 | |||
407 | sane = False | 398 | sane = False |
408 | has_syms = False | 399 | has_syms = False |
409 | 400 | ||
410 | # If this binary has symbols, we expect it to have GNU_HASH too. | 401 | # If this binary has symbols, we expect it to have GNU_HASH too. |
411 | for line in package_qa_get_objdump(d, path): | 402 | for line in os.popen("LC_ALL=C PATH=%s %s -p '%s' 2> /dev/null" % (env_path, objdump, path), "r"): |
412 | if "SYMTAB" in line: | 403 | if "SYMTAB" in line: |
413 | has_syms = True | 404 | has_syms = True |
414 | if "GNU_HASH" in line: | 405 | if "GNU_HASH" in line: |
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass index d74361bf93..116e10b9de 100644 --- a/meta/classes/kernel.bbclass +++ b/meta/classes/kernel.bbclass | |||
@@ -349,7 +349,7 @@ python populate_packages_prepend () { | |||
349 | path = d.getVar("PATH", True) | 349 | path = d.getVar("PATH", True) |
350 | 350 | ||
351 | cmd = "PATH=\"%s\" depmod -n -a -b %s -F %s/boot/System.map-%s %s" % (path, dvar, dvar, kernelver, kernelver_stripped) | 351 | cmd = "PATH=\"%s\" depmod -n -a -b %s -F %s/boot/System.map-%s %s" % (path, dvar, dvar, kernelver, kernelver_stripped) |
352 | f = bb.process.Popen(cmd, shell=True).stdout | 352 | f = os.popen(cmd, 'r') |
353 | 353 | ||
354 | deps = {} | 354 | deps = {} |
355 | pattern0 = "^(.*\.k?o):..*$" | 355 | pattern0 = "^(.*\.k?o):..*$" |
diff --git a/meta/classes/metadata_scm.bbclass b/meta/classes/metadata_scm.bbclass index 5af593ae46..62650be675 100644 --- a/meta/classes/metadata_scm.bbclass +++ b/meta/classes/metadata_scm.bbclass | |||
@@ -60,16 +60,18 @@ def base_get_metadata_svn_revision(path, d): | |||
60 | return revision | 60 | return revision |
61 | 61 | ||
62 | def base_get_metadata_git_branch(path, d): | 62 | def base_get_metadata_git_branch(path, d): |
63 | branch = bb.process.run('cd %s; git branch | grep "^* " | tr -d "* "' % path)[0] | 63 | branch = os.popen('cd %s; git branch 2>&1 | grep "^* " | tr -d "* "' % path).read() |
64 | 64 | ||
65 | if len(branch) != 0: | 65 | if len(branch) != 0: |
66 | return branch | 66 | return branch |
67 | return "<unknown>" | 67 | return "<unknown>" |
68 | 68 | ||
69 | def base_get_metadata_git_revision(path, d): | 69 | def base_get_metadata_git_revision(path, d): |
70 | rev = bb.process.run("cd %s; git log -n 1 --pretty=oneline" % path)[0] | 70 | f = os.popen("cd %s; git log -n 1 --pretty=oneline -- 2>&1" % path) |
71 | if len(rev) != 0: | 71 | data = f.read() |
72 | rev = rev.split(" ")[0] | 72 | if f.close() is None: |
73 | return rev | 73 | rev = data.split(" ")[0] |
74 | if len(rev) != 0: | ||
75 | return rev | ||
74 | return "<unknown>" | 76 | return "<unknown>" |
75 | 77 | ||
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index bc83bfbf4e..41139ef921 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass | |||
@@ -1061,7 +1061,7 @@ python emit_pkgdata() { | |||
1061 | 1061 | ||
1062 | def get_directory_size(dir): | 1062 | def get_directory_size(dir): |
1063 | if os.listdir(dir): | 1063 | if os.listdir(dir): |
1064 | size = int(bb.process.run('du -sk %s' % dir)[0].split('\t')[0]) | 1064 | size = int(os.popen('du -sk %s' % dir).readlines()[0].split('\t')[0]) |
1065 | else: | 1065 | else: |
1066 | size = 0 | 1066 | size = 0 |
1067 | return size | 1067 | return size |
@@ -1221,7 +1221,7 @@ python package_do_filedeps() { | |||
1221 | rpfiles.append(os.path.join(root, file)) | 1221 | rpfiles.append(os.path.join(root, file)) |
1222 | 1222 | ||
1223 | for files in chunks(rpfiles, 100): | 1223 | for files in chunks(rpfiles, 100): |
1224 | dep_pipe = bb.process.Popen(rpmdeps + " " + " ".join(files), shell=True).stdout | 1224 | dep_pipe = os.popen(rpmdeps + " " + " ".join(files)) |
1225 | 1225 | ||
1226 | process_deps(dep_pipe, pkg, provides_files, requires_files) | 1226 | process_deps(dep_pipe, pkg, provides_files, requires_files) |
1227 | 1227 | ||
@@ -1263,15 +1263,11 @@ python package_do_shlibs() { | |||
1263 | 1263 | ||
1264 | def linux_so(root, path, file): | 1264 | def linux_so(root, path, file): |
1265 | needs_ldconfig = False | 1265 | needs_ldconfig = False |
1266 | cmd = d.getVar('OBJDUMP', True) + " -p " + pipes.quote(os.path.join(root, file)) | 1266 | cmd = d.getVar('OBJDUMP', True) + " -p " + pipes.quote(os.path.join(root, file)) + " 2>/dev/null" |
1267 | cmd = "PATH=\"%s\" %s" % (d.getVar('PATH', True), cmd) | 1267 | cmd = "PATH=\"%s\" %s" % (d.getVar('PATH', True), cmd) |
1268 | try: | 1268 | fd = os.popen(cmd) |
1269 | lines = "" | 1269 | lines = fd.readlines() |
1270 | lines = bb.process.run(cmd)[0] | 1270 | fd.close() |
1271 | # Some ".so" maybe ascii text, e.g: /usr/lib64/libpthread.so, | ||
1272 | # ingore those errors. | ||
1273 | except Exception: | ||
1274 | sys.exc_clear() | ||
1275 | for l in lines: | 1271 | for l in lines: |
1276 | m = re.match("\s+NEEDED\s+([^\s]*)", l) | 1272 | m = re.match("\s+NEEDED\s+([^\s]*)", l) |
1277 | if m: | 1273 | if m: |