summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
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)