Merge branch 'org.openembedded.dev' of ssh+git://git@git.openembedded.net/openembedde...
[openembedded.git] / classes / manifest.bbclass
1
2 python read_manifest () {
3         import sys
4         mfn = bb.data.getVar("MANIFEST", d, 1)
5         if os.access(mfn, os.R_OK):
6                 # we have a manifest, so emit do_stage and do_populate_pkgs,
7                 # and stuff some additional bits of data into the metadata store
8                 mfile = file(mfn, "r")
9                 manifest = bb.manifest.parse(mfile, d)
10                 if not manifest:
11                         return
12
13                 bb.data.setVar('manifest', manifest, d)
14 }
15
16 python parse_manifest () {
17                 manifest = bb.data.getVar("manifest", d)
18                 if not manifest:
19                         return
20                 for func in ("do_populate_staging", "do_populate_pkgs"):
21                         value = bb.manifest.emit(func, manifest, d)
22                         if value:
23                                 bb.data.setVar("manifest_" + func, value, d)
24                                 bb.data.delVarFlag("manifest_" + func, "python", d)
25                                 bb.data.delVarFlag("manifest_" + func, "fakeroot", d)
26                                 bb.data.setVarFlag("manifest_" + func, "func", 1, d)
27                 packages = []
28                 for l in manifest:
29                         if "pkg" in l and l["pkg"] is not None:
30                                 packages.append(l["pkg"])
31                 bb.data.setVar("PACKAGES", " ".join(packages), d)
32 }
33
34 python __anonymous () {
35         try:
36                 bb.build.exec_func('read_manifest', d)
37                 bb.build.exec_func('parse_manifest', d)
38         except exceptions.KeyboardInterrupt:
39                 raise
40         except Exception, e:
41                 bb.error("anonymous function: %s" % e)
42                 pass
43 }
44
45 #python do_populate_staging () {
46 #       if not bb.data.getVar('manifest', d):
47 #               bb.build.exec_func('do_emit_manifest', d)
48 #       if bb.data.getVar('do_stage', d):
49 #               bb.build.exec_func('do_stage', d)
50 #       else:
51 #               bb.build.exec_func('manifest_do_populate_staging', d)
52 #}
53
54 #addtask populate_pkgs after do_compile
55 #python do_populate_pkgs () {
56 #       if not bb.data.getVar('manifest', d):
57 #               bb.build.exec_func('do_emit_manifest', d)
58 #       bb.build.exec_func('manifest_do_populate_pkgs', d)
59 #       bb.build.exec_func('package_do_shlibs', d)
60 #}
61
62 addtask emit_manifest
63 python do_emit_manifest () {
64 #       FIXME: emit a manifest here
65 #       1) adjust PATH to hit the wrapper scripts
66         wrappers = bb.which(bb.data.getVar("BBPATH", d, 1), 'build/install', 0)
67         path = (bb.data.getVar('PATH', d, 1) or '').split(':')
68         path.insert(0, os.path.dirname(wrappers))
69         bb.data.setVar('PATH', ':'.join(path), d)
70 #       2) exec_func("do_install", d)
71         bb.build.exec_func('do_install', d)
72 #       3) read in data collected by the wrappers
73         print("Got here2 213")
74         bb.build.exec_func('read_manifest', d)
75 #       4) mangle the manifest we just generated, get paths back into
76 #          our variable form
77 #       5) write it back out
78 #       6) re-parse it to ensure the generated functions are proper
79         bb.build.exec_func('parse_manifest', d)
80 }