diff mbox series

[bug#55997,staging,2/4] gnu: Remove texlive's dependence on ruby-rspec and ruby-byebug.

Message ID 20220615150434.11604-2-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
Motivation: Break the dependency chain from guix to mariadb.

Prior to this patch:

$ guix graph --path guix mariadb
guix@1.3.0-27.598f728
po4a@0.63
texlive-tiny@59745
texlive-latex-base@59745
texlive-hyphen-afrikaans@59745
ruby-hydra@0.0-0.5abfa37
ruby-byebug@11.1.3
ruby-rubocop@1.10.0
ruby-parallel@1.21.0
ruby-mysql2@0.5.2
mariadb@10.5.12

As of this patch:

$ ./pre-inst-env guix graph --path guix mariadb
guix graph: error: no path from 'guix@1.3.0-27.598f728' to 'mariadb@10.5.12'

* gnu/packages/patches/texlive-hyph-utf8-no-byebug.patch: New file.
* gnu/packages/tex.scm (hyph-utf8-scripts): Add patch.
(texlive-hyphen-package): Depend on ruby-hydra-minimal.
---
 .../patches/texlive-hyph-utf8-no-byebug.patch         | 11 +++++++++++
 gnu/packages/tex.scm                                  |  3 ++-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/texlive-hyph-utf8-no-byebug.patch

Comments

M June 15, 2022, 9:06 p.m. UTC | #1
Tom Fitzhenry schreef op do 16-06-2022 om 01:04 [+1000]:
> +index 12831417..df6daa39 100644
> +--- a/lib/tex/hyphen/language.rb
> ++++ b/lib/tex/hyphen/language.rb
> +@@ -1,6 +1,5 @@
> + require 'yaml'
> + require 'hydra'
> +-require 'byebug'
> + 
> + require_relative 'path'
> + 

I recommend a small description: ’Avoid dependency on byebug to reduce
package closure significantly, see https://issues.guix.gnu.org/55997’.
Also, patches need to be added to gnu/local.mk because $reasons.

>      (sha256
>       (base32
>        "04xzf5gr3ylyh3ls09imrx4mwq3qp1k97r9njzlan6hlff875rx2"))))
> @@ -225,7 +226,7 @@ (define (texlive-hyphen-package name code locations hash)
>                       (invoke "ruby" "generate-ptex-patterns.rb")))))))))

>        (native-inputs
>         `(("ruby" ,ruby)
> -         ("ruby-hydra" ,ruby-hydra)
> +         ("ruby-hydra-minimal" ,ruby-hydra-minimal)
>           ("hyph-utf8-scripts" ,hyph-utf8-scripts)))

While we are rebuilding anyway, could you eliminate input labels (in a
separate patch)?

(native-inputs (list ruby ruby-hydra-minimal hyph-utf8-scripts))


Anyway, the concept looks good to me, though I haven't done any
practical testing!

Greetings,
Maxime.
Tom Fitzhenry June 19, 2022, 2:01 p.m. UTC | #2
Maxime Devos <maximedevos@telenet.be> writes:
> I recommend a small description: ’Avoid dependency on byebug to reduce
> package closure significantly, see https://issues.guix.gnu.org/55997’.
> Also, patches need to be added to gnu/local.mk because $reasons.

SGTM. I'll add this to v2.

> While we are rebuilding anyway, could you eliminate input labels (in a
> separate patch)?
>
> (native-inputs (list ruby ruby-hydra-minimal hyph-utf8-scripts))

I tried this, but this causes a build phase failure for
texlive-hyphen-package packages:

--8<---------------cut here---------------start------------->8---
starting phase `build'
error: in phase 'build': uncaught exception:
wrong-type-arg "string-length" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "string" #f) (#f) 
phase `build' failed after 0.0 seconds
Backtrace:
          10 (primitive-load "/gnu/store/b133miwd62x14d2lsbrsx1dk4rx…")
In guix/build/gnu-build-system.scm:
    906:2  9 (gnu-build #:source _ #:outputs _ #:inputs _ #:phases . #)
In ice-9/boot-9.scm:
  1752:10  8 (with-exception-handler _ _ #:unwind? _ # _)
In srfi/srfi-1.scm:
    634:9  7 (for-each #<procedure 553260 at guix/build/gnu-build-s…> …)
In ice-9/boot-9.scm:
  1752:10  6 (with-exception-handler _ _ #:unwind? _ # _)
In guix/build/gnu-build-system.scm:
   927:23  5 (_)
In ice-9/eval.scm:
    619:8  4 (_ #(#(#(#(#(#(#(#(#<directory (g…>) …) …) …) …) …) …) …))
In guix/build/utils.scm:
   390:15  3 (copy-recursively #f "scripts" #:log _ # _ #:copy-file _ …)
In unknown file:
           2 (string-length #f)
In ice-9/boot-9.scm:
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure string-length: Wrong type argument in position 1 (expecting string): #f
--8<---------------cut here---------------end--------------->8---

The failing line is gnu/packages/tex.scm line 188 [0]:

(copy-recursively
 (assoc-ref inputs "hyph-utf8-scripts") "scripts")

This fails because the assoc-ref call returns #f, presumably because
native-inputs is no longer an alist.

To try to find a new-style way to recursively copy an entire input, I
read https://guix.gnu.org/blog/2021/the-big-change/ and searched the
codebase, but I was unable to find any.

The closest I could find was to use search-input-directory, but 
this seems to only be suitable to copy known subdirectories across all
inputs, not an entire single input.

Do you know of any way/examples to recursively copy entire single inputs?

> Anyway, the concept looks good to me, though I haven't done any
> practical testing!

Great! I will provide testing details in v2.

0. https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/tex.scm?id=793ce82c9d5ead8457da9cec8d1d8afc12704f10#n188
M June 19, 2022, 2:47 p.m. UTC | #3
Tom Fitzhenry schreef op ma 20-06-2022 om 00:01 [+1000]:
> (copy-recursively
>  (assoc-ref inputs "hyph-utf8-scripts") "scripts")
> 
> This fails because the assoc-ref call returns #f, presumably because
> native-inputs is no longer an alist.

It's still an alist under the hood.

> To try to find a new-style way to recursively copy an entire input, I
> read https://guix.gnu.org/blog/2021/the-big-change/ and searched the
> codebase, but I was unable to find any.
> 
> The closest I could find was to use search-input-directory, but 
> this seems to only be suitable to copy known subdirectories across
> all inputs, not an entire single input.

Two options: insert the input directly into the G-exp:

 (copy-recursively #+hyph-utf8-scripts "scripts")

or: search for a file in hyph-utf8-scripts and then extract the
directory name:

 (copy-recursively (dirname (search-input-file inputs "hyph-utf8.rb"))
                   "scripts")

.  I'd prefer the latter because that makes it easier to define a
custom texlive-hyphen-... package replacing hyph-utf8-scripts by a
custom hyph-utf8-scripts by using simple package transformations (e.g.:
inherit + replace the native-inputs).

Greetings,
Maxime
diff mbox series

Patch

diff --git a/gnu/packages/patches/texlive-hyph-utf8-no-byebug.patch b/gnu/packages/patches/texlive-hyph-utf8-no-byebug.patch
new file mode 100644
index 0000000000..92d12d6665
--- /dev/null
+++ b/gnu/packages/patches/texlive-hyph-utf8-no-byebug.patch
@@ -0,0 +1,11 @@ 
+diff --git a/lib/tex/hyphen/language.rb b/lib/tex/hyphen/language.rb
+index 12831417..df6daa39 100644
+--- a/lib/tex/hyphen/language.rb
++++ b/lib/tex/hyphen/language.rb
+@@ -1,6 +1,5 @@
+ require 'yaml'
+ require 'hydra'
+-require 'byebug'
+ 
+ require_relative 'path'
+ 
diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 1dd3f09f90..33e2fab23c 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -157,6 +157,7 @@  (define hyph-utf8-scripts
     (file-name (string-append "hyph-utf8-scripts-"
                               (number->string %texlive-revision)
                               "-checkout"))
+    (patches (search-patches "texlive-hyph-utf8-no-byebug.patch"))
     (sha256
      (base32
       "04xzf5gr3ylyh3ls09imrx4mwq3qp1k97r9njzlan6hlff875rx2"))))
@@ -225,7 +226,7 @@  (define (texlive-hyphen-package name code locations hash)
                      (invoke "ruby" "generate-ptex-patterns.rb")))))))))
       (native-inputs
        `(("ruby" ,ruby)
-         ("ruby-hydra" ,ruby-hydra)
+         ("ruby-hydra-minimal" ,ruby-hydra-minimal)
          ("hyph-utf8-scripts" ,hyph-utf8-scripts)))
       (home-page "https://ctan.org/pkg/hyph-utf8"))))