Patchwork [3/4] image.bbclass:support incremental deb image generation

login
register
mail settings
Submitter Hongxu Jia
Date Jan. 22, 2013, 8:19 a.m.
Message ID <c31f9be90dc2dcbb3ed15f6e080442980b013169.1358824498.git.hongxu.jia@windriver.com>
Download mbox | patch
Permalink /patch/43147/
State New
Headers show

Comments

Hongxu Jia - Jan. 22, 2013, 8:19 a.m.
When use the deb incremental image generation, and the type of previous image
is deb, don't remove the rootfs. The same rule to the rpm incremental image
generation. If neither of them, rootfs will be removed.

[YOCTO #1893]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/classes/image.bbclass |   21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

Patch

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 0293d2e..5d93d59 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -203,16 +203,29 @@  run_intercept_scriptlets () {
 
 fakeroot do_rootfs () {
 	#set -x
-	# When use the rpm incremental image generation, don't remove the rootfs
-	if [ "${INC_RPM_IMAGE_GEN}" != "1" -o "${IMAGE_PKGTYPE}" != "rpm" ]; then
-		rm -rf ${IMAGE_ROOTFS}
-	elif [ -d ${T}/saved_rpmlib/var/lib/rpm ]; then
+	# When use the rpm incremental image generation, and the type
+	# of previous image is rpm, don't remove the rootfs
+	if [ "${INC_RPM_IMAGE_GEN}" = "1" -a "${IMAGE_PKGTYPE}" = "rpm" \
+		-a -d ${T}/saved_rpmlib/var/lib/rpm ]; then
+
+		echo "start rpm incremental image generation"
 		# Move the rpmlib back
 		if [ ! -d ${IMAGE_ROOTFS}/var/lib/rpm ]; then
 			mkdir -p ${IMAGE_ROOTFS}/var/lib/
 			mv ${T}/saved_rpmlib/var/lib/rpm ${IMAGE_ROOTFS}/var/lib/
 		fi
+
+	# When use the deb incremental image generation, and the type
+	# of previous image is deb, don't remove the rootfs
+	elif [ "${INC_DEB_IMAGE_GEN}" = "1" -a "${IMAGE_PKGTYPE}" = "deb" \
+		-a -e ${IMAGE_ROOTFS}/var/lib/dpkg/status ]; then
+
+		echo "start deb incremental image generation"
+	else
+		rm -rf ${IMAGE_ROOTFS}
+		rm -rf ${T}/saved_rpmlib
 	fi
+
 	rm -rf ${MULTILIB_TEMP_ROOTFS}
 	mkdir -p ${IMAGE_ROOTFS}
 	mkdir -p ${DEPLOY_DIR_IMAGE}