use a triggerpostun script to enable rpmdb-rebuild on upgrade [release 4.17.1.1-4mamba;Sun Sep 04 2022]

This commit is contained in:
Silvan Calarco 2024-01-05 17:29:07 +01:00
parent 77b62dbd50
commit 22259b2ad2
4 changed files with 86 additions and 42 deletions

View File

@ -1,10 +0,0 @@
--- rpm-4.14.2.1/scripts/find-lang.sh.orig 2019-08-31 12:50:47.237000000 +0200
+++ rpm-4.14.2.1/scripts/find-lang.sh 2019-08-31 12:50:53.363000000 +0200
@@ -235,6 +235,7 @@
find "$TOP_DIR" -type f -o -type l|sed '
s:'"$TOP_DIR"'::
'"$NO_ALL_NAME$QT"'s:\(.*/'"$NAME"'_\([a-zA-Z]\{2\}\([_@].*\)\?\)\.qm$\):%lang(\2) \1:
+'"$ALL_NAME$QT"'s:^\([^%].*/\([a-zA-Z_@]*\)/LC_MESSAGES/.*\.qm$\):%lang(\2) \1:
'"$ALL_NAME$QT"'s:^\([^%].*/\([a-zA-Z]\{2\}[_@].*\)\.qm$\):%lang(\2) \1:
'"$ALL_NAME$QT"'s:^\([^%].*/\([a-zA-Z]\{2\}\)\.qm$\):%lang(\2) \1:
'"$ALL_NAME$QT"'s:^\([^%].*/[^/_]\+_\([a-zA-Z]\{2\}[_@].*\)\.qm$\):%lang(\2) \1:

View File

@ -0,0 +1,10 @@
--- rpm-4.17.0/scripts/find-lang.sh.orig 2021-09-12 21:17:07.000297399 +0200
+++ rpm-4.17.0/scripts/find-lang.sh 2021-09-12 21:18:23.586346969 +0200
@@ -250,6 +250,7 @@
find "$TOP_DIR" -type f -o -type l|sed '
s:'"$TOP_DIR"'::
'"$NO_ALL_NAME$QT"'s:\(.*/'"$NAME"'_\([a-zA-Z]\+\([_@].*\)\?\)\.qm$\):%lang(\2) \1:
+'"$ALL_NAME$QT"'s:^\([^%].*/\([a-zA-Z_@]*\)/LC_MESSAGES/.*\.qm$\):%lang(\2) \1:
'"$ALL_NAME$QT"'s:^\([^%].*/\([a-zA-Z]\+[_@].*\)\.qm$\):%lang(\2) \1:
'"$ALL_NAME$QT"'s:^\([^%].*/\([a-zA-Z]\+\)\.qm$\):%lang(\2) \1:
'"$ALL_NAME$QT"'s:^\([^%].*/[^/_]\+_\([a-zA-Z]\+[_@].*\)\.qm$\):%lang(\2) \1:

View File

@ -16,8 +16,8 @@
%define majver %(echo %version | cut -d. -f1-2) %define majver %(echo %version | cut -d. -f1-2)
Name: rpm Name: rpm
Epoch: 1 Epoch: 1
Version: 4.16.1.3 Version: 4.17.1.1
Release: 2mamba Release: 4mamba
Summary: The RPM Package Manager (RPM) is a powerful package management system Summary: The RPM Package Manager (RPM) is a powerful package management system
Group: System/Management Group: System/Management
Vendor: openmamba Vendor: openmamba
@ -26,6 +26,7 @@ Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://rpm.org/index.html URL: https://rpm.org/index.html
Source: http://ftp.rpm.org/releases/rpm-%{majver}.x/rpm-%{version}.tar.bz2 Source: http://ftp.rpm.org/releases/rpm-%{majver}.x/rpm-%{version}.tar.bz2
Source2: rpm4-macros_openmamba Source2: rpm4-macros_openmamba
Source3: rpmdb-rebuild.service
Patch0: rpm-4.14.2.1-fix-rebuilddb-from-rpm-5.2.patch Patch0: rpm-4.14.2.1-fix-rebuilddb-from-rpm-5.2.patch
Patch1: rpm-4.14.2.1-fix-rebuilddb-from-rpm-5.2-better.patch Patch1: rpm-4.14.2.1-fix-rebuilddb-from-rpm-5.2-better.patch
Patch2: rpm-4.14.2.1-fix-missing-translations-from-rpm4-segfault.patch Patch2: rpm-4.14.2.1-fix-missing-translations-from-rpm4-segfault.patch
@ -38,18 +39,18 @@ Patch8: rpm-4.14.2.1-arm-openamba-force-armv5t.patch
Patch9: rpm-4.14.2.1-increase_default_patch_fuzz.patch Patch9: rpm-4.14.2.1-increase_default_patch_fuzz.patch
Patch10: rpm-4.14.2.1-openmamba-buildroot.patch Patch10: rpm-4.14.2.1-openmamba-buildroot.patch
Patch11: rpm-4.14.2.1-target-platform-gnu.patch Patch11: rpm-4.14.2.1-target-platform-gnu.patch
Patch12: rpm-4.14.2.1-find-lang-qt-fix.patch Patch12: rpm-4.17.0-find-lang-qt-fix.patch
Patch13: rpm-4.16.1.3-pythondistdeps-no-richdeps.patch Patch13: rpm-4.16.1.3-pythondistdeps-no-richdeps.patch
License: LGPL License: LGPL
## AUTOBUILDREQ-BEGIN ## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel BuildRequires: glibc-devel
BuildRequires: ldconfig
BuildRequires: libacl-devel BuildRequires: libacl-devel
BuildRequires: libarchive-devel BuildRequires: libarchive-devel
BuildRequires: libattr-devel
BuildRequires: libaudit-devel BuildRequires: libaudit-devel
BuildRequires: libb2-devel
BuildRequires: libbzip2-devel BuildRequires: libbzip2-devel
BuildRequires: libcap-ng-devel BuildRequires: libcap-ng-devel
BuildRequires: libdb53-devel
BuildRequires: libdbus-devel BuildRequires: libdbus-devel
BuildRequires: libdw-devel BuildRequires: libdw-devel
BuildRequires: libelf-devel BuildRequires: libelf-devel
@ -71,12 +72,12 @@ BuildRequires: libsystemd-devel
BuildRequires: libxml2-devel BuildRequires: libxml2-devel
BuildRequires: libz-devel BuildRequires: libz-devel
BuildRequires: libzstd-devel BuildRequires: libzstd-devel
BuildRequires: python3
## AUTOBUILDREQ-END ## AUTOBUILDREQ-END
BuildRequires: setup >= 1.2.0 BuildRequires: setup >= 1.2.0
Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release} Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release}
Provides: rpm-build Provides: rpm-build
Obsoletes: rpm-build < 1:4.16.1.2 Obsoletes: rpm-build < 1:4.16.1.2
Requires: debugedit
%description %description
The RPM Package Manager (RPM) is a powerful package management system capable of building computer software from source into easily distributable packages installing, updating and uninstalling packaged software querying detailed information about the packaged software, whether installed or not verifying integrity of packaged software and resulting software installation. The RPM Package Manager (RPM) is a powerful package management system capable of building computer software from source into easily distributable packages installing, updating and uninstalling packaged software querying detailed information about the packaged software, whether installed or not verifying integrity of packaged software and resulting software installation.
@ -139,9 +140,9 @@ This package should be installed if you want to develop Python programs that wil
%patch10 -p1 %patch10 -p1
%patch11 -p1 %patch11 -p1
%patch12 -p1 %patch12 -p1
%patch13 -p1 #%patch13 -p1
sed -i "s|/usr/bin/python$|%{__python3}|" scripts/pythondistdeps.py #sed -i "s|/usr/bin/python$|%{__python3}|" scripts/pythondistdeps.py
./autogen.sh --noconfigure ./autogen.sh --noconfigure
@ -157,14 +158,16 @@ sed -i "s|/usr/bin/python$|%{__python3}|" scripts/pythondistdeps.py
--infodir=%{__prefix}/share/info \ --infodir=%{__prefix}/share/info \
--localstatedir=/var \ --localstatedir=/var \
--sysconfdir=/etc \ --sysconfdir=/etc \
--with-path-sources=%{__prefix}/src/RPM \
--with-path-lib=%{_prefix}/lib/rpm%{?program_suffix} \
--with-path-cfg=%{_sysconfdir}/rpm%{?program_suffix} \
--enable-python \ --enable-python \
--with-external-db \
--with-vendor=openmamba \ --with-vendor=openmamba \
--enable-bdb-ro \
PYTHON=%{__python3} PYTHON=%{__python3}
# --with-path-sources=%{__prefix}/src/RPM \
# --with-path-lib=%{_prefix}/lib/rpm%{?program_suffix} \
# --with-path-cfg=%{_sysconfdir}/rpm%{?program_suffix} \
# --with-external-db \
%make %make
%install %install
@ -179,6 +182,9 @@ mkdir -p %{buildroot}%{_usr}/src/RPM/{BUILD,RPMS/{aarch64,arm,i586,noarch,x86_64
# install rpm macros for openmamba # install rpm macros for openmamba
install -D -m 644 %{S:2} %{buildroot}%{_sysconfdir}/rpm%{?program_suffix}/macros.openmamba install -D -m 644 %{S:2} %{buildroot}%{_sysconfdir}/rpm%{?program_suffix}/macros.openmamba
# install rpmdb-rebuild service
install -D -m0644 %{SOURCE3} %{buildroot}%{_unitdir}/rpmdb-rebuild.service
%ifarch x86_64 %ifarch x86_64
sed -i "s|/libexec$|/%{_libexec}|" %{buildroot}%{_prefix}/lib/rpm/platform/x86_64-linux/macros sed -i "s|/libexec$|/%{_libexec}|" %{buildroot}%{_prefix}/lib/rpm/platform/x86_64-linux/macros
%endif %endif
@ -187,28 +193,24 @@ sed -i "s|/libexec$|/%{_libexec}|" %{buildroot}%{_prefix}/lib/rpm/platform/x86_6
sed -i "s|/libexec$|/%{_libexec}|" %{buildroot}%{_prefix}/lib/rpm/platform/aarch64-linux/macros sed -i "s|/libexec$|/%{_libexec}|" %{buildroot}%{_prefix}/lib/rpm/platform/aarch64-linux/macros
%endif %endif
rm -f %{buildroot}%{_libdir}/librpm*.la
%clean %clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" [ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%pretrans %pretrans
[ -e /var/lib/rpm/Enhancename ] || { # Prepare upgrade from bdb to sqlite
cp -a /var/lib/rpm /var/lib/rpm.52.pretrans.bak [ -e /var/lib/rpm/Packages -a ! -e /var/lib/rpm/.rebuilddb ] && {
cp -a /var/lib/rpm /var/lib/rpm.bdb.bak && touch /var/lib/rpm/.rebuilddb
} }
: :
%post %post
# Upgrade db from 5.2.1 (tricky) %systemd_post rpmdb-rebuild.service
[ -e /var/lib/rpm/Enhancename ] || { :
cat > /tmp/rpm-upgrade.sh << _EOF
#!/bin/sh %preun
while true; do fuser -s /var/lib/rpm/*; [ $? -eq 1 ] && break; sleep 5; done %systemd_preun rpmdb-rebuild.service
echo "** Performing rpmdb upgrade from rpm5 to rpm4..."
rpm --rebuilddb
rpm --rebuilddb && echo "** rpmdb upgrade completed successfully"
_EOF
chmod +x /tmp/rpm-upgrade.sh
/bin/sh /tmp/rpm-upgrade.sh &
}
: :
%post -n lib%{name} %post -n lib%{name}
@ -217,14 +219,18 @@ _EOF
/usr/sbin/useradd packager -u %{packager_userid} -g packager -d /dev/null -s /bin/false 2>/dev/null || : /usr/sbin/useradd packager -u %{packager_userid} -g packager -d /dev/null -s /bin/false 2>/dev/null || :
: :
%postun -n lib%{name} %postun -n lib%{name} -p /sbin/ldconfig
/sbin/ldconfig
%triggerpostun -- rpm < 1:4.17.1.1-4mamba
# Ensuring enabling rpmdb-rebuild service on update
/usr/bin/systemctl enable rpmdb-rebuild.service
: :
%files -f rpm.lang %files -f rpm.lang
%defattr(-,root,root) %defattr(-,root,root)
%dir %{_sysconfdir}/rpm%{?program_suffix} %dir %{_sysconfdir}/rpm%{?program_suffix}
%config %{_sysconfdir}/rpm%{?program_suffix}/macros.openmamba %config %{_sysconfdir}/rpm%{?program_suffix}/macros.openmamba
%{_sysconfdir}/dbus-1/system.d/org.rpm.conf
%{_bindir}/gendiff%{?program_suffix} %{_bindir}/gendiff%{?program_suffix}
%{_bindir}/rpm%{?program_suffix} %{_bindir}/rpm%{?program_suffix}
%{_bindir}/rpm2archive%{?program_suffix} %{_bindir}/rpm2archive%{?program_suffix}
@ -237,6 +243,7 @@ _EOF
%{_bindir}/rpmsign%{?program_suffix} %{_bindir}/rpmsign%{?program_suffix}
%{_bindir}/rpmspec%{?program_suffix} %{_bindir}/rpmspec%{?program_suffix}
%{_bindir}/rpmverify %{_bindir}/rpmverify
%{_unitdir}/rpmdb-rebuild.service
%dir %{_prefix}/lib/rpm %dir %{_prefix}/lib/rpm
%{_prefix}/lib/rpm/* %{_prefix}/lib/rpm/*
%dir /usr/src/RPM %dir /usr/src/RPM
@ -274,13 +281,9 @@ _EOF
%defattr(-,root,root) %defattr(-,root,root)
%dir %{_includedir}/rpm %dir %{_includedir}/rpm
%{_includedir}/rpm/*.h %{_includedir}/rpm/*.h
%{_libdir}/librpm.la
%{_libdir}/librpm.so %{_libdir}/librpm.so
%{_libdir}/librpmbuild.la
%{_libdir}/librpmbuild.so %{_libdir}/librpmbuild.so
%{_libdir}/librpmio.la
%{_libdir}/librpmio.so %{_libdir}/librpmio.so
%{_libdir}/librpmsign.la
%{_libdir}/librpmsign.so %{_libdir}/librpmsign.so
%{_libdir}/pkgconfig/rpm.pc %{_libdir}/pkgconfig/rpm.pc
%doc ChangeLog README %doc ChangeLog README
@ -291,6 +294,28 @@ _EOF
%{python3_sitearch}/rpm/* %{python3_sitearch}/rpm/*
%changelog %changelog
* Sun Sep 04 2022 Silvan Calarco <silvan.calarco@mambasoft.it> 4.17.1.1-4mamba
- use a triggerpostun script to enable rpmdb-rebuild on upgrade
* Sun Sep 04 2022 Silvan Calarco <silvan.calarco@mambasoft.it> 4.17.1.1-3mamba
- enable rpmdb-rebuild service on update
* Sat Sep 03 2022 Silvan Calarco <silvan.calarco@mambasoft.it> 4.17.1.1-2mamba
- install rpmdb-rebuild service and configure to perform upgrade from bdb to sqlite
- require debugedit for find-debuginfo
* Sat Sep 03 2022 Automatic Build System <autodist@mambasoft.it> 4.17.1.1-1mamba
- automatic version update by autodist
* Fri Jul 01 2022 Automatic Build System <autodist@mambasoft.it> 4.17.1-1mamba
- automatic version update by autodist
* Tue Sep 14 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 4.17.0-2mamba
- rebuilt with --enable-bdb-ro
* Mon Sep 13 2021 Automatic Build System <autodist@mambasoft.it> 4.17.0-1mamba
- automatic version update by autodist
* Sun Apr 18 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 4.16.1.3-2mamba * Sun Apr 18 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 4.16.1.3-2mamba
- patches: pythondistdeps: use normal deps instead of rich deps; rpmrc: armv7l: set march=armv7-a - patches: pythondistdeps: use normal deps instead of rich deps; rpmrc: armv7l: set march=armv7-a

19
rpmdb-rebuild.service Normal file
View File

@ -0,0 +1,19 @@
[Unit]
Description=RPM database rebuild
ConditionPathExists=/var/lib/rpm/.rebuilddb
# This should run before any daemons that may open the rpmdb
DefaultDependencies=no
After=sysinit.target
Before=basic.target shutdown.target
Conflicts=shutdown.target
# In case /usr is remote-mounted
RequiresMountsFor=/usr
[Service]
Type=oneshot
ExecStart=/usr/bin/rpmdb --rebuilddb
ExecStartPost=rm -f /var/lib/rpm/.rebuilddb
[Install]
WantedBy=basic.target