summaryrefslogtreecommitdiffstats
path: root/meta/classes/package_rpm.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-26 20:54:23 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-30 11:37:28 +0100
commitb67fccc81e666339f24b26fe4c2aef6a9241fb2d (patch)
tree3bf2819fbeabaebcd97efec4b6cda3e3abf7d9c5 /meta/classes/package_rpm.bbclass
parentc1c9144f67108fdc6b7c62d21c9a638e38f12fb4 (diff)
downloadpoky-b67fccc81e666339f24b26fe4c2aef6a9241fb2d.tar.gz
package_rpm.bbclass: Replace shell provides/requires script with python version
The existing shell script is a fork bomb and forks off hundreds of grep/cur/wc calls as it reads from its input stream and iterates over the file data table for each line of input. This patch replaces the shell code with python code which doesn't exec anything and hence runs much faster without the exec() overhead. This speeds up rpm packaging considerably, as can be measured simply by timing it, or watching the processor utilisation. (From OE-Core rev: 2fb5f72b47840ed7f540df181595878e3f5ba4c6) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package_rpm.bbclass')
-rw-r--r--meta/classes/package_rpm.bbclass22
1 files changed, 13 insertions, 9 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index ffe3b312ff..d90976b65d 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -1004,8 +1004,9 @@ python do_package_rpm () {
1004 1004
1005 # Construct per file dependencies file 1005 # Construct per file dependencies file
1006 def dump_filerdeps(varname, outfile, d): 1006 def dump_filerdeps(varname, outfile, d):
1007 outfile.write("#!/bin/sh\n") 1007 outfile.write("#!/usr/bin/env python\n\n")
1008 outfile.write("\n# Dependency table\n") 1008 outfile.write("# Dependency table\n")
1009 outfile.write('deps = {\n')
1009 for pkg in packages.split(): 1010 for pkg in packages.split():
1010 dependsflist_key = 'FILE' + varname + 'FLIST' + "_" + pkg 1011 dependsflist_key = 'FILE' + varname + 'FLIST' + "_" + pkg
1011 dependsflist = (d.getVar(dependsflist_key, True) or "") 1012 dependsflist = (d.getVar(dependsflist_key, True) or "")
@@ -1018,7 +1019,7 @@ python do_package_rpm () {
1018 file = file.replace("@tab@", "\t") 1019 file = file.replace("@tab@", "\t")
1019 file = file.replace("@space@", " ") 1020 file = file.replace("@space@", " ")
1020 file = file.replace("@at@", "@") 1021 file = file.replace("@at@", "@")
1021 outfile.write("#" + pkgd + file + "\t") 1022 outfile.write('"' + pkgd + file + '" : "')
1022 for dep in depends_dict: 1023 for dep in depends_dict:
1023 ver = depends_dict[dep] 1024 ver = depends_dict[dep]
1024 if dep and ver: 1025 if dep and ver:
@@ -1027,12 +1028,15 @@ python do_package_rpm () {
1027 outfile.write(dep + " " + ver + " ") 1028 outfile.write(dep + " " + ver + " ")
1028 else: 1029 else:
1029 outfile.write(dep + " ") 1030 outfile.write(dep + " ")
1030 outfile.write("\n") 1031 outfile.write('",\n')
1031 outfile.write("\n\nwhile read file_name ; do\n") 1032 outfile.write('}\n\n')
1032 outfile.write("\tlength=$(echo \"#${file_name}\t\" | wc -c )\n") 1033 outfile.write("import sys\n")
1033 outfile.write("\tline=$(grep \"^#${file_name}\t\" $0 | cut -c ${length}- )\n") 1034 outfile.write("while 1:\n")
1034 outfile.write("\tprintf \"%s\\n\" ${line}\n") 1035 outfile.write("\tline = sys.stdin.readline().strip()\n")
1035 outfile.write("done\n") 1036 outfile.write("\tif not line:\n")
1037 outfile.write("\t\tsys.exit(0)\n")
1038 outfile.write("\tif line in deps:\n")
1039 outfile.write("\t\tprint(deps[line] + '\\n')\n")
1036 1040
1037 # OE-core dependencies a.k.a. RPM requires 1041 # OE-core dependencies a.k.a. RPM requires
1038 outdepends = workdir + "/" + srcname + ".requires" 1042 outdepends = workdir + "/" + srcname + ".requires"