RPM backed by LumoSQL
rpm is the package manager which is the core of Fedora, RHEL, SUSE, openSUSE, Mageia, OpenMandriva and other
Linux distributions, and it uses SQLite as its database.
LumoSQL is a modification of SQLite, explained in the main README.
This directory builds
RPM against LumoSQL with the LMDBv1 backend, without any modification of rpm.
This is aimed at RPM upstream contributors wanting to evaluate a different backend, and produces
rpm/rpmdb from git master by default.
RPM will work equally well with lumosql.so re-labelled as libsqlite3.so, or as an amalgamation compiled directly in identically to the SQLite method. We have chosen to statically compile LumoSQL in just because its simpler.
We compile LumoSQL's SQLite plus the LMDBv1 backend into a single static libsqlite3.a, generate a sqlite3.pc that describes it, and put that .pc first on
PKG_CONFIG_PATH. RPM's pkg_check_modules then discovers it and links LumoSQL statically into librpm.
Dependencies
Install the normal LumoSQL build dependencies from the top-level README, checking with make doctor as per the docs. In addition, RPM needs the following:
Fedora/RHEL:
sudo dnf install git cmake gcc gcc-c++ pkgconf
sudo dnf builddep rpm # pulls RPM's own build requirements
Debian/Ubuntu:
sudo apt install git cmake build-essential pkg-config
sudo apt build-dep rpm # make sure the deb-src repo is enabled
The Makefile disables RPM's optional SELinux and Sequoia integrations for this demo build, and uses a local scdoc fallback if scdoc is not installed.
Quick build
From the LumoSQL root directory:
make doctor # resolve any remaining LumoSQL dependency problems
cd examples/rpm
make
The binaries are:
examples/rpm/build/rpm-build/tools/rpm
examples/rpm/build/rpm-build/tools/rpmdb
Confirm LumoSQL is linked statically:
ldd build/rpm-build/tools/rpm | grep -i sqlite # expect: no output
By default the Makefile builds RPM master against LumoSQL target 3.53.2+lmdbv1-1.0, using build/ as its work directory. To build a specific RPM commit, pin the LumoSQL target explicitly, or override the source/work locations:
make RPM_REF=rpm-4.20.0
make LUMOSQL_TARGET=3.53.2+lmdbv1-1.0
make RPM_GIT_URL=https://github.com/rpm-software-management/rpm WORK_DIR=/tmp/lumo-rpm-build
Smoke test
make smoke # creates and queries a throwaway rpmdb
You can also drive it by hand against any scratch root:
RPM=build/rpm-build/tools/rpm
RPMDB=build/rpm-build/tools/rpmdb
RPM_COMMON="--rcfile build/rpm-build/rpmrc --macros build/rpm-build/macros --root /tmp/rpmtest"
"$RPMDB" $RPM_COMMON --initdb
"$RPM" $RPM_COMMON -qa # empty db: no output, exit 0
To migrate an existing system rpmdb into a LumoSQL-backed one, use RPM's header export/import. This is because the LMDB file format is completely different to SQLite.
RPM=build/rpm-build/tools/rpm
RPMDB=build/rpm-build/tools/rpmdb
RPM_COMMON="--rcfile build/rpm-build/rpmrc --macros build/rpm-build/macros --root /tmp/rpmtest"
rpmdb --exportdb > /tmp/live.headers
"$RPMDB" $RPM_COMMON --importdb < /tmp/live.headers