summaryrefslogtreecommitdiffstats
path: root/meta/classes/package.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-25 15:01:38 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-25 22:43:34 +0000
commit3edadc98025ef5f4c166ad5fd7981bae1be2c943 (patch)
tree0171b04f004ade79556d281813a0d50262483480 /meta/classes/package.bbclass
parente26e8ea364fdceb7a5829ea91bde782ba4626023 (diff)
downloadpoky-3edadc98025ef5f4c166ad5fd7981bae1be2c943.tar.gz
package.bbclass: Rewrite package_do_filedeps() to reduce the amount of subprocesses created and improve speed
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package.bbclass')
-rw-r--r--meta/classes/package.bbclass77
1 files changed, 44 insertions, 33 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index c8adbb0564..137de09bc0 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -822,55 +822,66 @@ RPMDEPS = "${STAGING_LIBDIR_NATIVE}/rpm/bin/rpmdeps"
822# FILERDEPENDS_filepath_pkg - per file dep 822# FILERDEPENDS_filepath_pkg - per file dep
823 823
824python package_do_filedeps() { 824python package_do_filedeps() {
825 import os 825 import os, re
826 826
827 pkgdest = bb.data.getVar('PKGDEST', d, True) 827 pkgdest = bb.data.getVar('PKGDEST', d, True)
828 packages = bb.data.getVar('PACKAGES', d, True) 828 packages = bb.data.getVar('PACKAGES', d, True)
829 829
830 cmd = bb.data.expand("${STAGING_LIBDIR_NATIVE}/rpm/perfile_rpmdeps.sh", d)
831 rpmdeps = bb.data.expand("${RPMDEPS}", d) 830 rpmdeps = bb.data.expand("${RPMDEPS}", d)
831 r = re.compile(r'[<>=]+ +[^ ]*')
832 832
833 # Quick routine to process the results of the rpmdeps call... 833 # Quick routine to process the results of the rpmdeps call...
834 def process_deps(pipe, pkg, varname): 834 def process_deps(pipe, pkg, f, provides_files, requires_files):
835 dep_files = "" 835 provides = []
836 requires = []
837 file = f.replace(pkgdest + "/" + pkg, "")
838 file = file.replace("@", "@at@")
839 file = file.replace(" ", "@space@")
840 file = file.replace("\t", "@tab@")
841 file = file.replace("[", "@openbrace@")
842 file = file.replace("]", "@closebrace@")
843 file = file.replace("_", "@underscore@")
844
836 for line in pipe: 845 for line in pipe:
837 key = "" 846 if line.startswith("Requires:"):
838 value = "" 847 i = requires
839 # We expect two items on each line 848 elif line.startswith("Provides:"):
840 # 1 - filepath 849 i = provides
841 # 2 - dep list 850 else:
842 line_list = line.rstrip().split(None,1); 851 continue
843 if len(line_list) <= 0 or len(line_list) > 2: 852 value = line.split(":", 1)[1].strip()
844 bb.error("deps list length error! " + len(line_list)); 853 value = r.sub(r'(\g<0>)', value)
845 if len(line_list) == 2: 854 if value.startswith("rpmlib("):
846 file = line_list[0]; 855 continue
847 value = line_list[1] 856 i.append(value)
848 file = file.replace(pkgdest + "/" + pkg, "") 857
849 file = file.replace("@", "@at@") 858 if len(provides) > 0:
850 file = file.replace(" ", "@space@") 859 provides_files.append(file)
851 file = file.replace("\t", "@tab@") 860 key = "FILERPROVIDES_" + file + "_" + pkg
852 file = file.replace("[", "@openbrace@") 861 bb.data.setVar(key, " ".join(provides), d)
853 file = file.replace("]", "@closebrace@") 862
854 file = file.replace("_", "@underscore@") 863 if len(requires) > 0:
855 dep_files = dep_files + " " + file 864 requires_files.append(file)
856 key = "FILE" + varname + "_" + file + "_" + pkg 865 key = "FILERDEPENDS_" + file + "_" + pkg
857 bb.data.setVar(key, value, d) 866 bb.data.setVar(key, " ".join(requires), d)
858 bb.data.setVar("FILE" + varname + "FLIST_" + pkg, dep_files, d)
859 867
860 # Determine dependencies 868 # Determine dependencies
861 for pkg in packages.split(): 869 for pkg in packages.split():
862 if pkg.endswith('-dbg') or pkg.endswith('-doc') or pkg.find('-locale-') != -1 or pkg.find('-localedata-') != -1 or pkg.find('-gconv-') != -1 or pkg.find('-charmap-') != -1 or pkg.startswith('kernel-module-'): 870 if pkg.endswith('-dbg') or pkg.endswith('-doc') or pkg.find('-locale-') != -1 or pkg.find('-localedata-') != -1 or pkg.find('-gconv-') != -1 or pkg.find('-charmap-') != -1 or pkg.startswith('kernel-module-'):
863 continue 871 continue
864 872
865 # Process provides 873 provides_files = []
866 dep_pipe = os.popen(cmd + " --rpmdeps " + rpmdeps + " --provides " + pkgdest + "/" + pkg) 874 requires_files = []
875 for root, dirs, files in os.walk(pkgdest + "/" + pkg):
876 for file in files:
877 f = os.path.join(root, file)
867 878
868 process_deps(dep_pipe, pkg, 'RPROVIDES') 879 dep_pipe = os.popen(rpmdeps + " --provides --requires -v " + f)
869 880
870 # Process requirements 881 process_deps(dep_pipe, pkg, f, provides_files, requires_files)
871 dep_pipe = os.popen(cmd + " --rpmdeps " + rpmdeps + " --requires " + pkgdest + "/" + pkg)
872 882
873 process_deps(dep_pipe, pkg, 'RDEPENDS') 883 bb.data.setVar("FILERDEPENDSFLIST_" + pkg, " ".join(requires_files), d)
884 bb.data.setVar("FILERPROVIDESFLIST_" + pkg, " ".join(provides_files), d)
874} 885}
875 886
876SHLIBSDIR = "${STAGING_DIR_HOST}/shlibs" 887SHLIBSDIR = "${STAGING_DIR_HOST}/shlibs"