Hello community, here is the log from the commit of package dpkg for openSUSE:Factory checked in at 2019-03-18 10:33:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/dpkg (Old) and /work/SRC/openSUSE:Factory/.dpkg.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "dpkg" Mon Mar 18 10:33:40 2019 rev:27 rq:684644 version:1.19.0.5 Changes: -------- --- /work/SRC/openSUSE:Factory/dpkg/update-alternatives.changes 2019-01-29 14:38:45.351526801 +0100 +++ /work/SRC/openSUSE:Factory/.dpkg.new.28833/update-alternatives.changes 2019-03-18 10:33:46.207554397 +0100 @@ -1,0 +2,5 @@ +Wed Mar 13 09:15:51 UTC 2019 - Stephan Kulow <co...@suse.com> + +- my attempt to rewrite %post in lua (bsc#1129036) + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ update-alternatives.spec ++++++ --- /var/tmp/diff_new_pack.SeiSVm/_old 2019-03-18 10:33:46.915554220 +0100 +++ /var/tmp/diff_new_pack.SeiSVm/_new 2019-03-18 10:33:46.919554219 +0100 @@ -31,8 +31,6 @@ BuildRequires: libtool BuildRequires: ncurses-devel BuildRequires: pkgconfig -Requires(post): coreutils -Requires(post): update-alternatives Provides: alternatives = %{version} %description @@ -71,18 +69,24 @@ ln -s %{name} %{buildroot}/%{_sbindir}/alternatives install -pm 0644 man/%{name}.1 %{buildroot}/%{_mandir}/man1/ -%post -# Migrate to new location -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 var/lib/rpm/alternatives/* %{_localstatedir}/lib/alternatives/ || : - rmdir var/lib/rpm/alternatives ||: -fi - -touch %{_localstatedir}/log/alternatives.log +%post -p <lua> +-- Migrate to new location +if posix.access('var/lib/rpm/alternatives', 'x') then + print("migrating update alternatives database to new location") + -- We proceed even if no alternatives directory exists, such situation + -- occurs in buildroot environment + new_location=rpm.expand('%{_localstatedir}/lib/alternatives/') + for i,old_file in pairs(posix.dir("var/lib/rpm/alternatives/")) do + print(old_file.."\n") + new_file = string.gsub(old_file, "(.*/)(.*)", new_location .. "%2") + print(new_file.."\n") + os.rename(old_file, new_file) + end + posix.rmdir('var/lib/rpm/alternatives') +end +-- touch file +new_file = io.open(rpm.expand('%{_localstatedir}/log/alternatives.log'), "w") +new_file.close() %files %license COPYING