Skip to contentSkip to conversation

Fix incremental rpm image generation

PATCH In review Robert Yang 2 participants 4 messages Nov 13, 2012 – Nov 30, 2012

lore
Share & tools
lore
#0 lore raw

cover Fix incremental rpm image generation

Port the patches from the master branch to denzil, and have tested on our local autobuilder. They are already on danny.

// Robert

The following changes since commit 846b7c388738f382e83576e77b705aa547c1dd9b:

bitbake: lib/bb/siggen.py: log when tainting the signature of a task (2012-10-12 08:58:48 +0100)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib robert/denzil_rpm
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/denzil_rpm

Robert Yang (2):
package_rpm.bbclass: Fix incremental rpm image generation rootfs_rpm.bbclass: save rpmlib rather than remove it

 meta/classes/image.bbclass       |    6 ++++++
 meta/classes/package_rpm.bbclass |   20 ++++++++------------
 meta/classes/rootfs_rpm.bbclass  |    6 +++++-
 3 files changed, 19 insertions(+), 13 deletions(-)
#1 lore raw

PATCH 1/2 package_rpm.bbclass: Fix incremental rpm image generation

Fix the incremental rpm image generation, it didn't work since the code has been changed.

The btmanifest should have a ".manifest" suffix, so that it can be moved to ${T} by rootfs_rpm.bbclass:
mv ${IMAGE_ROOTFS}/install/*.manifest ${T}/

Note: The locale pkgs would always be re-installed.

[YOCTO #2690]

(From OE-Core rev: 5149630746626c6d416f26ab9dd1c7213fcd8c50)

---
 meta/classes/package_rpm.bbclass |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)
meta/classes/package_rpm.bbclass +8 -12
index ffe3b31..e2bec2d 100644
@@ -168,28 +168,24 @@ rpm_common_comand () {
 rpm_update_pkg () {
 
     manifest=$1
-    btmanifest=$manifest.bt
+    btmanifest=$manifest.bt.manifest
+    pre_btmanifest=${T}/${btmanifest##/*/}
     local target_rootfs="${INSTALL_ROOTFS_RPM}"
 
     # Save the rpm's build time for incremental image generation, and the file
     # would be moved to ${T}
-    rm -f $btmanifest
     for i in `cat $manifest`; do
         # Use "rpm" rather than "${RPM}" here, since we don't need the
         # '--dbpath' option
-        echo "$i `rpm -qp --qf '%{BUILDTIME}\n' $i`" >> $btmanifest
-    done
+        echo "$i `rpm -qp --qf '%{BUILDTIME}\n' $i`"
+    done | sort -u > $btmanifest
 
     # Only install the different pkgs if incremental image generation is set
-    if [ "${INC_RPM_IMAGE_GEN}" = "1" -a -f ${T}/total_solution_bt.manifest -a \
+    if [ "${INC_RPM_IMAGE_GEN}" = "1" -a -f "$pre_btmanifest" -a \
         "${IMAGE_PKGTYPE}" = "rpm" ]; then
-        cur_list="$btmanifest"
-        pre_list="${T}/total_solution_bt.manifest"
-        sort -u $cur_list -o $cur_list
-        sort -u $pre_list -o $pre_list
-        comm -1 -3 $cur_list $pre_list | sed 's#.*/\(.*\)\.rpm .*#\1#' > \
+        comm -1 -3 $btmanifest $pre_btmanifest | sed 's#.*/\(.*\)\.rpm .*#\1#' > \
             ${target_rootfs}/install/remove.manifest
-        comm -2 -3 $cur_list $pre_list | awk '{print $1}' > \
+        comm -2 -3 $btmanifest $pre_btmanifest | awk '{print $1}' > \
             ${target_rootfs}/install/incremental.manifest
 
         # Attempt to remove unwanted pkgs, the scripts(pre, post, etc.) has not
@@ -472,7 +468,7 @@ EOF
 	# probably a feature. The only way to convince rpm to actually run the preinstall scripts 
 	# for base-passwd and shadow first before installing packages that depend on these packages 
 	# is to do two image installs, installing one set of packages, then the other.
-	if [ "${INC_RPM_IMAGE_GEN}" = "1" -a -f ${T}/total_solution_bt.manifest ]; then
+	if [ "${INC_RPM_IMAGE_GEN}" = "1" -a -f "$pre_btmanifest" ]; then
 		echo "Skipping pre install due to exisitng image"
 	else
 		echo "# Initial Install manifest" > ${target_rootfs}/install/initial_install.manifest
Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/2 rootfs_rpm.bbclass: save rpmlib rather than remove it

In reply to Robert Yang

The rpmlib was removed when images that add "remove_packaging_data_files" to ROOTFS_POSTPROCESS_COMMAND, which would make the increment rpm image generation doesn't work in the second build, since list_installed_packages would get incorrect value in the second build, move the rpmlib to ${T} rather than remove it, and move it back when INC_RPM_IMAGE_GEN =1.

[YOCTO #2690]

(From OE-Core rev: c30e79510c06701f10f659eedaa0fe785538ac17)

---
 meta/classes/image.bbclass      |    6 ++++++
 meta/classes/rootfs_rpm.bbclass |    6 +++++-
 2 files changed, 11 insertions(+), 1 deletions(-)
meta/classes/image.bbclass +6 -0
index 9557433..90a6a9d 100644
@@ -143,6 +143,12 @@ fakeroot do_rootfs () {
     # 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
+        # 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
     fi
 	rm -rf ${MULTILIB_TEMP_ROOTFS}
 	mkdir -p ${IMAGE_ROOTFS}
meta/classes/rootfs_rpm.bbclass +5 -1
index 9039b21..fbc46c0 100644
@@ -154,7 +154,11 @@ EOF
 }
 
 remove_packaging_data_files() {
-	rm -rf ${IMAGE_ROOTFS}${rpmlibdir}
+	# Save the rpmlib for increment rpm image generation
+	t="${T}/saved_rpmlib/var/lib"
+	rm -fr $t
+	mkdir -p $t
+	mv ${IMAGE_ROOTFS}${rpmlibdir} $t
 	rm -rf ${IMAGE_ROOTFS}${opkglibdir}
 }
 
Signature · 1 line
1.7.1
#3 lore raw
In reply to Robert Yang
Quoted 13 lines · Robert Yang

Port the patches from the master branch to denzil, and have tested on our local autobuilder. They are already on danny.

// Robert

The following changes since commit 846b7c388738f382e83576e77b705aa547c1dd9b:

bitbake: lib/bb/siggen.py: log when tainting the signature of a task (2012-10-12 08:58:48 +0100)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib robert/denzil_rpm
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/denzil_rpm

Quoted 8 lines

Robert Yang (2):
package_rpm.bbclass: Fix incremental rpm image generation rootfs_rpm.bbclass: save rpmlib rather than remove it

  meta/classes/image.bbclass       |    6 ++++++
  meta/classes/package_rpm.bbclass |   20 ++++++++------------
  meta/classes/rootfs_rpm.bbclass  |    6 +++++-
  3 files changed, 19 insertions(+), 13 deletions(-)

Pulled into sgarman/denzil-next.

Thanks,

Scott

Signature · 3 lines
Scott Garman
Embedded Linux Engineer - Yocto Project
Intel Open Source Technology Center