[oe-commits] Tom Rini : qemu: Move gcc version check, qemu-TARGET logic into qemu. bbclass

git version control git at git.openembedded.org
Wed Mar 3 21:07:07 UTC 2010


Module: openembedded.git
Branch: org.openembedded.dev
Commit: 27de16184dccb7b3a49bd08c9282fe4843d00251
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=27de16184dccb7b3a49bd08c9282fe4843d00251

Author: Tom Rini <tom_rini at mentor.com>
Date:   Wed Mar  3 14:04:57 2010 -0700

qemu: Move gcc version check, qemu-TARGET logic into qemu.bbclass

Move the logic to determine what qemu-TARGET to run into qemu.bbclass so
we can check for the right binary in sanity.bbclass.  This code was
duplicated by glibc-package and eglibc-package anyhow and with the new fn
we can clean up the usage in these classes a bit.  Now that we have a class
for qemu stuff, and the gcc check is just for qemu, move it there.

---

 classes/base.bbclass                  |   12 ------------
 classes/glibc-package.bbclass         |   15 +++++----------
 classes/qemu.bbclass                  |   27 +++++++++++++++++++++++++++
 classes/sanity.bbclass                |    4 +++-
 recipes/eglibc/eglibc-package.bbclass |   14 +++++---------
 recipes/qemu/qemu-gcc3-check.inc      |    2 ++
 6 files changed, 42 insertions(+), 32 deletions(-)

diff --git a/classes/base.bbclass b/classes/base.bbclass
index 65ad478..c083d48 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -1340,18 +1340,6 @@ def check_app_exists(app, d):
 	path = data.getVar('PATH', d, 1)
 	return len(which(path, app)) != 0
 
-def check_gcc3(data):
-	# Primarly used by qemu to make sure we have a workable gcc-3.x.
-	# Start by checking for the program name as we build it as there
-	# are some distribtuion provided gcc-3.x's that will not work.
-	gcc3_versions = 'gcc-3.4.6 gcc-3.4.4 gcc34 gcc-3.4 gcc-3.4.7 gcc-3.3 gcc33 gcc-3.3.6 gcc-3.2 gcc32'
-
-	for gcc3 in gcc3_versions.split():
-		if check_app_exists(gcc3, data):
-			return gcc3
-
-	return False
-
 # Patch handling
 inherit patch
 
diff --git a/classes/glibc-package.bbclass b/classes/glibc-package.bbclass
index af75bb5..d47c914 100644
--- a/classes/glibc-package.bbclass
+++ b/classes/glibc-package.bbclass
@@ -7,6 +7,8 @@
 #  "precompiled" - The binary locale files are pregenerated and already present
 #  "ondevice" - The device will build the locale files upon first boot through the postinst
 
+inherit qemu
+
 GLIBC_INTERNAL_USE_BINARY_LOCALE ?= "ondevice"
 
 PACKAGES = "glibc-dbg glibc catchsegv sln nscd ldd localedef glibc-utils glibc-pic glibc-dev glibc-static glibc-doc glibc-locale libcidn libmemusage libsegfault glibc-extra-nss glibc-thread-db glibc-pcprofile"
@@ -215,12 +217,6 @@ python package_do_split_gconvs () {
 		bb.data.setVar('RDEPENDS_%s' % pkgname, legitimize_package_name('glibc-binary-localedata-%s' % glibc_name), d)
 
 	def output_locale_binary(name, pkgname, locale, encoding):
-		target_arch = bb.data.getVar("TARGET_ARCH", d, 1)
-		if target_arch in ("i486", "i586", "i686"):
-			target_arch = "i386"
-		elif target_arch == "powerpc":
-			target_arch = "ppc"
-
 		# This is a hack till linux-libc-headers gets patched for the missing arm syscalls and all arm device kernels as well
 		if bb.data.getVar("DISTRO_NAME", d, 1) == "Angstrom":
 			kernel_ver = "2.6.24"
@@ -229,10 +225,9 @@ python package_do_split_gconvs () {
 		else:
 			kernel_ver = bb.data.getVar("OLDEST_KERNEL", d, 1)
 
-		if kernel_ver is None:
-			qemu = "qemu-%s  -s 1048576" % target_arch
-		else:
-			qemu = "qemu-%s  -s 1048576 -r %s" % (target_arch, kernel_ver)
+		qemu = qemu_target_binary(d) + " -s 1048576"
+		if kernel_ver:
+			qemu += " -r %s" % (kernel_ver)
 		pkgname = 'locale-base-' + legitimize_package_name(name)
 
 		treedir = base_path_join(bb.data.getVar("WORKDIR", d, 1), "locale-tree")
diff --git a/classes/qemu.bbclass b/classes/qemu.bbclass
new file mode 100644
index 0000000..40a3542
--- /dev/null
+++ b/classes/qemu.bbclass
@@ -0,0 +1,27 @@
+#
+# This class contains functions for recipes that need QEMU or test for its
+# existance.
+#
+
+def check_gcc3(data):
+	# Used by qemu to make sure we have a workable gcc-3.x.
+	# Start by checking for the program name as we build it as there
+	# are some distribtuion provided gcc-3.x's that will not work.
+	gcc3_versions = 'gcc-3.4.6 gcc-3.4.4 gcc34 gcc-3.4 gcc-3.4.7 gcc-3.3 gcc33 gcc-3.3.6 gcc-3.2 gcc32'
+
+	for gcc3 in gcc3_versions.split():
+		if check_app_exists(gcc3, data):
+			return gcc3
+
+	return False
+
+def qemu_target_binary(data):
+	import bb
+
+	target_arch = bb.data.getVar("TARGET_ARCH", data, 1)
+	if target_arch in ("i486", "i586", "i686"):
+		target_arch = "i386"
+	elif target_arch == "powerpc":
+		target_arch = "ppc"
+
+	return "qemu-" + target_arch
diff --git a/classes/sanity.bbclass b/classes/sanity.bbclass
index a78e8ed..5f0e724 100644
--- a/classes/sanity.bbclass
+++ b/classes/sanity.bbclass
@@ -2,6 +2,8 @@
 # Sanity check the users setup for common misconfigurations
 #
 
+inherit qemu
+
 def raise_sanity_error(msg):
 	import bb
 	bb.fatal(""" Openembedded's config sanity checker detected a potential misconfiguration.
@@ -95,7 +97,7 @@ def check_sanity(e):
 				missing = missing + "gcc-3.x (needed for qemu-native),"
 
 		if "qemu-native" in assume_provided:
-			required_utilities += "qemu"
+			required_utilities += " %s" % (qemu_target_binary(e.data))
 
 		try:
 			if os.path.exists("/proc/sys/vm/mmap_min_addr"):
diff --git a/recipes/eglibc/eglibc-package.bbclass b/recipes/eglibc/eglibc-package.bbclass
index 6480d16..3dc97b4 100644
--- a/recipes/eglibc/eglibc-package.bbclass
+++ b/recipes/eglibc/eglibc-package.bbclass
@@ -6,6 +6,8 @@
 # See the note in gcc/gcc_3.4.0.oe
 #
 
+inherit qemu
+
 python __anonymous () {
     import bb, re
     uc_os = (re.match('.*uclibc*', bb.data.getVar('TARGET_OS', d, 1)) != None)
@@ -296,16 +298,10 @@ python package_do_split_gconvs () {
 		bb.data.setVar('pkg_postrm_%s' % pkgname, bb.data.getVar('locale_base_postrm', d, 1) % (locale, encoding, locale), d)
 
 	def output_locale_binary(name, locale, encoding):
-		target_arch = bb.data.getVar("TARGET_ARCH", d, 1)
-		if target_arch in ("i486", "i586", "i686"):
-			target_arch = "i386"
-		elif target_arch == "powerpc":
-			target_arch = "ppc"
+		qemu = qemu_target_binary(d) + " -s 1048576"
 		kernel_ver = bb.data.getVar("OLDEST_KERNEL", d, 1)
-		if kernel_ver is None:
-			qemu = "qemu-%s  -s 1048576" % target_arch
-		else:
-			qemu = "qemu-%s  -s 1048576 -r %s" % (target_arch, kernel_ver)
+		if kernel_ver:
+			qemu += " -r %s" % (kernel_ver)
 		pkgname = 'locale-base-' + legitimize_package_name(name)
 		m = re.match("(.*)\.(.*)", name)
 		if m:
diff --git a/recipes/qemu/qemu-gcc3-check.inc b/recipes/qemu/qemu-gcc3-check.inc
index 81c3555..c55444a 100644
--- a/recipes/qemu/qemu-gcc3-check.inc
+++ b/recipes/qemu/qemu-gcc3-check.inc
@@ -1,3 +1,5 @@
+inherit qemu
+
 python __anonymous() {
     from bb import which, data
 





More information about the Openembedded-commits mailing list