diff mbox series

[bug#43494,1/4] gnu: Add guix-build-coordinator.

Message ID 20200918184042.22660-1-mail@cbaines.net
State Accepted
Headers show
Series Add package and services for the Guix Build Coordinator | expand

Checks

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

Commit Message

Christopher Baines Sept. 18, 2020, 6:40 p.m. UTC
* gnu/packages/package-management.scm (guix-build-coordinator): New variable.
---
 gnu/packages/package-management.scm | 89 +++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)

Comments

Ludovic Courtès Sept. 18, 2020, 8:08 p.m. UTC | #1
Hi!

Christopher Baines <mail@cbaines.net> skribis:

> * gnu/packages/package-management.scm (guix-build-coordinator): New variable.

[...]

> +           (lambda* (#:key inputs outputs #:allow-other-keys)
> +             (let* ((out (assoc-ref outputs "out"))
> +                    (bin (string-append out "/bin"))
> +                    (guile (assoc-ref inputs "guile"))
> +                    (guile-effective-version
> +                     (read-line
> +                      (open-pipe* OPEN_READ
> +                                  (string-append guile "/bin/guile")
> +                                  "-c" "(display (effective-version))")))

Maybe use ‘target-guile-effective-version’ from (guix build
guile-build-system).

> +                  (wrap-program (string-append bin "/" file)
> +                    `("PATH" ":" prefix
> +                      (,bin ,(assoc-ref inputs "sqitch")))
> +                    `("PERL5LIB" ":" prefix
> +                      (,(getenv "PERL5LIB")))

Do we really need PERL5LIB here?  Shouldn’t it be done in the wrapper of
‘sqitch’ directly?

> +                (scandir bin
> +                         (match-lambda
> +                           ((or "." "..") #f)
> +                           (_ #t))))

I think you could just use (find-files bin).

> +    (inputs
> +     `(("guile" ,guile-3.0-latest)

Rather ,@(assoc-ref (package-native-inputs guix) "guile").

> +       ("sqitch" ,sqitch)
> +       ("perl-dbd-sqlite" ,perl-dbd-sqlite)))

Shouldn’t perl-dbd-sqlite be a dependency of sqitch?

> +    (home-page "https://git.cbaines.net/guile/guix/build-coordinator")
> +    (synopsis "")
> +    (description
> +     "")

Missing!  :-)

LGTM with changes along these lines!

Ludo’.
Jonathan Brielmaier Sept. 18, 2020, 11:34 p.m. UTC | #2
On 18.09.20 22:08, Ludovic Courtès wrote:
>> +    (home-page "https://git.cbaines.net/guile/guix/build-coordinator")

It should be https://git.cbaines.net/guix/build-coordinator/
Christopher Baines Sept. 19, 2020, 9 a.m. UTC | #3
Jonathan Brielmaier <jonathan.brielmaier@web.de> writes:

> On 18.09.20 22:08, Ludovic Courtès wrote:
>>> +    (home-page "https://git.cbaines.net/guile/guix/build-coordinator")
>
> It should be https://git.cbaines.net/guix/build-coordinator/

Thanks Jonathan, I've fixed this now :)
Christopher Baines Sept. 19, 2020, 9:05 a.m. UTC | #4
Ludovic Courtès <ludo@gnu.org> writes:

> Hi!
>
> Christopher Baines <mail@cbaines.net> skribis:
>
>> * gnu/packages/package-management.scm (guix-build-coordinator): New variable.
>
> [...]
>
>> +           (lambda* (#:key inputs outputs #:allow-other-keys)
>> +             (let* ((out (assoc-ref outputs "out"))
>> +                    (bin (string-append out "/bin"))
>> +                    (guile (assoc-ref inputs "guile"))
>> +                    (guile-effective-version
>> +                     (read-line
>> +                      (open-pipe* OPEN_READ
>> +                                  (string-append guile "/bin/guile")
>> +                                  "-c" "(display (effective-version))")))
>
> Maybe use ‘target-guile-effective-version’ from (guix build
> guile-build-system).

I've changed this. I'll also try and remember and update the
guix-data-service package accordingly, as that's where I copied this
from.

>> +                  (wrap-program (string-append bin "/" file)
>> +                    `("PATH" ":" prefix
>> +                      (,bin ,(assoc-ref inputs "sqitch")))
>> +                    `("PERL5LIB" ":" prefix
>> +                      (,(getenv "PERL5LIB")))
>
> Do we really need PERL5LIB here?  Shouldn’t it be done in the wrapper of
> ‘sqitch’ directly?

Hmm, when I packaged sqitch, I didn't add all the database drivers which
are optional dependencies, but perl-dbd-pg did end up in there somehow
(probably because that's needed by the guix-data-service).

I've now gone ahead and added the database drivers which Guix has
packages for [1], it does increase the closure size a bit, but it was
quite big anyway.

1:
http://git.savannah.gnu.org/cgit/guix.git/commit/?id=6a1c3a908c8aadfde5b5fe405132839683a01776

All that means I can remove the wrapping here.

>> +                (scandir bin
>> +                         (match-lambda
>> +                           ((or "." "..") #f)
>> +                           (_ #t))))
>
> I think you could just use (find-files bin).

Done.

>> +    (inputs
>> +     `(("guile" ,guile-3.0-latest)
>
> Rather ,@(assoc-ref (package-native-inputs guix) "guile").

Done.

>> +       ("sqitch" ,sqitch)
>> +       ("perl-dbd-sqlite" ,perl-dbd-sqlite)))
>
> Shouldn’t perl-dbd-sqlite be a dependency of sqitch?

See above.

>> +    (home-page "https://git.cbaines.net/guile/guix/build-coordinator")
>> +    (synopsis "")
>> +    (description
>> +     "")
>
> Missing!  :-)

Ah, yeah, I should have remembered to lint the package. I've attempted
to write something now, I'm still working on trying to explain what the
Guix Build Coordinator is meant to be.

> LGTM with changes along these lines!

Thanks!
diff mbox series

Patch

diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index ec87226197..4272d3134d 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -50,6 +50,7 @@ 
   #:use-module (gnu packages cpio)
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages curl)
+  #:use-module (gnu packages databases)
   #:use-module (gnu packages dbm)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages file)
@@ -981,6 +982,94 @@  environments.")
     ;; and the fonts included in this package are licensed OFL1.1.
     (license (list license:gpl3+ license:agpl3+ license:silofl1.1))))
 
+(define-public guix-build-coordinator
+  (let ((commit "5e8408c833e209efddfa0159114b90400c1aaf4d")
+        (revision "0"))
+    (package
+    (name "guix-build-coordinator")
+    (version (git-version "0" revision commit))
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://git.cbaines.net/git/guix/build-coordinator")
+                    (commit commit)))
+              (sha256
+               (base32
+                "0f7m1zg9mlb2m22qyblglaa36h8f49b810jc9j5b0hsb42ijwh4b"))
+              (file-name (string-append name "-" version "-checkout"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:modules ((guix build utils)
+                  (guix build gnu-build-system)
+                  (ice-9 ftw)
+                  (ice-9 match)
+                  (ice-9 rdelim)
+                  (ice-9 popen))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'set-GUILE_AUTO_COMPILE
+           (lambda _
+             ;; To avoid warnings relating to 'guild'.
+             (setenv "GUILE_AUTO_COMPILE" "0")
+             #t))
+         (add-after 'install 'wrap-executable
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (guile (assoc-ref inputs "guile"))
+                    (guile-effective-version
+                     (read-line
+                      (open-pipe* OPEN_READ
+                                  (string-append guile "/bin/guile")
+                                  "-c" "(display (effective-version))")))
+                    (scm (string-append out "/share/guile/site/"
+                                        guile-effective-version))
+                    (go  (string-append out "/lib/guile/"
+                                        guile-effective-version
+                                        "/site-ccache")))
+               (for-each
+                (lambda (file)
+                  (simple-format (current-error-port)
+                                 "wrapping: ~A\n"
+                                 (string-append bin "/" file))
+                  (wrap-program (string-append bin "/" file)
+                    `("PATH" ":" prefix
+                      (,bin ,(assoc-ref inputs "sqitch")))
+                    `("PERL5LIB" ":" prefix
+                      (,(getenv "PERL5LIB")))
+                    `("GUILE_LOAD_PATH" ":" prefix
+                      (,scm ,(getenv "GUILE_LOAD_PATH")))
+                    `("GUILE_LOAD_COMPILED_PATH" ":" prefix
+                      (,go ,(getenv "GUILE_LOAD_COMPILED_PATH")))))
+                (scandir bin
+                         (match-lambda
+                           ((or "." "..") #f)
+                           (_ #t))))
+               #t)))
+         (delete 'strip))))             ; As the .go files aren't compatible
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("perl" ,perl)))
+    (inputs
+     `(("guile" ,guile-3.0-latest)
+       ("guile-fibers" ,guile-fibers)
+       ("guile-prometheus" ,guile-prometheus)
+       ("guile-gcrypt" ,guile-gcrypt)
+       ("guile-json" ,guile-json-3)
+       ("guile-lzlib" ,guile-lzlib)
+       ("guile-sqlite3" ,guile-sqlite3)
+       ("guix" ,guix)
+       ("sqlite" ,sqlite)
+       ("sqitch" ,sqitch)
+       ("perl-dbd-sqlite" ,perl-dbd-sqlite)))
+    (home-page "https://git.cbaines.net/guile/guix/build-coordinator")
+    (synopsis "")
+    (description
+     "")
+    (license license:gpl3+))))
+
 (define-public guix-jupyter
   (package
     (name "guix-jupyter")