Add upstream patches to diagnose possible F29 issue.

This commit is contained in:
Richard W.M. Jones 2019-01-24 14:43:22 +00:00
parent df888023bc
commit d24f9edcaa
3 changed files with 125 additions and 1 deletions

View File

@ -0,0 +1,89 @@
From 42955541dc3aa8ae3361f3bd6eb0ae338f307545 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Wed, 23 Jan 2019 12:22:19 +0100
Subject: [PATCH 1/2] rpm: extend the Multiple_matches exception
Add the package that raised the issue, so it can be used to provide
better diagnostic.
---
src/librpm-c.c | 15 ++++++++++-----
src/librpm.ml | 4 ++--
src/librpm.mli | 2 +-
3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/librpm-c.c b/src/librpm-c.c
index 3bd25a2..75ca4d7 100644
--- a/src/librpm-c.c
+++ b/src/librpm-c.c
@@ -66,10 +66,15 @@ librpm_handle_closed (void)
}
static void
-librpm_raise_multiple_matches (int occurrences)
+librpm_raise_multiple_matches (value pkgv, int occurrences)
{
- caml_raise_with_arg (*caml_named_value ("librpm_multiple_matches"),
- Val_int (occurrences));
+ CAMLparam1 (pkgv);
+
+ value args[] = { pkgv, Val_int (occurrences) };
+ caml_raise_with_args (*caml_named_value ("librpm_multiple_matches"),
+ 2, args);
+
+ CAMLnoreturn;
}
#define Librpm_val(v) (*((struct librpm_data *)Data_custom_val(v)))
@@ -296,7 +301,7 @@ supermin_rpm_pkg_requires (value rpmv, value pkgv)
fflush (stdout);
}
if (count != 1)
- librpm_raise_multiple_matches (count);
+ librpm_raise_multiple_matches (pkgv, count);
h = rpmdbNextIterator (iter);
assert (h != NULL);
@@ -413,7 +418,7 @@ supermin_rpm_pkg_filelist (value rpmv, value pkgv)
fflush (stdout);
}
if (count != 1)
- librpm_raise_multiple_matches (count);
+ librpm_raise_multiple_matches (pkgv, count);
h = rpmdbNextIterator (iter);
assert (h != NULL);
diff --git a/src/librpm.ml b/src/librpm.ml
index 4eeba77..b6f9ff8 100644
--- a/src/librpm.ml
+++ b/src/librpm.ml
@@ -23,7 +23,7 @@ external rpm_vercmp : string -> string -> int = "supermin_rpm_vercmp" "noalloc"
type t
-exception Multiple_matches of int
+exception Multiple_matches of string * int
external rpm_open : ?debug:int -> t = "supermin_rpm_open"
external rpm_close : t -> unit = "supermin_rpm_close"
@@ -49,4 +49,4 @@ external rpm_pkg_whatprovides : t -> string -> string array = "supermin_rpm_pkg_
external rpm_pkg_filelist : t -> string -> rpmfile_t array = "supermin_rpm_pkg_filelist"
let () =
- Callback.register_exception "librpm_multiple_matches" (Multiple_matches 0)
+ Callback.register_exception "librpm_multiple_matches" (Multiple_matches ("", 0))
diff --git a/src/librpm.mli b/src/librpm.mli
index 5229be6..53b4b2c 100644
--- a/src/librpm.mli
+++ b/src/librpm.mli
@@ -31,7 +31,7 @@ val rpm_vercmp : string -> string -> int
type t
(** The librpm handle. *)
-exception Multiple_matches of int
+exception Multiple_matches of string * int
val rpm_open : ?debug:int -> t
(** Open the librpm (transaction set) handle. *)
--
2.20.1

View File

@ -0,0 +1,27 @@
From 36878992ebdd08f0f9b37017f347f5eab18ce9ed Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Wed, 23 Jan 2019 12:23:02 +0100
Subject: [PATCH 2/2] Print Librpm.Multiple_matches exceptions
Print a better diagnostic for them, so it is more clear which package
is detected as present multiple times.
---
src/supermin.ml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/supermin.ml b/src/supermin.ml
index f9798f9..71d8b64 100644
--- a/src/supermin.ml
+++ b/src/supermin.ml
@@ -298,6 +298,8 @@ let () =
error "error: %s: %s: %s" fname (Unix.error_message code) param
| Failure msg -> (* from failwith/failwithf *)
error "failure: %s" msg
+ | Librpm.Multiple_matches (package, count) -> (* from librpm *)
+ error "RPM error: %d occurrences for %s" count package
| Invalid_argument msg -> (* probably should never happen *)
error "internal error: invalid argument: %s" msg
| Assert_failure (file, line, char) -> (* should never happen *)
--
2.20.1

View File

@ -26,7 +26,7 @@
Summary: Tool for creating supermin appliances
Name: supermin
Version: 5.1.20
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2+
%if 0%{?rhel} >= 7
@ -44,6 +44,11 @@ Source1: http://libguestfs.org/download/supermin/%{name}-%{version}.tar.gz
Source2: libguestfs.keyring
%endif
# Upstream patches to diagnose possible F29 issue:
# https://www.redhat.com/archives/libguestfs/2019-January/thread.html#00168
Patch1: 0001-rpm-extend-the-Multiple_matches-exception.patch
Patch2: 0002-Print-Librpm.Multiple_matches-exceptions.patch
BuildRequires: /usr/bin/pod2man
BuildRequires: /usr/bin/pod2html
BuildRequires: rpm
@ -165,6 +170,9 @@ make check || {
%changelog
* Thu Jan 24 2019 Richard W.M. Jones <rjones@redhat.com> - 5.1.20-2
- Add upstream patches to diagnose possible F29 issue.
* Thu Jan 17 2019 Richard W.M. Jones <rjones@redhat.com> - 5.1.20-1
- New upstream version 5.1.20.