Fix --if-newer
This commit is contained in:
parent
a020f9a10e
commit
1ae35926e5
@ -1,7 +1,7 @@
|
||||
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 1/5] rpm: New RPM database location in /usr/lib/sysimage/rpm
|
||||
Subject: [PATCH 1/7] 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.
|
||||
|
@ -1,7 +1,7 @@
|
||||
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 2/5] Add support for OCaml 5.0
|
||||
Subject: [PATCH 2/7] Add support for OCaml 5.0
|
||||
|
||||
---
|
||||
src/mode_build.ml | 4 ++--
|
||||
|
@ -1,7 +1,7 @@
|
||||
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 3/5] Restore compatibility with OCaml < 4.07
|
||||
Subject: [PATCH 3/7] Restore compatibility with OCaml < 4.07
|
||||
|
||||
---
|
||||
src/mode_build.ml | 6 ++++--
|
||||
|
@ -1,7 +1,7 @@
|
||||
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 4/5] rpm: Detect dnf5 and omit missing options
|
||||
Subject: [PATCH 4/7] rpm: Detect dnf5 and omit missing options
|
||||
|
||||
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2209412
|
||||
---
|
||||
|
@ -1,7 +1,7 @@
|
||||
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 5/5] rpm: Use dnf --config instead of -c
|
||||
Subject: [PATCH 5/7] rpm: Use dnf --config instead of -c
|
||||
|
||||
dnf5 does not support -c. dnf4 supports either.
|
||||
|
||||
|
@ -0,0 +1,56 @@
|
||||
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 6/7] 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.37.3
|
||||
|
39
0007-src-Fix-if-newer-copy-kernel.patch
Normal file
39
0007-src-Fix-if-newer-copy-kernel.patch
Normal file
@ -0,0 +1,39 @@
|
||||
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 7/7] 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.37.3
|
||||
|
@ -31,7 +31,7 @@
|
||||
Summary: Tool for creating supermin appliances
|
||||
Name: supermin
|
||||
Version: 5.3.3
|
||||
Release: 8%{?dist}
|
||||
Release: 9%{?dist}
|
||||
License: GPL-2.0-or-later
|
||||
|
||||
ExclusiveArch: %{kernel_arches}
|
||||
@ -55,6 +55,9 @@ Patch: 0003-Restore-compatibility-with-OCaml-4.07.patch
|
||||
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
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: make
|
||||
@ -199,6 +202,9 @@ make check || {
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Jun 12 2023 Richard W.M. Jones <rjones@redhat.com> - 5.3.3-9
|
||||
- Fix --if-newer
|
||||
|
||||
* Mon Jun 05 2023 Richard W.M. Jones <rjones@redhat.com> - 5.3.3-8
|
||||
- Migrated to SPDX license
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user