Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/3] Multilib image/package backend enablement
@ 2011-07-26 22:50 Richard Purdie
  2011-07-26 22:50 ` [PATCH 1/3] package/rootfs_rpm: Implement RPM multilib package handling Richard Purdie
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Richard Purdie @ 2011-07-26 22:50 UTC (permalink / raw)
  To: openembedded-core

The following three patches enable very basic multilib support for 
the opkg and rpm backends.

They are available in the git repository at:
  git://git.openembedded.org/openembedded-core-contrib rpurdie/ml5
  http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rpurdie/ml5

Lianhao Lu (2):
  package(rootfs)_ipk.bbclass: support multilib in opkg backend.
  image.bbclass: Added variables for multilib support.

Mark Hatle (1):
  package/rootfs_rpm: Implement RPM multilib package handling

 meta/classes/image.bbclass       |   54 +++++++++-
 meta/classes/package_ipk.bbclass |   51 +++++++++
 meta/classes/package_rpm.bbclass |  229 ++++++++++++++++++++++++--------------
 meta/classes/rootfs_ipk.bbclass  |    2 +
 meta/classes/rootfs_rpm.bbclass  |   17 +++-
 5 files changed, 266 insertions(+), 87 deletions(-)

-- 
1.7.4.1




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] package/rootfs_rpm: Implement RPM multilib package handling
  2011-07-26 22:50 [PATCH 0/3] Multilib image/package backend enablement Richard Purdie
@ 2011-07-26 22:50 ` Richard Purdie
  2011-07-27  3:18   ` Mark Hatle
  2011-07-26 22:50 ` [PATCH 2/3] package(rootfs)_ipk.bbclass: support multilib in opkg backend Richard Purdie
  2011-07-26 22:50 ` [PATCH 3/3] image.bbclass: Added variables for multilib support Richard Purdie
  2 siblings, 1 reply; 7+ messages in thread
From: Richard Purdie @ 2011-07-26 22:50 UTC (permalink / raw)
  To: openembedded-core

From: Mark Hatle <mark.hatle@windriver.com>

This is a first pass at adding multilib support to the RPM package
and image handling code.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
---
 meta/classes/package_rpm.bbclass |  229 ++++++++++++++++++++++++--------------
 meta/classes/rootfs_rpm.bbclass  |   17 +++-
 2 files changed, 160 insertions(+), 86 deletions(-)

diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 2cc5742..05f3929 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -21,67 +21,71 @@ RPMCONF_HOST_BASE = "${DEPLOY_DIR_RPM}/solvedb-sdk"
 # Update the Packages depsolver db in ${DEPLOY_DIR_RPM}
 #
 package_update_index_rpm () {
-	rpmarchs="${PACKAGE_ARCHS}"
-
 	if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then
 		return
 	fi
 
-	packagedirs=""
-	packagedirs_sdk=""
-	for arch in $rpmarchs ; 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
-		packagedirs="${DEPLOY_DIR_RPM}/$arch $packagedirs"
-		packagedirs_sdk="${DEPLOY_DIR_RPM}/$sdkarch$extension $packagedirs_sdk"
+	base_package_archs="${PACKAGE_ARCHS}"
+	ml_package_archs="${MULTILIB_PACKAGE_ARCHS}"
+
+	for archvar in base_package_archs ml_package_archs; do
+		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
+			packagedirs="${DEPLOY_DIR_RPM}/$arch $packagedirs"
+			packagedirs_sdk="${DEPLOY_DIR_RPM}/$sdkarch$extension $packagedirs_sdk"
 
-		rm -rf ${DEPLOY_DIR_RPM}/$arch/solvedb
-		rm -rf ${DEPLOY_DIR_RPM}/$sdkarch$extension/solvedb
-	done
+			rm -rf ${DEPLOY_DIR_RPM}/$arch/solvedb
+			rm -rf ${DEPLOY_DIR_RPM}/$sdkarch$extension/solvedb
+		done
 
-	cat /dev/null > ${RPMCONF_TARGET_BASE}.conf
-	for pkgdir in $packagedirs; do
-		if [ -e $pkgdir/ ]; then
-			echo "Generating solve db for $pkgdir..."
-			echo $pkgdir/solvedb >> ${RPMCONF_TARGET_BASE}.conf
-			if [ -d $pkgdir/solvedb ]; then
-				# We've already processed this and it's a duplicate
-				continue
+		cat /dev/null > ${RPMCONF_TARGET_BASE}-${archvar}.conf
+		for pkgdir in $packagedirs; do
+			if [ -e $pkgdir/ ]; then
+				echo "Generating solve db for $pkgdir..."
+				echo $pkgdir/solvedb >> ${RPMCONF_TARGET_BASE}-${archvar}.conf
+				if [ -d $pkgdir/solvedb ]; then
+					# We've already processed this and it's a duplicate
+					continue
+				fi
+				mkdir -p $pkgdir/solvedb
+				echo "# Dynamically generated solve manifest" >> $pkgdir/solvedb/manifest
+				find $pkgdir -maxdepth 1 -type f >> $pkgdir/solvedb/manifest
+				${RPM} -i --replacepkgs --replacefiles --oldpackage \
+					-D "_dbpath $pkgdir/solvedb" --justdb \
+					--noaid --nodeps --noorder --noscripts --notriggers --noparentdirs --nolinktos --stats \
+					--ignoresize --nosignature --nodigest \
+					-D "__dbi_txn create nofsync" \
+					$pkgdir/solvedb/manifest
 			fi
-			mkdir -p $pkgdir/solvedb
-			echo "# Dynamically generated solve manifest" >> $pkgdir/solvedb/manifest
-			find $pkgdir -maxdepth 1 -type f >> $pkgdir/solvedb/manifest
-			${RPM} -i --replacepkgs --replacefiles --oldpackage \
-				-D "_dbpath $pkgdir/solvedb" --justdb \
-				--noaid --nodeps --noorder --noscripts --notriggers --noparentdirs --nolinktos --stats \
-				--ignoresize --nosignature --nodigest \
-				-D "__dbi_txn create nofsync" \
-				$pkgdir/solvedb/manifest
-		fi
-	done
+		done
 
-	cat /dev/null > ${RPMCONF_HOST_BASE}.conf
-	for pkgdir in $packagedirs_sdk; do
-		if [ -e $pkgdir/ ]; then
-			echo "Generating solve db for $pkgdir..."
-			echo $pkgdir/solvedb >> ${RPMCONF_HOST_BASE}.conf
-			if [ -d $pkgdir/solvedb ]; then
-				# We've already processed this and it's a duplicate
-				continue
-			fi	
-			mkdir -p $pkgdir/solvedb
-			echo "# Dynamically generated solve manifest" >> $pkgdir/solvedb/manifest
-			find $pkgdir -maxdepth 1 -type f >> $pkgdir/solvedb/manifest
-			${RPM} -i --replacepkgs --replacefiles --oldpackage \
-				-D "_dbpath $pkgdir/solvedb" --justdb \
-				--noaid --nodeps --noorder --noscripts --notriggers --noparentdirs --nolinktos --stats \
-				--ignoresize --nosignature --nodigest \
-				-D "__dbi_txn create nofsync" \
-				$pkgdir/solvedb/manifest
-		fi
+		cat /dev/null > ${RPMCONF_HOST_BASE}.conf
+		for pkgdir in $packagedirs_sdk; do
+			if [ -e $pkgdir/ ]; then
+				echo "Generating solve db for $pkgdir..."
+				echo $pkgdir/solvedb >> ${RPMCONF_HOST_BASE}-${archvar}.conf
+				if [ -d $pkgdir/solvedb ]; then
+					# We've already processed this and it's a duplicate
+					continue
+				fi	
+				mkdir -p $pkgdir/solvedb
+				echo "# Dynamically generated solve manifest" >> $pkgdir/solvedb/manifest
+				find $pkgdir -maxdepth 1 -type f >> $pkgdir/solvedb/manifest
+				${RPM} -i --replacepkgs --replacefiles --oldpackage \
+					-D "_dbpath $pkgdir/solvedb" --justdb \
+					--noaid --nodeps --noorder --noscripts --notriggers --noparentdirs --nolinktos --stats \
+					--ignoresize --nosignature --nodigest \
+					-D "__dbi_txn create nofsync" \
+					$pkgdir/solvedb/manifest
+			fi
+		done
 	done
 }
 
@@ -91,25 +95,43 @@ package_update_index_rpm () {
 #
 package_generate_rpm_conf () {
 	printf "_solve_dbpath " > ${RPMCONF_TARGET_BASE}.macro
-	colon=false
-	for each in `cat ${RPMCONF_TARGET_BASE}.conf` ; do
-		if [ "$colon" == true ]; then
-			printf ":" >> ${RPMCONF_TARGET_BASE}.macro
-		fi
-		printf "%s" $each >> ${RPMCONF_TARGET_BASE}.macro
-		colon=true
-	done
-	printf "\n" >> ${RPMCONF_TARGET_BASE}.macro
+	o_colon_t=false
+	o_colon_h=false
+
+	for archvar in base_package_archs ml_package_archs; do
+		printf "_solve_dbpath " > ${RPMCONF_TARGET_BASE}-${archvar}.macro
+		colon=false
+		for each in `cat ${RPMCONF_TARGET_BASE}-${archvar}.conf` ; do
+			if [ "$o_colon_t" == true ]; then
+				printf ":" >> ${RPMCONF_TARGET_BASE}.macro
+			fi
+			if [ "$colon" == true ]; then
+				printf ":" >> ${RPMCONF_TARGET_BASE}-${archvar}.macro
+			fi
+			printf "%s" $each >> ${RPMCONF_TARGET_BASE}.macro
+			o_colon_t=true
+			printf "%s" $each >> ${RPMCONF_TARGET_BASE}-${archvar}.macro
+			colon=true
+		done
+		printf "\n" >> ${RPMCONF_TARGET_BASE}-${archvar}.macro
 
-	printf "_solve_dbpath " > ${RPMCONF_HOST_BASE}.macro
-	colon=false
-	for each in `cat ${RPMCONF_HOST_BASE}.conf` ; do
-		if [ "$colon" == true ]; then
-			printf ":" >> ${RPMCONF_HOST_BASE}.macro
-		fi
-		printf "%s" $each >> ${RPMCONF_HOST_BASE}.macro
-		colon=true
+		printf "_solve_dbpath " > ${RPMCONF_HOST_BASE}-${archvar}.macro
+		colon=false
+		for each in `cat ${RPMCONF_HOST_BASE}-${archvar}.conf` ; do
+			if [ "$o_colon_h" == true ]; then
+				printf ":" >> ${RPMCONF_HOST_BASE}.macro
+			fi
+			if [ "$colon" == true ]; then
+				printf ":" >> ${RPMCONF_HOST_BASE}-${archvar}.macro
+			fi
+			printf "%s" $each >> ${RPMCONF_HOST_BASE}.macro
+			o_colon_h=true
+			printf "%s" $each >> ${RPMCONF_HOST_BASE}-${archvar}.macro
+			colon=true
+		done
+		printf "\n" >> ${RPMCONF_HOST_BASE}-${archvar}.macro
 	done
+	printf "\n" >> ${RPMCONF_TARGET_BASE}.macro
 	printf "\n" >> ${RPMCONF_HOST_BASE}.macro
 }
 
@@ -139,11 +161,11 @@ rpm_log_check() {
 # resolve_pacakge <pkgname> <solvdb conffile>
 #
 resolve_package_rpm () {
-	local pkg="$1"
-	local conffile="$2"
+	local conffile="$1"
+	shift
 	local pkg_name=""
 	for solve in `cat ${conffile}`; do
-		pkg_name=$(${RPM} -D "_dbpath $solve" -D "__dbi_txn create nofsync" -q --yaml $pkg | grep -i 'Packageorigin' | cut -d : -f 2)
+		pkg_name=$(${RPM} -D "_dbpath $solve" -D "__dbi_txn create nofsync" -q --yaml $@ | grep -i 'Packageorigin' | cut -d : -f 2)
 		if [ -n "$pkg_name" ]; then
 			break;
 		fi
@@ -178,10 +200,10 @@ package_install_internal_rpm () {
 
 	# Setup base system configuration
 	mkdir -p ${target_rootfs}/etc/rpm/
-	echo "${platform}-poky-linux-gnu" > ${target_rootfs}/etc/rpm/platform
+	echo "${platform}${TARGET_VENDOR}-${TARGET_OS}" > ${target_rootfs}/etc/rpm/platform
 	if [ ! -z "$platform_extra" ]; then
 		for pt in $platform_extra ; do
-			echo "$pt-.*-linux.*" >> ${target_rootfs}/etc/rpm/platform
+			echo "$pt-.*-${TARGET_OS}" >> ${target_rootfs}/etc/rpm/platform
 		done
 	fi
 
@@ -204,9 +226,16 @@ package_install_internal_rpm () {
 		if [ ! -z "${package_lingusa}" ]; then
 			for pkg in ${package_lingusa}; do
 				echo "Processing $pkg..."
-				pkg_name=$(resolve_package_rpm $pkg ${confbase}.conf)
+
+				archvar=base_package_archs
+				ml_pkg=$(echo ${pkg} | sed "s,^${MLPREFIX}\(.*\),\1,")
+				if [ "${ml_pkg}" != "${pkg}" ]; then
+					archvar=ml_package_archs
+				fi
+
+				pkg_name=$(resolve_package_rpm ${confbase}-${archvar}.conf ${ml_pkg})
 				if [ -z "$pkg_name" ]; then
-					echo "Unable to find package $pkg!"
+					echo "Unable to find package $pkg ($ml_pkg)!"
 					exit 1
 				fi
 				echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest
@@ -217,12 +246,19 @@ package_install_internal_rpm () {
 	if [ ! -z "${package_to_install}" ]; then
 		for pkg in ${package_to_install} ; do
 			echo "Processing $pkg..."
-			pkg_name=$(resolve_package_rpm $pkg ${confbase}.conf)
+
+			archvar=base_package_archs
+			ml_pkg=$(echo ${pkg} | sed "s,$^{MLPREFIX}\(.*\),\1,")
+			if [ "${ml_pkg}" != "${pkg}" ]; then
+				archvar=ml_package_archs
+			fi
+
+			pkg_name=$(resolve_package_rpm ${confbase}-${archvar}.conf ${ml_pkg})
 			if [ -z "$pkg_name" ]; then
-				echo "Unable to find package $pkg!"
+				echo "Unable to find package $pkg ($ml_pkg)!"
 				exit 1
 			fi
-			echo $pkg_name >> ${target_rootfs}/install/install.manifest
+			echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest
 		done
 	fi
 
@@ -318,6 +354,21 @@ python write_specfile () {
 	import textwrap
 	import oe.packagedata
 
+	# We need a simple way to remove the MLPREFIX from the package name,
+	# and dependency information...
+	def strip_multilib(name, d):
+		multilibs = d.getVar('MULTILIBS', True) or ""
+		for ext in multilibs.split():
+			eext = ext.split(':')
+			if len(eext) > 1 and eext[0] == 'multilib' and name and name.find(eext[1] + '-') == 0:
+				name = (eext[1] + '-').join(name.split(eext[1] + '-', 1)[1:])
+		return name
+
+#		ml = bb.data.getVar("MLPREFIX", d, True)
+#		if ml and name and len(ml) != 0 and name.find(ml) == 0:
+#			return ml.join(name.split(ml, 1)[1:])
+#		return name
+
 	# In RPM, dependencies are of the format: pkg <>= Epoch:Version-Release
 	# This format is similar to OE, however there are restrictions on the
 	# characters that can be in a field.  In the Version field, "-"
@@ -346,7 +397,7 @@ python write_specfile () {
 							pv = subd['PKGV']
 							reppv = pv.replace('-', '+')
 							ver = ver.replace(pv, reppv)
-				newdeps_dict[dep] = ver
+				newdeps_dict[strip_multilib(dep, d)] = ver
 			depends = bb.utils.join_deps(newdeps_dict)
 			bb.data.setVar(varname, depends.strip(), d)
 
@@ -394,7 +445,7 @@ python write_specfile () {
 		return
 
 	# Construct the SPEC file...
-	srcname    = bb.data.getVar('PN', d, True)
+	srcname    = strip_multilib(bb.data.getVar('PN', d, True), d)
 	srcsummary = (bb.data.getVar('SUMMARY', d, True) or bb.data.getVar('DESCRIPTION', d, True) or ".")
 	srcversion = bb.data.getVar('PKGV', d, True).replace('-', '+')
 	srcrelease = bb.data.getVar('PKGR', d, True)
@@ -405,7 +456,7 @@ python write_specfile () {
 	srchomepage    = bb.data.getVar('HOMEPAGE', d, True)
 	srcdescription = bb.data.getVar('DESCRIPTION', d, True) or "."
 
-	srcdepends     = bb.data.getVar('DEPENDS', d, True)
+	srcdepends     = strip_multilib(bb.data.getVar('DEPENDS', d, True), d)
 	srcrdepends    = []
 	srcrrecommends = []
 	srcrsuggests   = []
@@ -448,7 +499,7 @@ python write_specfile () {
 
 		conffiles = (bb.data.getVar('CONFFILES', localdata, True) or "").split()
 
-		splitname    = pkgname
+		splitname    = strip_multilib(pkgname, d)
 
 		splitsummary = (bb.data.getVar('SUMMARY', localdata, True) or bb.data.getVar('DESCRIPTION', localdata, True) or ".")
 		splitversion = (bb.data.getVar('PKGV', localdata, True) or "").replace('-', '+')
@@ -699,6 +750,14 @@ python write_specfile () {
 python do_package_rpm () {
 	import os
 
+	# We need a simple way to remove the MLPREFIX from the package name,
+	# and dependency information...
+	def strip_multilib(name, d):
+		ml = bb.data.getVar("MLPREFIX", d, True)
+		if ml and name and len(ml) != 0 and name.find(ml) == 0:
+			return ml.join(name.split(ml, 1)[1:])
+		return name
+
 	workdir = bb.data.getVar('WORKDIR', d, True)
 	outdir = bb.data.getVar('DEPLOY_DIR_IPK', d, True)
 	tmpdir = bb.data.getVar('TMPDIR', d, True)
@@ -714,7 +773,7 @@ python do_package_rpm () {
 		return
 
 	# Construct the spec file...
-	srcname    = bb.data.getVar('PN', d, True)
+	srcname    = strip_multilib(bb.data.getVar('PN', d, True), d)
 	outspecfile = workdir + "/" + srcname + ".spec"
 	bb.data.setVar('OUTSPECFILE', outspecfile, d)
 	bb.build.exec_func('write_specfile', d)
diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass
index b554bae..04c0483 100644
--- a/meta/classes/rootfs_rpm.bbclass
+++ b/meta/classes/rootfs_rpm.bbclass
@@ -93,7 +93,7 @@ EOF
 
 	# List must be prefered to least preferred order
 	INSTALL_PLATFORM_EXTRA_RPM=""
-	for each_arch in ${PACKAGE_ARCHS} ; do
+	for each_arch in ${MULTILIB_PACKAGE_ARCHS} ${PACKAGE_ARCHS}; do
 		INSTALL_PLATFORM_EXTRA_RPM="$each_arch $INSTALL_PLATFORM_EXTRA_RPM"
 	done
 	export INSTALL_PLATFORM_RPM
@@ -207,4 +207,19 @@ python () {
         bb.data.setVarFlag('do_rootfs', 'recrdeptask', flags, d)
         bb.data.setVar('RPM_PREPROCESS_COMMANDS', '', d)
         bb.data.setVar('RPM_POSTPROCESS_COMMANDS', '', d)
+
+    ml_package_archs = ""
+    multilibs = d.getVar('MULTILIBS', True) or ""
+    for ext in multilibs.split():
+        eext = ext.split(':')
+        if len(eext) > 1 and eext[0] == 'multilib':
+            localdata = bb.data.createCopy(d)
+            overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + eext[1]
+            localdata.setVar("OVERRIDES", overrides)
+            # TEMP: OVERRIDES isn't working right
+            localdata.setVar("TUNENAME", localdata.getVar("TUNENAME_virtclass-multilib-" + eext[1], False) or "")
+            ml_package_archs += localdata.getVar("PACKAGE_ARCHS", True) or ""
+            bb.note("ML_PACKAGE_ARCHS %s %s %s" % (eext[1], localdata.getVar("PACKAGE_ARCHS", True) or "(none)", overrides))
+    bb.data.setVar('MULTILIB_PACKAGE_ARCHS', ml_package_archs, d)
+
 }
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] package(rootfs)_ipk.bbclass: support multilib in opkg backend.
  2011-07-26 22:50 [PATCH 0/3] Multilib image/package backend enablement Richard Purdie
  2011-07-26 22:50 ` [PATCH 1/3] package/rootfs_rpm: Implement RPM multilib package handling Richard Purdie
@ 2011-07-26 22:50 ` Richard Purdie
  2011-07-30 16:23   ` Khem Raj
  2011-07-26 22:50 ` [PATCH 3/3] image.bbclass: Added variables for multilib support Richard Purdie
  2 siblings, 1 reply; 7+ messages in thread
From: Richard Purdie @ 2011-07-26 22:50 UTC (permalink / raw)
  To: openembedded-core

From: Lianhao Lu <lianhao.lu@intel.com>

Support install multiple multilib in opkg backend.

The installation is done in 3 phases.

Phase 1: install normal packages to IMAGE_ROOTFS.

Phase 2: install multilib packages under MULTILIB_TEMP_ROOTFS. Packages
belongs to the same multilib arch would be installed to a unique
directory.

Phase 3: check file confliction between IMAGE_ROOTFS and
MULTILIB_TEMP_ROOTFS, install multilib packages to IMAGE_ROOTFS only if
the sanity check passed.

Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
---
 meta/classes/package_ipk.bbclass |   51 ++++++++++++++++++++++++++++++++++++++
 meta/classes/rootfs_ipk.bbclass  |    2 +
 2 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass
index 0c0f00d..b7afa83 100644
--- a/meta/classes/package_ipk.bbclass
+++ b/meta/classes/package_ipk.bbclass
@@ -61,6 +61,28 @@ python package_ipk_install () {
 		raise bb.build.FuncFailed
 }
 
+package_tryout_install_multilib_ipk() {
+	#try install multilib
+	multilib_tryout_dirs=""
+	for arch in ${MULTILIB_ARCHS}; do
+		local target_rootfs="${MULTILIB_TEMP_ROOTFS}/${arch}"
+		local ipkg_args="-f ${INSTALL_CONF_IPK} -o ${target_rootfs} --force_overwrite"
+		local selected_pkg=""
+		#strip the "ml" from package_arch
+		local pkgarch_prefix="${arch:2}-"
+		for pkg in "${INSTALL_PACKAGES_MULTILIB_IPK}"; do
+			if [ ${pkg:0:${#pkgarch_prefix}} == ${pkgarch_prefix} ]; then
+			    selected_pkg="${selected_pkg} ${pkg}"
+			fi
+		done
+		if [ ! -z "${selected_pkg}" ]; then
+			mkdir -p ${target_rootfs}/${opkglibdir}
+			opkg-cl ${ipkg_args} update
+			opkg-cl ${ipkg_args} install ${selected_pkg}
+			multilib_tryout_dirs="${multilib_tryout_dirs} ${target_rootfs}"
+		fi
+	done
+}
 #
 # install a bunch of packages using opkg
 # the following shell variables needs to be set before calling this func:
@@ -78,6 +100,7 @@ package_install_internal_ipk() {
 	local package_to_install="${INSTALL_PACKAGES_NORMAL_IPK}"
 	local package_attemptonly="${INSTALL_PACKAGES_ATTEMPTONLY_IPK}"
 	local package_lingusa="${INSTALL_PACKAGES_LINGUAS_IPK}"
+	local package_multilib="${INSTALL_PACKAGES_MULTILIB_IPK}"
 	local task="${INSTALL_TASK_IPK}"
 
 	mkdir -p ${target_rootfs}${localstatedir}/lib/opkg/
@@ -102,6 +125,14 @@ package_install_internal_ipk() {
 	if [ ! -z "${package_attemptonly}" ]; then
 		opkg-cl ${ipkg_args} install ${package_attemptonly} > "${WORKDIR}/temp/log.do_${task}_attemptonly.${PID}" || true
 	fi
+
+	package_tryout_install_multilib_ipk
+	#sanity check
+	multilib_sanity_check  ${target_rootfs} ${multilib_tryout_dirs}|| exit 1
+
+	if [ ! -z "${package_multilib}" ]; then
+		opkg-cl ${ipkg_args} install ${package_multilib}
+	fi
 }
 
 ipk_log_check() {
@@ -142,6 +173,11 @@ package_update_index_ipk () {
 		packagedirs="$packagedirs ${DEPLOY_DIR_IPK}/$arch ${DEPLOY_DIR_IPK}/$sdkarch-nativesdk"
 	done
 
+	multilib_archs="${MULTILIB_ARCHS}"
+	for arch in $multilib_archs; do
+		packagedirs="$packagedirs ${DEPLOY_DIR_IPK}/$arch"
+	done
+
 	for pkgdir in $packagedirs; do
 		if [ -e $pkgdir/ ]; then
 			touch $pkgdir/Packages
@@ -173,6 +209,13 @@ package_generate_ipkg_conf () {
 		        echo "src oe-$sdkarch$extension file:${DEPLOY_DIR_IPK}/$sdkarch$extension" >> ${IPKGCONF_SDK}
 		fi
 	done
+
+	multilib_archs="${MULTILIB_ARCHS}"
+	for arch in $multilib_archs; do
+		if [ -e ${DEPLOY_DIR_IPK}/$arch/Packages ] ; then
+		        echo "src oe-$arch file:${DEPLOY_DIR_IPK}/$arch" >> ${IPKGCONF_TARGET}
+		fi
+	done
 }
 
 package_generate_archlist () {
@@ -188,6 +231,14 @@ package_generate_archlist () {
 		echo "arch $sdkarch$extension $priority" >> ${IPKGCONF_SDK}
 		priority=$(expr $priority + 5)
 	done
+
+	multilib_archs="${MULTILIB_ARCHS}"
+	for arch in $multilib_archs; do
+		echo "arch $arch $priority" >> ${IPKGCONF_TARGET}
+		priority=$(expr $priority + 5)
+	done
+
+
 }
 
 python do_package_ipk () {
diff --git a/meta/classes/rootfs_ipk.bbclass b/meta/classes/rootfs_ipk.bbclass
index 4fcacc6..695bee0 100644
--- a/meta/classes/rootfs_ipk.bbclass
+++ b/meta/classes/rootfs_ipk.bbclass
@@ -22,6 +22,7 @@ opkglibdir = "${localstatedir}/lib/opkg"
 
 # Which packages to not install on the basis of a recommendation
 BAD_RECOMMENDATIONS ?= ""
+MULTILIBRE_ALLOW_REP = "${opkglibdir}"
 
 fakeroot rootfs_ipk_do_rootfs () {
 	set -x
@@ -58,6 +59,7 @@ fakeroot rootfs_ipk_do_rootfs () {
 	export INSTALL_ROOTFS_IPK="${IMAGE_ROOTFS}"
 	export INSTALL_CONF_IPK="${IPKGCONF_TARGET}"
 	export INSTALL_PACKAGES_NORMAL_IPK="${PACKAGE_INSTALL}"
+	export INSTALL_PACKAGES_MULTILIB_IPK="${MULTILIB_PACKAGE_INSTALL}"
 
 	package_install_internal_ipk
 
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] image.bbclass: Added variables for multilib support.
  2011-07-26 22:50 [PATCH 0/3] Multilib image/package backend enablement Richard Purdie
  2011-07-26 22:50 ` [PATCH 1/3] package/rootfs_rpm: Implement RPM multilib package handling Richard Purdie
  2011-07-26 22:50 ` [PATCH 2/3] package(rootfs)_ipk.bbclass: support multilib in opkg backend Richard Purdie
@ 2011-07-26 22:50 ` Richard Purdie
  2 siblings, 0 replies; 7+ messages in thread
From: Richard Purdie @ 2011-07-26 22:50 UTC (permalink / raw)
  To: openembedded-core

From: Lianhao Lu <lianhao.lu@intel.com>

1. Added MULTILIB_PACKAGE_INSTALL for multilib instances of packages to
be installed in the rootfs.

2. MULTILIBRE_ALLOW_REP contains the regular expression to match the
files allow to be replaced by the conflicting files.

3. MULTILIBRE_FORCE_SAME contains the regular expression to match the
files allow to be replaced only if the conflicting files are identical.

4. Added shell function multilib_sanity_check() to check whether the
overwring for multilib situation is allowed.

Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
---
 meta/classes/image.bbclass |   54 +++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 53 insertions(+), 1 deletions(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index edfb2d6..1db915b 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -5,13 +5,15 @@ inherit imagetest-${IMAGETEST}
 
 LICENSE = "MIT"
 PACKAGES = ""
-RDEPENDS += "${IMAGE_INSTALL} ${LINGUAS_INSTALL}"
+MULTILIB_IMAGE_INSTALL ?= ""
+RDEPENDS += "${IMAGE_INSTALL} ${LINGUAS_INSTALL} ${MULTILIB_IMAGE_INSTALL}"
 
 INHIBIT_DEFAULT_DEPS = "1"
 
 # "export IMAGE_BASENAME" not supported at this time
 IMAGE_BASENAME[export] = "1"
 export PACKAGE_INSTALL ?= "${IMAGE_INSTALL}"
+export MULTILIB_PACKAGE_INSTALL ?= "${MULTILIB_IMAGE_INSTALL}"
 PACKAGE_INSTALL_ATTEMPTONLY ?= ""
 
 # Images are generally built explicitly, do not need to be part of world.
@@ -88,6 +90,7 @@ do_rootfs[umask] = 022
 fakeroot do_rootfs () {
 	#set -x
 	rm -rf ${IMAGE_ROOTFS}
+	rm -rf ${MULTILIB_TEMP_ROOTFS}
 	mkdir -p ${IMAGE_ROOTFS}
 	mkdir -p ${DEPLOY_DIR_IMAGE}
 
@@ -163,6 +166,55 @@ log_check() {
 	done
 }
 
+MULTILIBRE_ALLOW_REP =. "${base_bindir}|${base_sbindir}|${bindir}|${sbindir}|${libexecdir}|"
+MULTILIBRE_FORCE_SAME =. "${sysconfdir}|${datadir}|"
+MULTILIB_CHECK_FILE = "${WORKDIR}/multilib_check.py"
+MULTILIB_TEMP_ROOTFS = "${WORKDIR}/multilib"
+
+multilib_generate_python_file() {
+  cat >${MULTILIB_CHECK_FILE} <<EOF
+import sys, os, os.path
+import re,filecmp
+
+allow_rep=re.compile(re.sub("\|$","","${MULTILIBRE_ALLOW_REP}"))
+force_same=re.compile(re.sub("\|$","","${MULTILIBRE_FORCE_SAME}"))
+error_promt="Multilib check error:"
+
+files={}
+dirs=raw_input()
+for dir in dirs.split():
+  for root, subfolers, subfiles in os.walk(dir):
+    for file in subfiles:
+      item=os.path.join(root,file)
+      key=str(os.path.join("/",os.path.relpath(item,dir)))
+
+      valid=True;
+      if files.has_key(key):
+        #check whether files are the same
+        if force_same.match(key):
+          if not filecmp.cmp(files[key],item):
+             valid=False
+             print("%s %s is not the same as %s\n" % (error_promt, item, files[key]))
+             sys.exit(1)
+        #check whether the file is allow to replace
+        elif allow_rep.match(key):
+          valid=True
+        else: 
+          valid=False
+          print("%s duplicated files %s %s not allowed\n" % (error_promt, item, files[key]))
+          sys.exit(1)
+
+      #pass the check, add to list
+      if valid:
+        files[key]=item
+EOF
+}
+
+multilib_sanity_check() {
+  multilib_generate_python_file
+  echo $@ | python ${MULTILIB_CHECK_FILE}
+}
+
 # set '*' as the rootpassword so the images
 # can decide if they want it or not
 
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] package/rootfs_rpm: Implement RPM multilib package handling
  2011-07-26 22:50 ` [PATCH 1/3] package/rootfs_rpm: Implement RPM multilib package handling Richard Purdie
@ 2011-07-27  3:18   ` Mark Hatle
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Hatle @ 2011-07-27  3:18 UTC (permalink / raw)
  To: openembedded-core

We found a minor bug in the patch since it was first sent out:

On 7/26/11 5:50 PM, Richard Purdie wrote:
> From: Mark Hatle <mark.hatle@windriver.com>
> 
> This is a first pass at adding multilib support to the RPM package
> and image handling code.
> 
> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
> ---
>  meta/classes/package_rpm.bbclass |  229 ++++++++++++++++++++++++--------------
>  meta/classes/rootfs_rpm.bbclass  |   17 +++-
>  2 files changed, 160 insertions(+), 86 deletions(-)
> 
> diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
> index 2cc5742..05f3929 100644
> --- a/meta/classes/package_rpm.bbclass
> +++ b/meta/classes/package_rpm.bbclass
> @@ -21,67 +21,71 @@ RPMCONF_HOST_BASE = "${DEPLOY_DIR_RPM}/solvedb-sdk"
>  # Update the Packages depsolver db in ${DEPLOY_DIR_RPM}
>  #
>  package_update_index_rpm () {
> -	rpmarchs="${PACKAGE_ARCHS}"
> -
>  	if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then
>  		return
>  	fi
>  
> -	packagedirs=""
> -	packagedirs_sdk=""
> -	for arch in $rpmarchs ; 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
> -		packagedirs="${DEPLOY_DIR_RPM}/$arch $packagedirs"
> -		packagedirs_sdk="${DEPLOY_DIR_RPM}/$sdkarch$extension $packagedirs_sdk"
> +	base_package_archs="${PACKAGE_ARCHS}"
> +	ml_package_archs="${MULTILIB_PACKAGE_ARCHS}"
> +
> +	for archvar in base_package_archs ml_package_archs; do
> +		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
> +			packagedirs="${DEPLOY_DIR_RPM}/$arch $packagedirs"
> +			packagedirs_sdk="${DEPLOY_DIR_RPM}/$sdkarch$extension $packagedirs_sdk"
>  
> -		rm -rf ${DEPLOY_DIR_RPM}/$arch/solvedb
> -		rm -rf ${DEPLOY_DIR_RPM}/$sdkarch$extension/solvedb
> -	done
> +			rm -rf ${DEPLOY_DIR_RPM}/$arch/solvedb
> +			rm -rf ${DEPLOY_DIR_RPM}/$sdkarch$extension/solvedb
> +		done
>  
> -	cat /dev/null > ${RPMCONF_TARGET_BASE}.conf
> -	for pkgdir in $packagedirs; do
> -		if [ -e $pkgdir/ ]; then
> -			echo "Generating solve db for $pkgdir..."
> -			echo $pkgdir/solvedb >> ${RPMCONF_TARGET_BASE}.conf
> -			if [ -d $pkgdir/solvedb ]; then
> -				# We've already processed this and it's a duplicate
> -				continue
> +		cat /dev/null > ${RPMCONF_TARGET_BASE}-${archvar}.conf
> +		for pkgdir in $packagedirs; do
> +			if [ -e $pkgdir/ ]; then
> +				echo "Generating solve db for $pkgdir..."
> +				echo $pkgdir/solvedb >> ${RPMCONF_TARGET_BASE}-${archvar}.conf
> +				if [ -d $pkgdir/solvedb ]; then
> +					# We've already processed this and it's a duplicate
> +					continue
> +				fi
> +				mkdir -p $pkgdir/solvedb
> +				echo "# Dynamically generated solve manifest" >> $pkgdir/solvedb/manifest
> +				find $pkgdir -maxdepth 1 -type f >> $pkgdir/solvedb/manifest
> +				${RPM} -i --replacepkgs --replacefiles --oldpackage \
> +					-D "_dbpath $pkgdir/solvedb" --justdb \
> +					--noaid --nodeps --noorder --noscripts --notriggers --noparentdirs --nolinktos --stats \
> +					--ignoresize --nosignature --nodigest \
> +					-D "__dbi_txn create nofsync" \
> +					$pkgdir/solvedb/manifest
>  			fi
> -			mkdir -p $pkgdir/solvedb
> -			echo "# Dynamically generated solve manifest" >> $pkgdir/solvedb/manifest
> -			find $pkgdir -maxdepth 1 -type f >> $pkgdir/solvedb/manifest
> -			${RPM} -i --replacepkgs --replacefiles --oldpackage \
> -				-D "_dbpath $pkgdir/solvedb" --justdb \
> -				--noaid --nodeps --noorder --noscripts --notriggers --noparentdirs --nolinktos --stats \
> -				--ignoresize --nosignature --nodigest \
> -				-D "__dbi_txn create nofsync" \
> -				$pkgdir/solvedb/manifest
> -		fi
> -	done
> +		done
>  
> -	cat /dev/null > ${RPMCONF_HOST_BASE}.conf
> -	for pkgdir in $packagedirs_sdk; do
> -		if [ -e $pkgdir/ ]; then
> -			echo "Generating solve db for $pkgdir..."
> -			echo $pkgdir/solvedb >> ${RPMCONF_HOST_BASE}.conf
> -			if [ -d $pkgdir/solvedb ]; then
> -				# We've already processed this and it's a duplicate
> -				continue
> -			fi	
> -			mkdir -p $pkgdir/solvedb
> -			echo "# Dynamically generated solve manifest" >> $pkgdir/solvedb/manifest
> -			find $pkgdir -maxdepth 1 -type f >> $pkgdir/solvedb/manifest
> -			${RPM} -i --replacepkgs --replacefiles --oldpackage \
> -				-D "_dbpath $pkgdir/solvedb" --justdb \
> -				--noaid --nodeps --noorder --noscripts --notriggers --noparentdirs --nolinktos --stats \
> -				--ignoresize --nosignature --nodigest \
> -				-D "__dbi_txn create nofsync" \
> -				$pkgdir/solvedb/manifest
> -		fi
> +		cat /dev/null > ${RPMCONF_HOST_BASE}.conf

The above line should be:

cat /dev/null > ${RPMCONF_HOST_BASE}-${archvar}.conf

....



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] package(rootfs)_ipk.bbclass: support multilib in opkg backend.
  2011-07-26 22:50 ` [PATCH 2/3] package(rootfs)_ipk.bbclass: support multilib in opkg backend Richard Purdie
@ 2011-07-30 16:23   ` Khem Raj
  2011-08-01  1:12     ` Lu, Lianhao
  0 siblings, 1 reply; 7+ messages in thread
From: Khem Raj @ 2011-07-30 16:23 UTC (permalink / raw)
  To: openembedded-core

On Tuesday, July 26, 2011 11:50:26 PM Richard Purdie wrote:
> From: Lianhao Lu <lianhao.lu@intel.com>
> 
> Support install multiple multilib in opkg backend.
> 
> The installation is done in 3 phases.
> 
> Phase 1: install normal packages to IMAGE_ROOTFS.
> 
> Phase 2: install multilib packages under MULTILIB_TEMP_ROOTFS. Packages
> belongs to the same multilib arch would be installed to a unique
> directory.
> 
> Phase 3: check file confliction between IMAGE_ROOTFS and
> MULTILIB_TEMP_ROOTFS, install multilib packages to IMAGE_ROOTFS only if
> the sanity check passed.
> 
> Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
> ---
>  meta/classes/package_ipk.bbclass |   51
> ++++++++++++++++++++++++++++++++++++++ meta/classes/rootfs_ipk.bbclass  |  
>  2 +
>  2 files changed, 53 insertions(+), 0 deletions(-)
> 
> diff --git a/meta/classes/package_ipk.bbclass
> b/meta/classes/package_ipk.bbclass index 0c0f00d..b7afa83 100644
> --- a/meta/classes/package_ipk.bbclass
> +++ b/meta/classes/package_ipk.bbclass
> @@ -61,6 +61,28 @@ python package_ipk_install () {
>  		raise bb.build.FuncFailed
>  }
> 
> +package_tryout_install_multilib_ipk() {
> +	#try install multilib
> +	multilib_tryout_dirs=""
> +	for arch in ${MULTILIB_ARCHS}; do
> +		local target_rootfs="${MULTILIB_TEMP_ROOTFS}/${arch}"
> +		local ipkg_args="-f ${INSTALL_CONF_IPK} -o ${target_rootfs}
> --force_overwrite" +		local selected_pkg=""
> +		#strip the "ml" from package_arch
> +		local pkgarch_prefix="${arch:2}-"
> +		for pkg in "${INSTALL_PACKAGES_MULTILIB_IPK}"; do
> +			if [ ${pkg:0:${#pkgarch_prefix}} == ${pkgarch_prefix} ]; then
> +			    selected_pkg="${selected_pkg} ${pkg}"
> +			fi
> +		done
> +		if [ ! -z "${selected_pkg}" ]; then
> +			mkdir -p ${target_rootfs}/${opkglibdir}
> +			opkg-cl ${ipkg_args} update
> +			opkg-cl ${ipkg_args} install ${selected_pkg}
> +			multilib_tryout_dirs="${multilib_tryout_dirs} ${target_rootfs}"
> +		fi
> +	done
> +}

we use --force-overwrite and if mistakenly if a multilib package installs into
standard paths will opkg inform about it ?

>  #
>  # install a bunch of packages using opkg
>  # the following shell variables needs to be set before calling this func:
> @@ -78,6 +100,7 @@ package_install_internal_ipk() {
>  	local package_to_install="${INSTALL_PACKAGES_NORMAL_IPK}"
>  	local package_attemptonly="${INSTALL_PACKAGES_ATTEMPTONLY_IPK}"
>  	local package_lingusa="${INSTALL_PACKAGES_LINGUAS_IPK}"
> +	local package_multilib="${INSTALL_PACKAGES_MULTILIB_IPK}"
>  	local task="${INSTALL_TASK_IPK}"
> 
>  	mkdir -p ${target_rootfs}${localstatedir}/lib/opkg/
> @@ -102,6 +125,14 @@ package_install_internal_ipk() {
>  	if [ ! -z "${package_attemptonly}" ]; then
>  		opkg-cl ${ipkg_args} install ${package_attemptonly} >
> "${WORKDIR}/temp/log.do_${task}_attemptonly.${PID}" || true fi
> +
> +	package_tryout_install_multilib_ipk
> +	#sanity check
> +	multilib_sanity_check  ${target_rootfs} ${multilib_tryout_dirs}|| exit 1
> +
> +	if [ ! -z "${package_multilib}" ]; then
> +		opkg-cl ${ipkg_args} install ${package_multilib}
> +	fi
>  }
> 
>  ipk_log_check() {
> @@ -142,6 +173,11 @@ package_update_index_ipk () {
>  		packagedirs="$packagedirs ${DEPLOY_DIR_IPK}/$arch
> ${DEPLOY_DIR_IPK}/$sdkarch-nativesdk" done
> 
> +	multilib_archs="${MULTILIB_ARCHS}"
> +	for arch in $multilib_archs; do
> +		packagedirs="$packagedirs ${DEPLOY_DIR_IPK}/$arch"
> +	done
> +
>  	for pkgdir in $packagedirs; do
>  		if [ -e $pkgdir/ ]; then
>  			touch $pkgdir/Packages
> @@ -173,6 +209,13 @@ package_generate_ipkg_conf () {
>  		        echo "src oe-$sdkarch$extension
> file:${DEPLOY_DIR_IPK}/$sdkarch$extension" >> ${IPKGCONF_SDK} fi
>  	done
> +
> +	multilib_archs="${MULTILIB_ARCHS}"
> +	for arch in $multilib_archs; do
> +		if [ -e ${DEPLOY_DIR_IPK}/$arch/Packages ] ; then
> +		        echo "src oe-$arch file:${DEPLOY_DIR_IPK}/$arch" >>
> ${IPKGCONF_TARGET} +		fi
> +	done
>  }
> 
>  package_generate_archlist () {
> @@ -188,6 +231,14 @@ package_generate_archlist () {
>  		echo "arch $sdkarch$extension $priority" >> ${IPKGCONF_SDK}
>  		priority=$(expr $priority + 5)
>  	done
> +
> +	multilib_archs="${MULTILIB_ARCHS}"
> +	for arch in $multilib_archs; do
> +		echo "arch $arch $priority" >> ${IPKGCONF_TARGET}
> +		priority=$(expr $priority + 5)
> +	done
> +
> +
>  }
> 
>  python do_package_ipk () {
> diff --git a/meta/classes/rootfs_ipk.bbclass
> b/meta/classes/rootfs_ipk.bbclass index 4fcacc6..695bee0 100644
> --- a/meta/classes/rootfs_ipk.bbclass
> +++ b/meta/classes/rootfs_ipk.bbclass
> @@ -22,6 +22,7 @@ opkglibdir = "${localstatedir}/lib/opkg"
> 
>  # Which packages to not install on the basis of a recommendation
>  BAD_RECOMMENDATIONS ?= ""
> +MULTILIBRE_ALLOW_REP = "${opkglibdir}"
> 
>  fakeroot rootfs_ipk_do_rootfs () {
>  	set -x
> @@ -58,6 +59,7 @@ fakeroot rootfs_ipk_do_rootfs () {
>  	export INSTALL_ROOTFS_IPK="${IMAGE_ROOTFS}"
>  	export INSTALL_CONF_IPK="${IPKGCONF_TARGET}"
>  	export INSTALL_PACKAGES_NORMAL_IPK="${PACKAGE_INSTALL}"
> +	export INSTALL_PACKAGES_MULTILIB_IPK="${MULTILIB_PACKAGE_INSTALL}"
> 
>  	package_install_internal_ipk
-- 
Khem Raj



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] package(rootfs)_ipk.bbclass: support multilib in opkg backend.
  2011-07-30 16:23   ` Khem Raj
@ 2011-08-01  1:12     ` Lu, Lianhao
  0 siblings, 0 replies; 7+ messages in thread
From: Lu, Lianhao @ 2011-08-01  1:12 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

Khem Raj wrote on 2011-07-31:
> On Tuesday, July 26, 2011 11:50:26 PM Richard Purdie wrote:
>> From: Lianhao Lu <lianhao.lu@intel.com>
>> 
>> Support install multiple multilib in opkg backend.
>> 
>> The installation is done in 3 phases.
>> 
>> Phase 1: install normal packages to IMAGE_ROOTFS.
>> 
>> Phase 2: install multilib packages under MULTILIB_TEMP_ROOTFS.
>> Packages belongs to the same multilib arch would be installed to a
>> unique directory.
>> 
>> Phase 3: check file confliction between IMAGE_ROOTFS and
>> MULTILIB_TEMP_ROOTFS, install multilib packages to IMAGE_ROOTFS only
>> if the sanity check passed.
>> 
>> Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
>> ---
>>  meta/classes/package_ipk.bbclass |   51
>> ++++++++++++++++++++++++++++++++++++++ meta/classes/rootfs_ipk.bbclass
>> ++++++++++++++++++++++++++++++++++++++ |
>>  2 +
>>  2 files changed, 53 insertions(+), 0 deletions(-)
>> diff --git a/meta/classes/package_ipk.bbclass
>> b/meta/classes/package_ipk.bbclass index 0c0f00d..b7afa83 100644
>> --- a/meta/classes/package_ipk.bbclass
>> +++ b/meta/classes/package_ipk.bbclass
>> @@ -61,6 +61,28 @@ python package_ipk_install () {
>>  		raise bb.build.FuncFailed
>>  }
>> +package_tryout_install_multilib_ipk() {
>> +	#try install multilib
>> +	multilib_tryout_dirs=""
>> +	for arch in ${MULTILIB_ARCHS}; do
>> +		local target_rootfs="${MULTILIB_TEMP_ROOTFS}/${arch}"
>> +		local ipkg_args="-f ${INSTALL_CONF_IPK} -o ${target_rootfs}
>> --force_overwrite" +		local selected_pkg=""
>> +		#strip the "ml" from package_arch
>> +		local pkgarch_prefix="${arch:2}-"
>> +		for pkg in "${INSTALL_PACKAGES_MULTILIB_IPK}"; do
>> +			if [ ${pkg:0:${#pkgarch_prefix}} == ${pkgarch_prefix} ]; then
>> +			    selected_pkg="${selected_pkg} ${pkg}"
>> +			fi
>> +		done
>> +		if [ ! -z "${selected_pkg}" ]; then
>> +			mkdir -p ${target_rootfs}/${opkglibdir}
>> +			opkg-cl ${ipkg_args} update
>> +			opkg-cl ${ipkg_args} install ${selected_pkg}
>> +			multilib_tryout_dirs="${multilib_tryout_dirs} ${target_rootfs}"
>> +		fi
>> +	done
>> +}
> 
> we use --force-overwrite and if mistakenly if a multilib package
> installs into standard paths will opkg inform about it ?

I'm afraid it will not. That's why we need to check the confliction before we finally get the multilib packages installed.
 
>>  #
>>  # install a bunch of packages using opkg  # the following shell
>> variables needs to be set before calling this func:
>> @@ -78,6 +100,7 @@ package_install_internal_ipk() {
>>  	local package_to_install="${INSTALL_PACKAGES_NORMAL_IPK}" 	local
>>  package_attemptonly="${INSTALL_PACKAGES_ATTEMPTONLY_IPK}" 	local
>>  package_lingusa="${INSTALL_PACKAGES_LINGUAS_IPK}" +	local
>>  package_multilib="${INSTALL_PACKAGES_MULTILIB_IPK}" 	local
>>  task="${INSTALL_TASK_IPK}"
>>  
>>  	mkdir -p ${target_rootfs}${localstatedir}/lib/opkg/ @@ -102,6 +125,14
>>  @@ package_install_internal_ipk() { 	if [ ! -z
>>  "${package_attemptonly}" ]; then 		opkg-cl ${ipkg_args} install
>>  ${package_attemptonly} >
>> "${WORKDIR}/temp/log.do_${task}_attemptonly.${PID}" || true fi
>> +
>> +	package_tryout_install_multilib_ipk
>> +	#sanity check
>> +	multilib_sanity_check  ${target_rootfs} ${multilib_tryout_dirs}||
>> +exit 1
>> +
>> +	if [ ! -z "${package_multilib}" ]; then
>> +		opkg-cl ${ipkg_args} install ${package_multilib}
>> +	fi
>>  }
>>  
>>  ipk_log_check() { @@ -142,6 +173,11 @@ package_update_index_ipk () {
>>  		packagedirs="$packagedirs ${DEPLOY_DIR_IPK}/$arch
>> ${DEPLOY_DIR_IPK}/$sdkarch-nativesdk" done
>> 
>> +	multilib_archs="${MULTILIB_ARCHS}"
>> +	for arch in $multilib_archs; do
>> +		packagedirs="$packagedirs ${DEPLOY_DIR_IPK}/$arch"
>> +	done
>> +
>>  	for pkgdir in $packagedirs; do 		if [ -e $pkgdir/ ]; then 			touch
>>  $pkgdir/Packages @@ -173,6 +209,13 @@ package_generate_ipkg_conf () {
>>  		        echo "src oe-$sdkarch$extension
>>  file:${DEPLOY_DIR_IPK}/$sdkarch$extension" >> ${IPKGCONF_SDK} fi 	done
>> +
>> +	multilib_archs="${MULTILIB_ARCHS}"
>> +	for arch in $multilib_archs; do
>> +		if [ -e ${DEPLOY_DIR_IPK}/$arch/Packages ] ; then
>> +		        echo "src oe-$arch file:${DEPLOY_DIR_IPK}/$arch" >>
>> ${IPKGCONF_TARGET} +		fi
>> +	done
>>  }
>>  
>>  package_generate_archlist () { @@ -188,6 +231,14 @@
>>  package_generate_archlist () { 		echo "arch $sdkarch$extension
>>  $priority" >> ${IPKGCONF_SDK} 		priority=$(expr $priority + 5) 	done
>> +
>> +	multilib_archs="${MULTILIB_ARCHS}"
>> +	for arch in $multilib_archs; do
>> +		echo "arch $arch $priority" >> ${IPKGCONF_TARGET}
>> +		priority=$(expr $priority + 5)
>> +	done
>> +
>> +
>>  }
>>  
>>  python do_package_ipk () {
>> diff --git a/meta/classes/rootfs_ipk.bbclass
>> b/meta/classes/rootfs_ipk.bbclass index 4fcacc6..695bee0 100644
>> --- a/meta/classes/rootfs_ipk.bbclass
>> +++ b/meta/classes/rootfs_ipk.bbclass
>> @@ -22,6 +22,7 @@ opkglibdir = "${localstatedir}/lib/opkg"
>> 
>>  # Which packages to not install on the basis of a recommendation
>> BAD_RECOMMENDATIONS ?= ""
>> +MULTILIBRE_ALLOW_REP = "${opkglibdir}"
>> 
>>  fakeroot rootfs_ipk_do_rootfs () { 	set -x @@ -58,6 +59,7 @@ fakeroot
>>  rootfs_ipk_do_rootfs () { 	export INSTALL_ROOTFS_IPK="${IMAGE_ROOTFS}"
>>  	export INSTALL_CONF_IPK="${IPKGCONF_TARGET}" 	export
>>  INSTALL_PACKAGES_NORMAL_IPK="${PACKAGE_INSTALL}"
>> +	export INSTALL_PACKAGES_MULTILIB_IPK="${MULTILIB_PACKAGE_INSTALL}"
>> 
>>  	package_install_internal_ipk

Best Regards,
Lianhao





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-08-01  1:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-26 22:50 [PATCH 0/3] Multilib image/package backend enablement Richard Purdie
2011-07-26 22:50 ` [PATCH 1/3] package/rootfs_rpm: Implement RPM multilib package handling Richard Purdie
2011-07-27  3:18   ` Mark Hatle
2011-07-26 22:50 ` [PATCH 2/3] package(rootfs)_ipk.bbclass: support multilib in opkg backend Richard Purdie
2011-07-30 16:23   ` Khem Raj
2011-08-01  1:12     ` Lu, Lianhao
2011-07-26 22:50 ` [PATCH 3/3] image.bbclass: Added variables for multilib support Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox