From 62f21a3cc66fd933e29942d2fee3589353159bba89f27d58f13035f954116ed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Wed, 6 Apr 2016 12:10:40 +0000 Subject: [PATCH 1/4] - The logfile for update-alternatives is /var/log/alternatives.log so stop using update-alternatives.log file which is empty OBS-URL: https://build.opensuse.org/package/show/system:packagemanager/dpkg?expand=0&rev=30 --- update-alternatives.changes | 6 ++++++ update-alternatives.spec | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/update-alternatives.changes b/update-alternatives.changes index 4eb7667..741c69a 100644 --- a/update-alternatives.changes +++ b/update-alternatives.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Apr 6 12:05:23 UTC 2016 - tchvatal@suse.com + +- The logfile for update-alternatives is /var/log/alternatives.log + so stop using update-alternatives.log file which is empty + ------------------------------------------------------------------- Fri Mar 25 09:47:24 UTC 2016 - tchvatal@suse.com diff --git a/update-alternatives.spec b/update-alternatives.spec index e8b118c..4809c68 100644 --- a/update-alternatives.spec +++ b/update-alternatives.spec @@ -67,7 +67,7 @@ install -m 0755 utils/%{name} %{buildroot}/%{_sbindir} install -m 0644 man/%{name}.1 %{buildroot}/%{_mandir}/man1/ %post -touch %{_localstatedir}/log/%{name}.log +touch %{_localstatedir}/log/alternatives.log %files %defattr(-,root,root,-) @@ -76,6 +76,6 @@ touch %{_localstatedir}/log/%{name}.log %dir %{_localstatedir}/lib/rpm/alternatives %{_sbindir}/update-alternatives %{_mandir}/man1/update-alternatives.1* -%ghost %{_localstatedir}/log/update-alternatives.log +%ghost %{_localstatedir}/log/alternatives.log %changelog From 8f7f8b5cc03ed6cb68acb24c0513942a5ca3ae5de67c02ab8cc0c35d42dbf543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Wed, 6 Apr 2016 18:21:31 +0000 Subject: [PATCH 2/4] - Fix bnc#969171 by updating even with equal priority * 0001-In-case-of-equal-priority-rather-update.patch - Fix bnc#969171 by updating even with equal priority * 0001-In-case-of-equal-priority-rather-update.patch OBS-URL: https://build.opensuse.org/package/show/system:packagemanager/dpkg?expand=0&rev=31 --- ...case-of-equal-priority-rather-update.patch | 30 +++++++++++++++++++ dpkg.changes | 6 ++++ dpkg.spec | 3 ++ update-alternatives.changes | 6 ++++ update-alternatives.spec | 3 ++ 5 files changed, 48 insertions(+) create mode 100644 0001-In-case-of-equal-priority-rather-update.patch diff --git a/0001-In-case-of-equal-priority-rather-update.patch b/0001-In-case-of-equal-priority-rather-update.patch new file mode 100644 index 0000000..679919e --- /dev/null +++ b/0001-In-case-of-equal-priority-rather-update.patch @@ -0,0 +1,30 @@ +From 9f73659ce9b9194ce2f0219afbfb77d27e90508b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= +Date: Wed, 6 Apr 2016 20:06:15 +0200 +Subject: [PATCH] In case of equal priority rather update + +This is needed because in some cases priorities in openSUSE python +packages were equal in priority yet pointing to different files. +With forced refresh we unfortunately update in some un-needed cases +but are safe against this kind of errors. +--- + utils/update-alternatives.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c +index 5dc3213..1af65a4 100644 +--- a/utils/update-alternatives.c ++++ b/utils/update-alternatives.c +@@ -1437,7 +1437,8 @@ alternative_get_best(struct alternative *a) + best = a->choices; + + for (fs = a->choices; fs; fs = fs->next) +- if (fs->priority > best->priority) ++ /* In case of equal priority rather use the new alternative */ ++ if (fs->priority >= best->priority) + best = fs; + + return best; +-- +2.7.4 + diff --git a/dpkg.changes b/dpkg.changes index 23661a6..85f76fc 100644 --- a/dpkg.changes +++ b/dpkg.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Apr 6 18:20:13 UTC 2016 - tchvatal@suse.com + +- Fix bnc#969171 by updating even with equal priority + * 0001-In-case-of-equal-priority-rather-update.patch + ------------------------------------------------------------------- Fri Mar 25 09:49:52 UTC 2016 - tchvatal@suse.com diff --git a/dpkg.spec b/dpkg.spec index 6d17597..fb81577 100644 --- a/dpkg.spec +++ b/dpkg.spec @@ -30,6 +30,8 @@ Source3: sensible-editor Patch1: update-alternatives-suse.patch # PATCH-FIX-UPSTREAM remove --utf8 since we only build En manpages. Patch6: dpkg-sparc.diff +# PATCH-FIX-SUSE: update if two alternatives have same priority bnc#969171 +Patch7: 0001-In-case-of-equal-priority-rather-update.patch BuildRequires: gcc-c++ BuildRequires: libbz2-devel BuildRequires: libselinux-devel @@ -78,6 +80,7 @@ Libraries and header files for dpkg. %setup -q %patch1 -p1 %patch6 -p1 +%patch7 -p1 %build export CFLAGS="%{optflags}" diff --git a/update-alternatives.changes b/update-alternatives.changes index 741c69a..3cf4e14 100644 --- a/update-alternatives.changes +++ b/update-alternatives.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Apr 6 18:20:13 UTC 2016 - tchvatal@suse.com + +- Fix bnc#969171 by updating even with equal priority + * 0001-In-case-of-equal-priority-rather-update.patch + ------------------------------------------------------------------- Wed Apr 6 12:05:23 UTC 2016 - tchvatal@suse.com diff --git a/update-alternatives.spec b/update-alternatives.spec index 4809c68..ef48d9b 100644 --- a/update-alternatives.spec +++ b/update-alternatives.spec @@ -28,6 +28,8 @@ Source0: http://ftp.de.debian.org/debian/pool/main/d/dpkg/dpkg_%{version} Source3: sensible-editor Patch0: update-alternatives-suse.patch Patch6: dpkg-sparc.diff +# PATCH-FIX-SUSE: update if two alternatives have same priority bnc#969171 +Patch7: 0001-In-case-of-equal-priority-rather-update.patch BuildRequires: ncurses-devel BuildRequires: xz BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -47,6 +49,7 @@ particular preference. %setup -q -n dpkg-%{version} %patch0 -p1 %patch6 -p1 +%patch7 -p1 %build %configure \ From d15c01c5ed20696f879fc7305ec037e7320c40f5405187e074038de172bfaf18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Thu, 7 Apr 2016 10:21:16 +0000 Subject: [PATCH 3/4] - Try to autorefresh all the alternatives in post in case some of them were broken OBS-URL: https://build.opensuse.org/package/show/system:packagemanager/dpkg?expand=0&rev=32 --- update-alternatives.changes | 2 ++ update-alternatives.spec | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/update-alternatives.changes b/update-alternatives.changes index 3cf4e14..cd6ae7b 100644 --- a/update-alternatives.changes +++ b/update-alternatives.changes @@ -3,6 +3,8 @@ Wed Apr 6 18:20:13 UTC 2016 - tchvatal@suse.com - Fix bnc#969171 by updating even with equal priority * 0001-In-case-of-equal-priority-rather-update.patch +- Try to autorefresh all the alternatives in post in case some of + them were broken ------------------------------------------------------------------- Wed Apr 6 12:05:23 UTC 2016 - tchvatal@suse.com diff --git a/update-alternatives.spec b/update-alternatives.spec index ef48d9b..d1bedb4 100644 --- a/update-alternatives.spec +++ b/update-alternatives.spec @@ -32,6 +32,7 @@ Patch6: dpkg-sparc.diff Patch7: 0001-In-case-of-equal-priority-rather-update.patch BuildRequires: ncurses-devel BuildRequires: xz +Requires(post): update-alternatives BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -71,6 +72,11 @@ install -m 0644 man/%{name}.1 %{buildroot}/%{_mandir}/man1/ %post touch %{_localstatedir}/log/alternatives.log +# Fix broken alternatives list bnc#969171 +cd %{_sysconfdir}/alternatives/ +for i in * ; do + update-alternatives --auto $i +done %files %defattr(-,root,root,-) From 484aa89b3d9feaabc7897558859731802bd156fb70db682d6cdca329f732160d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Thu, 7 Apr 2016 10:27:18 +0000 Subject: [PATCH 4/4] OBS-URL: https://build.opensuse.org/package/show/system:packagemanager/dpkg?expand=0&rev=33 --- update-alternatives.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/update-alternatives.spec b/update-alternatives.spec index d1bedb4..73a52db 100644 --- a/update-alternatives.spec +++ b/update-alternatives.spec @@ -75,7 +75,8 @@ touch %{_localstatedir}/log/alternatives.log # Fix broken alternatives list bnc#969171 cd %{_sysconfdir}/alternatives/ for i in * ; do - update-alternatives --auto $i + # continue on errors but still print them out + update-alternatives --auto $i || : done %files