From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: guix-devel <guix-devel@gnu.org>
Subject: Using gexp for the #:builder arg of build systems
Date: Fri, 29 Sep 2017 02:02:22 -0400 [thread overview]
Message-ID: <87vak2rqj5.fsf@gmail.com> (raw)
[-- 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... :)
next reply other threads:[~2017-09-29 6:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-29 6:02 Maxim Cournoyer [this message]
2017-09-29 15:32 ` Using gexp for the #:builder arg of build systems Ludovic Courtès
2017-09-29 15:43 ` Maxim Cournoyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vak2rqj5.fsf@gmail.com \
--to=maxim.cournoyer@gmail.com \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.