Subject: bug#68474: [PATCH] tls: Fix openssl-1.0 check phase.

From: Jean-Pierre De Jesus DIAZ <[email-masked]>
Date: Wed, 31 Jan 2024 15:20:23 +0100

From: Jean-Pierre De Jesus DIAZ <[email-masked]>

* modules/past/packages/tls.scm (openssl-1.0): Fix a time bomb in
cms-test.pl due to expired certificates.
---
 modules/past/packages/tls.scm | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/modules/past/packages/tls.scm b/modules/past/packages/tls.scm
index cbc9834..a494e1c 100644
--- a/modules/past/packages/tls.scm
+++ b/modules/past/packages/tls.scm
@@ -140,6 +140,20 @@
                        ,@(if (%current-target-system)
                              '((getenv "CONFIGURE_TARGET_ARCH"))
                              '())))))
+         (add-before 'check 'patch-util/shlib_wrap.sh
+           (lambda* (#:key tests? native-inputs inputs #:allow-other-keys)
+             (when tests?
+               (let ((lib (search-input-file (or native-inputs inputs)
+                                             "lib/faketime/libfaketime.so.1"))
+                     (release-date "2019-12-20 13:25:43"))
+                 ;; Invoking "faketime make ..." does not work as this script
+                 ;; sets its own LD_PRELOAD variable, so re-export it with
+                 ;; libfaketime and set the fake time.
+                 (substitute* "util/shlib_wrap.sh"
+                   (("cmd=\"\\$1\\$\\{EXE_EXT\\}\"" all)
+                    (string-append "export LD_PRELOAD=" lib ":$LD_PRELOAD\n"
+                                   "export FAKETIME=\"" release-date "\"\n"
+                                   all)))))))
          (add-after 'install 'move-static-libraries
            (lambda* (#:key outputs #:allow-other-keys)
              ;; Move static libraries to the "static" output.
@@ -175,7 +189,7 @@
                (delete-file-recursively (string-append out "/share/openssl-"
                                                        ,version "/misc"))
                #t))))))
-    (native-inputs (list (S "perl")))
+    (native-inputs (list (S "libfaketime") (S "perl")))
     (native-search-paths
      (list (search-path-specification
             (variable "SSL_CERT_DIR")

base-commit: d60a388678098e6de60ca1a65806903b5739da29
-- 
2.41.0