diff mbox series

[bug#55997,staging,1/4] gnu: Add ruby-hydra-minimal.

Message ID 20220615150434.11604-1-tom@tom-fitzhenry.me.uk
State Accepted
Headers show
Series Remove texlive's dependence on mariadb. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Tom Fitzhenry June 15, 2022, 3:04 p.m. UTC
* gnu/packages/patches/ruby-hydra-no-byebug.patch: New file.
* gnu/packages/ruby.scm (ruby-hydra): Refactor to inherit from ruby-hydra-minimal.
(ruby-hydra-minimal): New variable.
---
 .../patches/ruby-hydra-no-byebug.patch        |  9 +++++
 gnu/packages/ruby.scm                         | 35 +++++++++++++------
 2 files changed, 33 insertions(+), 11 deletions(-)
 create mode 100644 gnu/packages/patches/ruby-hydra-no-byebug.patch

Comments

Thiago Jung Bauermann June 19, 2022, 9:36 p.m. UTC | #1
Hello Tom,

Nice series! Thanks for tackling this issue.

I read all patches, and have only one minor suggestion about this one,
apart from what Maxime already mentioned.

Tom Fitzhenry <tom@tom-fitzhenry.me.uk> writes:

> --- a/gnu/packages/ruby.scm
> +++ b/gnu/packages/ruby.scm
> @@ -3124,24 +3124,39 @@ (define-public ruby-hashdiff
>      (home-page "https://github.com/liufengyun/hashdiff")
>      (license license:expat)))
>  
> -(define-public ruby-hydra
> +(define-public ruby-hydra-minimal
>    ;; No releases yet.
>    (let ((commit "5abfa378743756ae4d9306cc134bcc482f5c9525")
>          (revision "0"))
>      (package
> -      (name "ruby-hydra")
> +      (name "ruby-hydra-minimal")
>        (version (git-version "0.0" revision commit))
>        (home-page "https://github.com/hyphenation/hydra")
>        (source (origin
>                  (method git-fetch)
>                  (uri (git-reference (url home-page) (commit commit)))
>                  (file-name (git-file-name name version))
> +                ;; byebug is a non-essential debugging utility that brings in
> +                ;; many dependencies.
> +                (patches (search-patches "ruby-hydra-no-byebug.patch"))
>                  (sha256
>                   (base32
>                    "1cik398l2765y3d9sdhjzki3303hkry58ac6jlkiy7iy62nm529f"))))
>        (build-system ruby-build-system)
>        (arguments
> -       '(#:phases (modify-phases %standard-phases
> +       ;; Avoid rspec dependency.
> +       '(#:tests? #f))
> +      (synopsis "Ruby hyphenation patterns")
> +      (description
> +       "ruby-hydra-minimal is a Ruby library for working with hyphenation patterns. It is a low-dependency variant of ruby-hydra.")

guix lint has two complaints about this description:

    gnu/packages/ruby.scm:3151:7: ruby-hydra-minimal@0.0-0.5abfa37:
    sentences in description should be followed by two spaces; possible
    infraction at 74
    gnu/packages/ruby.scm:3151:0: ruby-hydra-minimal@0.0-0.5abfa37: line
    3151 is way too long (131 characters)

One suggestion to solve both is to put the second sentence in its own line.

> +      (license license:expat))))
> +
> +(define-public ruby-hydra
> +  (package
> +    (inherit ruby-hydra-minimal)
> +    (name "ruby-hydra")
> +    (arguments
> +        '(#:phases (modify-phases %standard-phases
>                      (add-after 'unpack 'make-files-writable
>                        (lambda _
>                          (for-each make-file-writable (find-files "."))

When I saw this patch I thought that ruby-hydra would also inherit the
“#:tests? #f” argument from its parent, but this construction overrides
the whole arguments list instead. Nice, I learned something new today. :-)
diff mbox series

Patch

diff --git a/gnu/packages/patches/ruby-hydra-no-byebug.patch b/gnu/packages/patches/ruby-hydra-no-byebug.patch
new file mode 100644
index 0000000000..902d32a30a
--- /dev/null
+++ b/gnu/packages/patches/ruby-hydra-no-byebug.patch
@@ -0,0 +1,9 @@ 
+diff --git a/lib/hydra.rb b/lib/hydra.rb
+index 29fbad2..6b5058a 100644
+--- a/lib/hydra.rb
++++ b/lib/hydra.rb
+@@ -1,4 +1,3 @@
+-require 'byebug' unless ENV['RACK_ENV'] == "production"
+ require 'pp'
+ 
+ module CoreExt
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 54dcae9089..2622bf717a 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -3124,24 +3124,39 @@  (define-public ruby-hashdiff
     (home-page "https://github.com/liufengyun/hashdiff")
     (license license:expat)))
 
-(define-public ruby-hydra
+(define-public ruby-hydra-minimal
   ;; No releases yet.
   (let ((commit "5abfa378743756ae4d9306cc134bcc482f5c9525")
         (revision "0"))
     (package
-      (name "ruby-hydra")
+      (name "ruby-hydra-minimal")
       (version (git-version "0.0" revision commit))
       (home-page "https://github.com/hyphenation/hydra")
       (source (origin
                 (method git-fetch)
                 (uri (git-reference (url home-page) (commit commit)))
                 (file-name (git-file-name name version))
+                ;; byebug is a non-essential debugging utility that brings in
+                ;; many dependencies.
+                (patches (search-patches "ruby-hydra-no-byebug.patch"))
                 (sha256
                  (base32
                   "1cik398l2765y3d9sdhjzki3303hkry58ac6jlkiy7iy62nm529f"))))
       (build-system ruby-build-system)
       (arguments
-       '(#:phases (modify-phases %standard-phases
+       ;; Avoid rspec dependency.
+       '(#:tests? #f))
+      (synopsis "Ruby hyphenation patterns")
+      (description
+       "ruby-hydra-minimal is a Ruby library for working with hyphenation patterns. It is a low-dependency variant of ruby-hydra.")
+      (license license:expat))))
+
+(define-public ruby-hydra
+  (package
+    (inherit ruby-hydra-minimal)
+    (name "ruby-hydra")
+    (arguments
+        '(#:phases (modify-phases %standard-phases
                     (add-after 'unpack 'make-files-writable
                       (lambda _
                         (for-each make-file-writable (find-files "."))
@@ -3149,14 +3164,12 @@  (define-public ruby-hydra
                     (replace 'check
                       (lambda _
                         (invoke "rspec"))))))
-      (native-inputs
-       (list ruby-rspec))
-      (propagated-inputs
-       (list ruby-byebug))
-      (synopsis "Ruby hyphenation patterns")
-      (description
-       "ruby-hydra is a Ruby library for working with hyphenation patterns.")
-      (license license:expat))))
+    (native-inputs
+     (list ruby-rspec))
+    (propagated-inputs
+     (list ruby-byebug))
+    (description
+     "ruby-hydra is a Ruby library for working with hyphenation patterns.")))
 
 (define-public ruby-shindo
   (package