Skip to contentSkip to conversation

rootfs_rpm.bbclass: Handle multilib configures with different

PATCH New Mark Hatle 1 participant 2 messages Feb 21, 2013

lore
Share & tools
lore

Mark Hatle

author
#0 lore raw

cover rootfs_rpm.bbclass: Handle multilib configures with different

This change requires a previous change that was sent up to the list the other day. (That change is already in the 'next' tree.):

rootfs_rpm.bbclass: Reorder feed priority based on multilib image setting

We found a case where the TARGET_OS of a multilib was not the same as other multilibs in the set of packages. This caused the wrong entries to be added to the /etc/rpm/platforms file, which caused a silent failure during package installation. (Smart decided the right packages were selected, while RPM decided that package was incompatible... Why this was silently ignored, I'm not sure.)

We refactor the way we generate and pass the platform information. This actually simplifies the code a lot and we can avoid making assumptions based on whichever multilib the image was generated with.

author
#1 lore raw

PATCH 1/1 rootfs_rpm.bbclass: Handle multilib configures with different OS values

[ CQID: WIND00404082 ]

It is possible for the TARGET_OS to change dependending on the multilib used for a given package build. mips64 has two potential TARGET_OS values: linux and linux-gnun32. The RPM and Smart setup needs to distinguish between the two otherwise packages of the "non-default" TARGET_OS may be ignored as incompatible.

---
 meta/classes/package_rpm.bbclass      | 31 ++++++++------------------
 meta/classes/populate_sdk_rpm.bbclass | 42 +++++++++++++++++++++++++----------
 meta/classes/rootfs_rpm.bbclass       | 37 +++++++++++++++++++++---------
 3 files changed, 66 insertions(+), 44 deletions(-)
meta/classes/package_rpm.bbclass +9 -22
index dac89a7..7a1da33 100644
@@ -248,8 +248,6 @@ translate_oe_to_smart() {
 package_install_internal_rpm () {
 
 	local target_rootfs="$INSTALL_ROOTFS_RPM"
-	local platform="`echo $INSTALL_PLATFORM_RPM | sed 's#-#_#g'`"
-	local platform_extra="`echo $INSTALL_PLATFORM_EXTRA_RPM | sed 's#-#_#g'`"
 	local package_to_install="$INSTALL_PACKAGES_RPM"
 	local package_attemptonly="$INSTALL_PACKAGES_ATTEMPTONLY_RPM"
 	local package_linguas="$INSTALL_PACKAGES_LINGUAS_RPM"
@@ -273,29 +271,17 @@ package_install_internal_rpm () {
 		# Setup base system configuration
 		echo "Note: configuring RPM platform settings"
 		mkdir -p ${target_rootfs}/etc/rpm/
-		if [ -n "${sdk_mode}" ]; then
-			platform_vendor="${SDK_VENDOR}"
-			platform_os="${SDK_OS}"
-		else
-			platform_vendor="${TARGET_VENDOR}"
-			platform_os="${TARGET_OS}"
-		fi
-
-		echo "${platform}${platform_vendor}-${platform_os}" > ${target_rootfs}/etc/rpm/platform
+		echo "$INSTALL_PLATFORM_RPM" > ${target_rootfs}/etc/rpm/platform
 
-
-		if [ ! -z "$platform_extra" ]; then
-			for pt in $platform_extra ; do
+		if [ ! -z "$INSTALL_PLATFORM_EXTRA_RPM" ]; then
+			for pt in $INSTALL_PLATFORM_EXTRA_RPM ; do
 				channel_priority=$(expr $channel_priority + 5)
 				case $pt in
-					noarch | any | all)
-						os="`echo ${platform_os} | sed "s,-.*,,"`.*"
-						;;
-					*)
-						os="${platform_os}"
+					noarch-* | any-* | all-*)
+						pt=$(echo $pt | sed "s,-linux.*$,-linux\.*,")
 						;;
 				esac
-				echo "$pt-.*-$os" >> ${target_rootfs}/etc/rpm/platform
+				echo "$pt" >> ${target_rootfs}/etc/rpm/platform
 			done
 		fi
 
@@ -360,12 +346,13 @@ EOF
 		smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-extra-macros._tmppath=/install/tmp
 		# Optional debugging
 		#smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-log-level=debug
+		#smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-log-file=/tmp/smart-debug-logfile
 
 		# Delay this until later...
 		#smart --data-dir=${target_rootfs}/var/lib/smart channel --add rpmsys type=rpm-sys -y
 
-		platform_extra_fixed=`echo "$platform_extra" | tr - _`
-		for arch in $platform_extra_fixed ; do
+		for canonical_arch in $INSTALL_PLATFORM_EXTRA_RPM; do
+			arch=$(echo $canonical_arch | sed "s,\([^-]*\)-.*,\1,")
 			if [ -d ${DEPLOY_DIR_RPM}/$arch -a ! -e ${target_rootfs}/install/channel.$arch.stamp ] ; then
 				echo "Note: adding Smart channel $arch ($channel_priority)"
 				smart --data-dir=${target_rootfs}/var/lib/smart channel --add $arch type=rpm-md type=rpm-md baseurl=${DEPLOY_DIR_RPM}/$arch -y
meta/classes/populate_sdk_rpm.bbclass +30 -12

87 lines not on this page · raw message

meta/classes/rootfs_rpm.bbclass +27 -10
index 920380e..9dc2bf9 100644
@@ -50,7 +50,7 @@ fakeroot rootfs_rpm_do_rootfs () {
 	# install packages
 	# This needs to work in the same way as populate_sdk_rpm.bbclass!
 	export INSTALL_ROOTFS_RPM="${IMAGE_ROOTFS}"
-	export INSTALL_PLATFORM_RPM="${TARGET_ARCH}"
+	export INSTALL_PLATFORM_RPM="$(echo ${TARGET_ARCH} | tr - _)${TARGET_VENDOR}-${TARGET_OS}"
 	export INSTALL_PACKAGES_RPM="${PACKAGE_INSTALL}"
 	export INSTALL_PACKAGES_ATTEMPTONLY_RPM="${PACKAGE_INSTALL_ATTEMPTONLY}"
 	export INSTALL_PACKAGES_LINGUAS_RPM="${LINGUAS_INSTALL}"
@@ -64,20 +64,31 @@ fakeroot rootfs_rpm_do_rootfs () {
 	# List must be prefered to least preferred order
 	default_extra_rpm=""
 	INSTALL_PLATFORM_EXTRA_RPM=""
-	for i in ${MULTILIB_PREFIX_LIST} ; do
+	for os in ${MULTILIB_OS_LIST} ; do
 		old_IFS="$IFS"
 		IFS=":"
-		set $i
+		set -- $os
 		IFS="$old_IFS"
 		mlib=$1
-		shift #remove mlib
-		while [ -n "$1" ]; do
-			if [ "$mlib" = "${BBEXTENDVARIANT}" ]; then
-				default_extra_rpm="$default_extra_rpm $1"
-			else
-				INSTALL_PLATFORM_EXTRA_RPM="$INSTALL_PLATFORM_EXTRA_RPM $1"
+		mlib_os=$2
+		for prefix in ${MULTILIB_PREFIX_LIST} ; do
+			old_IFS="$IFS"
+			IFS=":"
+			set -- $prefix
+			IFS="$old_IFS"
+			if [ "$mlib" != "$1" ]; then
+				continue
 			fi
-			shift
+			shift #remove mlib
+			while [ -n "$1" ]; do
+				platform="$(echo $1 | tr - _)-.*-$mlib_os"
+				if [ "$mlib" = "${BBEXTENDVARIANT}" ]; then
+					default_extra_rpm="$default_extra_rpm $platform"
+				else
+					INSTALL_PLATFORM_EXTRA_RPM="$INSTALL_PLATFORM_EXTRA_RPM $platform"
+				fi
+				shift
+			done
 		done
 	done
 	if [ -n "$default_extra_rpm" ]; then
@@ -210,7 +221,9 @@ python () {
     # package_arch order is reversed.  This ensures the -best- match is listed first!
     package_archs = d.getVar("PACKAGE_ARCHS", True) or ""
     package_archs = ":".join(package_archs.split()[::-1])
+    package_os = d.getVar("TARGET_OS", True) or ""
     ml_prefix_list = "%s:%s" % ('default', package_archs)
+    ml_os_list = "%s:%s" % ('default', package_os)
     multilibs = d.getVar('MULTILIBS', True) or ""
     for ext in multilibs.split():
         eext = ext.split(':')
@@ -219,8 +232,12 @@ python () {
             default_tune = localdata.getVar("DEFAULTTUNE_virtclass-multilib-" + eext[1], False)
             if default_tune:
                 localdata.setVar("DEFAULTTUNE", default_tune)
+                bb.data.update_data(localdata)
             package_archs = localdata.getVar("PACKAGE_ARCHS", True) or ""
             package_archs = ":".join([i in "all noarch any".split() and i or eext[1]+"_"+i for i in package_archs.split()][::-1])
+            package_os = localdata.getVar("TARGET_OS", True) or ""
             ml_prefix_list += " %s:%s" % (eext[1], package_archs)
+            ml_os_list += " %s:%s" % (eext[1], package_os)
     d.setVar('MULTILIB_PREFIX_LIST', ml_prefix_list)
+    d.setVar('MULTILIB_OS_LIST', ml_os_list)
 }
Signature · 1 line
1.8.1.2.545.g2f19ada