mirror of
				https://github.com/openwrt/openwrt.git
				synced 2025-10-30 07:49:23 +08:00 
			
		
		
		
	build: fix ipkg-remove: add support for removing apk files
Use apk adbdump to extract metadata from .apk files to derive the real package name. Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
		| @ -20,7 +20,7 @@ opkg_package_files = $(wildcard \ | ||||
|  | ||||
| apk_package_files = $(wildcard \ | ||||
| 	$(foreach dir,$(PACKAGE_SUBDIRS), \ | ||||
| 	  $(foreach pkg,$(1), $(dir)/$(pkg)_*.apk))) | ||||
| 	  $(foreach pkg,$(1), $(dir)/$(pkg)-*.apk))) | ||||
|  | ||||
| # 1: package name | ||||
| define FeedPackageDir | ||||
|  | ||||
| @ -15,7 +15,7 @@ endef | ||||
| # Generates a make statement to return a wildcard for candidate ipkg files | ||||
| # 1: package name | ||||
| define gen_package_wildcard | ||||
|   $(1)$$(if $$(filter -%,$$(ABIV_$(1))),,[^a-z-])* | ||||
|   $(1)$$(if $$(filter -%,$$(ABIV_$(1))),,[^a-z$(if $(CONFIG_USE_APK),,-)])* | ||||
| endef | ||||
|  | ||||
| # 1: package name | ||||
|  | ||||
| @ -4,10 +4,11 @@ sourcename="$1"; shift | ||||
|  | ||||
| for pkg in "$@"; do | ||||
| 	case "$pkg" in | ||||
| 		*/"${sourcename}_"*.ipk) | ||||
| 		*/"${sourcename}_"*.ipk|\ | ||||
| 		*/"${sourcename}-"[0-9]*.apk) | ||||
| 			rm -vf "$pkg" | ||||
| 		;; | ||||
| 		*) | ||||
| 		*.ipk) | ||||
| 			tar -Ozxf "$pkg" ./control.tar.gz 2>/dev/null | tar -Ozxf - ./control 2>/dev/null | { | ||||
| 				packagename= | ||||
| 				abiversion= | ||||
| @ -21,6 +22,20 @@ for pkg in "$@"; do | ||||
| 				[ "$packagename" = "$sourcename" ] && rm -vf "$pkg" | ||||
| 			} | ||||
| 		;; | ||||
| 		*.apk) | ||||
| 			apk adbdump "$pkg" | grep -E '^  (name:|.*openwrt:abiversion)' | { | ||||
| 				packagename= | ||||
| 				abiversion= | ||||
| 				while read field value; do | ||||
| 					case "$field" in | ||||
| 						name:) packagename="$value";; | ||||
| 						-) abiversion="${value##*abiversion=}";; | ||||
| 					esac | ||||
| 				done | ||||
| 				[ -n "$abiversion" ] && packagename="${packagename%%$abiversion}" | ||||
| 				[ "$packagename" = "$sourcename" ] && rm -vf "$pkg" | ||||
| 			} | ||||
| 		;; | ||||
| 	esac | ||||
| done | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Felix Fietkau
					Felix Fietkau