New upstream version 5.3.4

Remove patches which are now all upstream.
This commit is contained in:
Richard W.M. Jones 2024-01-11 12:25:53 +00:00
parent e50448eed6
commit 61460d5d8f
15 changed files with 8 additions and 719 deletions

View File

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

View File

@ -1,98 +0,0 @@
From f8774efbe02d3651cde449333cf108e79adba48c Mon Sep 17 00:00:00 2001
From: Kate <kit.ty.kate@disroot.org>
Date: Wed, 16 Nov 2022 19:30:01 +0000
Subject: [PATCH 02/13] Add support for OCaml 5.0
---
src/mode_build.ml | 4 ++--
src/supermin.ml | 16 ++++++++--------
src/utils.ml | 4 ++--
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/mode_build.ml b/src/mode_build.ml
index 7c48295..f81341d 100644
--- a/src/mode_build.ml
+++ b/src/mode_build.ml
@@ -123,7 +123,7 @@ let rec build debug
(PackageSet.cardinal packages);
if debug >= 2 then (
List.iter (printf " - %s\n") pretty_packages;
- flush Pervasives.stdout
+ flush Stdlib.stdout
)
);
@@ -207,7 +207,7 @@ let rec build debug
(List.length files);
if debug >= 2 then (
List.iter (fun { ft_path = path } -> printf " - %s\n" path) files;
- flush Pervasives.stdout
+ flush Stdlib.stdout
)
);
diff --git a/src/supermin.ml b/src/supermin.ml
index 659e857..bef9db6 100644
--- a/src/supermin.ml
+++ b/src/supermin.ml
@@ -296,27 +296,27 @@ let () =
main ()
with
| Unix.Unix_error (code, fname, "") -> (* from a syscall *)
- Printexc.print_backtrace Pervasives.stderr;
+ Printexc.print_backtrace Stdlib.stderr;
error "error: %s: %s" fname (Unix.error_message code)
| Unix.Unix_error (code, fname, param) -> (* from a syscall *)
- Printexc.print_backtrace Pervasives.stderr;
+ Printexc.print_backtrace Stdlib.stderr;
error "error: %s: %s: %s" fname (Unix.error_message code) param
| Failure msg -> (* from failwith/failwithf *)
- Printexc.print_backtrace Pervasives.stderr;
+ Printexc.print_backtrace Stdlib.stderr;
error "failure: %s" msg
| Librpm.Multiple_matches (package, count) -> (* from librpm *)
- Printexc.print_backtrace Pervasives.stderr;
+ Printexc.print_backtrace Stdlib.stderr;
error "RPM error: %d occurrences for %s" count package
| Invalid_argument msg -> (* probably should never happen *)
- Printexc.print_backtrace Pervasives.stderr;
+ Printexc.print_backtrace Stdlib.stderr;
error "internal error: invalid argument: %s" msg
| Assert_failure (file, line, char) -> (* should never happen *)
- Printexc.print_backtrace Pervasives.stderr;
+ Printexc.print_backtrace Stdlib.stderr;
error "internal error: assertion failed at %s, line %d, char %d"
file line char
| Not_found -> (* should never happen *)
- Printexc.print_backtrace Pervasives.stderr;
+ Printexc.print_backtrace Stdlib.stderr;
error "internal error: Not_found exception was thrown"
| exn -> (* something not matched above *)
- Printexc.print_backtrace Pervasives.stderr;
+ Printexc.print_backtrace Stdlib.stderr;
error "exception: %s" (Printexc.to_string exn)
diff --git a/src/utils.ml b/src/utils.ml
index 521d49e..ae99294 100644
--- a/src/utils.ml
+++ b/src/utils.ml
@@ -40,7 +40,7 @@ let dir_exists name =
try (stat name).st_kind = S_DIR
with Unix_error _ -> false
-let uniq ?(cmp = Pervasives.compare) xs =
+let uniq ?(cmp = Stdlib.compare) xs =
let rec loop acc = function
| [] -> acc
| [x] -> x :: acc
@@ -51,7 +51,7 @@ let uniq ?(cmp = Pervasives.compare) xs =
in
List.rev (loop [] xs)
-let sort_uniq ?(cmp = Pervasives.compare) xs =
+let sort_uniq ?(cmp = Stdlib.compare) xs =
let xs = List.sort cmp xs in
let xs = uniq ~cmp xs in
xs
--
2.42.0

View File

@ -1,125 +0,0 @@
From 3efe663421d94376694f292ca1fcf2732a82149f Mon Sep 17 00:00:00 2001
From: Kate <kit.ty.kate@disroot.org>
Date: Wed, 16 Nov 2022 19:59:36 +0000
Subject: [PATCH 03/13] Restore compatibility with OCaml < 4.07
---
src/mode_build.ml | 6 ++++--
src/supermin.ml | 18 ++++++++++--------
src/utils.ml | 6 ++++--
3 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/src/mode_build.ml b/src/mode_build.ml
index f81341d..f0e5e09 100644
--- a/src/mode_build.ml
+++ b/src/mode_build.ml
@@ -16,6 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*)
+let stdlib_stdout = stdout
+
open Unix
open Unix.LargeFile
open Printf
@@ -123,7 +125,7 @@ let rec build debug
(PackageSet.cardinal packages);
if debug >= 2 then (
List.iter (printf " - %s\n") pretty_packages;
- flush Stdlib.stdout
+ flush stdlib_stdout
)
);
@@ -207,7 +209,7 @@ let rec build debug
(List.length files);
if debug >= 2 then (
List.iter (fun { ft_path = path } -> printf " - %s\n" path) files;
- flush Stdlib.stdout
+ flush stdlib_stdout
)
);
diff --git a/src/supermin.ml b/src/supermin.ml
index bef9db6..d49c1e8 100644
--- a/src/supermin.ml
+++ b/src/supermin.ml
@@ -16,6 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*)
+let stdlib_stderr = stderr
+
open Unix
open Unix.LargeFile
open Printf
@@ -296,27 +298,27 @@ let () =
main ()
with
| Unix.Unix_error (code, fname, "") -> (* from a syscall *)
- Printexc.print_backtrace Stdlib.stderr;
+ Printexc.print_backtrace stdlib_stderr;
error "error: %s: %s" fname (Unix.error_message code)
| Unix.Unix_error (code, fname, param) -> (* from a syscall *)
- Printexc.print_backtrace Stdlib.stderr;
+ Printexc.print_backtrace stdlib_stderr;
error "error: %s: %s: %s" fname (Unix.error_message code) param
| Failure msg -> (* from failwith/failwithf *)
- Printexc.print_backtrace Stdlib.stderr;
+ Printexc.print_backtrace stdlib_stderr;
error "failure: %s" msg
| Librpm.Multiple_matches (package, count) -> (* from librpm *)
- Printexc.print_backtrace Stdlib.stderr;
+ Printexc.print_backtrace stdlib_stderr;
error "RPM error: %d occurrences for %s" count package
| Invalid_argument msg -> (* probably should never happen *)
- Printexc.print_backtrace Stdlib.stderr;
+ Printexc.print_backtrace stdlib_stderr;
error "internal error: invalid argument: %s" msg
| Assert_failure (file, line, char) -> (* should never happen *)
- Printexc.print_backtrace Stdlib.stderr;
+ Printexc.print_backtrace stdlib_stderr;
error "internal error: assertion failed at %s, line %d, char %d"
file line char
| Not_found -> (* should never happen *)
- Printexc.print_backtrace Stdlib.stderr;
+ Printexc.print_backtrace stdlib_stderr;
error "internal error: Not_found exception was thrown"
| exn -> (* something not matched above *)
- Printexc.print_backtrace Stdlib.stderr;
+ Printexc.print_backtrace stdlib_stderr;
error "exception: %s" (Printexc.to_string exn)
diff --git a/src/utils.ml b/src/utils.ml
index ae99294..1dc4310 100644
--- a/src/utils.ml
+++ b/src/utils.ml
@@ -16,6 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*)
+let stdlib_compare = compare
+
open Unix
open Unix.LargeFile
open Printf
@@ -40,7 +42,7 @@ let dir_exists name =
try (stat name).st_kind = S_DIR
with Unix_error _ -> false
-let uniq ?(cmp = Stdlib.compare) xs =
+let uniq ?(cmp = stdlib_compare) xs =
let rec loop acc = function
| [] -> acc
| [x] -> x :: acc
@@ -51,7 +53,7 @@ let uniq ?(cmp = Stdlib.compare) xs =
in
List.rev (loop [] xs)
-let sort_uniq ?(cmp = Stdlib.compare) xs =
+let sort_uniq ?(cmp = stdlib_compare) xs =
let xs = List.sort cmp xs in
let xs = uniq ~cmp xs in
xs
--
2.42.0

View File

@ -1,58 +0,0 @@
From 92d5d7e8c27088fa3fb8e5e6e9c5b8d3209053d6 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 30 May 2023 09:12:14 +0100
Subject: [PATCH 04/13] rpm: Detect dnf5 and omit missing options
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2209412
---
src/ph_rpm.ml | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/ph_rpm.ml b/src/ph_rpm.ml
index 2c199c1..3e803c6 100644
--- a/src/ph_rpm.ml
+++ b/src/ph_rpm.ml
@@ -482,19 +482,38 @@ and download_all_packages_with_dnf pkgs dir tdir =
(* Old dnf didn't create the destdir directory, newer versions do. *)
mkdir tdir 0o700;
+ (* dnf5 lacks various options so we have to detect it:
+ * https://github.com/rpm-software-management/dnf5/issues/580
+ * https://github.com/rpm-software-management/dnf5/issues/581
+ *)
+ let is_dnf5 = is_dnf5 () in
+ let debug_quiet_option =
+ if !settings.debug < 1 then " -q"
+ else if not is_dnf5 then " -v"
+ else "" in
+
let rpms = pkgs_as_NA_rpms pkgs in
let cmd =
- sprintf "%s download%s%s --destdir=%s --disableexcludes=all %s"
+ sprintf "%s download%s%s%s --destdir=%s %s"
Config.dnf
- (if !settings.debug >= 1 then " -v" else " -q")
+ debug_quiet_option
(match !settings.packager_config with
| None -> ""
| Some filename -> sprintf " -c %s" (quote filename))
+ (if not is_dnf5 then " --disableexcludes=all" else "")
(quote tdir)
(quoted_list rpms) in
run_command cmd
+and is_dnf5 () =
+ let cmd = sprintf "%s --version" Config.dnf in
+ let lines = run_command_get_lines cmd in
+ match lines with
+ | [] -> error "rpm: no output from '%s' command" cmd
+ | line :: _ when find line "version 5" >= 0 -> true
+ | _ -> false
+
and pkgs_as_NA_rpms pkgs =
let rpms = List.map rpm_of_pkg (PackageSet.elements pkgs) in
List.map (
--
2.42.0

View File

@ -1,28 +0,0 @@
From 057ea99a3211057d2cb2c9971afe56e0a85e0f78 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 31 May 2023 12:52:13 +0100
Subject: [PATCH 05/13] rpm: Use dnf --config instead of -c
dnf5 does not support -c. dnf4 supports either.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2211386
---
src/ph_rpm.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ph_rpm.ml b/src/ph_rpm.ml
index 3e803c6..e94f35f 100644
--- a/src/ph_rpm.ml
+++ b/src/ph_rpm.ml
@@ -500,7 +500,7 @@ and download_all_packages_with_dnf pkgs dir tdir =
debug_quiet_option
(match !settings.packager_config with
| None -> ""
- | Some filename -> sprintf " -c %s" (quote filename))
+ | Some filename -> sprintf " --config=%s" (quote filename))
(if not is_dnf5 then " --disableexcludes=all" else "")
(quote tdir)
(quoted_list rpms) in
--
2.42.0

View File

@ -1,56 +0,0 @@
From 8dd37da1b5979842b0db44b44655eeaf621f7ac9 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 12 Jun 2023 12:51:56 +0100
Subject: [PATCH 06/13] src: Improved debugging of the supermin if-newer
calculation
Also I expanded the code to make it easier to read. There is no
change to the calculation intended.
---
src/supermin.ml | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/src/supermin.ml b/src/supermin.ml
index d49c1e8..c30c73c 100644
--- a/src/supermin.ml
+++ b/src/supermin.ml
@@ -241,10 +241,33 @@ appliance automatically.
try
let outputs = Mode_build.get_outputs args inputs in
let outputs = List.map ((//) outputdir) outputs in
- let odates = List.map (fun d -> (lstat d).st_mtime) (outputdir :: outputs) in
- let idates = List.map (fun d -> (lstat d).st_mtime) inputs in
+ let outputs = outputdir :: outputs in
+ let odates = List.map (fun f -> (lstat f).st_mtime) outputs in
+ if debug >= 2 then (
+ List.iter (
+ fun f ->
+ printf "supermin: if-newer: output %s => %.2f\n"
+ f (lstat f).st_mtime
+ ) outputs;
+ );
+ let idates = List.map (fun f -> (lstat f).st_mtime) inputs in
+ if debug >= 2 then (
+ List.iter (
+ fun f ->
+ printf "supermin: if-newer: input %s => %.2f\n"
+ f (lstat f).st_mtime
+ ) inputs;
+ );
let pdate = (get_package_handler ()).ph_get_package_database_mtime () in
- if List.for_all (fun idate -> List.for_all (fun odate -> idate < odate) odates) (pdate :: idates) then (
+ if debug >= 2 then (
+ printf "supermin: if-newer: package database date: %.2f\n" pdate;
+ );
+ let older =
+ List.for_all (
+ fun idate ->
+ List.for_all (fun odate -> idate < odate) odates
+ ) (pdate :: idates) in
+ if older then (
if debug >= 1 then
printf "supermin: if-newer: output does not need rebuilding\n%!";
exit 0
--
2.42.0

View File

@ -1,39 +0,0 @@
From 8c38641042e274a713a18daf7fc85584ca0fc9bb Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 12 Jun 2023 13:02:37 +0100
Subject: [PATCH 07/13] src: Fix --if-newer --copy-kernel
We previously copied the kernel into the appliance using 'cp -p' which
preserves the datestamps of the installed kernel. This can confuse
the --if-newer calculation, if for example the package database is
newer than the date on the installed kernel (which quite often is the
case). This makes it think that the appliance is always older than
the package database, thus forcing a rebuild.
We can fix this using 'cp' instead of 'cp -p'. We don't need the
permissions and datestamps on the copied kernel to be preserved anyway
(in fact, it could cause problems if the permissions are restrictive).
Fixes: commit 30de2cb603cdde33524a66d5466f6a9b986ce8a6
---
src/format_ext2_kernel.ml | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/format_ext2_kernel.ml b/src/format_ext2_kernel.ml
index c592703..6d2e699 100644
--- a/src/format_ext2_kernel.ml
+++ b/src/format_ext2_kernel.ml
@@ -311,6 +311,9 @@ and copy_or_symlink_file copy_kernel src dest =
if not copy_kernel then
symlink src dest
else (
- let cmd = sprintf "cp -p %s %s" (quote src) (quote dest) in
+ (* NB: Do not use -p here, we want the kernel to appear newer
+ * so that --if-newer works.
+ *)
+ let cmd = sprintf "cp %s %s" (quote src) (quote dest) in
run_command cmd
)
--
2.42.0

View File

@ -1,29 +0,0 @@
From 2f3eae350aa89b8067201a8bb24ff830d0fd919c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 22 Jun 2023 08:35:51 +0100
Subject: [PATCH 08/13] rpm: Reenable disable_excludes for dnf5
Updates: commit 92d5d7e8c27088fa3fb8e5e6e9c5b8d3209053d6
Thanks: Jan Kolarik
Link: https://github.com/rpm-software-management/dnf5/issues/581#issuecomment-1600682713
---
src/ph_rpm.ml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/ph_rpm.ml b/src/ph_rpm.ml
index e94f35f..783d1bb 100644
--- a/src/ph_rpm.ml
+++ b/src/ph_rpm.ml
@@ -501,7 +501,8 @@ and download_all_packages_with_dnf pkgs dir tdir =
(match !settings.packager_config with
| None -> ""
| Some filename -> sprintf " --config=%s" (quote filename))
- (if not is_dnf5 then " --disableexcludes=all" else "")
+ (if not is_dnf5 then " --disableexcludes=all"
+ else " --setopt=disable_excludes=*")
(quote tdir)
(quoted_list rpms) in
run_command cmd
--
2.42.0

View File

@ -1,26 +0,0 @@
From 4b3922feb65150f3423d0877038c5ba6e16d910c Mon Sep 17 00:00:00 2001
From: Simon Fischer <1522981+Fischer-Simon@users.noreply.github.com>
Date: Wed, 12 Jul 2023 17:10:53 +0200
Subject: [PATCH 09/13] src/format_ext2_kernel.ml: Fix kernel filtering for
aarch64 architecture
Add appropriate globs for arm based kernels. The file names end in -arm64 but the architecture is named aarch64.
---
src/format_ext2_kernel.ml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/format_ext2_kernel.ml b/src/format_ext2_kernel.ml
index 6d2e699..4589552 100644
--- a/src/format_ext2_kernel.ml
+++ b/src/format_ext2_kernel.ml
@@ -187,6 +187,7 @@ and patt_of_cpu host_cpu =
| "amd64" | "x86_64" -> ["amd64"; "x86_64"]
| "parisc" | "parisc64" -> ["hppa"; "hppa64"]
| "ppc64el" -> ["powerpc64le"]
+ | "aarch64" -> ["aarch64"; "arm64"]
| _ when host_cpu.[0] = 'i' && host_cpu.[2] = '8' && host_cpu.[3] = '6' -> ["?86"]
| _ when String.length host_cpu >= 5 && String.sub host_cpu 0 5 = "armv7" -> ["armmp"]
| _ -> [host_cpu]
--
2.42.0

View File

@ -1,33 +0,0 @@
From dc80dbbef60d5d81a7d4321683a8c7305dc04972 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 12 Jul 2023 22:37:58 +0100
Subject: [PATCH 10/13] ocamlc: Use -output-complete-exe instead of -custom
This prevents bytecode executables from being broken by strip and
similar tools. Note this is incompatible with OCaml < 4.10 (so breaks
RHEL 8). However this only affects bytecode builds which we prefer
not to use in RHEL. I left the old option in the Makefile so that it
could be uncommented by someone using older OCaml + bytecode. We need
this for OCaml 5.0 since that drops native backends (temporarily) for
riscv64, s390x and ppc64le.
---
src/Makefile.am | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 5b07e5d..5a1c671 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -132,7 +132,8 @@ OCAMLFLAGS = -g -warn-error +C+D+E+F+L+M+P+S+U+V+X+Y+Z-3
if !HAVE_OCAMLOPT
OBJECTS = $(BOBJECTS)
BEST = c
-OCAMLFLAGS += -custom
+#OCAMLFLAGS += -custom # for OCaml < 4.10
+OCAMLFLAGS += -output-complete-exe
else
OBJECTS = $(XOBJECTS)
BEST = opt
--
2.42.0

View File

@ -1,42 +0,0 @@
From 59a8ffc40db94a38879d9c923520e0bd70ffa271 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 12 Jul 2023 22:51:43 +0100
Subject: [PATCH 11/13] ocamlc: Only supply -output-complete-exe to final link
Add a separate variable to store link flags, and use that to supply
-output-complete-exe. Apparently ocamlc ignores -custom in the wrong
place.
Fixes: dc80dbbef60d5d81a7d4321683a8c7305dc04972
---
src/Makefile.am | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 5a1c671..1268aa5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -132,8 +132,8 @@ OCAMLFLAGS = -g -warn-error +C+D+E+F+L+M+P+S+U+V+X+Y+Z-3
if !HAVE_OCAMLOPT
OBJECTS = $(BOBJECTS)
BEST = c
-#OCAMLFLAGS += -custom # for OCaml < 4.10
-OCAMLFLAGS += -output-complete-exe
+#OCAMLLINKFLAGS = -custom # for OCaml < 4.10
+OCAMLLINKFLAGS = -output-complete-exe
else
OBJECTS = $(XOBJECTS)
BEST = opt
@@ -143,7 +143,8 @@ supermin_DEPENDENCIES = $(OBJECTS)
supermin_LINK = \
./supermin-link.sh \
- $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) \
+ $(OCAMLFIND) $(BEST) $(OCAMLLINKFLAGS) $(OCAMLFLAGS) \
+ $(OCAMLPACKAGES) \
$(OBJECTS) -o $@
.mli.cmi:
--
2.42.0

View File

@ -1,36 +0,0 @@
From 9a0d078dc35fde7a715666bce6c765ed5fe5e916 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 10 Nov 2023 08:55:25 +0000
Subject: [PATCH 12/13] src/format_ext2_kernel.ml: Rename function file ->
kernel
No change, just rename the function.
---
src/format_ext2_kernel.ml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/format_ext2_kernel.ml b/src/format_ext2_kernel.ml
index 4589552..36514c6 100644
--- a/src/format_ext2_kernel.ml
+++ b/src/format_ext2_kernel.ml
@@ -54,7 +54,7 @@ let rec build_kernel debug host_cpu copy_kernel kernel =
printf "supermin: kernel: modpath %s\n%!" modpath;
);
- copy_or_symlink_file copy_kernel kernel_file kernel;
+ copy_or_symlink_kernel copy_kernel kernel_file kernel;
(kernel_version, modpath)
@@ -308,7 +308,7 @@ and read_string chan offset len =
really_input chan buf 0 len;
Bytes.to_string buf
-and copy_or_symlink_file copy_kernel src dest =
+and copy_or_symlink_kernel copy_kernel src dest =
if not copy_kernel then
symlink src dest
else (
--
2.42.0

View File

@ -1,72 +0,0 @@
From 5230e2c3cd07e82bd6431e871e239f7056bf25ad Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 10 Nov 2023 10:20:49 +0000
Subject: [PATCH 13/13] src: Uncompress kernel on RISC-V
---
src/format_ext2_kernel.ml | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/src/format_ext2_kernel.ml b/src/format_ext2_kernel.ml
index 36514c6..09a3f21 100644
--- a/src/format_ext2_kernel.ml
+++ b/src/format_ext2_kernel.ml
@@ -25,6 +25,20 @@ open Ext2fs
open Fnmatch
open Glob
+(* Similar but not the same as get_file_type in mode_build. There
+ * is a case for deriving a common base utility. XXX
+ *)
+type compression_type = GZip | Uncompressed
+let get_compression_type file =
+ let chan = open_in file in
+ let buf = Bytes.create 512 in
+ let len = input chan buf 0 (Bytes.length buf) in
+ close_in chan;
+ let buf = Bytes.to_string buf in
+ if len >= 3 && buf.[0] = '\x1f' && buf.[1] = '\x8b' && buf.[2] = '\x08'
+ then GZip
+ else Uncompressed (* or other unknown compression type *)
+
let rec build_kernel debug host_cpu copy_kernel kernel =
(* Locate the kernel.
* SUPERMIN_* environment variables override everything. If those
@@ -54,7 +68,19 @@ let rec build_kernel debug host_cpu copy_kernel kernel =
printf "supermin: kernel: modpath %s\n%!" modpath;
);
- copy_or_symlink_kernel copy_kernel kernel_file kernel;
+ (* RISC-V relies on the bootloader or firmware to uncompress the
+ * kernel and doesn't have a concept of self-extracting kernels.
+ * On Arm which is similar, qemu -kernel will automatically uncompress
+ * the kernel, but qemu-system-riscv won't do that and the code is a
+ * big mess so I don't fancy fixing it. So we have to detect that
+ * case here and uncompress the kernel.
+ *)
+ let kernel_compression_type = get_compression_type kernel_file in
+ if string_prefix "riscv" host_cpu && kernel_compression_type <> Uncompressed
+ then
+ copy_and_uncompress_kernel kernel_compression_type kernel_file kernel
+ else
+ copy_or_symlink_kernel copy_kernel kernel_file kernel;
(kernel_version, modpath)
@@ -308,6 +334,13 @@ and read_string chan offset len =
really_input chan buf 0 len;
Bytes.to_string buf
+and copy_and_uncompress_kernel compression_type src dest =
+ let cmd =
+ match compression_type with
+ | GZip -> sprintf "zcat %s > %s" (quote src) (quote dest)
+ | Uncompressed -> sprintf "cp %s %s" (quote src) (quote dest) in
+ run_command cmd
+
and copy_or_symlink_kernel copy_kernel src dest =
if not copy_kernel then
symlink src dest
--
2.42.0

View File

@ -1,2 +1,2 @@
SHA512 (supermin-5.3.3.tar.gz) = 39eb687a4e6fbd13d356612f950352848626fe68a14054a62ac7fa1bb3b42be716189b1505bf137331974ea02d75e2e8079f412a133af165cba7767699925f38
SHA512 (supermin-5.3.3.tar.gz.sig) = e5109e718b06992bde73be913be49cd00358ec835566beb1f207109f54f73dbc6600275e929eb88fea42bda13643ec3ee9bb80032f8a05c37537f28bafb49fad
SHA512 (supermin-5.3.4.tar.gz) = 383d783f57af3a870f1debd3c87929b1d73a12d404c3268640963967a53582419923076410d47e79de0eb2a111fe66a998258e636de41caa3ff7f296b5458797
SHA512 (supermin-5.3.4.tar.gz.sig) = 1cae330cc4cee6c48e238738a4fd26b31f21f5ffb054b0496d6eebc5e45d0599c2a9586f3e0a9fe25475ab184394bf5d4155a5c5f82b83a380da0994568c8937

View File

@ -37,8 +37,8 @@ ExcludeArch: %{ix86}
Summary: Tool for creating supermin appliances
Name: supermin
Version: 5.3.3
Release: 19%{?dist}
Version: 5.3.4
Release: 1%{?dist}
License: GPL-2.0-or-later
ExclusiveArch: %{kernel_arches}
@ -53,29 +53,6 @@ Source1: http://download.libguestfs.org/supermin/%{source_directory}/%{nam
# Keyring used to verify tarball signature.
Source2: libguestfs.keyring
# https://fedoraproject.org/wiki/Changes/RelocateRPMToUsr
Patch: 0001-rpm-New-RPM-database-location-in-usr-lib-sysimage-rp.patch
# OCaml 5 compatibility:
Patch: 0002-Add-support-for-OCaml-5.0.patch
Patch: 0003-Restore-compatibility-with-OCaml-4.07.patch
# dnf5 (https://bugzilla.redhat.com/show_bug.cgi?id=2209412):
Patch: 0004-rpm-Detect-dnf5-and-omit-missing-options.patch
# dnf5 (https://bugzilla.redhat.com/show_bug.cgi?id=2211386)
Patch: 0005-rpm-Use-dnf-config-instead-of-c.patch
# Fix --if-newer
Patch: 0006-src-Improved-debugging-of-the-supermin-if-newer-calc.patch
Patch: 0007-src-Fix-if-newer-copy-kernel.patch
# Reenable disable_excludes for dnf5
Patch: 0008-rpm-Reenable-disable_excludes-for-dnf5.patch
# Fix kernel filtering on aarch64
Patch: 0009-src-format_ext2_kernel.ml-Fix-kernel-filtering-for-a.patch
# Fix bytecode builds so they resist stripping
Patch: 0010-ocamlc-Use-output-complete-exe-instead-of-custom.patch
Patch: 0011-ocamlc-Only-supply-output-complete-exe-to-final-link.patch
# Fix RISC-V gzip compressed kernels
Patch: 0012-src-format_ext2_kernel.ml-Rename-function-file-kerne.patch
Patch: 0013-src-Uncompress-kernel-on-RISC-V.patch
BuildRequires: gcc
BuildRequires: make
BuildRequires: autoconf, automake
@ -229,6 +206,10 @@ make check || {
%changelog
* Thu Jan 11 2023 Richard W.M. Jones <rjones@redhat.com> - 5.3.4-1
- New upstream version 5.3.4
- Remove patches which are now all upstream.
* Mon Dec 18 2023 Richard W.M. Jones <rjones@redhat.com> - 5.3.3-19
- OCaml 5.1.1 + s390x code gen fix for Fedora 40