Patchwork [6/6] rootfs_rpm.bbclass: Update database configuration and initial install

login
register
mail settings
Submitter Mark Hatle
Date June 4, 2012, 5:52 p.m.
Message ID <7da56c920238535a626b0addc57d5defcdf17012.1338832215.git.mark.hatle@windriver.com>
Download mbox | patch
Permalink /patch/29201/
State New
Headers show

Comments

Mark Hatle - June 4, 2012, 5:52 p.m.
Move the creation of the database configuration files to just before we
perform the install actions.  This ensures they will exist even in SDK or
other non-target filesystem images.

Also check the initial install actually has something to install, otherwise
this can lead to a failure case.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
---
 meta/classes/package_rpm.bbclass |   71 +++++++++++++++++++++++++++++---------
 meta/classes/rootfs_rpm.bbclass  |   31 ----------------
 2 files changed, 54 insertions(+), 48 deletions(-)

Patch

diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 097fa12..9f13a07 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -182,6 +182,7 @@  rpm_update_pkg () {
         # been run by now, so don't have to run them(preun, postun, etc.) when
         # erase the pkg
         if [ -s ${target_rootfs}/install/remove.manifest ]; then
+            echo "# Removal manifest padding...." >> ${target_rootfs}/install/remove.manifest
             rpm_common_comand --noscripts --nodeps \
                 -e `cat ${target_rootfs}/install/remove.manifest`
         fi
@@ -454,6 +455,38 @@  EOF
 
 	chmod 0755 ${WORKDIR}/scriptlet_wrapper
 
+	# Configure RPM... we enforce these settings!
+	mkdir -p ${target_rootfs}${rpmlibdir}
+	mkdir -p ${target_rootfs}${rpmlibdir}/log
+	# After change the __db.* cache size, log file will not be generated automatically,
+	# that will raise some warnings, so touch a bare log for rpm write into it.
+	touch ${target_rootfs}${rpmlibdir}/log/log.0000000001
+	cat > ${target_rootfs}${rpmlibdir}/DB_CONFIG << EOF
+# ================ Environment
+set_data_dir .
+set_create_dir .
+set_lg_dir ./log
+set_tmp_dir ./tmp
+set_flags db_log_autoremove on
+
+# -- thread_count must be >= 8
+set_thread_count 64
+
+# ================ Logging
+
+# ================ Memory Pool
+set_cachesize 0 1048576 0
+set_mp_mmapsize 268435456
+
+# ================ Locking
+set_lk_max_locks 16384
+set_lk_max_lockers 16384
+set_lk_max_objects 16384
+mutex_set_max 163840
+
+# ================ Replication
+EOF
+
 	# RPM is special. It can't handle dependencies and preinstall scripts correctly. Its
 	# 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 
@@ -461,33 +494,37 @@  EOF
 	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
+		rm -f ${target_rootfs}/install/initial_install.manifest
 		echo "Installing base dependencies first (base-passwd, base-files and shadow) since rpm is special"
 		grep /base-passwd-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true
 		grep /base-files-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true
 		grep /shadow-[0-9] ${target_rootfs}/install/total_solution.manifest >> ${target_rootfs}/install/initial_install.manifest || true
 
-		# Generate an install solution by doing a --justdb install, then recreate it with
-		# an actual package install!
-		mkdir -p ${target_rootfs}/initial
+		if [ -s ${target_rootfs}/install/initial_install.manifest ]; then
+			echo "# Initial Install manifest padding..." >> ${target_rootfs}/install/initial_install.manifest
 
-		${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
-			--predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
-			-D "_dbpath ${target_rootfs}/initial" -D "`cat ${confbase}.macro`" \
-			-D "__dbi_txn create nofsync" \
-			-U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
-			${target_rootfs}/install/initial_install.manifest
+			# Generate an install solution by doing a --justdb install, then recreate it with
+			# an actual package install!
+			mkdir -p ${target_rootfs}/initial
 
-		${RPM} -D "_dbpath ${target_rootfs}/initial" -qa --qf "%{packageorigin}\n" \
-			-D "__dbi_txn create nofsync private" \
-			> ${target_rootfs}/install/initial_solution.manifest
+			${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
+				--predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
+				-D "_dbpath ${target_rootfs}/initial" -D "`cat ${confbase}.macro`" \
+				-D "__dbi_txn create nofsync" \
+				-U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
+				${target_rootfs}/install/initial_install.manifest
 
-		rpm_update_pkg ${target_rootfs}/install/initial_solution.manifest
+			${RPM} -D "_dbpath ${target_rootfs}/initial" -qa --qf "%{packageorigin}\n" \
+				-D "__dbi_txn create nofsync private" \
+				> ${target_rootfs}/install/initial_solution.manifest
+
+			rpm_update_pkg ${target_rootfs}/install/initial_solution.manifest
 		
-		grep -Fv -f ${target_rootfs}/install/initial_solution.manifest ${target_rootfs}/install/total_solution.manifest > ${target_rootfs}/install/total_solution.manifest.new
-		mv ${target_rootfs}/install/total_solution.manifest.new ${target_rootfs}/install/total_solution.manifest
+			grep -Fv -f ${target_rootfs}/install/initial_solution.manifest ${target_rootfs}/install/total_solution.manifest > ${target_rootfs}/install/total_solution.manifest.new
+			mv ${target_rootfs}/install/total_solution.manifest.new ${target_rootfs}/install/total_solution.manifest
 		
-		rm -rf ${target_rootfs}/initial
+			rm -rf ${target_rootfs}/initial
+		fi
 	fi
 
 	echo "Installing main solution manifest (${target_rootfs}/install/total_solution.manifest)"
diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass
index 703fa15..d227e61 100644
--- a/meta/classes/rootfs_rpm.bbclass
+++ b/meta/classes/rootfs_rpm.bbclass
@@ -59,37 +59,6 @@  fakeroot rootfs_rpm_do_rootfs () {
 	# Setup base system configuration
 	mkdir -p ${INSTALL_ROOTFS_RPM}/etc/rpm/
 
-	mkdir -p ${INSTALL_ROOTFS_RPM}${rpmlibdir}
-	mkdir -p ${INSTALL_ROOTFS_RPM}${rpmlibdir}/log
-	# After change the __db.* cache size, log file will not be generated automatically,
-	# that will raise some warnings, so touch a bare log for rpm write into it.
-	touch ${INSTALL_ROOTFS_RPM}${rpmlibdir}/log/log.0000000001
-	cat > ${INSTALL_ROOTFS_RPM}${rpmlibdir}/DB_CONFIG << EOF
-# ================ Environment
-set_data_dir .
-set_create_dir .
-set_lg_dir ./log
-set_tmp_dir ./tmp
-set_flags db_log_autoremove on
-
-# -- thread_count must be >= 8
-set_thread_count 64
-
-# ================ Logging
-
-# ================ Memory Pool
-set_cachesize 0 1048576 0
-set_mp_mmapsize 268435456
-
-# ================ Locking
-set_lk_max_locks 16384
-set_lk_max_lockers 16384
-set_lk_max_objects 16384
-mutex_set_max 163840
-
-# ================ Replication
-EOF
-
 	# List must be prefered to least preferred order
 	INSTALL_PLATFORM_EXTRA_RPM=""
 	for each_arch in ${MULTILIB_PACKAGE_ARCHS} ${PACKAGE_ARCHS}; do