From 5cf1016a45f10c98972764bd1357cdbfc6e45c890747e0bb1416a4f839ebe7dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Wed, 22 Nov 2017 11:15:53 +0000 Subject: [PATCH] Accepting request 544381 from home:dimstar:Factory - Migrate u-a data from /var/lib/rpm instead of relying on dbpath: no u-a version ever installed files explicitly into dbpath, but always hard specified /var/lib/rpm. The fact that RPM moved its database is irrelevant to update-alternatives. In case RPM moved it's database, our files are still accessible via the /var/lib/rpm symlink being put in place. - Drop the arbitrary depenency on a specific rpm version: the idea was to ensure to have an rpm with the new dbpath location in place. For one, the dependency does not work as intended, and 2nd, as the migration now happens explicitly from the old u-a admindir without relying on dbpath, is no longer needed. OBS-URL: https://build.opensuse.org/request/show/544381 OBS-URL: https://build.opensuse.org/package/show/system:packagemanager/dpkg?expand=0&rev=55 --- update-alternatives.changes | 15 +++++++++++++++ update-alternatives.spec | 8 +++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/update-alternatives.changes b/update-alternatives.changes index 99a0559..77f4958 100644 --- a/update-alternatives.changes +++ b/update-alternatives.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Wed Nov 22 11:06:33 UTC 2017 - dimstar@opensuse.org + +- Migrate u-a data from /var/lib/rpm instead of relying on dbpath: + no u-a version ever installed files explicitly into dbpath, but + always hard specified /var/lib/rpm. The fact that RPM moved its + database is irrelevant to update-alternatives. In case RPM moved + it's database, our files are still accessible via the + /var/lib/rpm symlink being put in place. +- Drop the arbitrary depenency on a specific rpm version: the idea + was to ensure to have an rpm with the new dbpath location in + place. For one, the dependency does not work as intended, and + 2nd, as the migration now happens explicitly from the old u-a + admindir without relying on dbpath, is no longer needed. + ------------------------------------------------------------------- Mon Nov 20 14:50:53 UTC 2017 - mpluskal@suse.com diff --git a/update-alternatives.spec b/update-alternatives.spec index 6af80d0..228e2d0 100644 --- a/update-alternatives.spec +++ b/update-alternatives.spec @@ -33,8 +33,6 @@ BuildRequires: automake BuildRequires: libtool BuildRequires: ncurses-devel BuildRequires: pkgconfig -# We want to make sure to have rpm with new dbpath used -Requires(post): rpm >= 4.13 Requires(post): coreutils Requires(post): update-alternatives Provides: alternatives = %{version} @@ -78,13 +76,13 @@ install -pm 0644 man/%{name}.1 %{buildroot}/%{_mandir}/man1/ %post # Migrate to new location -if [ -d %{_dbpath}/alternatives ]; then +if [ -d var/lib/rpm/alternatives ]; then echo "migrating update alternatives database to new location" # We proceed even if no alternatives directory exists, such situation # occurs in buildroot environment (we can't buildrequire package # itself). - mv -f %{_dbpath}/alternatives/* /var/lib/alternatives/ || : - rmdir %{_dbpath}/alternatives ||: + mv -f var/lib/rpm/alternatives/* /var/lib/alternatives/ || : + rmdir var/lib/rpm/alternatives ||: fi touch %{_localstatedir}/log/alternatives.log