[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Help defining a trivial package.
From: |
Pierre-Henry F. |
Subject: |
Help defining a trivial package. |
Date: |
Thu, 29 Aug 2019 11:23:26 +0000 |
> As a note for the future, it would be helpful to include the error
> message that you saw when things went wrong. Here, I’m assuming that
> Guix said:
>
> guix build: error: #<unspecified>: not something we can build
>
> Running “guix build --file=X” causes Guix to build the last expression
> evaluated in the file “X”. In your case, the last expression that gets
> evaluated is the “define-public” form, which returns an unspecified
> value.
>
> While testing, you can put “blog” at the bottom of the file, causing
> Guix to build your defined “blog” package.
>
> Hope that helps!
>
>
> -- Tim
Great :-) !
So, we have, in ~bash~:
$ lzip --decompress release_3.tar.lz
$ tar xf release_3.tar
$ cd blog/ # coming from the preceding line.
$ tree
.
├── bin
│ └── program
└── src
└── hello_world.py
$ cat src/hello_world.py
print("Hello world!")
$ cat bin/program
#! /usr/bin/env bash
script_path="${BASH_SOURCE[0]}"
script_dir="$(dirname $script_path)"
python3 "$script_dir/../src/hello_world.py"
That's it.
The idea is to build a Guix package that does exactly that.
Expected outcome:
$ guix package -s blog
# fetch release_3.tar.lz
# uncompress ...
# ...
$ program
Hello World!
My question: how to build that Guix package? I try to get something working
using
the docs. This is how the package looks to far:
(use-modules
(guix packages)
(guix download)
(guix build-system trivial)
(guix licenses)
(guix gexp)
(gnu packages base)
(gnu packages python))
;; The "derivation" i.e. low level sequence of instructions that the build
deamon is
;; supposed to execute on the behalf of the user.
(define build-drv
(gexp->derivation
"the-thing"
#~(begin
(mkdir #$output)
(chdir #$output)
(symlink (string-append #$coreutils "/bin/ls")
"list-files"))))
(package
(name "blog")
(version "3")
(source
(origin
(method url-fetch)
(uri (string-append "/home/phf/programs/blog/releases/release_" version
".tar.lz"))
(sha256
(base32
"1y819b53ksyas6asldysr0r8p73n5i8ipbpmbgjrfx8qz8cy2zsx"))))
(build-system trivial-build-system)
(arguments `(#:builder ,build-drv))
(inputs `(("python" ,python)))
(synopsis "Guix 'hello world' to learn about Guix")
(description "Guess what GNU Hello prints!")
(home-page "http://www.gnu.org/software/hello/")
(license gpl3+))
Assuming everything else is correct, would you please help refine ~build-drv~
until
it matches the ~bash~ above ?
This is what the execution trace looks like:
phf@f02c:~/tools/guix/packages$ guix build --keep-failed --verbosity=2
--file=./blog.scm
substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
building /gnu/store/8b0gyazhgmc9rkrxir7vxpav0x28xk3d-blog-3.drv...
ERROR: In procedure primitive-load:
In procedure scm_lreadr:
/gnu/store/zlbf2x6n4084v0cpw2rh9dydqmi5b2rn-blog-3-guile-builder:1:10: Unknown
# object: #\<
note: keeping build directory `/tmp/guix-build-blog-3.drv-2'
builder for `/gnu/store/8b0gyazhgmc9rkrxir7vxpav0x28xk3d-blog-3.drv' failed
with exit code 1
build of /gnu/store/8b0gyazhgmc9rkrxir7vxpav0x28xk3d-blog-3.drv failed
View build log at
'/var/log/guix/drvs/8b/0gyazhgmc9rkrxir7vxpav0x28xk3d-blog-3.drv.bz2'.
guix build: error: build of
`/gnu/store/8b0gyazhgmc9rkrxir7vxpav0x28xk3d-blog-3.drv' failed
phf@f02c:~/tools/guix/packages$ ll /tmp/guix-build-blog-3.drv-2
total 140K
drwxr-xr-x 2 phf phf 4.0K Aug 29 13:14 ./
drwxrwxrwt 21 root root 132K Aug 29 13:14 ../
Thanks !
PHF