+++ /dev/null
-#!/bin/sh
-
-ROOTDIR=
-if [ "$1" = "-r" ]; then
- shift
- ROOTDIR="$1"
-
- if [ ! -d "$ROOTDIR" ]; then
- echo "Specified root directory ($ROOTDIR) does not exist!"
- echo "Bailing out!"
- exit
- fi
-fi
-
-if [ -f "$ROOTDIR"/var/lib/rpm/Packages ]; then
- if ! /usr/lib/rpm/rpmdb_reset -r lsn "$ROOTDIR"/var/lib/rpm/Packages ; then
- echo
- echo "rpm database conversion failed!"
- echo
- echo "You have to run:"
- echo
- echo " /usr/lib/rpm/rpmdb_reset -r lsn /var/lib/rpm/Packages"
- echo " /bin/rm -f /var/lib/rpm/__db.00*"
- echo " /bin/rm -rf /var/lib/rpm/log"
- echo " /usr/bin/rpmdb --rebuilddb"
- echo
- exit
- fi
-
- /bin/rm --interactive=never -f "$ROOTDIR"/var/lib/rpm/__db.00* >/dev/null 2>/dev/null || :
- /bin/rm --interactive=never -rf "$ROOTDIR"/var/lib/rpm/log >/dev/null 2>/dev/null || :
- /bin/rm --interactive=never -rf "$ROOTDIR"/var/lib/rpm/tmp >/dev/null 2>/dev/null || :
-fi
-
-if ! /usr/bin/rpmdb --rebuilddb ${ROOTDIR:+--root="$ROOTDIR"}; then
- echo
- echo "rpm database conversion failed!"
- echo "You have to run /usr/bin/rpmdb manually"
- echo
-fi
%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
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
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
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
# 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}
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
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
%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
%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
%patch30 -p1
%patch31 -p1
%patch32 -p1
+%patch33 -p1
%patch100 -p1
install %{SOURCE15} scripts/perl.prov.in
# 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
PYTHON=python3 \
--enable-python \
%endif
+ --disable-inhibit-plugin \
--disable-silent-rules \
--enable-shared \
--enable-bdb \
%{__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
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
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
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
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
%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
%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) %{_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
+++ /dev/null
-#include <sys/types.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <db.h>
-
-int version_check __P((void));
-
-const char *progname = "rpmdb_checkversion"; /* Program name. */
-
-/*
- * A very simple program to check for a Berkeley DB environment mismatch.
- */
-int
-main(int argc, char *argv[])
-{
- extern char *optarg;
- extern int optind;
- const char *data_dir, *home;
- int ch, quiet;
- DB_ENV *dbenv;
- int ret;
-
- if ((ret = version_check()) != 0)
- return (EXIT_FAILURE);
-
- /*
- * All of the shared database files live in home, but
- * data files will live in data_dir.
- */
- quiet = 0;
- home = "/var/lib/rpm";
- data_dir = "/var/lib/rpm";
- while ((ch = getopt(argc, argv, "h:d:qV")) != EOF)
- switch (ch) {
- case 'h':
- home = optarg;
- break;
- case 'd':
- data_dir = optarg;
- break;
- case 'q':
- quiet = 1;
- break;
- case 'V':
- printf("%s\n", db_version(NULL, NULL, NULL));
- return (EXIT_SUCCESS);
- case '?':
- default:
- (void)fprintf(stderr, "usage: %s [-h home] [-d data_dir]\n", progname);
- return (1);
- }
- argc -= optind;
- argv += optind;
-
- if (argc != 0) {
- (void)fprintf(stderr, "usage: %s [-h home] [-d data_dir]\n", progname);
- return (1);
- }
-
- /*
- * Create an environment object and initialize it for error
- * reporting.
- */
- if ((ret = db_env_create(&dbenv, 0)) != 0) {
- if (!quiet)
- fprintf(stderr, "%s: %s\n", progname, db_strerror(ret));
- return (1);
- }
- if (quiet) {
- dbenv->set_errfile(dbenv, NULL);
- } else {
- dbenv->set_errfile(dbenv, stderr);
- }
- dbenv->set_errpfx(dbenv, progname);
-
- /*
- * We want to specify the shared memory buffer pool cachesize,
- * but everything else is the default.
- */
- if ((ret = dbenv->set_cachesize(dbenv, 0, 64 * 1024, 0)) != 0) {
- dbenv->err(dbenv, ret, "set_cachesize");
- dbenv->close(dbenv, 0);
- return (1);
- }
-
- /* Databases are in a subdirectory. */
- (void)dbenv->set_data_dir(dbenv, data_dir);
-
- /* Open the environment with full transactional support. */
- ret = dbenv->open(dbenv, home, DB_INIT_MPOOL, 0644);
- /* Close the environment handle. */
- dbenv->close(dbenv, 0);
-#if 0
- if (ret == DB_VERSION_MISMATCH) {
-#else
- if (ret != 0) {
-#endif
- return (1);
- }
-
- return (0);
-}
-
-int
-version_check()
-{
- int v_major, v_minor, v_patch;
-
- /* Make sure we're loaded with the right version of the DB library. */
- (void)db_version(&v_major, &v_minor, &v_patch);
- if (v_major != DB_VERSION_MAJOR || v_minor != DB_VERSION_MINOR) {
- fprintf(stderr,
- "%s: version %d.%d doesn't match library version %d.%d\n",
- progname, DB_VERSION_MAJOR,
- DB_VERSION_MINOR, v_major, v_minor);
- return (EXIT_FAILURE);
- }
- return (0);
-}
+++ /dev/null
-#include <sys/types.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <db.h>
-
-typedef struct { /* XXX: Globals. */
- const char *progname; /* Program name. */
- char *hdrbuf; /* Input file header. */
- u_long lineno; /* Input file line number. */
- u_long origline; /* Original file line number. */
- int endodata; /* Reached the end of a database. */
- int endofile; /* Reached the end of the input. */
- int version; /* Input version. */
- char *home; /* Env home. */
- char *passwd; /* Env passwd. */
- int private; /* Private env. */
- u_int32_t cache; /* Env cache size. */
-} LDG;
-
-int db_init __P((DB_ENV *, char *, u_int32_t, int *));
-int env_create __P((DB_ENV **, LDG *));
-int main __P((int, char *[]));
-int usage __P((void));
-int version_check __P((void));
-
-const char *progname = "rpmdb_reset";
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- enum { NOTSET, FILEID_RESET, LSN_RESET, STANDARD_LOAD } mode;
- extern char *optarg;
- extern int optind;
- DBTYPE dbtype;
- DB_ENV *dbenv;
- LDG ldg;
- u_int ldf;
- int ch, exitval, ret;
-
- if ((exitval = version_check()) != 0)
- goto done;
-
- ldg.progname = progname;
- ldg.lineno = 0;
- ldg.endodata = ldg.endofile = 0;
- ldg.version = 1;
- ldg.cache = (1024 * 1024);
- ldg.hdrbuf = NULL;
- ldg.home = NULL;
- ldg.passwd = NULL;
-
- mode = NOTSET;
- ldf = 0;
- exitval = 0;
- dbtype = DB_UNKNOWN;
-
- /*
- * There are two modes for db_load: -r and everything else. The -r
- * option zeroes out the database LSN's or resets the file ID, it
- * doesn't really "load" a new database. The functionality is in
- * db_load because we don't have a better place to put it, and we
- * don't want to create a new utility for just that functionality.
- */
- while ((ch = getopt(argc, argv, "h:r:V")) != EOF)
- switch (ch) {
- case 'h':
- ldg.home = optarg;
- break;
- case 'r':
- if (strcmp(optarg, "lsn") == 0)
- mode = LSN_RESET;
- else if (strcmp(optarg, "fileid") == 0)
- mode = FILEID_RESET;
- else {
- exitval = usage();
- goto done;
- }
- break;
- case 'V':
- printf("%s\n", db_version(NULL, NULL, NULL));
- return (EXIT_SUCCESS);
- case '?':
- default:
- exitval = usage();
- goto done;
- }
- argc -= optind;
- argv += optind;
-
- if (argc != 1 || mode == NOTSET) {
- exitval = usage();
- goto done;
- }
-
- /*
- * Create an environment object initialized for error reporting, and
- * then open it.
- */
- if (env_create(&dbenv, &ldg) != 0)
- goto err;
-
- /* If we're resetting the LSNs, that's an entirely separate path. */
- switch (mode) {
- case FILEID_RESET:
- exitval = dbenv->fileid_reset(dbenv, argv[0], 0);
- break;
- case LSN_RESET:
- exitval = dbenv->lsn_reset(dbenv, argv[0], 0);
- break;
- case NOTSET:
- break;
- }
-
- if (0) {
-err: exitval = 1;
- }
- if ((ret = dbenv->close(dbenv, 0)) != 0) {
- exitval = 1;
- fprintf(stderr,
- "%s: dbenv->close: %s\n", ldg.progname, db_strerror(ret));
- }
-
- if (ldg.passwd != NULL)
- free(ldg.passwd);
-
-done:
- return (exitval);
-}
-
-/*
- * env_create --
- * Create the environment and initialize it for error reporting.
- */
-int
-env_create(dbenvp, ldg)
- DB_ENV **dbenvp;
- LDG *ldg;
-{
- DB_ENV *dbenv;
- int ret;
-
- if ((ret = db_env_create(dbenvp, 0)) != 0) {
- fprintf(stderr, "%s: db_env_create: %s\n",
- ldg->progname, db_strerror(ret));
- return (ret);
- }
- dbenv = *dbenvp;
- dbenv->set_errfile(dbenv, stderr);
- dbenv->set_errpfx(dbenv, ldg->progname);
- if (ldg->passwd != NULL && (ret = dbenv->set_encrypt(dbenv,
- ldg->passwd, DB_ENCRYPT_AES)) != 0) {
- dbenv->err(dbenv, ret, "set_passwd");
- return (ret);
- }
- if ((ret = db_init(dbenv, ldg->home, ldg->cache, &ldg->private)) != 0)
- return (ret);
- dbenv->app_private = ldg;
-
- return (0);
-}
-
-/*
- * db_init --
- * Initialize the environment.
- */
-int
-db_init(dbenv, home, cache, is_private)
- DB_ENV *dbenv;
- char *home;
- u_int32_t cache;
- int *is_private;
-{
- u_int32_t flags;
- int ret;
-
- *is_private = 0;
- /* We may be loading into a live environment. Try and join. */
- flags = DB_USE_ENVIRON |
- DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN;
- if ((ret = dbenv->open(dbenv, home, flags, 0)) == 0)
- return (0);
- if (ret == DB_VERSION_MISMATCH)
- goto err;
-
- /*
- * We're trying to load a database.
- *
- * An environment is required because we may be trying to look at
- * databases in directories other than the current one. We could
- * avoid using an environment iff the -h option wasn't specified,
- * but that seems like more work than it's worth.
- *
- * No environment exists (or, at least no environment that includes
- * an mpool region exists). Create one, but make it private so that
- * no files are actually created.
- */
-#define LF_SET(f) ((flags) |= (f))
-#define LF_CLR(f) ((flags) &= ~(f))
- LF_CLR(DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_TXN);
- LF_SET(DB_CREATE | DB_PRIVATE);
- *is_private = 1;
- if ((ret = dbenv->set_cachesize(dbenv, 0, cache, 1)) != 0) {
- dbenv->err(dbenv, ret, "set_cachesize");
- return (1);
- }
- if ((ret = dbenv->open(dbenv, home, flags, 0)) == 0)
- return (0);
-
- /* An environment is required. */
-err: dbenv->err(dbenv, ret, "DB_ENV->open");
- return (1);
-}
-
-/*
- * usage --
- * Display the usage message.
- */
-int
-usage()
-{
- (void)fprintf(stderr, "usage: %s %s\n\t%s %s\n",
- progname, "[-V]",
- progname, "-r lsn | fileid [-h home] db_file");
- return (EXIT_FAILURE);
-}
-
-int
-version_check()
-{
- int v_major, v_minor, v_patch;
-
- /* Make sure we're loaded with the right version of the DB library. */
- (void)db_version(&v_major, &v_minor, &v_patch);
- if (v_major != DB_VERSION_MAJOR || v_minor != DB_VERSION_MINOR) {
- fprintf(stderr,
- "%s: version %d.%d doesn't match library version %d.%d\n",
- progname, DB_VERSION_MAJOR,
- DB_VERSION_MINOR, v_major, v_minor);
- return (EXIT_FAILURE);
- }
- return (0);
-}
--- /dev/null
+--- rpm-4.16.1.2/macros.in~ 2020-12-25 11:29:20.000000000 +0100
++++ rpm-4.16.1.2/macros.in 2021-01-05 22:55:49.955934996 +0100
+@@ -627,7 +627,7 @@
+ # sqlite Sqlite database
+ # dummy dummy backend (no actual functionality)
+ #
+-%_db_backend bdb
++%_db_backend sqlite
+
+ #
+ # Macros used to configure Berkley db parameters.