Blame 0006-src-Improved-debugging-of-the-supermin-if-newer-calc.patch

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