29afe98686
Add all patches since 5.1.20 was released.
91 lines
2.5 KiB
Diff
91 lines
2.5 KiB
Diff
From e57e988c39aca015100fb92377dbd8d114c0bece Mon Sep 17 00:00:00 2001
|
|
From: Pino Toscano <ptoscano@redhat.com>
|
|
Date: Fri, 12 Apr 2019 12:26:11 +0200
|
|
Subject: [PATCH 07/12] rpm: query the RPM architecture
|
|
|
|
Query the RPM library for the current architecture of RPM, storing it
|
|
for later use, and printing it to the debug output.
|
|
---
|
|
src/librpm-c.c | 10 ++++++++++
|
|
src/librpm.ml | 1 +
|
|
src/librpm.mli | 3 +++
|
|
src/ph_rpm.ml | 8 ++++++--
|
|
4 files changed, 20 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/librpm-c.c b/src/librpm-c.c
|
|
index 75ca4d7..2e2f048 100644
|
|
--- a/src/librpm-c.c
|
|
+++ b/src/librpm-c.c
|
|
@@ -132,6 +132,16 @@ supermin_rpm_vercmp (value av, value bv)
|
|
return Val_int (rpmvercmp (String_val (av), String_val (bv)));
|
|
}
|
|
|
|
+value
|
|
+supermin_rpm_get_arch (value unit)
|
|
+{
|
|
+ const char *str;
|
|
+
|
|
+ rpmGetArchInfo (&str, NULL);
|
|
+
|
|
+ return caml_copy_string (str);
|
|
+}
|
|
+
|
|
value
|
|
supermin_rpm_open (value debugv)
|
|
{
|
|
diff --git a/src/librpm.ml b/src/librpm.ml
|
|
index b6f9ff8..c987e21 100644
|
|
--- a/src/librpm.ml
|
|
+++ b/src/librpm.ml
|
|
@@ -20,6 +20,7 @@ external rpm_is_available : unit -> bool = "supermin_rpm_is_available" "noalloc"
|
|
|
|
external rpm_version : unit -> string = "supermin_rpm_version"
|
|
external rpm_vercmp : string -> string -> int = "supermin_rpm_vercmp" "noalloc"
|
|
+external rpm_get_arch : unit -> string = "supermin_rpm_get_arch"
|
|
|
|
type t
|
|
|
|
diff --git a/src/librpm.mli b/src/librpm.mli
|
|
index 53b4b2c..c0d7bdf 100644
|
|
--- a/src/librpm.mli
|
|
+++ b/src/librpm.mli
|
|
@@ -28,6 +28,9 @@ val rpm_version : unit -> string
|
|
val rpm_vercmp : string -> string -> int
|
|
(** Compare two RPM version strings using RPM version compare rules. *)
|
|
|
|
+val rpm_get_arch : unit -> string
|
|
+(** The current main RPM architecture. *)
|
|
+
|
|
type t
|
|
(** The librpm handle. *)
|
|
|
|
diff --git a/src/ph_rpm.ml b/src/ph_rpm.ml
|
|
index a8bcf7c..e27d226 100644
|
|
--- a/src/ph_rpm.ml
|
|
+++ b/src/ph_rpm.ml
|
|
@@ -64,7 +64,7 @@ let ibm_powerkvm_detect () =
|
|
with Unix_error _ -> false
|
|
|
|
let settings = ref no_settings
|
|
-let rpm_major, rpm_minor = ref 0, ref 0
|
|
+let rpm_major, rpm_minor, rpm_arch = ref 0, ref 0, ref ""
|
|
let zypper_major, zypper_minor, zypper_patch = ref 0, ref 0, ref 0
|
|
let t = ref None
|
|
|
|
@@ -93,7 +93,11 @@ let rec rpm_init s =
|
|
if !settings.debug >= 1 then
|
|
printf "supermin: rpm: detected RPM version %d.%d\n" major minor;
|
|
|
|
- t := Some (rpm_open ~debug:!settings.debug)
|
|
+ t := Some (rpm_open ~debug:!settings.debug);
|
|
+
|
|
+ rpm_arch := rpm_get_arch ();
|
|
+ if !settings.debug >= 1 then
|
|
+ printf "supermin: rpm: detected RPM architecture %s\n" !rpm_arch
|
|
|
|
and opensuse_init s =
|
|
rpm_init s;
|
|
--
|
|
2.23.0
|
|
|