From 4ddd505dd73daea7a2b92b1fedf4d69e6193b81f8afa06e9d24c2db8897fc2bb Mon Sep 17 00:00:00 2001 From: Frank Schreiner Date: Wed, 3 Feb 2021 15:49:49 +0000 Subject: [PATCH] Accepting request 863143 from home:lnussel:usrmove - don't remove slave links that turned into master. Happens on usrmerge (boo#1180939, update-alternatives-slavetomaster.patch) OBS-URL: https://build.opensuse.org/request/show/863143 OBS-URL: https://build.opensuse.org/package/show/system:packagemanager/dpkg?expand=0&rev=77 --- dpkg.spec | 2 +- update-alternatives-slavetomaster.patch | 16 ++++++++++++++++ update-alternatives.changes | 6 ++++++ update-alternatives.spec | 6 +++--- 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 update-alternatives-slavetomaster.patch diff --git a/dpkg.spec b/dpkg.spec index ce76baa..2973b94 100644 --- a/dpkg.spec +++ b/dpkg.spec @@ -1,7 +1,7 @@ # # spec file for package dpkg # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed diff --git a/update-alternatives-slavetomaster.patch b/update-alternatives-slavetomaster.patch new file mode 100644 index 0000000..aaf40b4 --- /dev/null +++ b/update-alternatives-slavetomaster.patch @@ -0,0 +1,16 @@ +Index: dpkg-1.19.0.5/utils/update-alternatives.c +=================================================================== +--- dpkg-1.19.0.5.orig/utils/update-alternatives.c ++++ dpkg-1.19.0.5/utils/update-alternatives.c +@@ -1796,7 +1796,10 @@ alternative_prepare_install(struct alter + /* Drop unused slave. */ + fn = xasprintf("%s/%s", altdir, sl->name); + if (alternative_path_can_remove(sl->link)) +- alternative_add_commit_op(a, OPCODE_RM, sl->link, NULL); ++ if (strcmp(sl->link, a->master_link)) ++ alternative_add_commit_op(a, OPCODE_RM, sl->link, NULL); ++ else ++ warning("not removing %s, now master", a->master_link); + else + warning(_("not removing %s since it's not a symlink"), + sl->link); diff --git a/update-alternatives.changes b/update-alternatives.changes index 47efb05..7462228 100644 --- a/update-alternatives.changes +++ b/update-alternatives.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Jan 14 09:33:00 UTC 2021 - Ludwig Nussel + +- don't remove slave links that turned into master. Happens on usrmerge + (boo#1180939, update-alternatives-slavetomaster.patch) + ------------------------------------------------------------------- Tue Apr 2 20:04:25 UTC 2019 - Andreas Schwab diff --git a/update-alternatives.spec b/update-alternatives.spec index 273f71c..c491de5 100644 --- a/update-alternatives.spec +++ b/update-alternatives.spec @@ -1,7 +1,7 @@ # # spec file for package update-alternatives # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -26,6 +26,7 @@ URL: http://ftp.de.debian.org/debian/pool/main/d/dpkg/ Source0: http://ftp.de.debian.org/debian/pool/main/d/dpkg/dpkg_%{version}.tar.xz Source3: sensible-editor Patch0: update-alternatives-suse.patch +Patch1: update-alternatives-slavetomaster.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: libtool @@ -45,8 +46,7 @@ make a good choice of editor to invoke if the user has not specified a particular preference. %prep -%setup -q -n dpkg-%{version} -%patch0 -p1 +%autosetup -p1 -n dpkg-%{version} %build %global _lto_cflags %{_lto_cflags} -ffat-lto-objects