[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using gexp for the #:builder arg of build systems
From: |
Maxim Cournoyer |
Subject: |
Using gexp for the #:builder arg of build systems |
Date: |
Fri, 29 Sep 2017 02:02:22 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
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:
1 file changed, 36 insertions(+)
gnu/packages/android.scm | 36 ++++++++++++++++++++++++++++++++++++
modified gnu/packages/android.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2016 Marius Bakke <address@hidden>
;;; Copyright © 2017 Julien Lepiller <address@hidden>
;;; Copyright © 2017 Hartmut Goebel <address@hidden>
+;;; Copyright © 2017 Maxim Cournoyer <address@hidden>
;;;
;;; 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
address@hidden 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")
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... :)
- Using gexp for the #:builder arg of build systems,
Maxim Cournoyer <=