Browse Source

updated 2 packages

apt-0.5.15lorg3.95-32.git522

rpm-4.16.1.2-1

git-svn-id: http://trac.vinelinux.org/repos/projects/specs@12547 ec354946-7b23-47d6-9f5a-488ba84defc7
tomop 3 years ago
parent
commit
fa738811e0
2 changed files with 295 additions and 271 deletions
  1. 32 6
      a/apt/apt-vl.spec
  2. 263 265
      r/rpm/rpm-vl.spec

+ 32 - 6
a/apt/apt-vl.spec

@@ -13,7 +13,7 @@ Summary: Advanced front-end for rpm (APT - Advanced Package Tool)
 Summary(ja): RPM の高機能なフロントエンド (APT - アドバンスドパッケージツール)
 Name: apt
 Version: 0.5.15lorg3.95
-Release: 30.%{snapver}%{?_dist_release}
+Release: 32.%{snapver}%{?_dist_release}
 Group: admin-tools
 Vendor: Project Vine
 Distribution: Vine Linux
@@ -98,9 +98,12 @@ Patch210: apt-0.5.15lorg3.95.git522-revert-mass-constify-rpmhandler-getter-metho
 # http://apt-rpm.org/scm/?p=apt.git;a=commit;h=70f33318cc6a391a92f77a37a4f7773e6008dc36
 # new genpkglist does not handle userfulFile correctly
 Patch220: apt-0.5.15lorg3.95-revert-genbasedir.patch
-
+Patch221: add-rpm-legacy-layer.patch
 # lua 5.2 patch
 Patch230: apt-0.5.15lorg3.95-lua-5.2d.patch
+Patch231: apt-0.5.15lorg3.95-lua-5.3.patch
+Patch232: apt-0.5.15lorg3.95-lua-5.4.patch
+Patch233: list-extras-lua54.patch
 
 # rpm-4.12 patch
 Patch300: apt-0.5.15lorg3.95.git522-rpm-4.12.patch
@@ -111,6 +114,9 @@ Patch310: apt-0.5.15lorg3.95.git522-gcc-5.4.patch
 # add "pkgdump()" function to lua
 Patch320: apt-lua-pkgdump.patch
 
+# add support for sqlite backend of rpm-4.16
+Patch330: apt-rpm4.16-sqlite.patch
+
 # from fedora 31
 # fix format-security issue
 Patch504: apt-0.5.15lorg3.95-format-security.patch
@@ -122,7 +128,7 @@ Requires: rpm >= 4.0.4, gnupg, bzip2
 Requires: readline >= 4.3
 Requires: vine-keyring
 Requires: apt-sourceslist-main
-Requires: lua51-rex
+Requires: lua-rex
 BuildRequires: rpm-devel >= 4.0.4
 BuildRequires: bzip2-devel, zlib-devel
 BuildRequires: glibc-devel, popt
@@ -132,7 +138,7 @@ BuildRequires: autoconf
 BuildRequires: docbook-utils >= 0.6.14-4
 BuildRequires: cvs
 BuildRequires: libxml2-devel >= 2.6
-BuildRequires: lua51-devel
+BuildRequires: lua-devel
 %if %{with_python}
 BuildRequires: python
 BuildRequires: python-devel
@@ -189,6 +195,9 @@ This package contains the python binding for apt libraries.
 %endif
 
 
+%debug_package
+
+
 %prep
 %setup -q -a 110 -n %{name}-%{srcver}
 %patch0 -p1 -b .ppc
@@ -215,12 +224,22 @@ This package contains the python binding for apt libraries.
 %patch200 -p1
 %endif
 %patch210 -p1
+#genbasedir
 %patch220 -p1
+%patch221 -p1
+
 # lua-5.2
 #%patch230 -p1
+# lua-5.3
+#%patch231 -p1
+# lua-5.4
+%patch232 -p1
+%patch233 -p1
+
 %patch300 -p1
 %patch310 -p1
 %patch320 -p1
+%patch330 -p1
 %patch504 -p1
 
 cp %{SOURCE100} po/ja.po
@@ -237,7 +256,8 @@ cp -f %{SOURCE40} %{SOURCE41} contrib/allow-duplicated/
 autoreconf -f -i
 %configure \
   --disable-dependency-tracking --disable-static \
-  CPPFLAGS=-D_RPM_4_4_COMPAT
+  %{nil}
+#  CPPFLAGS=-D_RPM_4_4_COMPAT
 
 %__make %{?_smp_mflags}
 %__make -C po ja.gmo
@@ -331,7 +351,7 @@ rm -f %{buildroot}%{_libdir}/libapt-pkg.la
 pushd doc/ja
 %{__make} install MANDIR-JA="%{buildroot}%{_mandir}/ja"
 popd
-      
+
 
 %triggerun -- apt < 0.5.4
 CONF=/etc/apt/apt.conf
@@ -423,6 +443,12 @@ rm -rf %{buildroot}
 %endif
 
 %changelog
+* Tue Feb 23 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.5.15lorg3.95-32.git522
+- fixed genbasedir.
+
+* Mon Feb 22 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.5.15lorg3.95-31.git522
+- rebuilt with rpm-4.16 and lua-5.4.
+
 * Sat Aug 22 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.5.15lorg3.95-30.git522
 - rebuilt with lua51-5.1.5.
 - added Patch504.

+ 263 - 265
r/rpm/rpm-vl.spec

@@ -1,3 +1,6 @@
+%bcond_with systemd
+%bcond_without check
+
 # new vine linux release number
 %define _dist_release vl%(cat /etc/vine-release | cut -f3 -d" " | cut -f1 -d.)
 
@@ -5,10 +8,28 @@
 #define _prever -rc1
 
 %define	with_python_subpackage	1%{nil}
-%define	with_python_version	2.7%{nil}
+%define	with_python_version	3.8%{nil}
 %define	with_apidocs		1%{nil}
 
+# build against xz?
+%bcond_without xz
+# build with plugins?
+%bcond_with plugins
+# build with libarchive? (needed for rpm2archive)
+%bcond_without libarchive
+# build with zstd support?
+%bcond_without zstd
+# build with ndb backend?
+%bcond_without ndb
+# build with sqlite support?
+%bcond_without sqlite
+# build with bdb support?
+%bcond_without bdb
+# build with internal Berkeley DB?
 %bcond_with int_bdb
+# build with bdb_ro support?
+%bcond_without bdb_ro
+
 %define bdbver 5.3.28
 
 # XXX legacy requires './' payload prefix to be omitted from rpm packages.
@@ -29,67 +50,73 @@
 Summary: The RPM package management system.
 Summary(ja): RPM パッケージ管理システム
 Name: rpm
-Version: 4.12.0.1
+Version: 4.16.1.2
 %define rpm_version %{version}
-Release: 4%{_dist_release}
+Release: 1%{_dist_release}%{?with_systemd:.systemd}
 Group: admin-tools
 Vendor: Project Vine
 Distribution: Vine Linux
 
 License: GPL
-Source: http://rpm.org/releases/rpm-4.12.x/rpm-%{version}%{?_prever}.tar.bz2
+%global srcver %{rpm_version}%{?snapver:-%{snapver}}
+%global srcdir %{?snapver:testing}%{!?snapver:rpm-%(echo %{rpm_version} | cut -d'.' -f1-2).x}
+# ex. http://ftp.rpm.org/releases/rpm-4.16.x/rpm-4.16.1.tar.bz2
+Source: http://ftp.rpm.org/releases/%{srcdir}/rpm-%{srcver}.tar.bz2
 %if %{with int_bdb}
 Source1: db-%{bdbver}.tar.gz
 %endif
-Source100: rpm-4.11.2-ja.po
+Source10: rpmdb-rebuild.service
+# vine sources
 Source110: GROUPS_for_vine.txt
 Source120: GROUPS-DESC_for_vine.txt
 Source130: COMPAT32_for_vine
-Source200: rpm44-perldeps.pl
 
 # Patches already in upstream
 
+# Patches from fedora
+
+# Temporary band-aid for rpm2cpio whining on payload size mismatch (#1142949)
+Patch5: rpm-4.12.0-rpm2cpio-hack.patch
+# https://github.com/rpm-software-management/rpm/pull/473
+Patch6: 0001-find-debuginfo.sh-decompress-DWARF-compressed-ELF-se.patch
+Patch7: 0001-Issue-deprecation-warning-when-creating-BDB-database.patch
+
 # These are not yet upstream
-Patch301: rpm-4.6.0-niagara.patch
-Patch302: rpm-4.7.1-geode-i686.patch
+Patch906: rpm-4.7.1-geode-i686.patch
 # Probably to be upstreamed in slightly different form
-Patch304: rpm-4.9.1.1-ld-flags.patch
-# Compressed debuginfo support (#833311)
-Patch305: rpm-4.10.0-dwz-debuginfo.patch
-# Minidebuginfo support (#834073)
-Patch306: rpm-4.10.0-minidebuginfo.patch
-# Temporary Patch to provide support for updates
-Patch400: rpm-4.10.90-rpmlib-filesystem-check.patch
+Patch907: rpm-4.15.x-ldflags.patch
+
+# Not yet (all) upstream, debugedit DWARF5
+# https://code.wildebeest.org/git/user/mjw/rpm/log/?h=gcc-dwarf5-4.16.1.2
+Patch911: 0001-NFC-debugedit-Protect-macro-arguments-by-parentheses.patch
+Patch912: 0002-NFC-debugedit-Move-code-from-edit_dwarf2-to-edit_inf.patch
+Patch913: 0003-debugedit-Fix-missing-relocation-of-.debug_types-sec.patch
+Patch914: 0004-NFC-debugedit-Move-code-to-separate-functions.patch
+Patch915: 0005-debugedit-Implement-DWARF-5-unit-header-and-new-form.patch
+Patch916: 0006-debugedit-Handle-DWARF-5-debug_line-and-debug_line_s.patch
 
 # Patches for Vine Linux
-Patch1100: rpm-4.12.0.1-vine.patch
-#Patch1120: rpm-4.0.4-langC.patch
-#Patch1130: rpm-4.8.0-home.patch
-Patch1140: rpm-4.9.1.2-shortcircuit.patch
-Patch1170: rpm-4.9.1.2-legacyaliases.patch
-Patch1180: rpm-4.4.3-no-terminate_build.patch
-Patch1190: rpm-4.9.1.2-disable-python-requires.patch
-#Patch1200: rpm-4.4.2-use-external-depgen.patch
-Patch1210: rpm-4.4.2-deadlock-ppc.patch
-Patch1220: rpm-4.12.0.1-disable-debug.patch
-Patch1230: rpm-4.12.0.1-optflags.patch
-Patch1240: rpm-4.8.0-default-buildarch.patch
-Patch1250: rpm-4.4.2-add-default-srcdefattr.patch
-Patch1270: rpm-4.4.2-vine-groups.patch
-#Patch1290: rpm-4.4.2.3-find-mono-dependencies.patch
-Patch1310: rpm-4.10.0-brp-strip-static-archive-find-a-only.patch
-Patch1320: rpm-4.9.1.2-force-v3-sigs.patch
-Patch1330: rpm-4.9.1.2-enable-xz-payload.patch
-
-# https://github.com/rpm-software-management/rpm/commit/5b4805df2085b0e7c4f09caad62638c3238b3bc1
-Patch10000: rpm-strip.patch
+Patch10000: 0001-rpm-4.12.0.1-vine.patch.patch
+Patch10001: 0002-rpm-4.9.1.2-shortcircuit.patch.patch
+Patch10002: 0003-rpm-4.9.1.2-legacyaliases.patch.patch
+Patch10003: 0004-rpm-4.4.3-no-terminate_build.patch.patch
+Patch10004: 0005-rpm-4.9.1.2-disable-python-requires.patch.patch
+Patch10005: 0006-rpm-4.12.0.1-disable-debug.patch.patch
+Patch10006: 0007-rpm-4.12.0.1-optflags.patch.patch
+Patch10007: 0008-rpm-4.8.0-default-buildarch.patch.patch
+Patch10008: 0009-rpm-4.4.2-add-default-srcdefattr.patch.patch
+Patch10009: 0010-rpm-4.10.0-brp-strip-static-archive-find-a-only.patc.patch
+Patch10010: 0011-rpm-4.9.1.2-force-v3-sigs.patch.patch
+Patch10011: 0012-rpm-4.9.1.2-enable-xz-payload.patch.patch
+Patch11000: rpm-4.16.1.2-ja.po.patch
+Patch12000: add-log.patch
 
 Conflicts: patch < 2.5
 Requires(post): coreutils, shadow-utils
 Requires(postun): coreutils, shadow-utils
 
 Requires: popt >= 1.10.2.1
-Requires: nss >= 3.12.5
+Requires: openssl >= 1.1.1
 Requires: rpm-libs = %{version}
 %if %{without int_bdb}
 Requires: libdb-utils
@@ -98,33 +125,33 @@ Requires: vine-rpm-macros
 
 Obsoletes: rpm-perl < %{version}
 
-# XXX necessary only to drag in /usr/lib/libelf.a, otherwise internal elfutils.
-#BuildRequires: elfutils-libelf
+BuildRequires: gawk
 BuildRequires: elfutils-devel
-
-BuildRequires: automake, autoconf
-BuildRequires: sed readline-devel zlib-devel
-BuildRequires: neon-devel
-BuildRequires: sqlite3-devel
-BuildRequires: gettext
-#BuildRequires: nkf
-BuildRequires: cvs
-#BuildRequires: libselinux-devel
-BuildRequires: bzip2-devel >= 0.9.0c-2
+BuildRequires: elfutils-libelf-devel
+BuildRequires: readline-devel zlib-devel
+BuildRequires: openssl-devel
 BuildRequires: popt-devel
-BuildRequires: lua51-devel
+BuildRequires: file-devel
+BuildRequires: gettext-devel
+BuildRequires: ncurses-devel
+BuildRequires: bzip2-devel >= 0.9.0c-2
+BuildRequires: lua-devel
 BuildRequires: libcap-devel
 BuildRequires: libacl-devel
-BuildRequires: nss-devel
+BuildRequires: xz-devel
+BuildRequires: libarchive-devel
+BuildRequires: libzstd-devel
+BuildRequires: sqlite3-devel
+#BuildRequires: libselinux-devel
+BuildRequires: dbus-devel
+BuildRequires: audit-libs-devel
 %if %{without int_bdb}
 BuildRequires: libdb-devel >= 5.3.28
 %endif
-BuildRequires: xz-devel
-BuildRequires: file-devel
-BuildRequires: libarchive-devel
 
 %if %{with_python_subpackage}
-BuildRequires: python-devel >= %{with_python_version}
+BuildRequires: python3-devel
+BuildRequires: python3-rpm-macros
 %endif
 
 BuildRoot: %{_tmppath}/%{name}-root
@@ -161,12 +188,8 @@ Summary:  Development files for manipulating RPM packages.
 Summary(ja): RPM ライブラリ用の開発ファイル
 Group: programming
 Requires: rpm = %{rpm_version}-%{release}
-Requires: beecrypt >= 4.1.2
-Requires: neon-devel
-Requires: sqlite3-devel
-Requires: popt-devel
-#Requires: libselinux-devel
-#Requires: elfutils-libelf-devel
+Requires: %{name}-libs%{_isa} = %{version}-%{release}
+Requires: popt-devel%{_isa}
 
 %description devel
 This package contains the RPM C library and header files. These
@@ -205,13 +228,15 @@ that are used to build packages using the RPM Package Manager.
 
 
 %if %{with_python_subpackage}
-%package python
+%package -n python3-rpm
 Summary: Python bindings for apps which will manipulate RPM packages.
 Group: programming
 Requires: rpm = %{rpm_version}-%{release}
-Requires: python >= %{with_python_version}
+Requires: %{name}-libs%{?_isa} = %{version}-%{release}
+Requires: python3
+Obsoletes: rpm-python < 4.16
 
-%description python
+%description -n python3-rpm
 The rpm-python package contains a module that permits applications
 written in the Python programming language to use the interface
 supplied by RPM Package Manager libraries.
@@ -219,7 +244,7 @@ supplied by RPM Package Manager libraries.
 This package should be installed if you want to develop Python
 programs that will manipulate RPM packages and databases.
 
-%description python -l ja
+%description -n python3-rpm -l ja
 rpm-python パッケージには,RPM パッケージマネージャのライブラリに
 アクセスする為の Python モジュールが収録されています.
 %endif
@@ -236,43 +261,11 @@ This package contains API documentation for developing applications
 that will manipulate RPM packages and databases.
 
 
+%debug_package
+
+
 %prep
-%setup -n %{name}-%{version}%{?_prever} -q %{?with_int_bdb:-a 1}
-
-%patch301 -p1 -b .niagara
-%patch302 -p1 -b .geode
-%patch304 -p1 -b .ldflags
-%patch305 -p1 -b .dwz-debuginfo
-%patch306 -p1 -b .minidebuginfo
-%patch400 -p1 -b .rpmlib-filesystem-check
-
-# vine patch
-%patch1100 -p1 -b .vine
-#%patch1120 -p1 -b .langC
-#%patch1130 -p1 -b .home
-%patch1140 -p1 -b .shortcircuit
-%patch1170 -p1 -b .legacyaliases
-%patch1180 -p1 -b .no-terminate_build
-%patch1190 -p1 -b .disable-pythonreq
-#%patch1200 -p1 -b .use-external-depgen
-%ifarch ppc
-%patch1210 -p1 -b .deadlock-ppc
-%endif
-%patch1220 -p1 -b .disable-debug
-%patch1230 -p1 -b .optflags
-%patch1240 -p1 -b .default-buildarch
-%patch1250 -p1 -b .default-srcdefattr
-%patch1270 -p1 -b .vine-groups
-#%patch1290 -p1 -b .mono-dependencies
-%patch1310 -p1 -b .find-a-only
-%patch1320 -p1 -b .force-v3-sigs
-%patch1330 -p1 -b .enable-xz-payload
-
-%patch10000 -p1 -b .brp-strip
-
-# install updated japanese message catalogue
-cp -f po/ja.po po/ja.po.orig
-cp -f %{SOURCE100} po/ja.po
+%autosetup -n rpm-%{srcver} %{?with_int_bdb:-a 1} -p1
 
 cp %{SOURCE110} %{SOURCE120} .
 
@@ -280,15 +273,17 @@ cp %{SOURCE110} %{SOURCE120} .
 ln -s db-%{bdbver} db
 %endif
 
-rm -rf popt/
+sed -i -e "/_db_backend/ s/ bdb/ sqlite/g" macros.in
 
-%build
 
+%build
 autoreconf -f -i
-sed -i -e 's|^mkinstalldirs =.*|mkinstalldirs = ../mkinstalldirs|g' po/Makefile*
+#sed -i -e 's|^mkinstalldirs =.*|mkinstalldirs = ../mkinstalldirs|g' po/Makefile*
 
-# XXX rpm needs functioning nptl for configure tests
-unset LD_ASSUME_KERNEL || :
+# Hardening hack taken from macro %%configure defined in redhat-rpm-config
+for i in $(find . -name ltmain.sh) ; do
+     %{__sed} -i.backup -e 's~compiler_flags=$~compiler_flags="%{?_hardened_ldflags}"~' $i
+done;
 
 %if %{with_python_subpackage}
 WITH_PYTHON="--enable-python"
@@ -296,43 +291,58 @@ WITH_PYTHON="--enable-python"
 WITH_PYTHON="--disable-python"
 %endif
 
-CPPFLAGS="$CPPFLAGS $(pkg-config --cflags nss)"
-CFLAGS="$RPM_OPT_FLAGS"
-export CPPFLAGS CFLAGS
 ./configure \
     --prefix=%{__prefix} \
-    --libdir=%{_libdir} \
     --sysconfdir=/etc \
     --localstatedir=/var \
     --sharedstatedir=/var/lib \
-    --infodir='%{__share}/info' \
-    --mandir='%{__share}/man' \
+    --libdir=%{_libdir} \
     --build=%{_target_platform} \
     --host=%{_target_platform} \
     --with-vendor=vine \
-    $WITH_PYTHON \
+    --enable-bdb=yes \
+    %{!?with_int_bdb: --with-external-db} \
+    %{!?with_plugins: --disable-plugins} \
     --with-lua \
+    --without-selinux \
     --with-cap \
     --with-acl \
-    %{!?with_int_bdb: --with-external-db} \
+    %{?with_ndb: --enable-ndb} \
+    %{?with_libimaevm: --with-imaevm} \
+    %{?with_zstd: --enable-zstd} \
+    %{?with_sqlite: --enable-sqlite} \
+    %{?with_bdb_ro: --enable-bdb-ro} \
+    $WITH_PYTHON \
+    --with-crypto=openssl \
     --without-javaglue \
-    --without-perl \
-    --without-selinux \
-    --disable-plugins
+    --without-perl
 
 make %{?_smp_mflags}
 make -C po ja.gmo
 
-%install
-# XXX rpm needs functioning nptl for configure tests
-unset LD_ASSUME_KERNEL || :
+pushd python
+%py3_build
+popd
 
-rm -rf $RPM_BUILD_ROOT
 
+%install
+rm -rf $RPM_BUILD_ROOT
 make DESTDIR="$RPM_BUILD_ROOT" install
 
-# downgrade perldeps.pl to remove perl module dependency...
-install -m 755 %{SOURCE200} $RPM_BUILD_ROOT%{_prefix}/lib/rpm/perldeps.pl
+# We need to build with --enable-python for the self-test suite, but we
+# actually package the bindings built with setup.py (#531543#c26)
+pushd python
+%py3_install
+popd
+
+%if %{with systemd}
+mkdir -p $RPM_BUILD_ROOT%{_unitdir}
+install -m 644 %{SOURCE10} $RPM_BUILD_ROOT/%{_unitdir}
+%if %{with bdb}
+mkdir -p ${RPM_BUILD_ROOT}%{_tmpfilesdir}
+echo "r /var/lib/rpm/__db.*" > ${RPM_BUILD_ROOT}%{_tmpfilesdir}/rpm.conf
+%endif
+%endif
 
 # Save list of packages through cron
 mkdir -p ${RPM_BUILD_ROOT}/etc/cron.daily
@@ -342,26 +352,34 @@ mkdir -p ${RPM_BUILD_ROOT}/etc/logrotate.d
 install -m 644 scripts/rpm.log ${RPM_BUILD_ROOT}/etc/logrotate.d/rpm
 
 mkdir -p $RPM_BUILD_ROOT/etc/rpm
-
-mkdir -p $RPM_BUILD_ROOT/var/spool/repackage
+mkdir -p $RPM_BUILD_ROOT%{rpmhome}/macros.d
 mkdir -p $RPM_BUILD_ROOT/var/lib/rpm
-for dbi in \
-	Basenames Conflictname Dirnames Group Installtid Name Packages \
-	Providename Provideversion Requirename Requireversion Triggername \
-	Filemd5s Pubkeys Sha1header Sigmd5 Obsoletename \
-	__db.001 __db.002 __db.003 __db.004 __db.005 __db.006 __db.007 \
-	__db.008 __db.009
-do
-    touch $RPM_BUILD_ROOT/var/lib/rpm/$dbi
+
+# init an empty database for %ghost'ing for all supported backends
+for be in %{?with_ndb:ndb} %{?with_sqlite:sqlite} %{?with_bdb:bdb}; do
+    ./rpmdb --define "_db_backend ${be}" --dbpath=${PWD}/${be} --initdb
+    cp -va ${be}/. $RPM_BUILD_ROOT/var/lib/rpm/
 done
 
-# plant links to db utils as rpmdb_foo so existing documantion is usable
-%if %{without int_bdb}
-for dbutil in dump load recover stat upgrade verify
-do
-    ln -s ../../bin/db_${dbutil} $RPM_BUILD_ROOT/%{rpmhome}/rpmdb_${dbutil}
+%find_lang rpm
+
+find $RPM_BUILD_ROOT -name "*.la"|xargs rm -f
+
+# These live in perl-generators and python-rpm-generators now
+rm -f $RPM_BUILD_ROOT/%{rpmhome}/{perldeps.pl,perl.*,pythond*}
+rm -f $RPM_BUILD_ROOT/%{_fileattrsdir}/{perl*,python*}
+rm -rf $RPM_BUILD_ROOT/var/tmp
+
+# init an empty database for %ghost'ing for all supported backends
+for be in %{?with_ndb:ndb} %{?with_sqlite:sqlite} %{?with_bdb:bdb}; do
+    ./rpmdb --define "_db_backend ${be}" --dbpath=${PWD}/${be} --initdb
+    cp -va ${be}/. $RPM_BUILD_ROOT/var/lib/rpm/
 done
-%endif
+
+# move command to /bin/
+mkdir -p %{buildroot}/bin
+mv -f %{buildroot}%{__bindir}/rpm %{buildroot}/bin/rpm
+ln -sf ../../bin/rpm %{buildroot}%{__bindir}/rpm
 
 # set i386 for _arch in i?86-linux/macros
 %ifarch x86_64
@@ -388,23 +406,27 @@ done
 %endif
 
 # Get rid of unpackaged files
+%if 0
 { cd $RPM_BUILD_ROOT
-  rm -f .%{_libdir}/lib*.la
-  rm -f .%{__prefix}/lib/rpm/{Specfile.pm,cpanflute,cpanflute2,rpmdiff,rpmdiff.cgi,sql.prov,sql.req,tcl.req}
-  rm -rf .%{__mandir}/{fr,ko}
-%if %{with_python_subpackage}
-  rm -f .%{__libdir}/python%{with_python_version}/site-packages/*.{a,la}
-  rm -f .%{__libdir}/python%{with_python_version}/site-packages/rpm/*.{a,la}
-  rm -f .%{__libdir}/python%{with_python_version}/site-packages/rpmdb/*.{a,la}
-%endif
   # obsoleted files (macros for metainfo are provided by vine-rpm-macros)
   rm -f ./usr/lib/rpm/appdata.prov
   rm -f ./usr/lib/rpm/fileattrs/appdata.attr
 }
+%endif
+
+
+%if %{with check}
+%check
+make check TESTSUITEFLAGS=-j%{_smp_build_ncpus} || (cat tests/rpmtests.log; exit 1)
+# rpm >= 4.16.0 testsuite leaves a read-only tree behind, clean it up
+make clean
+%endif
+
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+
 %posttrans
 # XXX this is klunky and ugly, rpm itself should handle this
 dbstat=/usr/lib/rpm/rpmdb_stat
@@ -413,8 +435,22 @@ if [ -x "$dbstat" ]; then
         rm -f /var/lib/rpm/__db.* 
     fi
 fi
+%if %{with systemd}
+if [ -f /var/lib/rpm/Packages ]; then
+    touch /var/lib/rpm/.rebuilddb
+fi
+%endif
 exit 0
-	    
+
+%if %{with systemd}
+# Handle rpmdb rebuild service on erasure of old to avoid ordering issues
+# https://pagure.io/fesco/issue/2382
+%triggerun -- rpm < 4.16
+if [ -x /bin/systemctl ]; then
+    systemctl --no-reload preset rpmdb-rebuild ||:
+fi
+%endif
+
 %pre
 if [ -f /var/lib/rpm/packages.rpm ]; then
     echo "
@@ -432,8 +468,8 @@ exit 0
 
 %post
 /sbin/ldconfig
-# Establish correct rpmdb ownership.
-/bin/chown rpm.rpm /var/lib/rpm/[A-Z]*
+# Establish correct rpmdb (db5) ownership.
+/bin/chown rpm.rpm /var/lib/rpm/[A-Z]* >/dev/null 2>&1 ||:
 exit 0
 
 %postun
@@ -448,101 +484,72 @@ exit 0
 %postun devel -p /sbin/ldconfig
 
 %if %{with_python_subpackage}
-%post python -p /sbin/ldconfig
-%postun python -p /sbin/ldconfig
+%post -n python3-rpm -p /sbin/ldconfig
+%postun -n python3-rpm -p /sbin/ldconfig
 %endif
 
 %define	rpmattr		%attr(0755, rpm, rpm)
+%define	rpmdbattr	%attr(0644, rpm, rpm) %verify(not md5 size mtime) %ghost %config(missingok,noreplace)
 
-%files
+%files -f rpm.lang
 %defattr(-,root,root)
-%doc CHANGES GROUPS doc/manual/[a-z]*
+%license COPYING
+%doc CREDITS doc/manual/[a-z]*
 %doc GROUPS*_for_vine.txt
-%attr(0755, rpm, rpm)	/bin/rpm
-
+%if %{with systemd}
+%{_unitdir}/rpmdb-rebuild.service
+%if %{with bdb}
+%{_tmpfilesdir}/rpm.conf
+%endif
+%endif
 %config(noreplace,missingok)	/etc/cron.daily/rpm
 %config(noreplace,missingok)	/etc/logrotate.d/rpm
 %dir				/etc/rpm
 #config(noreplace,missingok)	/etc/rpm/macros.*
-%attr(0755, rpm, rpm)	%dir /var/lib/rpm
-%attr(0755, rpm, rpm)	%dir /var/spool/repackage
-
-%define	rpmdbattr %attr(0644, rpm, rpm) %verify(not md5 size mtime) %ghost %config(missingok,noreplace)
+%rpmdbattr	%dir /var/lib/rpm
 %rpmdbattr	/var/lib/rpm/*
+%rpmdbattr	/var/lib/rpm/.*.lock
 
+%rpmattr	/bin/rpm
+%{__bindir}/rpm
 %rpmattr	%{__bindir}/rpm2archive
 %rpmattr	%{__bindir}/rpm2cpio
-%rpmattr	%{__bindir}/gendiff
 %rpmattr	%{__bindir}/rpmdb
-#%rpmattr	%{__bindir}/rpm[eiu]
-%rpmattr	%{__bindir}/rpmsign
-%rpmattr	%{__bindir}/rpmquery
-%rpmattr	%{__bindir}/rpmverify
 %rpmattr	%{__bindir}/rpmkeys
+%{__bindir}/rpmquery
+%rpmattr	%{__bindir}/rpmsign
+%{__bindir}/rpmverify
+%rpmattr	%{rpmhome}/rpmdb_*
 
-%attr(0755, rpm, rpm)	%dir %{__prefix}/lib/rpm
-%rpmattr	%{__prefix}/lib/rpm/config.guess
-%rpmattr	%{__prefix}/lib/rpm/config.sub
-%attr(0644, rpm, rpm)	%{__prefix}/lib/rpm/macros
-%attr(0644, rpm, rpm)	%{__prefix}/lib/rpm/macros.perl
-%attr(0644, rpm, rpm)	%{__prefix}/lib/rpm/macros.php
-%attr(0644, rpm, rpm)	%{__prefix}/lib/rpm/macros.python
-%rpmattr	%{__prefix}/lib/rpm/mkinstalldirs
-%rpmattr	%{__prefix}/lib/rpm/rpm.*
-%rpmattr	%{__prefix}/lib/rpm/rpm2cpio.sh
-%rpmattr	%{__prefix}/lib/rpm/tgpg
-%attr(0644, rpm, rpm)	%{__prefix}/lib/rpm/rpmpopt*
-%attr(0644, rpm, rpm)	%{__prefix}/lib/rpm/rpmrc
-
-%attr(-, rpm, rpm)	%{__prefix}/lib/rpm/platform
-
-%rpmattr	%{__prefix}/lib/rpm/rpmdb_*
-
-%lang(ar)	%{__prefix}/*/locale/ar/LC_MESSAGES/rpm.mo
-%lang(br)	%{__prefix}/*/locale/br/LC_MESSAGES/rpm.mo
-%lang(ca)	%{__prefix}/*/locale/ca/LC_MESSAGES/rpm.mo
-%lang(cmn)	%{__prefix}/*/locale/cmn/LC_MESSAGES/rpm.mo
-%lang(cs)	%{__prefix}/*/locale/cs/LC_MESSAGES/rpm.mo
-%lang(da)	%{__prefix}/*/locale/da/LC_MESSAGES/rpm.mo
-%lang(de)	%{__prefix}/*/locale/de/LC_MESSAGES/rpm.mo
-%lang(el)	%{__prefix}/*/locale/el/LC_MESSAGES/rpm.mo
-%lang(eo)	%{__prefix}/*/locale/eo/LC_MESSAGES/rpm.mo
-%lang(es)	%{__prefix}/*/locale/es/LC_MESSAGES/rpm.mo
-%lang(fi)	%{__prefix}/*/locale/fi/LC_MESSAGES/rpm.mo
-%lang(fr)	%{__prefix}/*/locale/fr/LC_MESSAGES/rpm.mo
-%lang(is)	%{__prefix}/*/locale/is/LC_MESSAGES/rpm.mo
-%lang(it)	%{__prefix}/*/locale/it/LC_MESSAGES/rpm.mo
-%lang(ja)	%{__prefix}/*/locale/ja/LC_MESSAGES/rpm.mo
-%lang(ko)	%{__prefix}/*/locale/ko/LC_MESSAGES/rpm.mo
-%lang(ms)	%{__prefix}/*/locale/ms/LC_MESSAGES/rpm.mo
-%lang(nb)	%{__prefix}/*/locale/nb/LC_MESSAGES/rpm.mo
-%lang(nl)	%{__prefix}/*/locale/nl/LC_MESSAGES/rpm.mo
-%lang(pl)	%{__prefix}/*/locale/pl/LC_MESSAGES/rpm.mo
-%lang(pt)	%{__prefix}/*/locale/pt/LC_MESSAGES/rpm.mo
-%lang(pt_BR)	%{__prefix}/*/locale/pt_BR/LC_MESSAGES/rpm.mo
-%lang(ru)	%{__prefix}/*/locale/ru/LC_MESSAGES/rpm.mo
-%lang(sk)	%{__prefix}/*/locale/sk/LC_MESSAGES/rpm.mo
-%lang(sl)	%{__prefix}/*/locale/sl/LC_MESSAGES/rpm.mo
-%lang(sr)	%{__prefix}/*/locale/sr/LC_MESSAGES/rpm.mo
-%lang(sr@latin)	%{__prefix}/*/locale/sr@latin/LC_MESSAGES/rpm.mo
-%lang(sv)	%{__prefix}/*/locale/sv/LC_MESSAGES/rpm.mo
-%lang(te)	%{__prefix}/*/locale/te/LC_MESSAGES/rpm.mo
-%lang(tr)	%{__prefix}/*/locale/tr/LC_MESSAGES/rpm.mo
-%lang(uk)	%{__prefix}/*/locale/uk/LC_MESSAGES/rpm.mo
-%lang(vi)	%{__prefix}/*/locale/vi/LC_MESSAGES/rpm.mo
-%lang(zh_CN)	%{__prefix}/*/locale/zh_CN/LC_MESSAGES/rpm.mo
-%lang(zh_TW)	%{__prefix}/*/locale/zh_TW/LC_MESSAGES/rpm.mo
+%attr(0644, rpm, rpm)	%{rpmhome}/macros
+%attr(0644, rpm, rpm)	%{rpmhome}/lua
+%attr(0644, rpm, rpm)	%{rpmhome}/rpmpopt*
+%attr(0644, rpm, rpm)	%{rpmhome}/rpmrc
+%rpmattr	%{rpmhome}/rpm.*
+%rpmattr	%{rpmhome}/rpm2cpio.sh
+%rpmattr	%{rpmhome}/tgpg
+
+%attr(-, rpm, rpm)	%{rpmhome}/platform
 
-%{__mandir}/man1/gendiff.1*
 %{__mandir}/man8/rpm.8*
+%{__mandir}/man8/rpmdb.8*
+%{__mandir}/man8/rpmkeys.8*
+%{__mandir}/man8/rpm2archive.8*
 %{__mandir}/man8/rpm2cpio.8*
 %{__mandir}/man8/rpmsign.8*
-%{__mandir}/man8/rpmkeys.8*
-%{__mandir}/man8/rpmdb.8*
-%lang(ja)	%{__mandir}/ja/man[18]/*.[18]*
-%lang(pl)	%{__mandir}/pl/man[18]/*.[18]*
-%lang(ru)	%{__mandir}/ru/man[18]/*.[18]*
-%lang(sk)	%{__mandir}/sk/man[18]/*.[18]*
+%{__mandir}/man8/rpm-misc.8*
+%if %{with plugins}
+%{__mandir}/man8/rpm-plugins.8*
+%endif
+
+# XXX this places translated manuals to wrong package wrt eg rpmbuild
+%lang(fr) %{__mandir}/fr/man[18]/*.[18]*
+%lang(ko) %{__mandir}/ko/man[18]/*.[18]*
+%lang(ja) %{__mandir}/ja/man[18]/*.[18]*
+%lang(pl) %{__mandir}/pl/man[18]/*.[18]*
+%lang(ru) %{__mandir}/ru/man[18]/*.[18]*
+%lang(sk) %{__mandir}/sk/man[18]/*.[18]*
+
 
 %files libs
 %defattr(-,root,root)
@@ -553,67 +560,58 @@ exit 0
 
 %files build
 %defattr(-,root,root)
+%rpmattr	%{__bindir}/gendiff
 %rpmattr	%{__bindir}/rpmbuild
 %rpmattr	%{__bindir}/rpmspec
-%rpmattr	%{__prefix}/lib/rpm/brp-*
-%rpmattr	%{__prefix}/lib/rpm/check-files
-%rpmattr	%{__prefix}/lib/rpm/check-prereqs
-%rpmattr	%{__prefix}/lib/rpm/check-buildroot
-%rpmattr	%{__prefix}/lib/rpm/check-rpaths
-%rpmattr	%{__prefix}/lib/rpm/check-rpaths-worker
-%rpmattr	%{__prefix}/lib/rpm/debugedit
-%rpmattr	%{__prefix}/lib/rpm/desktop-file.prov
-%rpmattr	%{__prefix}/lib/rpm/find-debuginfo.sh
-%rpmattr	%{__prefix}/lib/rpm/find-lang.sh
-%rpmattr	%{__prefix}/lib/rpm/find-provides
-%rpmattr	%{__prefix}/lib/rpm/find-requires
-%rpmattr	%{__prefix}/lib/rpm/fontconfig.prov
-%rpmattr	%{__prefix}/lib/rpm/elfdeps
-%rpmattr	%{__prefix}/lib/rpm/libtooldeps.sh
-%rpmattr	%{__prefix}/lib/rpm/mono-find-provides
-%rpmattr	%{__prefix}/lib/rpm/mono-find-requires
-%rpmattr	%{__prefix}/lib/rpm/ocaml-find-provides.sh
-%rpmattr	%{__prefix}/lib/rpm/ocaml-find-requires.sh
-%rpmattr	%{__prefix}/lib/rpm/osgideps.pl
-%rpmattr	%{__prefix}/lib/rpm/pkgconfigdeps.sh
-%rpmattr	%{__prefix}/lib/rpm/perldeps.pl
-%rpmattr	%{__prefix}/lib/rpm/perl.prov
-%rpmattr	%{__prefix}/lib/rpm/perl.req
-%rpmattr	%{__prefix}/lib/rpm/script.req
-%rpmattr	%{__prefix}/lib/rpm/pythondeps.sh
-
-%attr(0755, rpm, rpm)	%dir %{__prefix}/lib/rpm/fileattrs
-%rpmattr	%{__prefix}/lib/rpm/fileattrs/*
-
-%rpmattr	%{__prefix}/lib/rpm/rpmdeps
 
+%rpmattr	%{rpmhome}/brp-*
+%rpmattr	%{rpmhome}/check-*
+%rpmattr	%{rpmhome}/debugedit
+%rpmattr	%{rpmhome}/sepdebugcrcfix
+%rpmattr	%{rpmhome}/find-debuginfo.sh
+%rpmattr	%{rpmhome}/find-lang.sh
+%rpmattr	%{rpmhome}/*provides*
+%rpmattr	%{rpmhome}/*requires*
+%rpmattr	%{rpmhome}/*deps*
+%rpmattr	%{rpmhome}/*.prov
+%rpmattr	%{rpmhome}/*.req
+%rpmattr	%{rpmhome}/mkinstalldirs
+
+%attr(0755, rpm, rpm)	%dir %{rpmhome}/fileattrs
+%rpmattr	%{rpmhome}/fileattrs/*
+
+%{__mandir}/man1/gendiff.1*
 %{__mandir}/man8/rpmbuild.8*
-%{__mandir}/man8/rpmspec.8*
 %{__mandir}/man8/rpmdeps.8*
+%{__mandir}/man8/rpmspec.8*
 
 %if %{with_python_subpackage}
-%files python
+%files -n python3-rpm
 %defattr(-,root,root)
-%{__libdir}/python%{with_python_version}/site-packages/rpm
+%{python3_sitearch}/rpm/
+%{python3_sitearch}/rpm-%{rpm_version}*.egg-info
 %endif
 
 %files devel
 %defattr(-,root,root)
-%{__includedir}/rpm
-%{__libdir}/librpm.so
-%{__libdir}/librpmio.so
-%{__libdir}/librpmbuild.so
-%{__libdir}/librpmsign.so
 %{__mandir}/man8/rpmgraph.8*
-%{__libdir}/pkgconfig/rpm.pc
 %rpmattr	%{__bindir}/rpmgraph
+%{__libdir}/librp*[a-z].so
+%{__libdir}/pkgconfig/rpm.pc
+%{__includedir}/rpm
 
 %files apidocs
 %defattr(-,root,root)
-%doc COPYING doc/librpm/html/*
+%license COPYING
+%doc doc/librpm/html/*
 
 
 %changelog
+* Sun Feb 21 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 4.16.1.2-1
+- updated to 4.16.1.2.
+- updated patches from fedora.
+- updated vine-patches.
+
 * Sat Aug 22 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 4.12.0.1-4
 - rebuilt with lua51-5.1.5.