Patchwork [16/22] populate_sdk: Fix the introduction of sdknative packages

login
register
mail settings
Submitter Saul Wold
Date Aug. 1, 2011, 7:36 a.m.
Message ID <180637fbdcbc29750f30bc493ce2891dd8318de6.1312182844.git.sgw@linux.intel.com>
Download mbox | patch
Permalink /patch/8901/
State New, archived
Headers show

Comments

Saul Wold - Aug. 1, 2011, 7:36 a.m.
From: Mark Hatle <mark.hatle@windriver.com>

The sdknative packages were not being introduced into the list of available
packages properly.  Fix this by always introducing it and avoiding a sed of
one type to another.

Also fix a number of minor issues with the RPM behavior when building sdk
images.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
---
 meta/classes/package_rpm.bbclass      |   19 +++++++++----------
 meta/classes/populate_sdk_deb.bbclass |   11 ++---------
 meta/classes/populate_sdk_rpm.bbclass |   11 ++---------
 3 files changed, 13 insertions(+), 28 deletions(-)
Richard Purdie - Aug. 1, 2011, 1:06 p.m.
On Mon, 2011-08-01 at 00:36 -0700, Saul Wold wrote:
> From: Mark Hatle <mark.hatle@windriver.com>
> 
> The sdknative packages were not being introduced into the list of available
> packages properly.  Fix this by always introducing it and avoiding a sed of
> one type to another.
> 
> Also fix a number of minor issues with the RPM behavior when building sdk
> images.

I'm afraid this change looks wrong to me. Firstly, all arch packages are
"all", not "all-nativesdk". You're also cutting down the arch list to a
single sdk entry rather than the intended package_archs list.

"all" == "all-nativesdk" as things stand might be wrong for various
other reasons I can think of but it is what would currently be
generated.

All things considered, this issue needs more work.

Cheers,

Richard



> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
> ---
>  meta/classes/package_rpm.bbclass      |   19 +++++++++----------
>  meta/classes/populate_sdk_deb.bbclass |   11 ++---------
>  meta/classes/populate_sdk_rpm.bbclass |   11 ++---------
>  3 files changed, 13 insertions(+), 28 deletions(-)
> 
> diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
> index 0377100..856dfb0 100644
> --- a/meta/classes/package_rpm.bbclass
> +++ b/meta/classes/package_rpm.bbclass
> @@ -32,14 +32,12 @@ package_update_index_rpm () {
>  		eval archs=\${${archvar}}
>  		packagedirs=""
>  		packagedirs_sdk=""
> -		for arch in $archs; do
> -			sdkarch=`echo $arch | sed -e 's/${HOST_ARCH}/${SDK_ARCH}/'`
> -			extension="-nativesdk"
> -			if [ "$sdkarch" = "all" -o "$sdkarch" = "any" -o "$sdkarch" = "noarch" ]; then
> -			    extension=""
> -			fi
> +		if [ "${SDK_ARCH}-nativesdk" != "-nativesdk" ]; then
> +			packagedirs_sdk="${DEPLOY_DIR_RPM}/${SDK_ARCH}-nativesdk"
> +		fi
> +		for arch in $archs ; do
>  			packagedirs="${DEPLOY_DIR_RPM}/$arch $packagedirs"
> -			packagedirs_sdk="${DEPLOY_DIR_RPM}/$sdkarch$extension $packagedirs_sdk"
> +			packagedirs_sdk="${DEPLOY_DIR_RPM}/$arch $packagedirs_sdk"
>  
>  			rm -rf ${DEPLOY_DIR_RPM}/$arch/solvedb
>  			rm -rf ${DEPLOY_DIR_RPM}/$sdkarch$extension/solvedb
> @@ -95,6 +93,7 @@ package_update_index_rpm () {
>  #
>  package_generate_rpm_conf () {
>  	printf "_solve_dbpath " > ${RPMCONF_TARGET_BASE}.macro
> +	printf "_solve_dbpath " > ${RPMCONF_HOST_BASE}.macro
>  	o_colon_t=false
>  	o_colon_h=false
>  
> @@ -238,7 +237,7 @@ package_install_internal_rpm () {
>  					echo "Unable to find package $pkg ($ml_pkg)!"
>  					exit 1
>  				fi
> -				echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest
> +				echo $pkg_name >> ${target_rootfs}/install/install.manifest
>  			done
>  		fi
>  	fi
> @@ -258,7 +257,7 @@ package_install_internal_rpm () {
>  				echo "Unable to find package $pkg ($ml_pkg)!"
>  				exit 1
>  			fi
> -			echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest
> +			echo $pkg_name >> ${target_rootfs}/install/install.manifest
>  		done
>  	fi
>  
> @@ -303,7 +302,7 @@ package_install_internal_rpm () {
>  		# Dump the full set of recommends...
>  		${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
>  			--predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
> -			-D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${confbase}.macro`" \
> +			-D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}.macro`" \
>  			-D "__dbi_txn create nofsync private" \
>  			-qa --qf "[%{RECOMMENDS}\n]" | sort -u > ${target_rootfs}/install/recommend
>  		# Did we add more to the list?
> diff --git a/meta/classes/populate_sdk_deb.bbclass b/meta/classes/populate_sdk_deb.bbclass
> index a5b6384..9acc52d 100644
> --- a/meta/classes/populate_sdk_deb.bbclass
> +++ b/meta/classes/populate_sdk_deb.bbclass
> @@ -34,16 +34,9 @@ fakeroot populate_sdk_deb () {
>  	export INSTALL_ROOTFS_DEB="${SDK_OUTPUT}"
>  	export INSTALL_BASEARCH_DEB="${SDK_ARCH}"
>  	export INSTALL_PACKAGES_NORMAL_DEB="${TOOLCHAIN_HOST_TASK}"
> -	INSTALL_ARCHS_DEB=""
> +	INSTALL_ARCHS_DEB="${SDK_ARCH}-nativesdk"
>  	for arch in ${PACKAGE_ARCHS}; do
> -		sdkarch=`echo $arch | sed -e 's/${HOST_ARCH}/${SDK_ARCH}/'`
> -		extension="-nativesdk"
> -		if [ "$sdkarch" = "all" -o "$sdkarch" = "any" -o "$sdkarch" = "noarch" ]; then
> -		    extension=""
> -		fi
> -		if [ -e ${DEPLOY_DIR_DEB}/$sdkarch$extension ]; then
> -			INSTALL_ARCHS_DEB="$INSTALL_ARCHS_DEB $sdkarch$extension"
> -		fi
> +		INSTALL_ARCHS_DEB="$INSTALL_ARCHS_DEB $arch"
>  	done
>  	export INSTALL_ARCHS_DEB
>  
> diff --git a/meta/classes/populate_sdk_rpm.bbclass b/meta/classes/populate_sdk_rpm.bbclass
> index da308c1..8196542 100644
> --- a/meta/classes/populate_sdk_rpm.bbclass
> +++ b/meta/classes/populate_sdk_rpm.bbclass
> @@ -53,16 +53,9 @@ fakeroot populate_sdk_rpm () {
>  	export INSTALL_PLATFORM_RPM="${SDK_ARCH}"
>  	export INSTALL_CONFBASE_RPM="${RPMCONF_HOST_BASE}"
>  	export INSTALL_PACKAGES_NORMAL_RPM="${TOOLCHAIN_HOST_TASK}"
> -	export INSTALL_PLATFORM_EXTRA_RPM=""
> +	export INSTALL_PLATFORM_EXTRA_RPM="${SDK_ARCH}-nativesdk"
>  	for arch in ${PACKAGE_ARCHS}; do
> -		sdkarch=`echo $arch | sed -e 's/${HOST_ARCH}/${SDK_ARCH}/'`
> -		extension="-nativesdk"
> -		if [ "$sdkarch" = "all" -o "$sdkarch" = "any" -o "$sdkarch" = "noarch" ]; then
> -		    extension=""
> -		fi
> -		if [ -e ${DEPLOY_DIR_RPM}/$sdkarch$extension ]; then
> -			INSTALL_PLATFORM_EXTRA_RPM="$sdkarch $INSTALL_PLATFORM_EXTRA_RPM"
> -		fi
> +		INSTALL_PLATFORM_EXTRA_RPM="$arch $INSTALL_PLATFORM_EXTRA_RPM"
>  	done
>  	export INSTALL_PLATFORM_EXTRA_RPM
>
Mark Hatle - Aug. 1, 2011, 2:47 p.m.
On 8/1/11 8:06 AM, Richard Purdie wrote:
> On Mon, 2011-08-01 at 00:36 -0700, Saul Wold wrote:
>> From: Mark Hatle <mark.hatle@windriver.com>
>>
>> The sdknative packages were not being introduced into the list of available
>> packages properly.  Fix this by always introducing it and avoiding a sed of
>> one type to another.
>>
>> Also fix a number of minor issues with the RPM behavior when building sdk
>> images.
> 
> I'm afraid this change looks wrong to me. Firstly, all arch packages are
> "all", not "all-nativesdk". You're also cutting down the arch list to a
> single sdk entry rather than the intended package_archs list.
> 
> "all" == "all-nativesdk" as things stand might be wrong for various
> other reasons I can think of but it is what would currently be
> generated.

No, that's not what is happening at all.  The original sed was completely broken
and wouldn't always work.

The arch list being processed is the target arch list.. typically it's something
like:

all any noarch powerpc ppc603e qemuppc

Before the system was trying to do a search/replace on "HOST_ARCH" and replace
it with SDK_ARCH..  this is kind of insane.. because there is no guaranty that
HOST_ARCH will even be in the arch list.  So instead the patch simply adds
SDK_ARCH-nativesdk, and then processes the list as normal.. the result is:

x86_64-nativesdk all any noarch powerpc ppc603e qemuppc

before it would have been (assuming the sed even worked)

all any noarch x86_64-nativesdk ppc603e qemuppc

so any packages with arch of "powerpc" would have been missed and the install
failed..  (or if powerpc didn't exist, it would end up without x86_64-nativesdk
even in the list.. which is how I found the problem.)

> All things considered, this issue needs more work.
> 
> Cheers,
> 
> Richard
> 
> 
> 
>> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
>> ---
>>  meta/classes/package_rpm.bbclass      |   19 +++++++++----------
>>  meta/classes/populate_sdk_deb.bbclass |   11 ++---------
>>  meta/classes/populate_sdk_rpm.bbclass |   11 ++---------
>>  3 files changed, 13 insertions(+), 28 deletions(-)
>>
>> diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
>> index 0377100..856dfb0 100644
>> --- a/meta/classes/package_rpm.bbclass
>> +++ b/meta/classes/package_rpm.bbclass
>> @@ -32,14 +32,12 @@ package_update_index_rpm () {
>>  		eval archs=\${${archvar}}
>>  		packagedirs=""
>>  		packagedirs_sdk=""
>> -		for arch in $archs; do
>> -			sdkarch=`echo $arch | sed -e 's/${HOST_ARCH}/${SDK_ARCH}/'`
>> -			extension="-nativesdk"
>> -			if [ "$sdkarch" = "all" -o "$sdkarch" = "any" -o "$sdkarch" = "noarch" ]; then
>> -			    extension=""
>> -			fi
>> +		if [ "${SDK_ARCH}-nativesdk" != "-nativesdk" ]; then
>> +			packagedirs_sdk="${DEPLOY_DIR_RPM}/${SDK_ARCH}-nativesdk"
>> +		fi
>> +		for arch in $archs ; do
>>  			packagedirs="${DEPLOY_DIR_RPM}/$arch $packagedirs"
>> -			packagedirs_sdk="${DEPLOY_DIR_RPM}/$sdkarch$extension $packagedirs_sdk"
>> +			packagedirs_sdk="${DEPLOY_DIR_RPM}/$arch $packagedirs_sdk"
>>  
>>  			rm -rf ${DEPLOY_DIR_RPM}/$arch/solvedb
>>  			rm -rf ${DEPLOY_DIR_RPM}/$sdkarch$extension/solvedb
>> @@ -95,6 +93,7 @@ package_update_index_rpm () {
>>  #
>>  package_generate_rpm_conf () {
>>  	printf "_solve_dbpath " > ${RPMCONF_TARGET_BASE}.macro
>> +	printf "_solve_dbpath " > ${RPMCONF_HOST_BASE}.macro
>>  	o_colon_t=false
>>  	o_colon_h=false
>>  
>> @@ -238,7 +237,7 @@ package_install_internal_rpm () {
>>  					echo "Unable to find package $pkg ($ml_pkg)!"
>>  					exit 1
>>  				fi
>> -				echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest
>> +				echo $pkg_name >> ${target_rootfs}/install/install.manifest
>>  			done
>>  		fi
>>  	fi
>> @@ -258,7 +257,7 @@ package_install_internal_rpm () {
>>  				echo "Unable to find package $pkg ($ml_pkg)!"
>>  				exit 1
>>  			fi
>> -			echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest
>> +			echo $pkg_name >> ${target_rootfs}/install/install.manifest
>>  		done
>>  	fi
>>  
>> @@ -303,7 +302,7 @@ package_install_internal_rpm () {
>>  		# Dump the full set of recommends...
>>  		${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
>>  			--predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
>> -			-D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${confbase}.macro`" \
>> +			-D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}.macro`" \
>>  			-D "__dbi_txn create nofsync private" \
>>  			-qa --qf "[%{RECOMMENDS}\n]" | sort -u > ${target_rootfs}/install/recommend
>>  		# Did we add more to the list?
>> diff --git a/meta/classes/populate_sdk_deb.bbclass b/meta/classes/populate_sdk_deb.bbclass
>> index a5b6384..9acc52d 100644
>> --- a/meta/classes/populate_sdk_deb.bbclass
>> +++ b/meta/classes/populate_sdk_deb.bbclass
>> @@ -34,16 +34,9 @@ fakeroot populate_sdk_deb () {
>>  	export INSTALL_ROOTFS_DEB="${SDK_OUTPUT}"
>>  	export INSTALL_BASEARCH_DEB="${SDK_ARCH}"
>>  	export INSTALL_PACKAGES_NORMAL_DEB="${TOOLCHAIN_HOST_TASK}"
>> -	INSTALL_ARCHS_DEB=""
>> +	INSTALL_ARCHS_DEB="${SDK_ARCH}-nativesdk"
>>  	for arch in ${PACKAGE_ARCHS}; do
>> -		sdkarch=`echo $arch | sed -e 's/${HOST_ARCH}/${SDK_ARCH}/'`
>> -		extension="-nativesdk"
>> -		if [ "$sdkarch" = "all" -o "$sdkarch" = "any" -o "$sdkarch" = "noarch" ]; then
>> -		    extension=""
>> -		fi
>> -		if [ -e ${DEPLOY_DIR_DEB}/$sdkarch$extension ]; then
>> -			INSTALL_ARCHS_DEB="$INSTALL_ARCHS_DEB $sdkarch$extension"
>> -		fi
>> +		INSTALL_ARCHS_DEB="$INSTALL_ARCHS_DEB $arch"
>>  	done
>>  	export INSTALL_ARCHS_DEB
>>  
>> diff --git a/meta/classes/populate_sdk_rpm.bbclass b/meta/classes/populate_sdk_rpm.bbclass
>> index da308c1..8196542 100644
>> --- a/meta/classes/populate_sdk_rpm.bbclass
>> +++ b/meta/classes/populate_sdk_rpm.bbclass
>> @@ -53,16 +53,9 @@ fakeroot populate_sdk_rpm () {
>>  	export INSTALL_PLATFORM_RPM="${SDK_ARCH}"
>>  	export INSTALL_CONFBASE_RPM="${RPMCONF_HOST_BASE}"
>>  	export INSTALL_PACKAGES_NORMAL_RPM="${TOOLCHAIN_HOST_TASK}"
>> -	export INSTALL_PLATFORM_EXTRA_RPM=""
>> +	export INSTALL_PLATFORM_EXTRA_RPM="${SDK_ARCH}-nativesdk"
>>  	for arch in ${PACKAGE_ARCHS}; do
>> -		sdkarch=`echo $arch | sed -e 's/${HOST_ARCH}/${SDK_ARCH}/'`
>> -		extension="-nativesdk"
>> -		if [ "$sdkarch" = "all" -o "$sdkarch" = "any" -o "$sdkarch" = "noarch" ]; then
>> -		    extension=""
>> -		fi
>> -		if [ -e ${DEPLOY_DIR_RPM}/$sdkarch$extension ]; then
>> -			INSTALL_PLATFORM_EXTRA_RPM="$sdkarch $INSTALL_PLATFORM_EXTRA_RPM"
>> -		fi
>> +		INSTALL_PLATFORM_EXTRA_RPM="$arch $INSTALL_PLATFORM_EXTRA_RPM"
>>  	done
>>  	export INSTALL_PLATFORM_EXTRA_RPM
>>  
> 
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 0377100..856dfb0 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -32,14 +32,12 @@  package_update_index_rpm () {
 		eval archs=\${${archvar}}
 		packagedirs=""
 		packagedirs_sdk=""
-		for arch in $archs; do
-			sdkarch=`echo $arch | sed -e 's/${HOST_ARCH}/${SDK_ARCH}/'`
-			extension="-nativesdk"
-			if [ "$sdkarch" = "all" -o "$sdkarch" = "any" -o "$sdkarch" = "noarch" ]; then
-			    extension=""
-			fi
+		if [ "${SDK_ARCH}-nativesdk" != "-nativesdk" ]; then
+			packagedirs_sdk="${DEPLOY_DIR_RPM}/${SDK_ARCH}-nativesdk"
+		fi
+		for arch in $archs ; do
 			packagedirs="${DEPLOY_DIR_RPM}/$arch $packagedirs"
-			packagedirs_sdk="${DEPLOY_DIR_RPM}/$sdkarch$extension $packagedirs_sdk"
+			packagedirs_sdk="${DEPLOY_DIR_RPM}/$arch $packagedirs_sdk"
 
 			rm -rf ${DEPLOY_DIR_RPM}/$arch/solvedb
 			rm -rf ${DEPLOY_DIR_RPM}/$sdkarch$extension/solvedb
@@ -95,6 +93,7 @@  package_update_index_rpm () {
 #
 package_generate_rpm_conf () {
 	printf "_solve_dbpath " > ${RPMCONF_TARGET_BASE}.macro
+	printf "_solve_dbpath " > ${RPMCONF_HOST_BASE}.macro
 	o_colon_t=false
 	o_colon_h=false
 
@@ -238,7 +237,7 @@  package_install_internal_rpm () {
 					echo "Unable to find package $pkg ($ml_pkg)!"
 					exit 1
 				fi
-				echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest
+				echo $pkg_name >> ${target_rootfs}/install/install.manifest
 			done
 		fi
 	fi
@@ -258,7 +257,7 @@  package_install_internal_rpm () {
 				echo "Unable to find package $pkg ($ml_pkg)!"
 				exit 1
 			fi
-			echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest
+			echo $pkg_name >> ${target_rootfs}/install/install.manifest
 		done
 	fi
 
@@ -303,7 +302,7 @@  package_install_internal_rpm () {
 		# Dump the full set of recommends...
 		${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
 			--predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
-			-D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${confbase}.macro`" \
+			-D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}.macro`" \
 			-D "__dbi_txn create nofsync private" \
 			-qa --qf "[%{RECOMMENDS}\n]" | sort -u > ${target_rootfs}/install/recommend
 		# Did we add more to the list?
diff --git a/meta/classes/populate_sdk_deb.bbclass b/meta/classes/populate_sdk_deb.bbclass
index a5b6384..9acc52d 100644
--- a/meta/classes/populate_sdk_deb.bbclass
+++ b/meta/classes/populate_sdk_deb.bbclass
@@ -34,16 +34,9 @@  fakeroot populate_sdk_deb () {
 	export INSTALL_ROOTFS_DEB="${SDK_OUTPUT}"
 	export INSTALL_BASEARCH_DEB="${SDK_ARCH}"
 	export INSTALL_PACKAGES_NORMAL_DEB="${TOOLCHAIN_HOST_TASK}"
-	INSTALL_ARCHS_DEB=""
+	INSTALL_ARCHS_DEB="${SDK_ARCH}-nativesdk"
 	for arch in ${PACKAGE_ARCHS}; do
-		sdkarch=`echo $arch | sed -e 's/${HOST_ARCH}/${SDK_ARCH}/'`
-		extension="-nativesdk"
-		if [ "$sdkarch" = "all" -o "$sdkarch" = "any" -o "$sdkarch" = "noarch" ]; then
-		    extension=""
-		fi
-		if [ -e ${DEPLOY_DIR_DEB}/$sdkarch$extension ]; then
-			INSTALL_ARCHS_DEB="$INSTALL_ARCHS_DEB $sdkarch$extension"
-		fi
+		INSTALL_ARCHS_DEB="$INSTALL_ARCHS_DEB $arch"
 	done
 	export INSTALL_ARCHS_DEB
 
diff --git a/meta/classes/populate_sdk_rpm.bbclass b/meta/classes/populate_sdk_rpm.bbclass
index da308c1..8196542 100644
--- a/meta/classes/populate_sdk_rpm.bbclass
+++ b/meta/classes/populate_sdk_rpm.bbclass
@@ -53,16 +53,9 @@  fakeroot populate_sdk_rpm () {
 	export INSTALL_PLATFORM_RPM="${SDK_ARCH}"
 	export INSTALL_CONFBASE_RPM="${RPMCONF_HOST_BASE}"
 	export INSTALL_PACKAGES_NORMAL_RPM="${TOOLCHAIN_HOST_TASK}"
-	export INSTALL_PLATFORM_EXTRA_RPM=""
+	export INSTALL_PLATFORM_EXTRA_RPM="${SDK_ARCH}-nativesdk"
 	for arch in ${PACKAGE_ARCHS}; do
-		sdkarch=`echo $arch | sed -e 's/${HOST_ARCH}/${SDK_ARCH}/'`
-		extension="-nativesdk"
-		if [ "$sdkarch" = "all" -o "$sdkarch" = "any" -o "$sdkarch" = "noarch" ]; then
-		    extension=""
-		fi
-		if [ -e ${DEPLOY_DIR_RPM}/$sdkarch$extension ]; then
-			INSTALL_PLATFORM_EXTRA_RPM="$sdkarch $INSTALL_PLATFORM_EXTRA_RPM"
-		fi
+		INSTALL_PLATFORM_EXTRA_RPM="$arch $INSTALL_PLATFORM_EXTRA_RPM"
 	done
 	export INSTALL_PLATFORM_EXTRA_RPM