opkg-utils: correct priority matching in update-alternatives

(From OE-Core rev: 82baab5bd5e5ec4369eaad393feeee3132f0c087)

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alexander Kanavin
2020-10-28 22:05:56 +01:00
committed by Richard Purdie
parent 600cb136cd
commit 6c9e07e650
2 changed files with 31 additions and 2 deletions

View File

@@ -0,0 +1,28 @@
From 26206005dacd61380663bb4fd9b18178bb33665b Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Sat, 24 Oct 2020 21:59:27 +0200
Subject: [PATCH] update-alternatives: correctly match priority
It should always be at the end of string, otherwise something
like "/usr/bin/python3.9-config 123" will erroneously match
against priority 9.
Upstream-Status: Submitted
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
update-alternatives | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/update-alternatives b/update-alternatives
index 1389b3f..e0b31bf 100644
--- a/update-alternatives
+++ b/update-alternatives
@@ -94,7 +94,7 @@ add_alt() {
local path="$2"
local priority="$3"
remove_alt $name $path
- if grep -qw "$priority" $ad/$name; then
+ if grep -qw "$priority"$ $ad/$name; then
echo "Warn: update-alternatives: $name has multiple providers with the same priority, please check $ad/$name for details"
fi
echo "$path $priority" >> $ad/$name

View File

@@ -7,8 +7,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
file://opkg.py;beginline=2;endline=18;md5=ffa11ff3c15eb31c6a7ceaa00cc9f986"
PROVIDES += "${@bb.utils.contains('PACKAGECONFIG', 'update-alternatives', 'virtual/update-alternatives', '', d)}"
SRC_URI = "http://git.yoctoproject.org/cgit/cgit.cgi/${BPN}/snapshot/${BPN}-${PV}.tar.gz \
"
SRC_URI = "http://git.yoctoproject.org/cgit/cgit.cgi/${BPN}/snapshot/${BPN}-${PV}.tar.gz \
file://0001-update-alternatives-correctly-match-priority.patch \
"
UPSTREAM_CHECK_URI = "http://git.yoctoproject.org/cgit/cgit.cgi/opkg-utils/refs/"
SRC_URI[md5sum] = "7bbadb3c381f3ea935b21d3bb8cc4671"