Attached is a revised version of the patch following the feedback received
in the november Guix social meetup

-- 
"I object to doing things that computers can do." — Olin Shivers
From 1fe2dff60511b2278c6230c12dd635d33de6cb07 Mon Sep 17 00:00:00 2001
Message-ID: <1fe2dff60511b2278c6230c12dd635d33de6cb07.1732303354.git.pir...@gmail.com>
From: Javier Olaechea <[email protected]>
Date: Tue, 10 Sep 2024 17:10:09 -0500
Subject: [PATCH v2] gnu: ruby-net-smtp: Fix tests

* gnu/packages/ruby.scm (ruby-net-smtp): Fix check phase.

The tests where failing due to the SSL certificate being used
expired. Regenerate the certificate running the check phase.

Change-Id: I8bd72f2e929f496996f6fd88b13a4d95837273da
---
 gnu/packages/ruby.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 12c439b3a9..bd1aa11f7d 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -4730,6 +4730,33 @@ (define-public ruby-net-smtp
                (base32
                 "0ca2wh45xvc09rv6v6sz3vbnkzrjzk5c4l6dk50zk4dwxvghma8r"))))
     (build-system ruby-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'check 'regenerate-certificate
+            ;; On version 0.5.0 a Makefile was introduced to regenerated
+            ;; the certificates, and instead of calling openssl directory
+            ;; we could do (with-directory-excursion "test/net/fixtures"
+            ;; (invoke "make" "regen_certs"). However the certificate is
+            ;; expired versions before 0.5.0 as well.
+            (lambda _
+              (with-directory-excursion "test/net/fixtures"
+                (invoke
+                 "openssl" "req" "-new" "-key" "server.key" "-out"
+                 "server.csr" "-subj"
+                 "/C=JP/ST=Shimane/O=Ruby Core Team/OU=Ruby Test/CN=localhost")
+                (invoke "openssl" "req" "-new" "-x509" "-days" "3650"
+                        "-key" "server.key" "-out" "cacert.pem" "-subj"
+                        (string-append
+                         "/C=JP/ST=Shimane/L=Matz-e city/O=Ruby "
+                         "Core Team/CN=Ruby"
+                         " Test "
+                         "CA/[email protected]"))
+                (invoke "openssl" "x509" "-days" "3650" "-CA" "cacert.pem"
+                        "-CAkey" "server.key" "-set_serial" "00" "-in"
+                        "server.csr" "-req" "-out" "server.crt")))))))
+    (native-inputs (list openssl))
     (propagated-inputs (list ruby-net-protocol))
     (synopsis "Simple Mail Transfer Protocol client library for Ruby")
     (description "This library provides functionality to send Internet mail

base-commit: 043f02462766a913080723ad286028a288b79373
-- 
2.46.0

Reply via email to