summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau2025-07-15 18:47:31 +0000
committerFelix Fietkau2025-07-15 18:48:45 +0000
commit642d568b0f0ac4924474871f58b2fd1c6c354476 (patch)
treec861fedbb490ba63aec66519adc9fc71d4698540
parent471fd0a50281ce2a37fece402c4c5bd609b6d580 (diff)
downloadopenwrt-642d568b0f0ac4924474871f58b2fd1c6c354476.tar.gz
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>
-rw-r--r--include/feeds.mk2
-rw-r--r--include/package-pack.mk2
-rwxr-xr-xscripts/ipkg-remove19
3 files changed, 19 insertions, 4 deletions
diff --git a/include/feeds.mk b/include/feeds.mk
index c3a47cf5f9..f484a4e92b 100644
--- a/include/feeds.mk
+++ b/include/feeds.mk
@@ -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
diff --git a/include/package-pack.mk b/include/package-pack.mk
index 925c4ca4c7..f6d90e50ee 100644
--- a/include/package-pack.mk
+++ b/include/package-pack.mk
@@ -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
diff --git a/scripts/ipkg-remove b/scripts/ipkg-remove
index 19d7148e83..e7516c3d3d 100755
--- a/scripts/ipkg-remove
+++ b/scripts/ipkg-remove
@@ -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