summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-02-01 13:50:38 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-02-06 13:12:59 +0000
commitd81aa06ece4e5dcae5f91ab0ae8958d58cd3419f (patch)
tree9d8bdc7fa6f5cadcc4143f3ed48416351ed13790 /meta/lib
parent6c6f6b7ffd770418bda92898a5fdf90877e74dde (diff)
downloadpoky-d81aa06ece4e5dcae5f91ab0ae8958d58cd3419f.tar.gz
package.bbclass: Multithread per file dependency generation code
(From OE-Core rev: b659eb0f2070149d9516c129b3853b41fbbd1033) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/package.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
new file mode 100644
index 0000000000..6b1c1f48ce
--- /dev/null
+++ b/meta/lib/oe/package.py
@@ -0,0 +1,51 @@
1
2def file_translate(file):
3 ft = file.replace("@", "@at@")
4 ft = ft.replace(" ", "@space@")
5 ft = ft.replace("\t", "@tab@")
6 ft = ft.replace("[", "@openbrace@")
7 ft = ft.replace("]", "@closebrace@")
8 ft = ft.replace("_", "@underscore@")
9 return ft
10
11def filedeprunner(arg):
12 import re
13
14 (pkg, pkgfiles, rpmdeps, pkgdest) = arg
15 provides = {}
16 requires = {}
17
18 r = re.compile(r'[<>=]+ +[^ ]*')
19
20 def process_deps(pipe, pkg, pkgdest, provides, requires):
21 for line in pipe:
22 f = line.split(" ", 1)[0].strip()
23 line = line.split(" ", 1)[1].strip()
24
25 if line.startswith("Requires:"):
26 i = requires
27 elif line.startswith("Provides:"):
28 i = provides
29 else:
30 continue
31
32 file = f.replace(pkgdest + "/" + pkg, "")
33 file = file_translate(file)
34 value = line.split(":", 1)[1].strip()
35 value = r.sub(r'(\g<0>)', value)
36
37 if value.startswith("rpmlib("):
38 continue
39 if value == "python":
40 continue
41 if file not in i:
42 i[file] = []
43 i[file].append(value)
44
45 return provides, requires
46
47 dep_pipe = os.popen(rpmdeps + " " + " ".join(pkgfiles))
48
49 provides, requires = process_deps(dep_pipe, pkg, pkgdest, provides, requires)
50
51 return (pkg, provides, requires)