[openwrt/openwrt] build: ipkg-remove: fix source name / package confusion, optimize
LEDE Commits
lede-commits at lists.infradead.org
Tue Jul 15 11:48:59 PDT 2025
nbd pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/471fd0a50281ce2a37fece402c4c5bd609b6d580
commit 471fd0a50281ce2a37fece402c4c5bd609b6d580
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Tue Jul 15 15:26:16 2025 +0200
build: ipkg-remove: fix source name / package confusion, optimize
The script always gets passed the package name, not the source name.
Optimize for the default case where the package name matches the
filename prefix.
Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
scripts/ipkg-remove | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/scripts/ipkg-remove b/scripts/ipkg-remove
index f4957004c0..19d7148e83 100755
--- a/scripts/ipkg-remove
+++ b/scripts/ipkg-remove
@@ -3,17 +3,24 @@
sourcename="$1"; shift
for pkg in "$@"; do
- tar -Ozxf "$pkg" ./control.tar.gz 2>/dev/null | tar -Ozxf - ./control 2>/dev/null | \
- while read field value; do
- if [ "$field" = "SourceName:" ] && [ "$value" = "$sourcename" ]; then
- rm -vf "$pkg"
- break
- fi
- done
case "$pkg" in
*/"${sourcename}_"*.ipk)
rm -vf "$pkg"
;;
+ *)
+ tar -Ozxf "$pkg" ./control.tar.gz 2>/dev/null | tar -Ozxf - ./control 2>/dev/null | {
+ packagename=
+ abiversion=
+ while read field value; do
+ case "$field" in
+ Package:) packagename="$value";;
+ ABIVersion:) abiversion="$value";;
+ esac
+ done
+ [ -n "$abiversion" ] && packagename="${packagename%%$abiversion}"
+ [ "$packagename" = "$sourcename" ] && rm -vf "$pkg"
+ }
+ ;;
esac
done
More information about the lede-commits
mailing list