From 74d97b2638bc8ceee2f7cfc0edc9d9a495d1d297 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sat, 27 May 2006 08:20:36 +0000 Subject: base.bbclass: Move manifest code into manifest.bbclass and fix a bug in it (import bb.manifest) --- classes/base.bbclass | 84 +----------------------------------------------- classes/manifest.bbclass | 80 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 83 deletions(-) create mode 100644 classes/manifest.bbclass (limited to 'classes') diff --git a/classes/base.bbclass b/classes/base.bbclass index 5898a2cfc3..673e2f0548 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -607,23 +607,10 @@ do_populate_staging[dirs] = "${STAGING_DIR}/${TARGET_SYS}/bin ${STAGING_DIR}/${T addtask populate_staging after do_compile -#python do_populate_staging () { -# if not bb.data.getVar('manifest', d): -# bb.build.exec_func('do_emit_manifest', d) -# if bb.data.getVar('do_stage', d): -# bb.build.exec_func('do_stage', d) -# else: -# bb.build.exec_func('manifest_do_populate_staging', d) -#} - python do_populate_staging () { - if bb.data.getVar('manifest_do_populate_staging', d): - bb.build.exec_func('manifest_do_populate_staging', d) - else: - bb.build.exec_func('do_stage', d) + bb.build.exec_func('do_stage', d) } -#addtask install addtask install after do_compile do_install[dirs] = "${S} ${B}" @@ -631,14 +618,6 @@ base_do_install() { : } -#addtask populate_pkgs after do_compile -#python do_populate_pkgs () { -# if not bb.data.getVar('manifest', d): -# bb.build.exec_func('do_emit_manifest', d) -# bb.build.exec_func('manifest_do_populate_pkgs', d) -# bb.build.exec_func('package_do_shlibs', d) -#} - base_do_package() { : } @@ -653,38 +632,6 @@ do_build[func] = "1" SHLIBS = "" RDEPENDS_prepend = " ${SHLIBS}" -python read_manifest () { - import sys - mfn = bb.data.getVar("MANIFEST", d, 1) - if os.access(mfn, os.R_OK): - # we have a manifest, so emit do_stage and do_populate_pkgs, - # and stuff some additional bits of data into the metadata store - mfile = file(mfn, "r") - manifest = bb.manifest.parse(mfile, d) - if not manifest: - return - - bb.data.setVar('manifest', manifest, d) -} - -python parse_manifest () { - manifest = bb.data.getVar("manifest", d) - if not manifest: - return - for func in ("do_populate_staging", "do_populate_pkgs"): - value = bb.manifest.emit(func, manifest, d) - if value: - bb.data.setVar("manifest_" + func, value, d) - bb.data.delVarFlag("manifest_" + func, "python", d) - bb.data.delVarFlag("manifest_" + func, "fakeroot", d) - bb.data.setVarFlag("manifest_" + func, "func", 1, d) - packages = [] - for l in manifest: - if "pkg" in l and l["pkg"] is not None: - packages.append(l["pkg"]) - bb.data.setVar("PACKAGES", " ".join(packages), d) -} - def explode_deps(s): r = [] l = s.split() @@ -768,15 +715,6 @@ python __anonymous () { use_nls = bb.data.getVar('USE_NLS_%s' % pn, d, 1) if use_nls != None: bb.data.setVar('USE_NLS', use_nls, d) - - try: - bb.build.exec_func('read_manifest', d) - bb.build.exec_func('parse_manifest', d) - except exceptions.KeyboardInterrupt: - raise - except Exception, e: - bb.error("anonymous function: %s" % e) - pass } python () { @@ -800,26 +738,6 @@ python () { return } - -addtask emit_manifest -python do_emit_manifest () { -# FIXME: emit a manifest here -# 1) adjust PATH to hit the wrapper scripts - wrappers = bb.which(bb.data.getVar("BBPATH", d, 1), 'build/install', 0) - path = (bb.data.getVar('PATH', d, 1) or '').split(':') - path.insert(0, os.path.dirname(wrappers)) - bb.data.setVar('PATH', ':'.join(path), d) -# 2) exec_func("do_install", d) - bb.build.exec_func('do_install', d) -# 3) read in data collected by the wrappers - bb.build.exec_func('read_manifest', d) -# 4) mangle the manifest we just generated, get paths back into -# our variable form -# 5) write it back out -# 6) re-parse it to ensure the generated functions are proper - bb.build.exec_func('parse_manifest', d) -} - EXPORT_FUNCTIONS do_clean do_mrproper do_fetch do_unpack do_configure do_compile do_install do_package do_patch do_populate_pkgs do_stage MIRRORS[func] = "0" diff --git a/classes/manifest.bbclass b/classes/manifest.bbclass new file mode 100644 index 0000000000..687f4b756e --- /dev/null +++ b/classes/manifest.bbclass @@ -0,0 +1,80 @@ + +python read_manifest () { + import sys, bb.manifest + mfn = bb.data.getVar("MANIFEST", d, 1) + if os.access(mfn, os.R_OK): + # we have a manifest, so emit do_stage and do_populate_pkgs, + # and stuff some additional bits of data into the metadata store + mfile = file(mfn, "r") + manifest = bb.manifest.parse(mfile, d) + if not manifest: + return + + bb.data.setVar('manifest', manifest, d) +} + +python parse_manifest () { + manifest = bb.data.getVar("manifest", d) + if not manifest: + return + for func in ("do_populate_staging", "do_populate_pkgs"): + value = bb.manifest.emit(func, manifest, d) + if value: + bb.data.setVar("manifest_" + func, value, d) + bb.data.delVarFlag("manifest_" + func, "python", d) + bb.data.delVarFlag("manifest_" + func, "fakeroot", d) + bb.data.setVarFlag("manifest_" + func, "func", 1, d) + packages = [] + for l in manifest: + if "pkg" in l and l["pkg"] is not None: + packages.append(l["pkg"]) + bb.data.setVar("PACKAGES", " ".join(packages), d) +} + +python __anonymous () { + try: + bb.build.exec_func('read_manifest', d) + bb.build.exec_func('parse_manifest', d) + except exceptions.KeyboardInterrupt: + raise + except Exception, e: + bb.error("anonymous function: %s" % e) + pass +} + +#python do_populate_staging () { +# if not bb.data.getVar('manifest', d): +# bb.build.exec_func('do_emit_manifest', d) +# if bb.data.getVar('do_stage', d): +# bb.build.exec_func('do_stage', d) +# else: +# bb.build.exec_func('manifest_do_populate_staging', d) +#} + +#addtask populate_pkgs after do_compile +#python do_populate_pkgs () { +# if not bb.data.getVar('manifest', d): +# bb.build.exec_func('do_emit_manifest', d) +# bb.build.exec_func('manifest_do_populate_pkgs', d) +# bb.build.exec_func('package_do_shlibs', d) +#} + +addtask emit_manifest +python do_emit_manifest () { +# FIXME: emit a manifest here +# 1) adjust PATH to hit the wrapper scripts + wrappers = bb.which(bb.data.getVar("BBPATH", d, 1), 'build/install', 0) + path = (bb.data.getVar('PATH', d, 1) or '').split(':') + path.insert(0, os.path.dirname(wrappers)) + bb.data.setVar('PATH', ':'.join(path), d) +# 2) exec_func("do_install", d) + bb.build.exec_func('do_install', d) +# 3) read in data collected by the wrappers + print("Got here2 213") + bb.build.exec_func('read_manifest', d) +# 4) mangle the manifest we just generated, get paths back into +# our variable form +# 5) write it back out +# 6) re-parse it to ensure the generated functions are proper + bb.build.exec_func('parse_manifest', d) +} -- cgit v1.2.3