|
|
29efa3f |
From 86fd6f3e86ab99d54a22b475aecccfc19bdff07e Mon Sep 17 00:00:00 2001
|
|
|
29efa3f |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
29efa3f |
Date: Sat, 21 Jan 2023 09:38:55 +0000
|
|
|
2417d4b |
Subject: [PATCH 01/13] rpm: New RPM database location in /usr/lib/sysimage/rpm
|
|
|
29efa3f |
|
|
|
29efa3f |
A few years ago the RPM database was moved from /var to /usr. This is
|
|
|
29efa3f |
now feeding through to Linux distros.
|
|
|
29efa3f |
|
|
|
29efa3f |
http://lists.rpm.org/pipermail/rpm-maint/2017-October/006723.html
|
|
|
29efa3f |
https://fedoraproject.org/wiki/Changes/RelocateRPMToUsr
|
|
|
29efa3f |
https://src.fedoraproject.org/rpms/rpm/pull-request/21
|
|
|
29efa3f |
---
|
|
|
29efa3f |
src/ph_rpm.ml | 20 +++++++++++++++-----
|
|
|
29efa3f |
1 file changed, 15 insertions(+), 5 deletions(-)
|
|
|
29efa3f |
|
|
|
29efa3f |
diff --git a/src/ph_rpm.ml b/src/ph_rpm.ml
|
|
|
29efa3f |
index 85557fe..2c199c1 100644
|
|
|
29efa3f |
--- a/src/ph_rpm.ml
|
|
|
29efa3f |
+++ b/src/ph_rpm.ml
|
|
|
29efa3f |
@@ -236,12 +236,22 @@ let rpm_package_name pkg =
|
|
|
29efa3f |
let rpm = rpm_of_pkg pkg in
|
|
|
29efa3f |
rpm.name
|
|
|
29efa3f |
|
|
|
29efa3f |
+let rpmdb_locations = [
|
|
|
29efa3f |
+ "/usr/lib/sysimage/rpm/rpmdb.sqlite";
|
|
|
29efa3f |
+ "/var/lib/rpm/rpmdb.sqlite";
|
|
|
29efa3f |
+ "/var/lib/rpm/Packages"
|
|
|
29efa3f |
+]
|
|
|
29efa3f |
+
|
|
|
29efa3f |
+let find_rpmdb () =
|
|
|
29efa3f |
+ let rec loop = function
|
|
|
29efa3f |
+ | [] -> error "rpm: cannot locate RPM database; if this is a normal RPM-based Linux distro then this is probably a supermin bug"
|
|
|
29efa3f |
+ | db :: rest ->
|
|
|
29efa3f |
+ if Sys.file_exists db then db else loop rest
|
|
|
29efa3f |
+ in
|
|
|
29efa3f |
+ loop rpmdb_locations
|
|
|
29efa3f |
+
|
|
|
29efa3f |
let rpm_get_package_database_mtime () =
|
|
|
29efa3f |
- (try
|
|
|
29efa3f |
- lstat "/var/lib/rpm/rpmdb.sqlite"
|
|
|
29efa3f |
- with Unix_error (ENOENT, _, _) ->
|
|
|
29efa3f |
- lstat "/var/lib/rpm/Packages"
|
|
|
29efa3f |
- ).st_mtime
|
|
|
29efa3f |
+ (lstat (find_rpmdb ())).st_mtime
|
|
|
29efa3f |
|
|
|
29efa3f |
(* Return the best provider of a particular RPM requirement.
|
|
|
29efa3f |
*
|
|
|
29efa3f |
--
|
|
|
2417d4b |
2.42.0
|
|
|
29efa3f |
|