unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Javier Olaechea <pirata@gmail.com>
To: 73155@debbugs.gnu.org
Subject: bug#73155: [PATCH] gnu: ruby-net-smtp: Fix tests
Date: Tue, 10 Sep 2024 22:35:05 +0000	[thread overview]
Message-ID: <CAFVS=zB=veeV35O5nA3vn2b-FMzQ23Amb9_TZxo093MByJq-oQ@mail.gmail.com> (raw)
In-Reply-To: <ddea93e4-8caf-7461-8d7c-57e505d163ef@mailbox.org>


[-- Attachment #1.1: Type: text/plain, Size: 624 bytes --]

Attached is a patch to fix the build by regenerating the certificates. Note
that a Makefile to update the certificates was introduced in the version
that updated the certificates. In those versions we can simplify the
before-check hook to be:

(with-directory "test/net/fixtures"
  (invoke "make" "regen_certificates"))

Another question, we are packaging a ~2 year old version. When updating the
version, should we drop the before-check lambda? Or should we keep it in
case someone wants to build ruby-net-smtp in the year 2034?

Cheers
-- 
"I object to doing things that computers can do." — Olin Shivers

[-- Attachment #1.2: Type: text/html, Size: 923 bytes --]

[-- Attachment #2: 0001-gnu-ruby-net-smtp-Fix-tests.patch --]
[-- Type: text/x-patch, Size: 2789 bytes --]

From 1df4a966abce35fc8841843e45c942682dc153f5 Mon Sep 17 00:00:00 2001
Message-ID: <1df4a966abce35fc8841843e45c942682dc153f5.1726007239.git.pirata@gmail.com>
From: Javier Olaechea <pirata@gmail.com>
Date: Tue, 10 Sep 2024 17:10:09 -0500
Subject: [PATCH] gnu: ruby-net-smtp: Fix tests

* gnu/packages/ruby.scm (ruby-net-smpt): 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 | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 5af1bb1cef..c401a8eab3 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -102,6 +102,7 @@ (define-module (gnu packages ruby)
   #:use-module (guix modules)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
+  #:use-module ((guix build utils) #:select (with-directory-excursion))
   #:use-module (gnu packages xml)
   #:use-module (gnu packages web)
   #:use-module (guix build-system ruby)
@@ -4722,6 +4723,25 @@ (define-public ruby-net-smtp
                (base32
                 "0ca2wh45xvc09rv6v6sz3vbnkzrjzk5c4l6dk50zk4dwxvghma8r"))))
     (build-system ruby-build-system)
+    (arguments
+     '(#: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"
+                       "/C=JP/ST=Shimane/L=Matz-e city/O=Ruby Core Team/CN=Ruby Test CA/emailAddress=security@ruby-lang.org")
+               (invoke "openssl" "x509" "-days" "3650" "-CA" "cacert.pem" "-CAkey"
+                       "server.key" "-set_serial" "00" "-in" "server.csr" "-req" "-out" "server.crt")
+               (invoke "rm" "server.csr"))
+)))))
+    (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: 7f05b73d90f740c6a139f0e706b717d3174f6321
-- 
2.45.2


      parent reply	other threads:[~2024-09-11 15:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-09 18:49 bug#73155: ruby-net-smtp-0.3.3 fails to build Tomás Ortín via Bug reports for GNU Guix
2024-09-09 19:41 ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2024-09-10 22:35 ` Javier Olaechea [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFVS=zB=veeV35O5nA3vn2b-FMzQ23Amb9_TZxo093MByJq-oQ@mail.gmail.com' \
    --to=pirata@gmail.com \
    --cc=73155@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).