[openwrt/openwrt] include/package-pack: add special handling for CONTROL conffiles

LEDE Commits lede-commits at lists.infradead.org
Tue Jun 11 14:58:59 PDT 2024


ansuel pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/52e9431731fc4c0b6a2c2e2e76090a0641dc4334

commit 52e9431731fc4c0b6a2c2e2e76090a0641dc4334
Author: Christian Marangi <ansuelsmth at gmail.com>
AuthorDate: Wed May 22 19:35:35 2024 +0200

    include/package-pack: add special handling for CONTROL conffiles
    
    Add special handling for CONTROL conffiles. Some packages (base-files)
    manually append stuff to the CONTROL directory.
    
    The CONTROL directory is something for OPKG that is added in the root of
    the ipkg directory and usually contains postinst, list, and conffiles
    file. For APK the implementation is different, to keep compatibility
    with this and maybe other packages, apply manual fixup and check for
    these corner case.
    
    Also check if the CONTROL directory is present and is empty to make sure
    we don't drop other special file while removing any pending CONTROL
    directory in the ipkg directory.
    
    Link: https://github.com/openwrt/openwrt/pull/15543
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
 include/package-pack.mk | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/package-pack.mk b/include/package-pack.mk
index 5054e8dc85..75acdd185c 100644
--- a/include/package-pack.mk
+++ b/include/package-pack.mk
@@ -309,6 +309,20 @@ else
 	(cd $$(IDIR_$(1)) && find . -type f,l -printf "/%P\n" > $$(IDIR_$(1))/lib/apk/packages/$(1).list)
 	if [ -f $$(ADIR_$(1))/conffiles ]; then mv $$(ADIR_$(1))/conffiles $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles; fi;
 
+	# Some package (base-files) manually append stuff to conffiles
+	# Append stuff from it and delete the CONTROL directory since everything else should be migrated
+	if [ -f $$(IDIR_$(1))/CONTROL/conffiles ]; then \
+		cat $$(IDIR_$(1))/CONTROL/conffiles >> $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles; \
+		rm -rf $$(IDIR_$(1))/CONTROL/conffiles; \
+	fi
+
+	if [ -z "$$$$(ls -A $$(IDIR_$(1))/CONTROL 2>/dev/null)" ]; then \
+		rm -rf $$(IDIR_$(1))/CONTROL; \
+	else \
+		echo "CONTROL directory $$(IDIR_$(1))/CONTROL is not empty! This is not right and should be checked!" >&2; \
+		exit 1; \
+	fi
+
 	$(FAKEROOT) $(STAGING_DIR_HOST)/bin/apk mkpkg \
 	  --info "name:$(1)$$(ABIV_$(1))" \
 	  --info "version:$(VERSION)" \




More information about the lede-commits mailing list