supermin/0006-src-Improved-debugging-of-the-supermin-if-newer-calc.patch
2023-07-12 22:53:51 +01:00

57 lines
2.0 KiB
Diff

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/10] 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