From 24f65d8096e185714b50b1e0bef084ea8cc8392d Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 11 Nov 2009 13:52:02 +0000 Subject: base.bbclass: Detect recipes where there are problems with staging functions after staging upgrades Signed-off-by: Richard Purdie --- classes/base.bbclass | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'classes') diff --git a/classes/base.bbclass b/classes/base.bbclass index aa1037e472..e4fc2ac34f 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -1085,6 +1085,8 @@ python do_populate_staging () { if legacy: bb.data.setVar("SYSROOT_DESTDIR", "", d) bb.note("Legacy staging mode for %s" % bb.data.getVar("FILE", d, True)) + if bb.data.getVarFlags('do_stage', d) is None: + bb.fatal("This recipe (%s) has a do_stage_prepend or do_stage_append and do_stage now doesn't exist. Please rename this to do_stage()" % bb.data.getVar("FILE", d, True)) lock = bb.utils.lockfile(lockfile) bb.build.exec_func('do_stage', d) bb.build.exec_func('populate_staging_prehook', d) @@ -1248,6 +1250,9 @@ python () { base_after_parse(d) if is_legacy_staging(d): bb.debug(1, "Legacy staging mode for %s" % bb.data.getVar("FILE", d, True)) + if bb.data.getVarFlags('do_stage', d) is None: + bb.error("This recipe (%s) has a do_stage_prepend or do_stage_append and do_stage now doesn't exist. Please rename this to do_stage()" % bb.data.getVar("FILE", d, True)) + } def check_app_exists(app, d): -- cgit v1.2.3 From 81bdf9133524e76c3239f155dca9539e68032658 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 11 Nov 2009 15:36:52 +0000 Subject: classes: Drop some random import bb/os statements Signed-off-by: Richard Purdie --- classes/binconfig.bbclass | 1 - classes/manifest.bbclass | 2 +- classes/packaged-staging.bbclass | 1 - classes/patch.bbclass | 4 ---- classes/recipe_sanity.bbclass | 9 --------- 5 files changed, 1 insertion(+), 16 deletions(-) (limited to 'classes') diff --git a/classes/binconfig.bbclass b/classes/binconfig.bbclass index dad54a5f56..b3b2236709 100644 --- a/classes/binconfig.bbclass +++ b/classes/binconfig.bbclass @@ -2,7 +2,6 @@ FILES_${PN}-dev += "${bindir}/*-config" # The namespaces can clash here hence the two step replace def get_binconfig_mangle(d): - import bb.data s = "-e ''" if not bb.data.inherits_class('native', d): optional_quote = r"\(\"\?\)" diff --git a/classes/manifest.bbclass b/classes/manifest.bbclass index 687f4b756e..8d714d3bbc 100644 --- a/classes/manifest.bbclass +++ b/classes/manifest.bbclass @@ -1,6 +1,6 @@ python read_manifest () { - import sys, bb.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, diff --git a/classes/packaged-staging.bbclass b/classes/packaged-staging.bbclass index c65efd8b12..013f22dead 100644 --- a/classes/packaged-staging.bbclass +++ b/classes/packaged-staging.bbclass @@ -27,7 +27,6 @@ PSTAGE_NATIVEDEPENDS = "\ BB_STAMP_WHITELIST = "${PSTAGE_NATIVEDEPENDS}" python () { - import bb pstage_allowed = True # These classes encode staging paths into the binary data so can only be diff --git a/classes/patch.bbclass b/classes/patch.bbclass index dfb8ec960f..bb49fed7a1 100644 --- a/classes/patch.bbclass +++ b/classes/patch.bbclass @@ -76,8 +76,6 @@ def patch_init(d): def __str__(self): return "Patch Error: %s" % self.msg - import bb, bb.data, bb.fetch - class PatchSet(object): defaults = { "strippath": 1 @@ -457,8 +455,6 @@ do_patch[depends] = "${PATCHDEPENDENCY}" python patch_do_patch() { import re - import bb.fetch - patch_init(d) src_uri = (bb.data.getVar('SRC_URI', d, 1) or '').split() diff --git a/classes/recipe_sanity.bbclass b/classes/recipe_sanity.bbclass index 29f4a8fada..d929da6319 100644 --- a/classes/recipe_sanity.bbclass +++ b/classes/recipe_sanity.bbclass @@ -1,10 +1,8 @@ def __note(msg, d): - import bb bb.note("%s: recipe_sanity: %s" % (d.getVar("P", 1), msg)) __recipe_sanity_badtargetvars = "RDEPENDS RPROVIDES" def bad_target_vars(cfgdata, d): - import bb.data if bb.data.inherits_class("native", d) or \ bb.data.inherits_class("cross", d): return @@ -43,14 +41,12 @@ def var_renames_overwrite(cfgdata, d): __note("rename of variable '%s' to '%s' overwrote existing value '%s' with '%s'." % (key, newkey, oldvalue, newvalue), d) def incorrect_nonempty_PACKAGES(cfgdata, d): - import bb.data if bb.data.inherits_class("native", d) or \ bb.data.inherits_class("cross", d): if d.getVar("PACKAGES", 1): return True def can_use_autotools_base(cfgdata, d): - import bb cfg = d.getVar("do_configure", 1) if not bb.data.inherits_class("autotools", d): return False @@ -68,8 +64,6 @@ def can_use_autotools_base(cfgdata, d): return True def can_remove_FILESPATH(cfgdata, d): - import os - import bb expected = cfgdata.get("FILESPATH") #expected = "${@':'.join([os.path.normpath(os.path.join(fp, p, o)) for fp in d.getVar('FILESPATHBASE', 1).split(':') for p in d.getVar('FILESPATHPKG', 1).split(':') for o in (d.getVar('OVERRIDES', 1) + ':').split(':') if os.path.exists(os.path.join(fp, p, o))])}:${FILESDIR}" expectedpaths = bb.data.expand(expected, d) @@ -84,8 +78,6 @@ def can_remove_FILESPATH(cfgdata, d): return expected != unexpanded def can_remove_FILESDIR(cfgdata, d): - import os - import bb expected = cfgdata.get("FILESDIR") #expected = "${@bb.which(d.getVar('FILESPATH', 1), '.')}" unexpanded = d.getVar("FILESDIR", 0) @@ -102,7 +94,6 @@ def can_remove_FILESDIR(cfgdata, d): expanded == bb.data.expand(expected, d)) def can_remove_others(p, cfgdata, d): - import bb for k in ["S", "PV", "PN", "DESCRIPTION", "LICENSE", "DEPENDS", "SECTION", "PACKAGES", "EXTRA_OECONF", "EXTRA_OEMAKE"]: #for k in cfgdata: -- cgit v1.2.3 From 25db6767cbf1b00a4e8dbf746d2d16458c3696ea Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 11 Nov 2009 21:01:47 +0000 Subject: perl: Move config.sh to STAGING_LIBDIR rather than trying to be clever with staging variables and losing Signed-off-by: Richard Purdie --- classes/cpan-base.bbclass | 6 ++---- classes/cpan.bbclass | 2 +- classes/cpan_build.bbclass | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'classes') diff --git a/classes/cpan-base.bbclass b/classes/cpan-base.bbclass index cc0d11e515..82fd5b459a 100644 --- a/classes/cpan-base.bbclass +++ b/classes/cpan-base.bbclass @@ -9,8 +9,8 @@ RDEPENDS += "${@["perl", ""][(bb.data.inherits_class('native', d))]}" # Determine the staged version of perl from the perl configuration file def get_perl_version(d): - import os, bb, re - cfg = bb.data.expand('${STAGING_DIR}/${HOST_SYS}/perl/config.sh', d) + import re + cfg = bb.data.expand('${STAGING_LIBDIR}/perl/config.sh', d) try: f = open(cfg, 'r') except IOError: @@ -33,7 +33,6 @@ def is_new_perl(d): # Determine where the library directories are def perl_get_libdirs(d): - import bb libdir = bb.data.getVar('libdir', d, 1) if is_new_perl(d) == "yes": libdirs = libdir + '/perl5' @@ -42,7 +41,6 @@ def perl_get_libdirs(d): return libdirs def is_target(d): - import bb if not bb.data.inherits_class('native', d): return "yes" return "no" diff --git a/classes/cpan.bbclass b/classes/cpan.bbclass index 7b3faa2561..66054bc755 100644 --- a/classes/cpan.bbclass +++ b/classes/cpan.bbclass @@ -16,7 +16,7 @@ export PERL_ARCHLIB = "${STAGING_LIBDIR}/perl/${@get_perl_version(d)}" cpan_do_configure () { yes '' | perl Makefile.PL ${EXTRA_CPANFLAGS} if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then - . ${STAGING_DIR_TARGET}/perl/config.sh + . ${STAGING_LIBDIR}/perl/config.sh if [ "${IS_NEW_PERL}" = "yes" ]; then sed -i -e "s:\(SITELIBEXP = \).*:\1${sitelibexp}:" \ -e "s:\(SITEARCHEXP = \).*:\1${sitearchexp}:" \ diff --git a/classes/cpan_build.bbclass b/classes/cpan_build.bbclass index c3804ff4cc..2ca01996a9 100644 --- a/classes/cpan_build.bbclass +++ b/classes/cpan_build.bbclass @@ -25,7 +25,7 @@ DEPENDS_prepend = "${@cpan_build_dep_prepend(d)}" cpan_build_do_configure () { if [ ${@is_target(d)} == "yes" ]; then # build for target - . ${STAGING_DIR_TARGET}/perl/config.sh + . ${STAGING_LIBDIR}/perl/config.sh if [ "${IS_NEW_PERL}" = "yes" ]; then perl Build.PL --installdirs vendor \ --destdir ${D} \ -- cgit v1.2.3 From fe9ff4fa1f8edf885ee1a9089366079fa6729a03 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 12 Nov 2009 10:31:04 +0000 Subject: base.bbclass: Fix legacy staging package generation as pre hook was called too late. Also allow legacy staging to be forced with FORCE_LEGACY_STAGING Signed-off-by: Richard Purdie --- classes/base.bbclass | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'classes') diff --git a/classes/base.bbclass b/classes/base.bbclass index e4fc2ac34f..9d063f2151 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -1041,6 +1041,8 @@ def is_legacy_staging(d): legacy = False if bb.data.getVar('PSTAGE_BROKEN_DESTDIR', d, 1) == "1": legacy = True + if bb.data.getVar('FORCE_LEGACY_STAGING', d, 1) == "1": + legacy = True return legacy do_populate_staging[dirs] = "${STAGING_DIR_TARGET}/${bindir} ${STAGING_DIR_TARGET}/${libdir} \ @@ -1088,8 +1090,8 @@ python do_populate_staging () { if bb.data.getVarFlags('do_stage', d) is None: bb.fatal("This recipe (%s) has a do_stage_prepend or do_stage_append and do_stage now doesn't exist. Please rename this to do_stage()" % bb.data.getVar("FILE", d, True)) lock = bb.utils.lockfile(lockfile) - bb.build.exec_func('do_stage', d) bb.build.exec_func('populate_staging_prehook', d) + bb.build.exec_func('do_stage', d) for f in (bb.data.getVar('SYSROOT_PREPROCESS_FUNCS', d, True) or '').split(): bb.build.exec_func(f, d) bb.build.exec_func('populate_staging_posthook', d) -- cgit v1.2.3 From 43be9de6f9225760b6cd0f7dbf332a9adb22b7bc Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 12 Nov 2009 10:32:08 +0000 Subject: native.bbclass: Force legacy staging mode autotools_stage_all is used as often the do_install is empty too. This fixes issues with curl-native Signed-off-by: Richard Purdie --- classes/native.bbclass | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'classes') diff --git a/classes/native.bbclass b/classes/native.bbclass index 6292e4b121..89f6501218 100644 --- a/classes/native.bbclass +++ b/classes/native.bbclass @@ -87,7 +87,12 @@ DEPENDS_virtclass-native ?= "${ORIG_DEPENDS}" python __anonymous () { # If we've a legacy native do_stage, we need to neuter do_install stagefunc = bb.data.getVar('do_stage', d, True) - if (stagefunc.strip() != "do_stage_native" and stagefunc.strip() != "autotools_stage_all") and bb.data.getVar('AUTOTOOLS_NATIVE_STAGE_INSTALL', d, 1) == "1": + + # For now, force legacy mode for native packages using autotools_stage_all + if (stagefunc.strip() == "autotools_stage_all"): + bb.note("Forcing legacy staging mode for %s" % bb.data.getVar('FILE', d, 1)) + bb.data.setVar('FORCE_LEGACY_STAGING', "1", d) + elif (stagefunc.strip() != "do_stage_native" and stagefunc.strip() != "autotools_stage_all") and bb.data.getVar('AUTOTOOLS_NATIVE_STAGE_INSTALL', d, 1) == "1": bb.data.setVar("do_install", " :", d) if "native" in (bb.data.getVar('BBCLASSEXTEND', d, True) or ""): -- cgit v1.2.3 From 6be354c4bcc84447493cd7e68ebadb2a5a89dc60 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 12 Nov 2009 10:37:57 +0000 Subject: native.bbclass: Change warning to debug, not a note for now Signed-off-by: Richard Purdie --- classes/native.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'classes') diff --git a/classes/native.bbclass b/classes/native.bbclass index 89f6501218..96f9cf1a96 100644 --- a/classes/native.bbclass +++ b/classes/native.bbclass @@ -90,7 +90,7 @@ python __anonymous () { # For now, force legacy mode for native packages using autotools_stage_all if (stagefunc.strip() == "autotools_stage_all"): - bb.note("Forcing legacy staging mode for %s" % bb.data.getVar('FILE', d, 1)) + bb.debug(1, "Forcing legacy staging mode for %s" % bb.data.getVar('FILE', d, 1)) bb.data.setVar('FORCE_LEGACY_STAGING', "1", d) elif (stagefunc.strip() != "do_stage_native" and stagefunc.strip() != "autotools_stage_all") and bb.data.getVar('AUTOTOOLS_NATIVE_STAGE_INSTALL', d, 1) == "1": bb.data.setVar("do_install", " :", d) -- cgit v1.2.3 From ca68e0eeba638451480ba936f5c72c4ec17e73cf Mon Sep 17 00:00:00 2001 From: Phil Blundell Date: Fri, 13 Nov 2009 17:22:22 +0000 Subject: base.bbclass: add support for checksums in .bb files --- classes/base.bbclass | 56 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 6 deletions(-) (limited to 'classes') diff --git a/classes/base.bbclass b/classes/base.bbclass index 9d063f2151..ef0bf8567c 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -56,6 +56,50 @@ def base_chk_load_parser(config_paths): return parser +def base_chk_file_vars(parser, localpath, params, data): + try: + name = params["name"] + except KeyError: + return False + flagName = "%s.md5sum" % name + want_md5sum = bb.data.getVarFlag("SRC_URI", flagName, data) + flagName = "%s.sha256sum" % name + want_sha256sum = bb.data.getVarFlag("SRC_URI", flagName, data) + + if (want_sha256sum == None and want_md5sum == None): + # no checksums to check, nothing to do + return False + + if not os.path.exists(localpath): + localpath = base_path_out(localpath, data) + bb.note("The localpath does not exist '%s'" % localpath) + raise Exception("The path does not exist '%s'" % localpath) + + if want_md5sum: + try: + md5pipe = os.popen('PATH=%s md5sum %s' % (bb.data.getVar('PATH', data, True), localpath)) + md5data = (md5pipe.readline().split() or [ "" ])[0] + md5pipe.close() + except OSError, e: + raise Exception("Executing md5sum failed") + if want_md5sum != md5data: + bb.note("The MD5Sums did not match. Wanted: '%s' and Got: '%s'" % (want_md5sum, md5data)) + raise Exception("MD5 Sums do not match. Wanted: '%s' Got: '%s'" % (want_md5sum, md5data)) + + if want_sha256sum: + try: + shapipe = os.popen('PATH=%s oe_sha256sum %s' % (bb.data.getVar('PATH', data, True), localpath)) + shadata = (shapipe.readline().split() or [ "" ])[0] + shapipe.close() + except OSError, e: + raise Exception("Executing shasum failed") + if want_sha256sum != sha256data: + bb.note("The SHA256Sums did not match. Wanted: '%s' and Got: '%s'" % (want_sha256sum, sha256data)) + raise Exception("SHA256 Sums do not match. Wanted: '%s' Got: '%s'" % (want_sha256sum, sha256data)) + + return True + + def base_chk_file(parser, pn, pv, src_uri, localpath, data): no_checksum = False # Try PN-PV-SRC_URI first and then try PN-SRC_URI @@ -639,15 +683,15 @@ python base_do_fetch() { # Check each URI for url in src_uri.split(): localpath = bb.data.expand(bb.fetch.localpath(url, localdata), localdata) - (type,host,path,_,_,_) = bb.decodeurl(url) + (type,host,path,_,_,params) = bb.decodeurl(url) uri = "%s://%s%s" % (type,host,path) try: - if type == "http" or type == "https" or type == "ftp" or type == "ftps": - if not base_chk_file(parser, pn, pv,uri, localpath, d): - if not bb.data.getVar("OE_ALLOW_INSECURE_DOWNLOADS",d, True): - bb.fatal("%s-%s: %s has no entry in conf/checksums.ini, not checking URI" % (pn,pv,uri)) + if type in [ "http", "https", "ftp", "ftps" ]: + if not (base_chk_file_vars(parser, localpath, params, d) or base_chk_file(parser, pn, pv,uri, localpath, d)): + if not bb.data.getVar("OE_ALLOW_INSECURE_DOWNLOADS", d, True): + bb.fatal("%s-%s: %s has no checksum defined, cannot check archive integrity" % (pn,pv,uri)) else: - bb.note("%s-%s: %s has no entry in conf/checksums.ini, not checking URI" % (pn,pv,uri)) + bb.note("%s-%s: %s has no checksum defined, archive integrity not checked" % (pn,pv,uri)) except Exception: raise bb.build.FuncFailed("Checksum of '%s' failed" % uri) } -- cgit v1.2.3 From 1f986867b61e756b0cd0a620f431e0d09b2bad62 Mon Sep 17 00:00:00 2001 From: Phil Blundell Date: Fri, 13 Nov 2009 17:32:32 +0000 Subject: fix c&p error in last patch --- classes/base.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'classes') diff --git a/classes/base.bbclass b/classes/base.bbclass index ef0bf8567c..3602801f50 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -89,7 +89,7 @@ def base_chk_file_vars(parser, localpath, params, data): if want_sha256sum: try: shapipe = os.popen('PATH=%s oe_sha256sum %s' % (bb.data.getVar('PATH', data, True), localpath)) - shadata = (shapipe.readline().split() or [ "" ])[0] + sha256data = (shapipe.readline().split() or [ "" ])[0] shapipe.close() except OSError, e: raise Exception("Executing shasum failed") -- cgit v1.2.3 From 2c09164fd4c11832865f18b72f46266b7abffbc7 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sat, 14 Nov 2009 00:57:51 +0000 Subject: kernel.bbclass: Fix populate_packaged 'D' references Signed-off-by: Richard Purdie --- classes/kernel.bbclass | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'classes') diff --git a/classes/kernel.bbclass b/classes/kernel.bbclass index 9c1f637a66..0dde2d33ca 100644 --- a/classes/kernel.bbclass +++ b/classes/kernel.bbclass @@ -333,7 +333,7 @@ python populate_packages_prepend () { def parse_depmod(): import os, re - dvar = bb.data.getVar('D', d, 1) + dvar = bb.data.getVar('PKGD', d, 1) if not dvar: bb.error("D not defined") return @@ -382,7 +382,7 @@ python populate_packages_prepend () { return deps def get_dependencies(file, pattern, format): - file = file.replace(bb.data.getVar('D', d, 1) or '', '', 1) + file = file.replace(bb.data.getVar('PKGD', d, 1) or '', '', 1) if module_deps.has_key(file): import os.path, re @@ -401,7 +401,7 @@ python populate_packages_prepend () { import re vals = extract_modinfo(file) - dvar = bb.data.getVar('D', d, 1) + dvar = bb.data.getVar('PKGD', d, 1) # If autoloading is requested, output /etc/modutils/ and append # appropriate modprobe commands to the postinst -- cgit v1.2.3