unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Using gexp for the #:builder arg of build systems
@ 2017-09-29  6:02 Maxim Cournoyer
  2017-09-29 15:32 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Maxim Cournoyer @ 2017-09-29  6:02 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 144 bytes --]

Hello,

After reading Ludovic's paper about gexps, I was curious to try it in a
package definition. Is this supported yet?

Here's my attempt:


[-- Attachment #2: Type: text/x-patch, Size: 2635 bytes --]

1 file changed, 36 insertions(+)
gnu/packages/android.scm | 36 ++++++++++++++++++++++++++++++++++++

modified   gnu/packages/android.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2017 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2017 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,10 +22,12 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages android)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
+  #:use-module (guix build-system trivial)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
   #:use-module (gnu packages gnupg)
@@ -305,6 +308,39 @@ of device actions, such as installing and debugging apps, and it provides access
 to a Unix shell that can run commands on the connected device or emulator.")
     (license license:asl2.0)))
 
+(define-public android-udev-rules
+  (package
+    (name "android-udev-rules")
+    (version "20170910")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/M0Rf30/android-udev-rules")
+             (commit version)))
+       (file-name (string-append name "-" version "-checkout"))
+       (sha256
+        (base32 "0vic40n3si0dxag3dyc3hi3pn7cjpm5q378x8v2ys19n3iz9fp1g"))))
+    (build-system trivial-build-system)
+    (arguments
+     (list
+      #:builder
+      (with-imported-modules '((guix build utils))
+        #~(begin
+            (use-modules (guix build utils))
+            (install-file "51-android.rules"
+                          (string-append #$output "/lib/udev/rules.d"))))))
+    (home-page "https://github.com/M0Rf30/android-udev-rules")
+    (synopsis "udev rules for Android devices")
+    (description "Provides a set of udev rules to allow using Android devices
+with tools such as @command{adb} and @command{fastboot} without root
+privileges.  This package is intended to be added as a rule to the
+@code{udev-service-type} in your @code{operating-system}
+configuration. Additionally, an @code{adbusers} group must be defined and your
+user added to it.  @emph{Simply installing this package will @strong{not} have
+an effect.}")
+    (license license:gpl3+)))
+
 (define-public git-repo
   (package
     (name "git-repo")


[-- Attachment #3: Type: text/plain, Size: 2271 bytes --]


And here's the error I get when attempting to build it:

--8<---------------cut here---------------start------------->8---
@ build-succeeded /gnu/store/6qcm0pxqhi4hd4lldixdlm88zakl4cip-android-udev-rules-20170910-checkout.drv -
@ build-started /gnu/store/kfdc7a7wnb7wppn0pylhcqq8pqf9gv21-android-udev-rules-20170910.drv - x86_64-linux /var/log/guix/drvs/kf//dc7a7wnb7wppn0pylhcqq8pqf9gv21-android-udev-rules-20170910.drv.bz2
ERROR: In procedure primitive-load:
ERROR: In procedure scm_lreadr: /gnu/store/kkrin9p4xd7j4pkiy8rvhq7hlhb5i8kp-android-udev-rules-20170910-guile-builder:1:10: Unknown # object: #\<
builder for `/gnu/store/kfdc7a7wnb7wppn0pylhcqq8pqf9gv21-android-udev-rules-20170910.drv' failed with exit code 1
@ build-failed /gnu/store/kfdc7a7wnb7wppn0pylhcqq8pqf9gv21-android-udev-rules-20170910.drv - 1 builder for `/gnu/store/kfdc7a7wnb7wppn0pylhcqq8pqf9gv21-android-udev-rules-20170910.drv' failed with exit code 1
guix build: error: build failed: build of `/gnu/store/kfdc7a7wnb7wppn0pylhcqq8pqf9gv21-android-udev-rules-20170910.drv' failed
--8<---------------cut here---------------end--------------->8---

Possibly, the gexps are not being lowered (compiled) in the generated
builder script. When manually indenting it[1] this builder looks like:

--8<---------------cut here---------------start------------->8---
(begin #<gexp
       (begin (use-modules (guix build utils))
	      (install-file "51-android.rules"
			    (string-append #<gexp-output out> "/lib/udev/rules.d"))) 286c810>
			    (define %output (getenv "out"))
			    (define %outputs (map (lambda (o) (cons o (getenv o))) (quote ("out"))))
			    (define %build-inputs (quote (("source" . "/gnu/store/n9prv51xsahbxiz1jypaz6q14gid9r5d-android-udev-rules-20170910-checkout"))))
			    (unsetenv "GUILE_LOAD_COMPILED_PATH")
			    (unsetenv "LD_LIBRARY_PATH"))
(exit (#<gexp
       (begin (use-modules (guix build utils))
	      (install-file "51-android.rules"
			    (string-append #<gexp-output out> "/lib/udev/rules.d"))) 286c810>))
--8<---------------cut here---------------end--------------->8---

It seems to me that the gexp objects should have been lowered into
absolute file paths at this point, no?

Maxim

[1]  A Guile auto-formatter could be an interesting pet project... :)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using gexp for the #:builder arg of build systems
  2017-09-29  6:02 Using gexp for the #:builder arg of build systems Maxim Cournoyer
@ 2017-09-29 15:32 ` Ludovic Courtès
  2017-09-29 15:43   ` Maxim Cournoyer
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2017-09-29 15:32 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: guix-devel

Hello!

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

> After reading Ludovic's paper about gexps, I was curious to try it in a
> package definition. Is this supported yet?

It’s not possible in current master.  There’s work for that in
‘wip-gexp’, that I’d like to merge in ‘core-updates’ Real Soon (I’ve
rebased it locally, it “just” needs more love.)

Ludo’.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using gexp for the #:builder arg of build systems
  2017-09-29 15:32 ` Ludovic Courtès
@ 2017-09-29 15:43   ` Maxim Cournoyer
  0 siblings, 0 replies; 3+ messages in thread
From: Maxim Cournoyer @ 2017-09-29 15:43 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Hi Ludovic!

ludo@gnu.org (Ludovic Courtès) writes:

> Hello!
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>
>> After reading Ludovic's paper about gexps, I was curious to try it in a
>> package definition. Is this supported yet?
>
> It’s not possible in current master.  There’s work for that in
> ‘wip-gexp’, that I’d like to merge in ‘core-updates’ Real Soon (I’ve
> rebased it locally, it “just” needs more love.)
>
> Ludo’.

OK! I'll try it again when I see it merged :)

Thanks,

Maxim

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-29 15:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-29  6:02 Using gexp for the #:builder arg of build systems Maxim Cournoyer
2017-09-29 15:32 ` Ludovic Courtès
2017-09-29 15:43   ` Maxim Cournoyer

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).