Accepting request 533751 from home:RBrownSUSE:branches:Base:System

Now with mitigation for any scriptlets running in the same transaction. 
Also has the added benefit of no longer creating an empty db in /usr/lib/rpmdb just to overwrite it again in posttrans.

OBS-URL: https://build.opensuse.org/request/show/533751
OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=404
This commit is contained in:
Michael Schröder 2017-10-16 13:34:53 +00:00 committed by Git OBS Bridge
parent 4b044876a1
commit c7cda24f07
3 changed files with 56 additions and 9 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Oct 5 13:28:53 UTC 2017 - rbrown@suse.com
- Add usr-lib-rpmdb.patch to locate rpmdb to /usr/lib/rpmdb
- Migrates existing rpmdb in /var/lib/rpm to /usr/lib/rpmdb
-------------------------------------------------------------------
Fri Sep 8 15:37:36 UTC 2017 - mmarek@suse.com

View File

@ -63,6 +63,7 @@ Patch1: beecrypt-4.1.2.diff
Patch2: db.diff
Patch3: rpm-4.12.0.1-fix-bashisms.patch
Patch4: beecrypt-4.1.2-build.diff
Patch5: usr-lib-rpmdb.patch
# quilt patches start here
Patch11: debugedit.diff
Patch13: ignore-auxv.diff
@ -228,6 +229,7 @@ rm -f rpmdb/db.h
%patch -P 1
%patch3 -p1
%patch -P 4
%patch5 -p1
%patch -P 11 -P 12 -P 13 -P 14 -P 15 -P 16 -P 17 -P 18 -P 19
%patch -P 20 -P 21 -P 24 -P 25 -P 26 -P 27 -P 28 -P 29
%patch -P 30 -P 31 -P 32 -P 33 -P 34 -P 35 -P 36 -P 37 -P 38
@ -326,6 +328,7 @@ for d in %{buildroot}/usr/lib/rpm/platform/*-linux/macros ; do
mkdir %{buildroot}/usr/src/packages/RPMS/$dd
chmod 755 %{buildroot}/usr/src/packages/RPMS/$dd
done
mkdir -p %{buildroot}/usr/lib/rpmdb
mkdir -p %{buildroot}/var/lib/rpm
gzip -9 %{buildroot}/%{_mandir}/man[18]/*.[18]
export RPM_BUILD_ROOT
@ -380,15 +383,41 @@ echo -n "%{_target_cpu}-suse-linux-gnueabi" > %{buildroot}/etc/rpm/platform
%post
%{fillup_only -an services}
test -f var/lib/rpm/Packages || rpmdb --initdb
if test -s var/lib/rpm/packages.rpm ; then
echo "converting rpm-3 database to rpm-4 format..."
usr/lib/rpm/convertdb1 var/lib/rpm/packages.rpm
mv -f var/lib/rpm/packages.rpm var/lib/rpm/packages.rpm3
rm -f var/lib/rpm/conflictsindex.rpm var/lib/rpm/fileindex.rpm var/lib/rpm/groupindex.rpm var/lib/rpm/nameindex.rpm var/lib/rpm/providesindex.rpm var/lib/rpm/requiredby.rpm var/lib/rpm/triggerindex.rpm
# var/lib/rpm migration: set forwards compatible symlink for /usr/lib/rpmdb so scriptlets in same transaction will still work
if (test ! -L var/lib/rpm) && (test -f var/lib/rpm/Packages) ; then
rmdir usr/lib/rpmdb
ln -s ../../var/lib/rpm usr/lib/rpmdb
fi
test -f usr/lib/rpmdb/Packages || rpmdb --initdb
%posttrans
# var/lib/rpm migration
if test ! -L var/lib/rpm ; then
if test -s var/lib/rpm/packages.rpm ; then
echo "converting rpm-3 database to rpm-4 format..."
usr/lib/rpm/convertdb1 var/lib/rpm/packages.rpm
mv -f var/lib/rpm/packages.rpm var/lib/rpm/packages.rpm3
rm -f var/lib/rpm/conflictsindex.rpm var/lib/rpm/fileindex.rpm var/lib/rpm/groupindex.rpm var/lib/rpm/nameindex.rpm var/lib/rpm/providesindex.rpm var/lib/rpm/requiredby.rpm var/lib/rpm/triggerindex.rpm
fi
# delete no longer maintained databases
rm -f var/lib/rpm/Filemd5s var/lib/rpm/Filedigests var/lib/rpm/Requireversion var/lib/rpmdb/Provideversion
if test -f var/lib/rpm/Packages ; then
echo "migrating rpmdb from /var/lib/rpm to /usr/lib/rpmdb..."
# remove forwards compatible symlink
if test -L usr/lib/rpmdb ; then
rm -f usr/lib/rpmdb
mkdir -p usr/lib/rpmdb
fi
mv -f var/lib/rpm/.[!.]* usr/lib/rpmdb/
mv -f var/lib/rpm/* usr/lib/rpmdb/
fi
rmdir var/lib/rpm && ln -s ../../usr/lib/rpmdb var/lib/rpm
fi
# delete no longer maintained databases
rm -f var/lib/rpm/Filemd5s var/lib/rpm/Filedigests var/lib/rpm/Requireversion var/lib/rpm/Provideversion
%files -f rpm.lang
%defattr(-,root,root)
@ -408,7 +437,8 @@ rm -f var/lib/rpm/Filemd5s var/lib/rpm/Filedigests var/lib/rpm/Requireversion va
%{_libdir}/librpmio.so.*
%{_libdir}/librpmsign.so.*
%doc %{_mandir}/man[18]/*.[18]*
%dir /var/lib/rpm
%dir /usr/lib/rpmdb
%dir /var/lib/rpm
%dir %attr(755,root,root) /usr/src/packages/BUILD
%dir %attr(755,root,root) /usr/src/packages/SPECS
%dir %attr(755,root,root) /usr/src/packages/SOURCES

11
usr-lib-rpmdb.patch Normal file
View File

@ -0,0 +1,11 @@
--- rpm-4.13.0.1/macros.in.orig 2017-10-04 17:05:17.198681581 +0200
+++ rpm-4.13.0.1/macros.in 2017-10-04 17:07:37.122679969 +0200
@@ -165,7 +165,7 @@
%_bzip2bin %{__bzip2}
# The location of the rpm database file(s).
-%_dbpath %{_var}/lib/rpm
+%_dbpath %{_usr}/lib/rpmdb
# The location of the rpm database file(s) after "rpm --rebuilddb".
%_dbpath_rebuild %{_dbpath}