]> TLD Linux GIT Repositories - packages/rpm.git/blobdiff - rpm.spec
- merged PLD changes, TLDized
[packages/rpm.git] / rpm.spec
index 97ab2c8e847faa7a36162f90d1164eabf602f03b..18c81df3e0088d31ed9175a07524c8cc1b615af8 100644 (file)
--- a/rpm.spec
+++ b/rpm.spec
@@ -6,7 +6,7 @@
 %bcond_without apidocs         # don't generate documentation with doxygen
 %bcond_without python3         # don't build python bindings
 %bcond_without plugins         # build plugins
 %bcond_without apidocs         # don't generate documentation with doxygen
 %bcond_without python3         # don't build python bindings
 %bcond_without plugins         # build plugins
-%bcond_with    recommends_tags # build without Recommends tag (bootstrapping)
+%bcond_without recommends_tags # build without Recommends tag (bootstrapping)
 %bcond_with    imaevm          # build with IMA/EVM support (requires libimaevm from ima-evm-utils)
 
 %define                db_ver          5.3.28.0
 %bcond_with    imaevm          # build with IMA/EVM support (requires libimaevm from ima-evm-utils)
 
 %define                db_ver          5.3.28.0
@@ -26,7 +26,7 @@ Summary(ru.UTF-8):    Менеджер пакетов от RPM
 Summary(uk.UTF-8):     Менеджер пакетів від RPM
 Name:          rpm
 Version:       4.16.1.2
 Summary(uk.UTF-8):     Менеджер пакетів від RPM
 Name:          rpm
 Version:       4.16.1.2
-Release:       0.1
+Release:       0.3
 Epoch:         1
 License:       GPL v2 / LGPL v2.1
 Group:         Base
 Epoch:         1
 License:       GPL v2 / LGPL v2.1
 Group:         Base
@@ -48,9 +48,6 @@ Source12:     %{name}.noautoprovfiles
 Source13:      %{name}.noautoreq
 Source14:      %{name}.noautoreqfiles
 Source15:      perl.prov
 Source13:      %{name}.noautoreq
 Source14:      %{name}.noautoreqfiles
 Source15:      perl.prov
-Source16:      %{name}db_checkversion.c
-Source17:      %{name}db_reset.c
-Source18:      dbupgrade.sh
 Patch0:                %{name}-man_pl.patch
 Patch1:                %{name}-popt-aliases.patch
 Patch2:                %{name}-perl-macros.patch
 Patch0:                %{name}-man_pl.patch
 Patch1:                %{name}-popt-aliases.patch
 Patch2:                %{name}-perl-macros.patch
@@ -83,6 +80,7 @@ Patch29:      %{name}-noarch_py_prov.patch
 Patch30:       missing-ghost-terminate-build.patch
 Patch31:       missing-doc-terminate-build.patch
 Patch32:       noexpand.patch
 Patch30:       missing-ghost-terminate-build.patch
 Patch31:       missing-doc-terminate-build.patch
 Patch32:       noexpand.patch
+Patch33:       sqlite-db-backend.patch
 Patch100:      build-id-links.patch
 URL:           https://rpm.org/
 BuildRequires: acl-devel
 Patch100:      build-id-links.patch
 URL:           https://rpm.org/
 BuildRequires: acl-devel
@@ -105,7 +103,6 @@ BuildRequires:      libselinux-devel >= 2.1.0
 # needed only for AM_PROG_CXX used for CXX substitution in rpm.macros
 BuildRequires: libstdc++-devel
 BuildRequires: libtool >= 1:1.4.2-9
 # needed only for AM_PROG_CXX used for CXX substitution in rpm.macros
 BuildRequires: libstdc++-devel
 BuildRequires: libtool >= 1:1.4.2-9
-BuildRequires: ossp-uuid-devel
 BuildRequires: patch >= 2.2
 BuildRequires: pkgconfig(lua) >= 5.1
 BuildRequires: popt-devel >= %{popt_ver}
 BuildRequires: patch >= 2.2
 BuildRequires: pkgconfig(lua) >= 5.1
 BuildRequires: popt-devel >= %{popt_ver}
@@ -133,12 +130,11 @@ Requires: rpm-tld-macros >= 1.744
 Requires:      FHS >= 3.0-2
 Requires:      libgcrypt
 Requires:      popt >= %{popt_ver}
 Requires:      FHS >= 3.0-2
 Requires:      libgcrypt
 Requires:      popt >= %{popt_ver}
-#%if %{with recommends_tags}
-#Recommends:   rpm-plugin-audit
-#Recommends:   rpm-plugin-prioreset
-#Recommends:   rpm-plugin-syslog
-#Recommends:   rpm-plugin-systemd-inhibit
-#%endif
+%if %{with recommends_tags}
+Recommends:    rpm-plugin-audit
+Recommends:    rpm-plugin-prioreset
+Recommends:    rpm-plugin-syslog
+%endif
 Obsoletes:     rpm-utils-perl
 Obsoletes:     rpm-utils-static
 Conflicts:     glibc < 2.2.92
 Obsoletes:     rpm-utils-perl
 Obsoletes:     rpm-utils-static
 Conflicts:     glibc < 2.2.92
@@ -321,10 +317,10 @@ Summary(pl.UTF-8):        Dodatkowe narzędzia do zarządzania bazą RPM-a i pakietami
 Group:         Applications/File
 Requires:      %{name} = %{epoch}:%{version}-%{release}
 Requires:      popt >= %{popt_ver}
 Group:         Applications/File
 Requires:      %{name} = %{epoch}:%{version}-%{release}
 Requires:      popt >= %{popt_ver}
-#%if %{with recommends_tags}
-#Recommends:   bzip2
-#Recommends:   gzip
-#%endif
+%if %{with recommends_tags}
+Recommends:    bzip2
+Recommends:    gzip
+%endif
 Conflicts:     filesystem-debuginfo < 3.0-16
 
 %description utils
 Conflicts:     filesystem-debuginfo < 3.0-16
 
 %description utils
@@ -489,15 +485,6 @@ Requires:  %{name}-lib = %{epoch}:%{version}-%{release}
 %description plugin-syslog
 This plugin exports RPM actions to the system log.
 
 %description plugin-syslog
 This plugin exports RPM actions to the system log.
 
-%package plugin-systemd-inhibit
-Summary:       Plugin for systemd inhibit functionality
-Group:         Base
-Requires:      %{name}-lib = %{epoch}:%{version}-%{release}
-
-%description plugin-systemd-inhibit
-This plugin blocks systemd from entering idle, sleep or shutdown while
-an rpm transaction is running using the systemd-inhibit mechanism.
-
 %package plugin-ima
 Summary:       Plugin for IMA file signatures
 Group:         Base
 %package plugin-ima
 Summary:       Plugin for IMA file signatures
 Group:         Base
@@ -514,8 +501,7 @@ Requires:   %{name}-lib = %{epoch}:%{version}-%{release}
 
 %description plugin-prioreset
 This plugin is useful on legacy SysV init systems if you run rpm
 
 %description plugin-prioreset
 This plugin is useful on legacy SysV init systems if you run rpm
-transactions with nice/ionice priorities. Should not be used on
-systemd systems.
+transactions with nice/ionice priorities.
 
 %package plugin-selinux
 Summary:       Plugin for SELinux functionality
 
 %package plugin-selinux
 Summary:       Plugin for SELinux functionality
@@ -582,6 +568,7 @@ Dokumentacja API RPM-a oraz przewodniki w formacie HTML generowane ze
 %patch30 -p1
 %patch31 -p1
 %patch32 -p1
 %patch30 -p1
 %patch31 -p1
 %patch32 -p1
+%patch33 -p1
 %patch100 -p1
 
 install %{SOURCE15} scripts/perl.prov.in
 %patch100 -p1
 
 install %{SOURCE15} scripts/perl.prov.in
@@ -591,9 +578,6 @@ install %{SOURCE15} scripts/perl.prov.in
 # generate Group translations to *.po
 awk -f %{SOURCE6} %{SOURCE5}
 
 # generate Group translations to *.po
 awk -f %{SOURCE6} %{SOURCE5}
 
-install %{SOURCE16} tools/rpmdb_checkversion.c
-install %{SOURCE17} tools/rpmdb_reset.c
-
 %{__sed} -i -e '1s,/usr/bin/python,%{__python3},' scripts/pythondistdeps.py
 
 %build
 %{__sed} -i -e '1s,/usr/bin/python,%{__python3},' scripts/pythondistdeps.py
 
 %build
@@ -618,6 +602,7 @@ sed -i \
        PYTHON=python3 \
        --enable-python \
 %endif
        PYTHON=python3 \
        --enable-python \
 %endif
+       --disable-inhibit-plugin \
        --disable-silent-rules \
        --enable-shared \
        --enable-bdb \
        --disable-silent-rules \
        --enable-shared \
        --enable-bdb \
@@ -637,18 +622,6 @@ sed -i \
 
 %{__make}
 
 
 %{__make}
 
-%{__cc} %{rpmcflags} tools/rpmdb_checkversion.c -o tools/rpmdb_checkversion -ldb
-%{__cc} %{rpmcflags} tools/rpmdb_reset.c -o tools/rpmdb_reset -ldb
-
-if tools/rpmdb_checkversion -V 2>&1 | grep "t match library version"; then
-       echo "Error linking rpmdb tools!"
-       exit 1
-fi
-if tools/rpmdb_reset -V 2>&1 | grep "t match library version"; then
-       echo "Error linking rpmdb tools!"
-       exit 1
-fi
-
 %if %{with python3}
 cd python
 %py3_build
 %if %{with python3}
 cd python
 %py3_build
@@ -735,10 +708,6 @@ cp -p %{SOURCE12} $RPM_BUILD_ROOT%{_sysconfdir}/rpm/noautoprovfiles
 cp -p %{SOURCE13} $RPM_BUILD_ROOT%{_sysconfdir}/rpm/noautoreq
 cp -p %{SOURCE14} $RPM_BUILD_ROOT%{_sysconfdir}/rpm/noautoreqfiles
 
 cp -p %{SOURCE13} $RPM_BUILD_ROOT%{_sysconfdir}/rpm/noautoreq
 cp -p %{SOURCE14} $RPM_BUILD_ROOT%{_sysconfdir}/rpm/noautoreqfiles
 
-cp -p tools/rpmdb_checkversion $RPM_BUILD_ROOT%{_rpmlibdir}/
-cp -p tools/rpmdb_reset $RPM_BUILD_ROOT%{_rpmlibdir}/
-cp -p %{SOURCE18} $RPM_BUILD_ROOT%{_rpmlibdir}/dbupgrade.sh
-
 # move rpm to /bin
 %{__mv} $RPM_BUILD_ROOT%{_bindir}/rpm $RPM_BUILD_ROOT/bin
 ln -sf /bin/rpm $RPM_BUILD_ROOT%{_bindir}/rpmquery
 # move rpm to /bin
 %{__mv} $RPM_BUILD_ROOT%{_bindir}/rpm $RPM_BUILD_ROOT/bin
 ln -sf /bin/rpm $RPM_BUILD_ROOT%{_bindir}/rpmquery
@@ -750,8 +719,16 @@ for a in librpm.so librpmbuild.so librpmio.so librpmsign.so; do
        ln -sf /%{_lib}/$(basename $RPM_BUILD_ROOT/%{_lib}/${a}.*.*.*) $RPM_BUILD_ROOT%{_libdir}/${a}
 done
 
        ln -sf /%{_lib}/$(basename $RPM_BUILD_ROOT/%{_lib}/${a}.*.*.*) $RPM_BUILD_ROOT%{_libdir}/${a}
 done
 
-# Make sure we have bdb set a default backend
-grep -qE "db_backend[[:blank:]]+bdb" $RPM_BUILD_ROOT%{_rpmlibdir}/macros
+# init an empty database for %ghost'ing for all supported backends
+for be in sqlite bdb ndb; do
+       ./rpmdb \
+               --macros=$RPM_BUILD_ROOT%{_rpmlibdir}/macros \
+               --rcfile=$RPM_BUILD_ROOT%{_rpmlibdir}/rpmrc \
+               --dbpath=${PWD}/${be} \
+               --define "_db_backend ${be}" \
+               --initdb
+       cp -va ${be}/. $RPM_BUILD_ROOT/var/lib/rpm/
+done
 
 %if %{with python3}
 # Remove anything that rpm make install might put there
 
 %if %{with python3}
 # Remove anything that rpm make install might put there
@@ -772,8 +749,7 @@ cd ..
 rm -rf $RPM_BUILD_ROOT
 
 %posttrans
 rm -rf $RPM_BUILD_ROOT
 
 %posttrans
-if [ -e /var/lib/rpm/Packages ] && \
-               ! %{_rpmlibdir}/rpmdb_checkversion -h /var/lib/rpm -d /var/lib/rpm; then
+if [ -e /var/lib/rpm/Packages ]; then
        if [ ! -e /var/lib/rpm.rpmbackup-%{version}-%{release} ] && \
                        /bin/cp -a /var/lib/rpm /var/lib/rpm.rpmbackup-%{version}-%{release}; then
                echo
        if [ ! -e /var/lib/rpm.rpmbackup-%{version}-%{release} ] && \
                        /bin/cp -a /var/lib/rpm /var/lib/rpm.rpmbackup-%{version}-%{release}; then
                echo
@@ -784,7 +760,17 @@ if [ -e /var/lib/rpm/Packages ] && \
        echo 'If poldek aborts after migration with rpmdb error, this is expected behaviour,'
        echo 'you should ignore it and restart poldek'
        echo
        echo 'If poldek aborts after migration with rpmdb error, this is expected behaviour,'
        echo 'you should ignore it and restart poldek'
        echo
-       %{_rpmlibdir}/dbupgrade.sh
+       %{__rm} -rf /var/lib/rpm/log >/dev/null 2>/dev/null || :
+       %{__rm} -rf /var/lib/rpm/tmp >/dev/null 2>/dev/null || :
+       # Unlock database for rebuild, safe since this is posttrans
+       %{__rm} -rf /var/lib/rpm/.rpm.lock >/dev/null 2>/dev/null || :
+       if ! /usr/bin/rpmdb --rebuilddb; then
+               echo
+               echo "rpm database conversion failed!"
+               echo "You have to run '/usr/bin/rpmdb --rebuilddb' manually"
+               echo
+               exit 1
+       fi
 fi
 
 %post  lib -p /sbin/ldconfig
 fi
 
 %post  lib -p /sbin/ldconfig
@@ -824,6 +810,8 @@ find %{_rpmlibdir} -name '*-linux' -type l | xargs rm -f
 %lang(sk) %{_mandir}/sk/man8/rpm.8*
 
 %dir /var/lib/rpm
 %lang(sk) %{_mandir}/sk/man8/rpm.8*
 
 %dir /var/lib/rpm
+%ghost %config(missingok,noreplace) /var/lib/rpm/*
+%ghost /var/lib/rpm/.*.lock
 
 %{_rpmlibdir}/rpmpopt*
 %{_rpmlibdir}/rpmrc
 
 %{_rpmlibdir}/rpmpopt*
 %{_rpmlibdir}/rpmrc
@@ -867,9 +855,6 @@ find %{_rpmlibdir} -name '*-linux' -type l | xargs rm -f
 
 %dir %{_rpmlibdir}/tld
 
 
 %dir %{_rpmlibdir}/tld
 
-%attr(755,root,root) %{_rpmlibdir}/dbupgrade.sh
-%attr(755,root,root) %{_rpmlibdir}/rpmdb_checkversion
-%attr(755,root,root) %{_rpmlibdir}/rpmdb_reset
 %attr(755,root,root) %{_rpmlibdir}/rpmdb_dump
 %attr(755,root,root) %{_rpmlibdir}/rpmdb_load
 
 %attr(755,root,root) %{_rpmlibdir}/rpmdb_dump
 %attr(755,root,root) %{_rpmlibdir}/rpmdb_load
 
@@ -1018,11 +1003,6 @@ find %{_rpmlibdir} -name '*-linux' -type l | xargs rm -f
 %attr(755,root,root) %{_libdir}/rpm-plugins/syslog.so
 %{_mandir}/man8/rpm-plugin-syslog.8*
 
 %attr(755,root,root) %{_libdir}/rpm-plugins/syslog.so
 %{_mandir}/man8/rpm-plugin-syslog.8*
 
-%files plugin-systemd-inhibit
-%defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/rpm-plugins/systemd_inhibit.so
-%{_mandir}/man8/rpm-plugin-systemd-inhibit.8*
-
 %files plugin-ima
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_libdir}/rpm-plugins/ima.so
 %files plugin-ima
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_libdir}/rpm-plugins/ima.so