All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Qi <Qi.Chen@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: [PATCH 2/2] opkg-utils: warn if update-alternatives finds priority conflict
Date: Wed, 21 Dec 2016 12:32:47 +0800	[thread overview]
Message-ID: <8829487e98adb89f68c9ef56371d7044184e0078.1482294710.git.Qi.Chen@windriver.com> (raw)
In-Reply-To: <cover.1482294710.git.Qi.Chen@windriver.com>

If multiple providers for a utility have the same alternatives priority,
which one would be chosen is determined by which one is installed later.
Our alternatives system should be able to detect such problem and warn users
so that potential problems could be avoided.

Modify update-alternatives to warn users when detecting multiple providers
with the same priority.

[YOCTO #8314]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 ...rnatives-warn-when-multiple-providers-hav.patch | 26 ++++++++++++++++++++++
 meta/recipes-devtools/opkg-utils/opkg-utils_git.bb |  3 ++-
 2 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/opkg-utils/opkg-utils/0001-update-alternatives-warn-when-multiple-providers-hav.patch

diff --git a/meta/recipes-devtools/opkg-utils/opkg-utils/0001-update-alternatives-warn-when-multiple-providers-hav.patch b/meta/recipes-devtools/opkg-utils/opkg-utils/0001-update-alternatives-warn-when-multiple-providers-hav.patch
new file mode 100644
index 0000000..afce1e1
--- /dev/null
+++ b/meta/recipes-devtools/opkg-utils/opkg-utils/0001-update-alternatives-warn-when-multiple-providers-hav.patch
@@ -0,0 +1,26 @@
+Subject: update-alternatives: warn when multiple providers have the same priority
+
+Upstream-Status: Pending
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ update-alternatives | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/update-alternatives b/update-alternatives
+index ca01d5d..ffad853 100644
+--- a/update-alternatives
++++ b/update-alternatives
+@@ -90,6 +90,9 @@ add_alt() {
+ 	local path="$2"
+ 	local priority="$3"
+ 	remove_alt $name $path
++	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
+ }
+ 
+-- 
+2.8.3
+
diff --git a/meta/recipes-devtools/opkg-utils/opkg-utils_git.bb b/meta/recipes-devtools/opkg-utils/opkg-utils_git.bb
index 19a852e..7b01bfc 100644
--- a/meta/recipes-devtools/opkg-utils/opkg-utils_git.bb
+++ b/meta/recipes-devtools/opkg-utils/opkg-utils_git.bb
@@ -10,7 +10,8 @@ PROVIDES += "${@bb.utils.contains('PACKAGECONFIG', 'update-alternatives', 'virtu
 SRCREV = "3ffece9bf19a844edacc563aa092fd1fbfcffeee"
 PV = "0.3.2+git${SRCPV}"
 
-SRC_URI = "git://git.yoctoproject.org/opkg-utils"
+SRC_URI = "git://git.yoctoproject.org/opkg-utils \
+           file://0001-update-alternatives-warn-when-multiple-providers-hav.patch"
 SRC_URI_append_class-native = " file://tar_ignore_error.patch"
 
 S = "${WORKDIR}/git"
-- 
1.9.1



      parent reply	other threads:[~2016-12-21  4:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-21  4:32 [PATCH 0/2] warn when ALTERNATIVE_PRIORITY are the same Chen Qi
2016-12-21  4:32 ` [PATCH 1/2] package_manager: default to have scriptlet output captured in log Chen Qi
2016-12-22  9:36   ` Jussi Kukkonen
2016-12-23  2:02     ` ChenQi
2016-12-21  4:32 ` Chen Qi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8829487e98adb89f68c9ef56371d7044184e0078.1482294710.git.Qi.Chen@windriver.com \
    --to=qi.chen@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.