Skip to contentSkip to conversation

rootfs_ipk: delete opkg metadata if package management not required and all packages are configured

PATCH Superseded Phil Blundell 3 participants 5 messages May 26, 2011 – Jun 3, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rootfs_ipk: delete opkg metadata if package management not required and all packages are configured

If all the postinsts were successfully run in offline mode, and package-management hasn't been requested as an IMAGE_FEATURE, the opkg metadata is now redundant and can safely be deleted.

If some packages are still unconfigured at this point then we need to keep their metadata around so that either opkg or the awk script can configure the packages at boot time. In theory it would be possible to strip out the data for packages that have already been configured, but right now we just hold on to the whole status file in that situation.

---
 meta/classes/rootfs_ipk.bbclass |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
meta/classes/rootfs_ipk.bbclass +7 -0
index edd84fb..53099e9 100644
@@ -82,6 +82,13 @@ fakeroot rootfs_ipk_do_rootfs () {
 	
 	rm -f ${IMAGE_ROOTFS}${opkglibdir}/lists/*
 
+	if ${@base_contains("IMAGE_FEATURES", "package-management", "false", "true", d)}; then
+		if [ $runtime_script_required -eq 0 ]; then
+			# All packages were successfully configured, status file no longer required
+			rm -rf ${IMAGE_ROOTFS}${opkglibdir}
+		fi
+	fi
+
 	log_check rootfs 	
 }
 
Signature · 1 line
1.7.1
#1 lore raw

PATCH v2 1/1 rootfs_ipk: delete opkg metadata if package management not required and all packages are configured

Also remove update-rc.d and base-passwd since their services are no longer required.

---
 meta/classes/rootfs_ipk.bbclass |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
meta/classes/rootfs_ipk.bbclass +11 -0
index edd84fb..3b4b4da 100644
@@ -82,6 +82,17 @@ fakeroot rootfs_ipk_do_rootfs () {
 	
 	rm -f ${IMAGE_ROOTFS}${opkglibdir}/lists/*
 
+	if ${@base_contains("IMAGE_FEATURES", "package-management", "false", "true", d)}; then
+		if [ $runtime_script_required -eq 0 ]; then
+			# All packages were successfully configured.
+			# update-rc.d, base-passwd are no further use, remove them now
+			opkg-cl ${IPKG_ARGS} --force-depends remove update-rc.d base-passwd || true
+
+			# Also delete the status files
+			rm -rf ${IMAGE_ROOTFS}${opkglibdir}
+		fi
+	fi
+
 	log_check rootfs 	
 }
 
Signature · 1 line
1.7.1
#2 lore raw
Quoted 2 lines · Phil Blundell

Also remove update-rc.d and base-passwd since their services are no longer required.

This patch message stripped all the information you had in the v1 message. I think that was useful information.

Please resend the patch with the full header.

Thanks
Sau!

Quoted 27 lines
---
  meta/classes/rootfs_ipk.bbclass |   11 +++++++++++
  1 files changed, 11 insertions(+), 0 deletions(-)
meta/classes/rootfs_ipk.bbclass +11 -0
index edd84fb..3b4b4da 100644
@@ -82,6 +82,17 @@ fakeroot rootfs_ipk_do_rootfs () {
 
  	rm -f ${IMAGE_ROOTFS}${opkglibdir}/lists/*
 
+	if ${@base_contains("IMAGE_FEATURES", "package-management", "false", "true", d)}; then
+		if [ $runtime_script_required -eq 0 ]; then
+			# All packages were successfully configured.
+			# update-rc.d, base-passwd are no further use, remove them now
+			opkg-cl ${IPKG_ARGS} --force-depends remove update-rc.d base-passwd || true
+
+			# Also delete the status files
+			rm -rf ${IMAGE_ROOTFS}${opkglibdir}
+		fi
+	fi
+
  	log_check rootfs 	
  }
 
#3 lore raw

PATCH v3 1/1 rootfs_ipk: delete opkg metadata if package management not required and all packages are configured

If all the postinsts were successfully run in offline mode, and package-management hasn't been requested as an IMAGE_FEATURE, the opkg metadata is now redundant and can safely be deleted.

Also, the update-rc.d and base-passwd packages can be removed since they will serve no further purpose in this situation.

If some packages are still unconfigured at this point then we need to keep their metadata around so that either opkg or the awk script can configure the packages at boot time. In theory it would be possible to strip out the data for packages that have already been configured, but right now we just hold on to the whole status file in that situation.

---
 meta/classes/rootfs_ipk.bbclass |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
meta/classes/rootfs_ipk.bbclass +11 -0
index edd84fb..3b4b4da 100644
@@ -82,6 +82,17 @@ fakeroot rootfs_ipk_do_rootfs () {
 	
 	rm -f ${IMAGE_ROOTFS}${opkglibdir}/lists/*
 
+	if ${@base_contains("IMAGE_FEATURES", "package-management", "false", "true", d)}; then
+		if [ $runtime_script_required -eq 0 ]; then
+			# All packages were successfully configured.
+			# update-rc.d, base-passwd are no further use, remove them now
+			opkg-cl ${IPKG_ARGS} --force-depends remove update-rc.d base-passwd || true
+
+			# Also delete the status files
+			rm -rf ${IMAGE_ROOTFS}${opkglibdir}
+		fi
+	fi
+
 	log_check rootfs 	
 }
 
Signature · 1 line
1.7.1
Applied
#4 lore raw
Quoted 30 lines · Phil Blundell

If all the postinsts were successfully run in offline mode, and package-management hasn't been requested as an IMAGE_FEATURE, the opkg metadata is now redundant and can safely be deleted.

Also, the update-rc.d and base-passwd packages can be removed since they will serve no further purpose in this situation.

If some packages are still unconfigured at this point then we need to keep their metadata around so that either opkg or the awk script can configure the packages at boot time. In theory it would be possible to strip out the data for packages that have already been configured, but right now we just hold on to the whole status file in that situation.

---
  meta/classes/rootfs_ipk.bbclass |   11 +++++++++++
  1 files changed, 11 insertions(+), 0 deletions(-)
meta/classes/rootfs_ipk.bbclass +4 -0
index edd84fb..3b4b4da 100644
@@ -82,6 +82,17 @@ fakeroot rootfs_ipk_do_rootfs () {
 
  	rm -f ${IMAGE_ROOTFS}${opkglibdir}/lists/*
 
+	if ${@base_contains("IMAGE_FEATURES", "package-management", "false", "true", d)}; then
+		if [ $runtime_script_required -eq 0 ]; then
+			# All packages were successfully configured.
+			# update-rc.d, base-passwd are no further use, remove them now

meta/classes/rootfs_ipk.bbclass fakeroot rootfs_ipk_do_rootfs () { · line 98

Quoted 10 lines
meta/classes/rootfs_ipk.bbclass +7 -0
+			opkg-cl ${IPKG_ARGS} --force-depends remove update-rc.d base-passwd || true
+
+			# Also delete the status files
+			rm -rf ${IMAGE_ROOTFS}${opkglibdir}
+		fi
+	fi
+
  	log_check rootfs 	
  }
 

Merged into oe-core

Thanks
Sau!