Skip to contentSkip to conversation

Collected cached siteconfig in the runtime

PATCH New Lianhao Lu 1 participant 3 messages Aug 16, 2011

lore
Share & tools
lore

Lianhao Lu

author
#0 lore raw

v3 cover Collected cached siteconfig in the runtime

These 2 patches are trying to fix the bug #892. It collected the cached site config files name in the runtime for meta-toolchain and meta-environment, and also added task dependencies to ensure the caches are generated.

The variable TOOLCHAIN_NEED_CONFIGSITE_CACHE specifies what site config files are needed from the cache used for the toolchain.

The following changes since commit 13db5f420ca9bff98561f80d78958278734ad1f4:
Zhai Edwin (1):
distro-tracking: Update info for gpgme, libassuan, apr... after last upgrade.

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib llu/bug892
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=llu/bug892

Lianhao Lu (2):
toolchain-script.bbclass: Collected cached site config in runtime. meta-toolchain/environment: Collected site config files in runtime.

 meta/classes/populate_sdk.bbclass             |    2 +-
 meta/classes/siteinfo.bbclass                 |    4 +++-
 meta/classes/toolchain-scripts.bbclass        |   24 +++++++++++++++++++++---
 meta/recipes-core/meta/meta-environment.bb    |    7 +++----
 meta/recipes-core/meta/meta-toolchain-gmae.bb |    2 ++
 meta/recipes-core/meta/meta-toolchain.bb      |    4 +---
 6 files changed, 31 insertions(+), 12 deletions(-)
author
#1 lore raw

PATCH v3 1/2 toolchain-script.bbclass: Collected cached site config in runtime.

[YOCTO #892]
Modify the function toolchain_create_sdk_siteconfig to collect the cached site config files which are specified by TOOLCHAIN_NEED_CONFIGSITE_CACHE in runtime.

Also added task dependency to ensure the cached site config files are generated.

---
 meta/classes/siteinfo.bbclass          |    4 +++-
 meta/classes/toolchain-scripts.bbclass |   24 +++++++++++++++++++++---
 2 files changed, 24 insertions(+), 4 deletions(-)
meta/classes/siteinfo.bbclass +3 -1
index a61b5e5..02294c4 100644
@@ -118,7 +118,7 @@ python () {
         bb.fatal("Please add your architecture to siteinfo.bbclass")
 }
 
-def siteinfo_get_files(d):
+def siteinfo_get_files(d, no_cache = False):
     sitedata = siteinfo_data(d)
     sitefiles = ""
     for path in d.getVar("BBPATH", True).split(":"):
@@ -127,6 +127,8 @@ def siteinfo_get_files(d):
             if os.path.exists(filename):
                 sitefiles += filename + " "
 
+    if no_cache: return sitefiles
+
     # Now check for siteconfig cache files
     path_siteconfig = bb.data.getVar('SITECONFIG_SYSROOTCACHE', d, 1)
     if os.path.isdir(path_siteconfig):
meta/classes/toolchain-scripts.bbclass +21 -3
index f7b52be..6fc67f8 100644
@@ -101,17 +101,28 @@ toolchain_create_sdk_env_script_for_installer () {
 	echo 'export POKY_SDK_VERSION="${SDK_VERSION}"' >> $script
 }
 
+#we get the cached site config in the runtime
+TOOLCHAIN_CONFIGSITE_NOCACHE := "${@siteinfo_get_files(d, True)}"
+TOOLCHAIN_CONFIGSITE_SYSROOTCACHE := "${STAGING_DATADIR}/${TARGET_SYS}_config_site.d"
+TOOLCHAIN_NEED_CONFIGSITE_CACHE = "eglibc ncurses"
+
 #This function create a site config file
 toolchain_create_sdk_siteconfig () {
 	local siteconfig=$1
-	shift
-	local files=$@
 
 	rm -f $siteconfig
 	touch $siteconfig
-	for sitefile in ${files} ; do
+
+	for sitefile in ${TOOLCHAIN_CONFIGSITE_NOCACHE} ; do
 		cat $sitefile >> $siteconfig
 	done
+
+	#get cached site config
+	for sitefile in ${TOOLCHAIN_NEED_CONFIGSITE_CACHE}; do
+		if [ -r ${TOOLCHAIN_CONFIGSITE_SYSROOTCACHE}/${sitefile}_config ]; then
+			cat ${TOOLCHAIN_CONFIGSITE_SYSROOTCACHE}/${sitefile}_config >> $siteconfig
+		fi
+	done
 }
 
 #This function create a version information file
@@ -124,3 +135,10 @@ toolchain_create_sdk_version () {
 	echo 'Metadata Revision: ${METADATA_REVISION}' >> $versionfile
 	echo 'Timestamp: ${DATETIME}' >> $versionfile
 }
+
+python __anonymous () {
+    deps = bb.data.getVarFlag('do_configure', 'depends', d) or ""
+    for dep in (bb.data.getVar('TOOLCHAIN_NEED_CONFIGSITE_CACHE', d, True) or "").split():
+        deps += " %s:do_populate_sysroot" % dep
+    bb.data.setVarFlag('do_configure', 'depends', deps, d)
+}
Signature · 1 line
1.7.0.4
author
#2 lore raw

PATCH v3 2/2 meta-toolchain/environment: Collected site config files in runtime.

[YOCTO #892]
Use the new cached site config files generation mechanism in toolchain-script.bbclass.

---
 meta/classes/populate_sdk.bbclass             |    2 +-
 meta/recipes-core/meta/meta-environment.bb    |    7 +++----
 meta/recipes-core/meta/meta-toolchain-gmae.bb |    2 ++
 meta/recipes-core/meta/meta-toolchain.bb      |    4 +---
 4 files changed, 7 insertions(+), 8 deletions(-)
meta/classes/populate_sdk.bbclass +1 -1
index 0f3591b..69780e5 100644
@@ -47,7 +47,7 @@ fakeroot do_populate_sdk() {
 	ln -s /etc/ld.so.cache ${SDK_OUTPUT}/${SDKPATHNATIVE}/etc/ld.so.cache
 
 	# Setup site file for external use
-	toolchain_create_sdk_siteconfig ${SDK_OUTPUT}/${SDKPATH}/site-config-${MULTIMACH_TARGET_SYS} ${CONFIG_SITE}
+	toolchain_create_sdk_siteconfig ${SDK_OUTPUT}/${SDKPATH}/site-config-${MULTIMACH_TARGET_SYS}
 
 	toolchain_create_sdk_env_script
 
meta/recipes-core/meta/meta-environment.bb +3 -4
index 114727c..39ba96c 100644
@@ -2,13 +2,12 @@ DESCRIPTION = "Package of environment files for SDK"
 LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \
                     file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 LICENSE = "MIT"
-PR = "r6"
+PR = "r7"
 
 EXCLUDE_FROM_WORLD = "1"
 
 inherit toolchain-scripts
-# get target config site before inheritting cross-canadian
-TARGET_CONFIG_SITE := "${@siteinfo_get_files(d)}"
+TOOLCHAIN_NEED_CONFIGSITE_CACHE += "zlib"
 REAL_MULTIMACH_TARGET_SYS = "${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}"
 
 SDK_DIR = "${WORKDIR}/sdk"
@@ -23,7 +22,7 @@ do_generate_content() {
     rm -rf ${SDK_OUTPUT}
     mkdir -p ${SDK_OUTPUT}/${SDKPATH}
 
-    toolchain_create_sdk_siteconfig ${SDK_OUTPUT}/${SDKPATH}/site-config-${REAL_MULTIMACH_TARGET_SYS} ${TARGET_CONFIG_SITE}
+    toolchain_create_sdk_siteconfig ${SDK_OUTPUT}/${SDKPATH}/site-config-${REAL_MULTIMACH_TARGET_SYS}
 
     toolchain_create_sdk_env_script_for_installer ${REAL_MULTIMACH_TARGET_SYS}
 
meta/recipes-core/meta/meta-toolchain-gmae.bb +2 -0
index 4f5501e..512810b 100644
@@ -3,3 +3,5 @@ TOOLCHAIN_TARGET_TASK = "${TOOLCHAIN_TARGET_GMAETASK}"
 TOOLCHAIN_OUTPUTNAME = "${SDK_NAME}-toolchain-gmae-${DISTRO_VERSION}"
 PROVIDES = "meta-toolchain-sdk"
 require meta-toolchain.bb
+
+TOOLCHAIN_NEED_CONFIGSITE_CACHE += "zlib"
meta/recipes-core/meta/meta-toolchain.bb +1 -3
index 164d717..1058c68 100644
@@ -1,12 +1,10 @@
 DESCRIPTION = "Meta package for building a installable toolchain"
 LICENSE = "MIT"
 
-PR = "r5"
+PR = "r6"
 
 LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \
                     file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 
 IMAGETEST ?= "dummy"
 inherit populate_sdk imagetest-${IMAGETEST}
-
-CONFIG_SITE := "${@siteinfo_get_files(d)}"
Signature · 1 line
1.7.0.4