Subject: Re: [bug#32153] [PATCH 1/2] ruby-build-system: Error or return #t from all phases.

From: Marius Bakke <[email-masked]>
Date: Sun, 15 Jul 2018 01:11:06 +0200

Christopher Baines <[email-masked]> writes:

> Previously, if the tests didn't pass, the check phase would evaluate to #f,
> but the package would be built sucessfully. This changes all the phases to
> raise exceptions if errors are encountered, and return #t otherwise.
>
> This involves using invoke rather than system*, so that exceptions are raised
> if the program exits with a status other than 0, and also returning #t at the
> end of functions.
>
> * gnu/build/ruby-build-system.scm (unpack): Use invoke rather than system*,
> and return #t at the end.
> (build, check): Use invoke rather than system*.
> (install): Remove the use of "and", and rewrite the error handling to raise an
> exception.
> (wrap): Return #t.

Thanks!  The changes LGTM.  I will suggest a micro-improvement not
related to this patch since it was there from before:

> +    ;; For gems with native extensions, several Makefile-related files
> +    ;; are created that contain timestamps or other elements making
> +    ;; them not reproducible.  They are unnecessary so we remove them.
> +    (if (file-exists? (string-append vendor-dir "/ext"))
> +        (begin
> +          (for-each (lambda (file)
> +                      (log-file-deletion file)
> +                      (delete-file file))
> +                    (append
> +                     (find-files (string-append vendor-dir "/doc")
> +                                 "page-Makefile.ri")
> +                     (find-files (string-append vendor-dir "/extensions")
> +                                 "gem_make.out")
> +                     (find-files (string-append vendor-dir "/ext")
> +                                 "Makefile")))))
> +
> +    #t))

I was confused whether the #t was the "else" clause for the "if"
expression until I realized it didn't have one.

Could you turn this into a (when (file-exists? ...) (for-each ...))
while at it?  It also makes the (begin ...) redundant.