Skip to contentSkip to conversation

Added generic populate_sdk task

PATCH In review Lianhao Lu 2 participants 10 messages Jan 30, 2011 – Jan 31, 2011

lore
Share & tools
lore

Lianhao Lu

author
#0 lore raw

cover Added generic populate_sdk task

From: Lianhao Lu <[email protected]>

The purpose of this series of patches is to add rpm/deb support in meta-toolchain creation, and also to fix bug #227.

It makes the task populate_sdk in meta/recipes-core/meta/meta-toolchain.bb more generic to support installing packages from ipk, rpm, and deb files in creating meta-toolchain tarball, and move the populate_sdk task out of meta-toolchain.bb recipe into a bbclass.

It added populate_sdk_xxx.bbclass for different package file format.

Since there are quite many code duplication between relevant popuplage_sdk_xxx and rootfs_xxx bbclasses, it also moved the common code into the package_xxx.bbclass, based on RP's suggestion. The generic function package_install_internal_xxx() may installs a list of packages, based on the information specified by various shell environment variables about where the target directory to be installed to, package architecture information, etc.

Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: llu/bug227
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=llu/bug227

Thanks,
Lianhao Lu <[email protected]>
---

Lianhao Lu (8):
image/package_xx/rootfs_xx.bbclass: move rootfs_xx_log_check(). rootfs_deb/package_deb.bbclass: move func from rootfs_deb to
package_deb
rootfs_ipk/package_ipk.bbclass: Move func from rootfs_ipk to
package_ipk
rootfs_rpm/package_rpm.bbclass: Move func from rootfs_rpm to
package_rpm
populate_sdk_rpm.bbclass: Added rpm support for populate_sdk task. populate_sdk_deb.bbclass: Added deb support for populate_sdk task. populate_sdk_ipk.bbclass: Added ipk support in populate_sdk task. populate_sdk.bbclass/meta-toolchain: Made populate_sdk task more
generic

 meta/classes/image.bbclass               |    5 +-
 meta/classes/package_deb.bbclass         |  145 +++++++++++++++++
 meta/classes/package_ipk.bbclass         |   63 ++++++++
 meta/classes/package_rpm.bbclass         |  250 ++++++++++++++++++++++++++++--
 meta/classes/populate_sdk.bbclass        |   82 ++++++++++
 meta/classes/populate_sdk_deb.bbclass    |   60 +++++++
 meta/classes/populate_sdk_ipk.bbclass    |   44 ++++++
 meta/classes/populate_sdk_rpm.bbclass    |   80 ++++++++++
 meta/classes/rootfs_deb.bbclass          |  111 ++-----------
 meta/classes/rootfs_ipk.bbclass          |   45 +-----
 meta/classes/rootfs_rpm.bbclass          |  168 ++------------------
 meta/recipes-core/meta/meta-toolchain.bb |  103 +------------
 12 files changed, 757 insertions(+), 399 deletions(-)
 create mode 100644 meta/classes/populate_sdk.bbclass
 create mode 100644 meta/classes/populate_sdk_deb.bbclass
 create mode 100644 meta/classes/populate_sdk_ipk.bbclass
 create mode 100644 meta/classes/populate_sdk_rpm.bbclass
author
#1 lore raw

PATCH 1/8 image/package_xx/rootfs_xx.bbclass: move rootfs_xx_log_check().

From: Lianhao Lu <[email protected]>

Move function rootfs_xx_log_check() from rootfs_xx.bbclass to relevant package_xx.bbclass. (Where xx is rpm/ipk/deb).

---
 meta/classes/image.bbclass       |    5 +----
 meta/classes/package_deb.bbclass |   20 ++++++++++++++++++++
 meta/classes/package_ipk.bbclass |   20 ++++++++++++++++++++
 meta/classes/package_rpm.bbclass |   20 ++++++++++++++++++++
 meta/classes/rootfs_deb.bbclass  |   20 --------------------
 meta/classes/rootfs_ipk.bbclass  |   20 --------------------
 meta/classes/rootfs_rpm.bbclass  |   20 --------------------
 7 files changed, 61 insertions(+), 64 deletions(-)
meta/classes/image.bbclass +1 -4
index 8e8d92b..14de3e1 100644
@@ -155,7 +155,6 @@ insert_feed_uris () {
 }
 
 log_check() {
-	set +x
 	for target in $*
 	do
 		lf_path="${WORKDIR}/temp/log.do_$target.${PID}"
@@ -164,14 +163,12 @@ log_check() {
 		
 		if test -e "$lf_path"
 		then
-			rootfs_${IMAGE_PKGTYPE}_log_check $target $lf_path
+			${IMAGE_PKGTYPE}_log_check $target $lf_path
 		else
 			echo "Cannot find logfile [$lf_path]"
 		fi
 		echo "Logfile is clean"
 	done
-
-	set -x
 }
 
 # set '*' as the rootpassword so the images
meta/classes/package_deb.bbclass +20 -0
index 29dcc5c..2181ce7 100644
@@ -67,6 +67,26 @@ python do_package_deb_install () {
     os.putenv('PATH', path)
 }
 
+deb_log_check() {
+	target="$1"
+	lf_path="$2"
+
+	lf_txt="`cat $lf_path`"
+	for keyword_die in "E:"
+	do
+		if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
+		then
+			echo "log_check: There were error messages in the logfile"
+			echo -e "log_check: Matched keyword: [$keyword_die]\n"
+			echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die"
+			echo ""
+			do_exit=1
+		fi
+	done
+	test "$do_exit" = 1 && exit 1
+	true
+}
+
 python do_package_deb () {
     import re, copy
     import textwrap
meta/classes/package_ipk.bbclass +20 -0
index fdf3262..ba76874 100644
@@ -61,6 +61,26 @@ python package_ipk_install () {
 		raise bb.build.FuncFailed
 }
 
+ipk_log_check() {
+       target="$1"
+       lf_path="$2"
+
+       lf_txt="`cat $lf_path`"
+       for keyword_die in "exit 1" "Collected errors" ERR Fail
+       do
+               if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
+               then
+                       echo "log_check: There were error messages in the logfile"
+                       echo -e "log_check: Matched keyword: [$keyword_die]\n"
+                       echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die"
+                       echo ""
+                       do_exit=1
+               fi
+       done
+       test "$do_exit" = 1 && exit 1
+       true
+}
+
 #
 # Update the Packages index files in ${DEPLOY_DIR_IPK}
 #
meta/classes/package_rpm.bbclass +20 -0
index 7c2cdb0..076d6cf 100644
@@ -70,6 +70,26 @@ package_generate_rpm_conf () {
 	printf "\n" >> ${DEPLOY_DIR_RPM}/solvedb.macro
 }
 
+rpm_log_check() {
+       target="$1"
+       lf_path="$2"
+
+       lf_txt="`cat $lf_path`"
+       for keyword_die in "Cannot find package" "exit 1" ERR Fail
+       do
+               if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
+               then
+                       echo "log_check: There were error messages in the logfile"
+                       echo -e "log_check: Matched keyword: [$keyword_die]\n"
+                       echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die"
+                       echo ""
+                       do_exit=1
+               fi
+       done
+       test "$do_exit" = 1 && exit 1
+       true
+}
+
 python write_specfile () {
 	import textwrap
 
meta/classes/rootfs_deb.bbclass +0 -20
index f579b53..1335e71 100644
@@ -136,26 +136,6 @@ fakeroot rootfs_deb_do_rootfs () {
 	log_check rootfs 
 }
 
-rootfs_deb_log_check() {
-	target="$1"
-        lf_path="$2"
-
-	lf_txt="`cat $lf_path`"
-	for keyword_die in "E:"
-	do				
-		if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
-		then
-			echo "log_check: There were error messages in the logfile"
-			echo -e "log_check: Matched keyword: [$keyword_die]\n"
-			echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die"
-			echo ""
-			do_exit=1
-		fi
-	done
-	test "$do_exit" = 1 && exit 1						
-	true
-}
-
 remove_packaging_data_files() {
 	rm -rf ${IMAGE_ROOTFS}${opkglibdir}
 	rm -rf ${IMAGE_ROOTFS}/usr/dpkg/
meta/classes/rootfs_ipk.bbclass +0 -20
index 593a403..07c114e 100644
@@ -82,26 +82,6 @@ fakeroot rootfs_ipk_do_rootfs () {
 	log_check rootfs 	
 }
 
-rootfs_ipk_log_check() {
-	target="$1"
-        lf_path="$2"
-
-	lf_txt="`cat $lf_path`"
-	for keyword_die in "exit 1" "Collected errors" ERR Fail
-	do				
-		if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
-		then
-			echo "log_check: There were error messages in the logfile"
-			echo -e "log_check: Matched keyword: [$keyword_die]\n"
-			echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die"
-			echo ""
-			do_exit=1				
-		fi
-	done
-	test "$do_exit" = 1 && exit 1
-	true
-}
-
 rootfs_ipk_write_manifest() {
 	manifest=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.manifest
 	cp ${IMAGE_ROOTFS}${opkglibdir}/status $manifest
meta/classes/rootfs_rpm.bbclass +0 -20
index 93223ab..fc8251c 100644
@@ -226,26 +226,6 @@ EOF
 	fi
 }
 
-rootfs_rpm_log_check() {
-	target="$1"
-        lf_path="$2"
-
-	lf_txt="`cat $lf_path`"
-	for keyword_die in "Cannot find package" "exit 1" ERR Fail
-	do
-		if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
-		then
-			echo "log_check: There were error messages in the logfile"
-			echo -e "log_check: Matched keyword: [$keyword_die]\n"
-			echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die"
-			echo ""
-			do_exit=1
-		fi
-	done
-	test "$do_exit" = 1 && exit 1
-	true
-}
-
 remove_packaging_data_files() {
 	rm -rf ${IMAGE_ROOTFS}${rpmlibdir}
 	rm -rf ${IMAGE_ROOTFS}${opkglibdir}
Signature · 1 line
1.7.0.4
#2 lore raw

Re: [PATCH 1/8] image/package_xx/rootfs_xx.bbclass: move rootfs_xx_log_check().

Quoted 6 lines · Lianhao Lu

From: Lianhao Lu <[email protected]>

Move function rootfs_xx_log_check() from rootfs_xx.bbclass to relevant package_xx.bbclass. (Where xx is rpm/ipk/deb).

Quoted 9 lines
---
 meta/classes/image.bbclass       |    5 +----
 meta/classes/package_deb.bbclass |   20 ++++++++++++++++++++
 meta/classes/package_ipk.bbclass |   20 ++++++++++++++++++++
 meta/classes/package_rpm.bbclass |   20 ++++++++++++++++++++
 meta/classes/rootfs_deb.bbclass  |   20 --------------------
 meta/classes/rootfs_ipk.bbclass  |   20 --------------------
 meta/classes/rootfs_rpm.bbclass  |   20 --------------------
 7 files changed, 61 insertions(+), 64 deletions(-)

I've merged this to master since it is an improvement, thanks. Given the similarity between the functions it would be nice to perhaps just define a list of error strings in the package_xxx.bbclass and then have the code to search for those strings in a shared core function?

Cheers,

Richard

author
#3 lore raw

PATCH 2/8 rootfs_deb/package_deb.bbclass: move func from rootfs_deb to package_deb

In reply to Lianhao Lu

From: Lianhao Lu <[email protected]>

package_deb.bbclass:
1. Added new function package_update_index_deb() to generate package index files.

2. Added new function package_install_internal_deb() to install a list deb packages to a specified root directory, with the specified package architecutre information.

rootfs_deb.bbclass:
Used the above new functions to install the rootfs.

---
 meta/classes/package_deb.bbclass |  125 ++++++++++++++++++++++++++++++++++++++
 meta/classes/rootfs_deb.bbclass  |   91 +++++-----------------------
 2 files changed, 141 insertions(+), 75 deletions(-)
meta/classes/package_deb.bbclass +125 -0
index 2181ce7..52bd264 100644
@@ -67,6 +67,131 @@ python do_package_deb_install () {
     os.putenv('PATH', path)
 }
 
+#
+# Update the Packages index files in ${DEPLOY_DIR_DEB}
+#
+package_update_index_deb () {
+
+	local debarchs=""
+
+	if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then
+		return
+	fi
+
+	for arch in ${PACKAGE_ARCHS}; do
+		sdkarch=`echo $arch | sed -e 's/${HOST_ARCH}/${SDK_ARCH}/'`
+		if [ -e ${DEPLOY_DIR_DEB}/$arch ]; then
+			debarchs="$debarchs $arch"
+		fi
+		if [ -e ${DEPLOY_DIR_DEB}/$sdkarch-nativesdk ]; then
+			debarchs="$debarchs $sdkarch-nativesdk"
+		fi
+	done
+
+	for arch in $debarchs; do
+		if [ ! -d ${DEPLOY_DIR_DEB}/$arch ]; then
+			continue;
+		fi
+		cd ${DEPLOY_DIR_DEB}/$arch
+		dpkg-scanpackages . | bzip2 > Packages.bz2
+		echo "Label: $arch" > Release
+	done
+}
+
+#
+# install a bunch of packages using apt
+# the following shell variables needs to be set before calling this func:
+# INSTALL_ROOTFS_DEB - install root dir
+# INSTALL_BASEARCH_DEB - install base architecutre
+# INSTALL_ARCHS_DEB - list of available archs
+# INSTALL_PACKAGES_NORMAL_DEB - packages to be installed
+# INSTALL_PACKAGES_ATTEMPTONLY_DEB - packages attemped to be installed only
+# INSTALL_PACKAGES_LINGUAS_DEB - additional packages for uclibc
+# INSTALL_TASK_DEB - task name
+
+package_install_internal_deb () {
+
+	local target_rootfs="${INSTALL_ROOTFS_DEB}"
+	local dpkg_arch="${INSTALL_BASEARCH_DEB}"
+	local archs="${INSTALL_ARCHS_DEB}"
+	local package_to_install="${INSTALL_PACKAGES_NORMAL_DEB}"
+	local package_attemptonly="${INSTALL_PACKAGES_ATTEMPTONLY_DEB}"
+	local package_lingusa="${INSTALL_PACKAGES_LINGUAS_DEB}"
+	local task="${INSTALL_TASK_DEB}"
+
+	rm -f ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev
+	rm -f ${STAGING_ETCDIR_NATIVE}/apt/preferences
+
+	priority=1
+	for arch in $archs; do
+		if [ ! -d ${DEPLOY_DIR_DEB}/$arch ]; then
+			continue;
+		fi
+
+		echo "deb file:${DEPLOY_DIR_DEB}/$arch/ ./" >> ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev
+		(echo "Package: *"
+		echo "Pin: release l=$arch"
+		echo "Pin-Priority: $(expr 800 + $priority)"
+		echo) >> ${STAGING_ETCDIR_NATIVE}/apt/preferences
+		priority=$(expr $priority + 5)
+	done
+
+	tac ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev > ${STAGING_ETCDIR_NATIVE}/apt/sources.list
+
+	cat "${STAGING_ETCDIR_NATIVE}/apt/apt.conf.sample" \
+		| sed -e "s#Architecture \".*\";#Architecture \"${dpkg_arch}\";#" \
+		| sed -e "s:#ROOTFS#:${target_rootfs}:g" \
+		> "${STAGING_ETCDIR_NATIVE}/apt/apt-${task}.conf"
+
+	export APT_CONFIG="${STAGING_ETCDIR_NATIVE}/apt/apt-${task}.conf"
+
+	mkdir -p ${target_rootfs}/var/dpkg/info
+	mkdir -p ${target_rootfs}/var/dpkg/updates
+
+	> ${target_rootfs}/var/dpkg/status
+	> ${target_rootfs}/var/dpkg/available
+
+	apt-get update
+
+	# Uclibc builds don't provide this stuff..
+	if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then
+		if [ ! -z "${package_lingusa}" ]; then
+			apt-get install glibc-localedata-i18n --force-yes --allow-unauthenticated
+			if [ $? -ne 0 ]; then
+				exit 1
+			fi
+			for i in ${package_lingusa}; do
+				apt-get install $i --force-yes --allow-unauthenticated
+				if [ $? -ne 0 ]; then
+					exit 1
+				fi
+			done
+		fi
+	fi
+
+	# normal install
+	for i in ${package_to_install}; do
+		apt-get install $i --force-yes --allow-unauthenticated
+		if [ $? -ne 0 ]; then
+			exit 1
+		fi
+	done
+
+	rm -f ${WORKDIR}/temp/log.do_${task}-attemptonly.${PID}
+	if [ ! -z "${package_attemptonly}" ]; then
+		for i in ${package_attemptonly}; do
+			apt-get install $i --force-yes --allow-unauthenticated >> ${WORKDIR}/temp/log.do_${task}-attemptonly.${PID} || true
+		done
+	fi
+
+	find ${target_rootfs} -name \*.dpkg-new | for i in `cat`; do
+		mv $i `echo $i | sed -e's,\.dpkg-new$,,'`
+	done
+
+	# Mark all packages installed
+	sed -i -e "s/Status: install ok unpacked/Status: install ok installed/;" ${target_rootfs}/var/dpkg/status
+}
+
 deb_log_check() {
 	target="$1"
 	lf_path="$2"
meta/classes/rootfs_deb.bbclass +16 -75

126 lines not on this page · raw message

Signature · 1 line
1.7.0.4
author
#4 lore raw

PATCH 3/8 rootfs_ipk/package_ipk.bbclass: Move func from rootfs_ipk to package_ipk

In reply to Lianhao Lu

From: Lianhao Lu <[email protected]>

package_ipk.bbclass:
Added new function package_install_internal_ipk() to install a list of ipk packages to a specified root directory, with the specified package architecutre information.

rootfs_ipk.bbclass:
Used the above new functions to install rootfs.

---
 meta/classes/package_ipk.bbclass |   43 ++++++++++++++++++++++++++++++++++++++
 meta/classes/rootfs_ipk.bbclass  |   31 ++++++++++----------------
 2 files changed, 55 insertions(+), 19 deletions(-)
meta/classes/package_ipk.bbclass +43 -0
index ba76874..3c2472b 100644
@@ -61,6 +61,49 @@ python package_ipk_install () {
 		raise bb.build.FuncFailed
 }
 
+#
+# install a bunch of packages using opkg
+# the following shell variables needs to be set before calling this func:
+# INSTALL_ROOTFS_IPK - install root dir
+# INSTALL_CONF_IPK - configuration file
+# INSTALL_PACKAGES_NORMAL_IPK - packages to be installed
+# INSTALL_PACKAGES_ATTEMPTONLY_IPK - packages attemped to be installed only
+# INSTALL_PACKAGES_LINGUAS_IPK - additional packages for uclibc
+# INSTALL_TASK_IPK - task name
+
+package_install_internal_ipk() {
+
+	local target_rootfs="${INSTALL_ROOTFS_IPK}"
+	local conffile="${INSTALL_CONF_IPK}"
+	local package_to_install="${INSTALL_PACKAGES_NORMAL_IPK}"
+	local package_attemptonly="${INSTALL_PACKAGES_ATTEMPTONLY_IPK}"
+	local package_lingusa="${INSTALL_PACKAGES_LINGUAS_IPK}"
+	local task="${INSTALL_TASK_IPK}"
+
+	mkdir -p ${target_rootfs}${localstatedir}/lib/opkg/
+
+	local ipkg_args="-f ${conffile} -o ${target_rootfs} --force-overwrite"
+
+	opkg-cl ${ipkg_args} update
+
+	# Uclibc builds don't provide this stuff...
+	if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then
+		if [ ! -z "${package_lingusa}" ]; then
+			for i in ${package_lingusa}; do
+				opkg-cl ${ipkg_args} install $i
+			done
+		fi
+	fi
+
+	if [ ! -z "${package_to_install}" ]; then
+		opkg-cl ${ipkg_args} install ${package_to_install}
+	fi
+
+	if [ ! -z "${package_attemptonly}" ]; then
+		opkg-cl ${ipkg_args} install ${package_attemptonly} > "${WORKDIR}/temp/log.do_${task}_attemptonly.${PID}" || true
+	fi
+}
+
 ipk_log_check() {
        target="$1"
        lf_path="$2"
meta/classes/rootfs_ipk.bbclass +9 -16
index 07c114e..5727d15 100644
@@ -29,26 +29,19 @@ fakeroot rootfs_ipk_do_rootfs () {
 	${OPKG_PREPROCESS_COMMANDS}
 
 	mkdir -p ${T}/
-	mkdir -p ${IMAGE_ROOTFS}${opkglibdir}
 
-	opkg-cl ${IPKG_ARGS} update
+	#install
+	export INSTALL_PACKAGES_ATTEMPTONLY_IPK="${PACKAGE_INSTALL_ATTEMPTONLY}"
+	export INSTALL_PACKAGES_LINGUAS_IPK="${LINGUAS_INSTALL}"
+	export INSTALL_TASK_IPK="rootfs"
 
-	# Uclibc builds don't provide this stuff...
-	if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then 
-		if [ ! -z "${LINGUAS_INSTALL}" ]; then
-			for i in ${LINGUAS_INSTALL}; do
-				opkg-cl ${IPKG_ARGS} install $i 
-			done
-		fi
-	fi
-	if [ ! -z "${PACKAGE_INSTALL}" ]; then
-		opkg-cl ${IPKG_ARGS} install ${PACKAGE_INSTALL}
-	fi
+	export INSTALL_ROOTFS_IPK="${IMAGE_ROOTFS}"
+	export INSTALL_CONF_IPK="${IPKGCONF_TARGET}"
+	export INSTALL_PACKAGES_NORMAL_IPK="${PACKAGE_INSTALL}"
 
-	if [ ! -z "${PACKAGE_INSTALL_ATTEMPTONLY}" ]; then
-		opkg-cl ${IPKG_ARGS} install ${PACKAGE_INSTALL_ATTEMPTONLY} > "${WORKDIR}/temp/log.do_rootfs_attemptonly.${PID}" || true
-	fi
+	package_install_internal_ipk
 
+	#post install
 	export D=${IMAGE_ROOTFS}
 	export OFFLINE_ROOT=${IMAGE_ROOTFS}
 	export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
Signature · 1 line
1.7.0.4
author
#5 lore raw

PATCH 4/8 rootfs_rpm/package_rpm.bbclass: Move func from rootfs_rpm to package_rpm

In reply to Lianhao Lu

From: Lianhao Lu <[email protected]>

package_deb.bbclass:
1. Modified package_update_index_rpm() and package_generate_rpm_conf() to generate sperate depsolver db and rpm configuration, for target packages and host packages respectively.

2. Added new function package_install_internal_rpm() to install a list deb packages to a specified root directory, with the specified package architecutre information.

3. Added new function resolve_package_rpm() to resolve package names to filepaths.

rootfs_deb.bbclass:
Used the above new functions to install the rootfs.

---
 meta/classes/package_rpm.bbclass |  230 ++++++++++++++++++++++++++++++++++++--
 meta/classes/rootfs_rpm.bbclass  |  148 +++----------------------
 2 files changed, 234 insertions(+), 144 deletions(-)
meta/classes/package_rpm.bbclass +220 -10
index 076d6cf..bc2b2cf 100644
@@ -15,6 +15,8 @@ python package_rpm_install () {
 	bb.fatal("package_rpm_install not implemented!")
 }
 
+RPMCONF_TARGET_BASE = "${DEPLOY_DIR_RPM}/solvedb"
+RPMCONF_HOST_BASE = "${DEPLOY_DIR_RPM}/solvedb-sdk"
 #
 # Update the Packages depsolver db in ${DEPLOY_DIR_RPM}
 #
@@ -26,15 +28,18 @@ package_update_index_rpm () {
 	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="$packagedirs ${DEPLOY_DIR_RPM}/$arch"
-		#packagedirs="$packagedirs ${DEPLOY_DIR_RPM}/$sdkarch-nativesdk"
+		packagedirs_sdk="$packagedirs_sdk ${DEPLOY_DIR_RPM}/$sdkarch$extension"
 	done
 
-	#packagedirs="$packagedirs ${DEPLOY_DIR_RPM}/${SDK_ARCH}-${TARGET_ARCH}-canadian"
-
-	cat /dev/null > ${DEPLOY_DIR_RPM}/solvedb.conf
+	cat /dev/null > ${RPMCONF_TARGET_BASE}.conf
 	for pkgdir in $packagedirs; do
 		if [ -e $pkgdir/ ]; then
 			echo "Generating solve db for $pkgdir..."
@@ -48,7 +53,25 @@ package_update_index_rpm () {
 				--ignoresize --nosignature --nodigest \
 				-D "__dbi_txn create nofsync" \
 				$pkgdir/solvedb/manifest
-			echo $pkgdir/solvedb >> ${DEPLOY_DIR_RPM}/solvedb.conf
+			echo $pkgdir/solvedb >> ${RPMCONF_TARGET_BASE}.conf
+		fi
+	done
+
+	cat /dev/null > ${RPMCONF_HOST_BASE}.conf
+	for pkgdir in $packagedirs_sdk; do
+		if [ -e $pkgdir/ ]; then
+			echo "Generating solve db for $pkgdir..."
+			rm -rf $pkgdir/solvedb
+			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
+			echo $pkgdir/solvedb >> ${RPMCONF_HOST_BASE}.conf
 		fi
 	done
 }
@@ -58,16 +81,27 @@ package_update_index_rpm () {
 # generated depsolver db's...
 #
 package_generate_rpm_conf () {
-	printf "_solve_dbpath " > ${DEPLOY_DIR_RPM}/solvedb.macro
+	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
+
+	printf "_solve_dbpath " > ${RPMCONF_HOST_BASE}.macro
 	colon=false
-	for each in `cat ${DEPLOY_DIR_RPM}/solvedb.conf` ; do
+	for each in `cat ${RPMCONF_HOST_BASE}.conf` ; do
 		if [ "$colon" == true ]; then
-			printf ":" >> ${DEPLOY_DIR_RPM}/solvedb.macro
+			printf ":" >> ${RPMCONF_HOST_BASE}.macro
 		fi
-		printf "%s" $each >> ${DEPLOY_DIR_RPM}/solvedb.macro
+		printf "%s" $each >> ${RPMCONF_HOST_BASE}.macro
 		colon=true
 	done
-	printf "\n" >> ${DEPLOY_DIR_RPM}/solvedb.macro
+	printf "\n" >> ${RPMCONF_HOST_BASE}.macro
 }
 
 rpm_log_check() {
@@ -90,6 +124,182 @@ rpm_log_check() {
        true
 }
 
+
+#
+# Resolve package names to filepaths
+# resolve_pacakge <pkgname> <solvdb conffile>
+#
+resolve_package_rpm () {
+	local pkg="$1"
+	local conffile="$2"
+	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)
+		if [ -n "$pkg_name" ]; then
+			break;
+		fi
+	done
+	echo $pkg_name
+}
+
+#
+# install a bunch of packages using rpm
+# the following shell variables needs to be set before calling this func:
+# INSTALL_ROOTFS_RPM - install root dir
+# INSTALL_PLATFORM_RPM - main platform
+# INSTALL_PLATFORM_EXTRA_RPM - extra platform
+# INSTALL_CONFBASE_RPM - configuration file base name
+# INSTALL_PACKAGES_NORMAL_RPM - packages to be installed
+# INSTALL_PACKAGES_ATTEMPTONLY_RPM - packages attemped to be installed only
+# INSTALL_PACKAGES_LINGUAS_RPM - additional packages for uclibc
+# INSTALL_PROVIDENAME_RPM - content for provide name
+# INSTALL_TASK_RPM - task name
+
+package_install_internal_rpm () {
+
+	local target_rootfs="${INSTALL_ROOTFS_RPM}"
+	local platform="${INSTALL_PLATFORM_RPM}"
+	local platform_extra="${INSTALL_PLATFORM_EXTRA_RPM}"
+	local confbase="${INSTALL_CONFBASE_RPM}"
+	local package_to_install="${INSTALL_PACKAGES_NORMAL_RPM}"
+	local package_attemptonly="${INSTALL_PACKAGES_ATTEMPTONLY_RPM}"
+	local package_lingusa="${INSTALL_PACKAGES_LINGUAS_RPM}"
+	local providename="${INSTALL_PROVIDENAME_RPM}"
+	local task="${INSTALL_TASK_RPM}"
+
+	# Setup base system configuration
+	mkdir -p ${target_rootfs}/etc/rpm/
+	echo "${platform}-unknown-linux" >${target_rootfs}/etc/rpm/platform
+	if [ ! -z "$platform_extra" ]; then
+		for pt in $platform_extra ; do
+			echo "$pt-unknown-linux" >> ${target_rootfs}/etc/rpm/platform
+		done
+	fi
+
+	# Tell RPM that the "/" directory exist and is available
+	mkdir -p ${target_rootfs}/etc/rpm/sysinfo
+	echo "/" >${target_rootfs}/etc/rpm/sysinfo/Dirnames
+	if [ ! -z "$providename" ]; then
+		>>${target_rootfs}/etc/rpm/sysinfo/Providename
+		for provide in $providename ; do
+			echo $provide >> ${target_rootfs}/etc/rpm/sysinfo/Providename
+		done
+	fi
+
+	# Setup manifest of packages to install...
+	mkdir -p ${target_rootfs}/install
+	echo "# Install manifest" > ${target_rootfs}/install/install.manifest
+
+	# Uclibc builds don't provide this stuff...
+	if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then
+		if [ ! -z "${package_lingusa}" ]; then
+			for pkg in ${package_lingusa}; do
+				echo "Processing $pkg..."
+				pkg_name=$(resolve_package_rpm $pkg ${confbase}.conf)
+				if [ -z "$pkg_name" ]; then
+					echo "Unable to find package $pkg!"
+					exit 1
+				fi
+				echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest
+			done
+		fi
+	fi
+
+	if [ ! -z "${package_to_install}" ]; then
+		for pkg in ${package_to_install} ; do
+			echo "Processing $pkg..."
+			pkg_name=$(resolve_package_rpm $pkg ${confbase}.conf)
+			if [ -z "$pkg_name" ]; then
+				echo "Unable to find package $pkg!"
+				exit 1
+			fi
+			echo $pkg_name >> ${target_rootfs}/install/install.manifest
+		done
+	fi
+
+	# Generate an install solution by doing a --justdb install, then recreate it with
+	# an actual package install!
+	${RPM} -D "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
+		-D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}.macro`" \
+		-D "__dbi_txn create nofsync" \
+		-U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
+		${target_rootfs}/install/install.manifest
+
+	if [ ! -z "${package_attemptonly}" ]; then
+		echo "Adding attempt only packages..."
+		for pkg in ${package_attemptonly} ; do
+			echo "Processing $pkg..."
+			pkg_name=$(resolve_package_rpm $pkg ${confbase}.conf)
+			if [ -z "$pkg_name" ]; then
+				echo "Unable to find package $pkg!"
+				exit 1
+			fi
+			echo "Attempting $pkg_name..." >> "${WORKDIR}/temp/log.do_${task}_attemptonly.${PID}"
+			${RPM} -D "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
+				-D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}.macro`" \
+				-D "__dbi_txn create nofsync private" \
+				-U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
+			$pkg_name >> "${WORKDIR}/temp/log.do_${task}_attemptonly.${PID}" || true
+		done
+	fi
+
+	#### Note: 'Recommends' is an arbitrary tag that means _SUGGESTS_ in Poky..
+	# Add any recommended packages to the image
+	# RPM does not solve for recommended packages because they are optional...
+	# So we query them and tree them like the ATTEMPTONLY packages above...
+	# Change the loop to "1" to run this code...
+	loop=0
+	if [ $loop -eq 1 ]; then
+	 echo "Processing recommended packages..."
+	 cat /dev/null >  ${target_rootfs}/install/recommend.list
+	 while [ $loop -eq 1 ]; do
+		# Dump the full set of recommends...
+		${RPM} -D "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
+			-D "_dbpath ${IMAGE_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?
+		grep -v -x -F -f ${target_rootfs}/install/recommend.list ${target_rootfs}/install/recommend > ${target_rootfs}/install/recommend.new || true
+		# We don't want to loop unless there is a change to the list!
+		loop=0
+		cat ${target_rootfs}/install/recommend.new | \
+		 while read pkg ; do
+			# Ohh there was a new one, we'll need to loop again...
+			loop=1
+			echo "Processing $pkg..."
+			pkg_name=$(resolve_package $pkg ${confbase}.conf)
+			if [ -z "$pkg_name" ]; then
+				echo "Unable to find package $pkg." >> "${WORKDIR}/temp/log.do_${task}_recommend.${PID}"
+				continue
+			fi
+			echo "Attempting $pkg_name..." >> "${WORKDIR}/temp/log.do_{task}_recommend.${PID}"
+			${RPM} -D "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
+				-D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}.macro`" \
+				-D "__dbi_txn create nofsync private" \
+				-U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
+				$pkg_name >> "${WORKDIR}/temp/log.do_${task}_recommend.${PID}" 2>&1 || true
+		done
+		cat ${target_rootfs}/install/recommend.list ${target_rootfs}/install/recommend.new | sort -u > ${target_rootfs}/install/recommend.new.list
+		mv -f ${target_rootfs}/install/recommend.new.list ${target_rootfs}/install/recommend.list
+		rm ${target_rootfs}/install/recommend ${target_rootfs}/install/recommend.new
+	 done
+	fi
+
+	# Now that we have a solution, pull out a list of what to install...
+	echo "Manifest: ${target_rootfs}/install/install.manifest"
+	${RPM} -D "_dbpath ${target_rootfs}/install" -qa --yaml \
+		-D "__dbi_txn create nofsync private" \
+		| grep -i 'Packageorigin' | cut -d : -f 2 > ${target_rootfs}/install/install_solution.manifest
+
+	# Attempt install
+	${RPM} --root ${target_rootfs} \
+		-D "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
+		-D "_dbpath ${rpmlibdir}" \
+		--noscripts --notriggers --noparentdirs --nolinktos \
+		-D "__dbi_txn create nofsync private" \
+		-Uhv ${target_rootfs}/install/install_solution.manifest
+}
+
 python write_specfile () {
 	import textwrap
 
meta/classes/rootfs_rpm.bbclass +14 -134

176 lines not on this page · raw message

Signature · 1 line
1.7.0.4
author
#6 lore raw

PATCH 5/8 populate_sdk_rpm.bbclass: Added rpm support for populate_sdk task.

In reply to Lianhao Lu

From: Lianhao Lu <[email protected]>

This is preparation commit to support using rpm in populate_sdk task.

---
 meta/classes/populate_sdk_rpm.bbclass |   80 +++++++++++++++++++++++++++++++++
 1 files changed, 80 insertions(+), 0 deletions(-)
 create mode 100644 meta/classes/populate_sdk_rpm.bbclass
meta/classes/populate_sdk_rpm.bbclass new file +80 -0
new file mode 100644
index 0000000..e1abbad
@@ -0,0 +1,80 @@
+do_populate_sdk[depends] += "rpm-native:do_populate_sysroot"
+do_populate_sdk[recrdeptask] += "do_package_write_rpm"
+
+rpmlibdir = "/var/lib/rpm"
+RPMOPTS="--dbpath ${rpmlibdir} --define='_openall_before_chroot 1'"
+RPM="rpm ${RPMOPTS}"
+
+
+populate_sdk_post_rpm () {
+
+	local target_rootfs=$1
+
+	# remove lock files
+	rm -f ${target_rootfs}/__db.*
+
+	# Move manifests into the directory with the logs
+	mv ${target_rootfs}/install/*.manifest ${T}/
+
+	# Remove all remaining resolver files
+	rm -rf ${target_rootfs}/install
+}
+
+fakeroot populate_sdk_rpm () {
+
+	package_update_index_rpm
+	package_generate_rpm_conf
+
+	export INSTALL_PACKAGES_ATTEMPTONLY_RPM=""
+	export INSTALL_PACKAGES_LINGUAS_RPM=""
+	export INSTALL_PROVIDENAME_RPM="/bin/sh"
+	export INSTALL_TASK_RPM="populate_sdk"
+
+
+	#install target
+	export INSTALL_ROOTFS_RPM="${SDK_OUTPUT}/${SDKTARGETSYSROOT}"
+	export INSTALL_PLATFORM_RPM="${TARGET_ARCH}"
+	export INSTALL_PLATFORM_EXTRA_RPM="${PACKAGE_ARCHS}"
+	export INSTALL_CONFBASE_RPM="${RPMCONF_TARGET_BASE}"
+	export INSTALL_PACKAGES_NORMAL_RPM="${TOOLCHAIN_TARGET_TASK}"
+
+	package_install_internal_rpm
+	populate_sdk_post_rpm ${INSTALL_ROOTFS_RPM}
+
+	#install host
+	export INSTALL_ROOTFS_RPM="${SDK_OUTPUT}"
+	export INSTALL_PLATFORM_RPM="${SDK_ARCH}"
+	export INSTALL_CONFBASE_RPM="${RPMCONF_HOST_BASE}"
+	export INSTALL_PACKAGES_NORMAL_RPM="${TOOLCHAIN_HOST_TASK}"
+	INSTALL_PLATFORM_EXTRA_RPM=""
+	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="$INSTALL_PLATFORM_EXTRA_RPM $sdkarch"
+		fi
+	done
+	export INSTALL_PLATFORM_EXTRA_RPM
+
+	package_install_internal_rpm
+	populate_sdk_post_rpm ${INSTALL_ROOTFS_RPM}
+
+	# move host RPM library data
+	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/rpm
+	mv ${SDK_OUTPUT}${rpmlibdir}/* ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/rpm/
+	rm -Rf ${SDK_OUTPUT}/var
+
+	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir}
+	mv ${SDK_OUTPUT}/etc/* ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir}/
+	rm -rf ${SDK_OUTPUT}/etc
+
+	populate_sdk_log_check populate_sdk
+
+	# Workaround so the parser knows we need the resolve_package function!
+	if false ; then
+		resolve_package_rpm foo ${RPMCONF_TARGET_BASE}.conf || true
+	fi
+}
Signature · 1 line
1.7.0.4
author
#7 lore raw

PATCH 6/8 populate_sdk_deb.bbclass: Added deb support for populate_sdk task.

In reply to Lianhao Lu

From: Lianhao Lu <[email protected]>

This is a preparation commit for adding deb support in populate_sdk task.

---
 meta/classes/populate_sdk_deb.bbclass |   60 +++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)
 create mode 100644 meta/classes/populate_sdk_deb.bbclass
meta/classes/populate_sdk_deb.bbclass new file +60 -0
new file mode 100644
index 0000000..d563c28
@@ -0,0 +1,60 @@
+do_populate_sdk[depends] += "dpkg-native:do_populate_sysroot apt-native:do_populate_sysroot bzip2-native:do_populate_sysroot"
+do_populate_sdk[recrdeptask] += "do_package_write_deb"
+
+
+populate_sdk_post_deb () {
+
+	local target_rootfs=$1
+
+	cp -r ${STAGING_ETCDIR_NATIVE}/apt ${target_rootfs}/etc
+}
+
+fakeroot populate_sdk_deb () {
+
+	package_update_index_deb
+
+	export INSTALL_TASK_DEB="populate_sdk"
+	export INSTALL_PACKAGES_LINGUAS_DEB=""
+	export INSTALL_PACKAGES_ATTEMPTONLY_DEB=""
+
+	#install target
+	echo "Installing TARGET packages"
+	export INSTALL_ROOTFS_DEB="${SDK_OUTPUT}/${SDKTARGETSYSROOT}"
+	export INSTALL_BASEARCH_DEB="${DPKG_ARCH}"
+	export INSTALL_ARCHS_DEB="${PACKAGE_ARCHS}"
+	export INSTALL_PACKAGES_NORMAL_DEB="${TOOLCHAIN_TARGET_TASK}"
+
+	package_install_internal_deb
+	populate_sdk_post_deb ${INSTALL_ROOTFS_DEB}
+
+	populate_sdk_log_check populate_sdk
+
+	#install host
+	echo "Installing HOST packages"
+	export INSTALL_ROOTFS_DEB="${SDK_OUTPUT}"
+	export INSTALL_BASEARCH_DEB="${SDK_ARCH}"
+	export INSTALL_PACKAGES_NORMAL_DEB="${TOOLCHAIN_HOST_TASK}"
+	INSTALL_ARCHS_DEB=""
+	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
+	done
+	export INSTALL_ARCHS_DEB
+
+	package_install_internal_deb
+	populate_sdk_post_deb ${SDK_OUTPUT}/${SDKPATHNATIVE}
+
+	#move remainings
+	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}/var/dpkg
+	mv ${SDK_OUTPUT}/var/dpkg/* ${SDK_OUTPUT}/${SDKPATHNATIVE}/var/dpkg
+	rm -rf ${SDK_OUTPUT}/var
+
+	populate_sdk_log_check populate_sdk
+}
+
Signature · 1 line
1.7.0.4
author
#8 lore raw

PATCH 7/8 populate_sdk_ipk.bbclass: Added ipk support in populate_sdk task.

In reply to Lianhao Lu

From: Lianhao Lu <[email protected]>

This is a preparation commit for adding ipk support in populate_sdk task.

---
 meta/classes/populate_sdk_ipk.bbclass |   44 +++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)
 create mode 100644 meta/classes/populate_sdk_ipk.bbclass
meta/classes/populate_sdk_ipk.bbclass new file +44 -0
new file mode 100644
index 0000000..79259f8
@@ -0,0 +1,44 @@
+do_populate_sdk[depends] += "opkg-native:do_populate_sysroot opkg-utils-native:do_populate_sysroot"
+do_populate_sdk[recrdeptask] += "do_package_write_ipk"
+
+fakeroot populate_sdk_ipk() {
+
+	rm -f ${IPKGCONF_TARGET}
+	touch ${IPKGCONF_TARGET}
+	rm -f ${IPKGCONF_SDK}
+	touch ${IPKGCONF_SDK}
+
+	package_update_index_ipk
+	package_generate_ipkg_conf
+
+	export INSTALL_PACKAGES_ATTEMPTONLY_IPK=""
+	export INSTALL_PACKAGES_LINGUAS_IPK=""
+	export INSTALL_TASK_IPK="populate_sdk"
+
+	#install target
+	export INSTALL_ROOTFS_IPK="${SDK_OUTPUT}/${SDKTARGETSYSROOT}"
+	export INSTALL_CONF_IPK="${IPKGCONF_TARGET}"
+	export INSTALL_PACKAGES_NORMAL_IPK="${TOOLCHAIN_TARGET_TASK}"
+
+	package_install_internal_ipk
+
+	#install host
+	export INSTALL_ROOTFS_IPK="${SDK_OUTPUT}"
+	export INSTALL_CONF_IPK="${IPKGCONF_SDK}"
+	export INSTALL_PACKAGES_NORMAL_IPK="${TOOLCHAIN_HOST_TASK}"
+
+	package_install_internal_ipk
+
+	#post clean up
+	install -d ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/${sysconfdir}
+	install -m 0644 ${IPKGCONF_TARGET} ${IPKGCONF_SDK} ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/${sysconfdir}/
+
+	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir}
+	install -m 0644 ${IPKGCONF_SDK} ${SDK_OUTPUT}/${SDKPATHNATIVE}/${sysconfdir}/
+
+	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/opkg
+	mv ${SDK_OUTPUT}/var/lib/opkg/* ${SDK_OUTPUT}/${SDKPATHNATIVE}${localstatedir_nativesdk}/lib/opkg/
+	rm -Rf ${SDK_OUTPUT}/var
+
+	populate_sdk_log_check populate_sdk
+}
Signature · 1 line
1.7.0.4
author
#9 lore raw

PATCH 8/8 populate_sdk.bbclass/meta-toolchain: Made populate_sdk task more generic

In reply to Lianhao Lu

From: Lianhao Lu <[email protected]>

Move the populate_sdk task out of meta-toolchain. Made it more generic to support rpm/deb package format.

This commit is dependant on a series of commit:
2ea0406e4516fc59dff86cb4adc35c82cb774c2f
7ffa45b7cfea24dae1b51f40cfc807bf78b21b66
bf201a74c243942af3fcae6f174496bdd819dbc0
3d29933f2925efe8a84f10efdf50396031c33ae4
3d29933f2925efe8a84f10efdf50396031c33ae4
9c724dbf57e610a9e06bbdce38383dee3ac49281

---
 meta/classes/populate_sdk.bbclass        |   82 ++++++++++++++++++++++++
 meta/recipes-core/meta/meta-toolchain.bb |  103 +-----------------------------
 2 files changed, 85 insertions(+), 100 deletions(-)
 create mode 100644 meta/classes/populate_sdk.bbclass
meta/classes/populate_sdk.bbclass new file +82 -0
new file mode 100644
index 0000000..7e260ef
@@ -0,0 +1,82 @@
+inherit meta toolchain-scripts
+inherit populate_sdk_${IMAGE_PKGTYPE}
+
+SDK_DIR = "${WORKDIR}/sdk"
+SDK_OUTPUT = "${SDK_DIR}/image"
+SDK_DEPLOY = "${TMPDIR}/deploy/sdk"
+
+SDKTARGETSYSROOT = "${SDKPATH}/sysroots/${TARGET_SYS}"
+
+TOOLCHAIN_HOST_TASK ?= "task-sdk-host task-cross-canadian-${TRANSLATED_TARGET_ARCH}"
+TOOLCHAIN_TARGET_TASK ?= "task-poky-standalone-sdk-target task-poky-standalone-sdk-target-dbg"
+TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${DISTRO_VERSION}"
+
+RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}"
+DEPENDS = "virtual/fakeroot-native sed-native"
+
+PID = "${@os.getpid()}"
+
+EXCLUDE_FROM_WORLD = "1"
+
+fakeroot do_populate_sdk() {
+	rm -rf ${SDK_OUTPUT}
+	mkdir -p ${SDK_OUTPUT}
+
+	populate_sdk_${IMAGE_PKGTYPE}
+
+	# Don't ship any libGL in the SDK
+	rm -rf ${SDK_OUTPUT}/${SDKPATHNATIVE}${libdir_nativesdk}/libGL*
+
+	# Can copy pstage files here
+	# target_pkgs=`cat ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/var/lib/opkg/status | grep Package: | cut -f 2 -d ' '`
+
+	# Fix or remove broken .la files
+	#rm -f ${SDK_OUTPUT}/${SDKPATHNATIVE}/lib/*.la
+	rm -f ${SDK_OUTPUT}/${SDKPATHNATIVE}${libdir_nativesdk}/*.la
+
+	# Link the ld.so.cache file into the hosts filesystem
+	ln -s /etc/ld.so.cache ${SDK_OUTPUT}/${SDKPATHNATIVE}/etc/ld.so.cache
+
+	# Setup site file for external use
+	siteconfig=${SDK_OUTPUT}/${SDKPATH}/site-config-${MULTIMACH_TARGET_SYS}
+	touch $siteconfig
+	for sitefile in ${CONFIG_SITE} ; do
+		cat $sitefile >> $siteconfig
+	done
+
+	toolchain_create_sdk_env_script
+
+	# Add version information
+	versionfile=${SDK_OUTPUT}/${SDKPATH}/version-${MULTIMACH_TARGET_SYS}
+	touch $versionfile
+	echo 'Distro: ${DISTRO}' >> $versionfile
+	echo 'Distro Version: ${DISTRO_VERSION}' >> $versionfile
+	echo 'Metadata Revision: ${METADATA_REVISION}' >> $versionfile
+	echo 'Timestamp: ${DATETIME}' >> $versionfile
+
+	# Package it up
+	mkdir -p ${SDK_DEPLOY}
+	cd ${SDK_OUTPUT}
+	tar --owner=root --group=root -cj --file=${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.tar.bz2 .
+}
+
+populate_sdk_log_check() {
+	for target in $*
+	do
+		lf_path="${WORKDIR}/temp/log.do_$target.${PID}"
+
+		echo "log_check: Using $lf_path as logfile"
+
+		if test -e "$lf_path"
+		then
+			${IMAGE_PKGTYPE}_log_check $target $lf_path
+		else
+			echo "Cannot find logfile [$lf_path]"
+		fi
+		echo "Logfile is clean"
+	done
+}
+
+do_populate_sdk[nostamp] = "1"
+do_populate_sdk[recrdeptask] = "do_package_write"
+addtask populate_sdk before do_build after do_install
meta/recipes-core/meta/meta-toolchain.bb +3 -100

109 lines not on this page · raw message

Signature · 1 line
1.7.0.4