mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-29 03:45:02 +01:00
pkg: Fix rpm warnings about not being able to read its database
When building on many debian machines, the RPM database, by default at /var/lib/rpm/rpmdb.sqlite, does not exist and can not be created when running as an unprivileged user. This will cause any rpm command that ties to access the database to print this obnoxious error message: error: Unable to open sqlite database /var/lib/rpm/rpmdb.sqlite: unable to open database file error: cannot open Packages index using sqlite - Operation not permitted (1) error: cannot open Packages database in /var/lib/rpm It appears as though this doesn't cause any failures and is really a warning. However, it can be printed more than 20 times when making the deb-kmod target. Detect when the database file is not readable at configure time and setup various rpm and rpmbuild invocations to use the root of the build directory as the database directory path. The alien program internally runs various rpm queries, however it provides no good way to tell those rpm invocations to use an alternate database path. A fake home is setup in the build directory to create the user rpm macro file with the database path defined there. Then run is alien with that home directory so its rpm invocations will pick up the desired database path. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Glenn Washburn <[email protected]> Closes #19162
This commit is contained in:
1 parent
1f7a484cf5
commit
0d5bb1d010
2 files changed
+18
No files matched your search
@@ -34,6 +34,10 @@ deb-local: deb-local-common
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi)
|
||||
if test "$(RPM_DBPATH)"; then \
|
||||
mkdir -p "$(RPM_DBPATH)" "$(abs_builddir)/.config/rpm"; \
|
||||
echo "%_dbpath $(RPM_DBPATH)" >"$(abs_builddir)/.config/rpm/macros"; \
|
||||
fi
|
||||
|
||||
deb-kmod: deb-local rpm-kmod
|
||||
name=${PACKAGE}; \
|
||||
@@ -41,6 +45,7 @@ deb-kmod: deb-local rpm-kmod
|
||||
arch=`$(RPM) -qp $${name}-kmod-$${version}.src.rpm --qf %{arch} | tail -1`; \
|
||||
debarch=`$(DPKG) --print-architecture`; \
|
||||
pkg1=kmod-$${name}*$${version}.$${arch}.rpm; \
|
||||
HOME=`test "$(RPM_DBPATH)" && echo "$(abs_builddir)" || echo "$${HOME}"` \
|
||||
fakeroot $(ALIEN) -k --scripts --to-deb --target=$$debarch $$pkg1 || exit 1; \
|
||||
$(RM) $$pkg1
|
||||
|
||||
@@ -51,6 +56,7 @@ deb-dkms: deb-local rpm-dkms
|
||||
arch=`$(RPM) -qp $${name}-dkms-$${version}.src.rpm --qf %{arch} | tail -1`; \
|
||||
debarch=`$(DPKG) --print-architecture`; \
|
||||
pkg1=$${name}-dkms-$${version}.$${arch}.rpm; \
|
||||
HOME=`test "$(RPM_DBPATH)" && echo "$(abs_builddir)" || echo "$${HOME}"` \
|
||||
fakeroot $(ALIEN) -k --scripts --to-deb --target=$$debarch $$pkg1 || exit 1; \
|
||||
$(RM) $$pkg1
|
||||
|
||||
@@ -82,6 +88,7 @@ deb-utils: deb-local rpm-utils-initramfs
|
||||
## which should NOT be mixed with the alien-generated debs created here
|
||||
chmod +x $${path_prepend}/dh_shlibdeps; \
|
||||
env "PATH=$${path_prepend}:$${PATH}" \
|
||||
HOME=`test "$(RPM_DBPATH)" && echo "$(abs_builddir)" || echo "$${HOME}"` \
|
||||
fakeroot $(ALIEN) -k --scripts --to-deb --target=$$debarch \
|
||||
$$pkg1 $$pkg2 $$pkg3 $$pkg4 $$pkg5 $$pkg6 $$pkg7 \
|
||||
$$pkg8 $$pkg9 $$pkg10 $$pkg11 || exit 1; \
|
||||
|
||||
@@ -503,6 +503,16 @@ AC_DEFUN([ZFS_AC_RPM], [
|
||||
AC_MSG_CHECKING([whether spec files are available])
|
||||
AC_MSG_RESULT([yes ($RPM_SPEC_DIR/*.spec.in)])
|
||||
|
||||
AC_MSG_CHECKING([whether rpm database is readable])
|
||||
AS_IF([test -r "$($RPM --eval '%{_dbpath}')/rpmdb.sqlite"], [
|
||||
AC_MSG_RESULT([yes ($($RPM --eval '%{_dbpath}')/rpmdb.sqlite)])
|
||||
],[
|
||||
RPM_DBPATH="${ac_pwd}/.rpmdb"
|
||||
RPM="$RPM --dbpath=\$(RPM_DBPATH)"
|
||||
RPMBUILD="$RPMBUILD --dbpath=\$(RPM_DBPATH)"
|
||||
AC_MSG_RESULT([no (using ${RPM_DBPATH}/rpmdb.sqlite)])
|
||||
])
|
||||
|
||||
AC_SUBST(HAVE_RPM)
|
||||
AC_SUBST(RPM)
|
||||
AC_SUBST(RPM_VERSION)
|
||||
@@ -511,6 +521,7 @@ AC_DEFUN([ZFS_AC_RPM], [
|
||||
AC_SUBST(RPMBUILD)
|
||||
AC_SUBST(RPMBUILD_VERSION)
|
||||
|
||||
AC_SUBST(RPM_DBPATH)
|
||||
AC_SUBST(RPM_SPEC_DIR)
|
||||
AC_SUBST(RPM_DEFINE_UTIL)
|
||||
AC_SUBST(RPM_DEFINE_KMOD)
|
||||
|
||||
Reference in new issue
Block a user