[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Newbie tries to add a snippet to an origin
From: |
Julien Lepiller |
Subject: |
Re: Newbie tries to add a snippet to an origin |
Date: |
Sat, 01 Aug 2020 11:50:50 -0400 |
User-agent: |
K-9 Mail for Android |
I don't think this is how you are supposed to use snippet :). It's code
executed from the root of the sources that changes it. Then guix repacks the
modified sources and the result is the source for tge package. Look at the code
in guix for more examples. Here's what I suggest:
(source (origin
…
(modules '((guix build utils)))
(snipet
`(begin
(with-output-to-file ".tarball-version"
(lambda _
(format #t "~a~%" ,version)))
#t))))
Of course version needs to be defined in this context (usually as a field in
the package definition, but I'm not sure what dist-package is). You can use any
other name or the result of any scheme function, like (package-version
pomdappi) if you prefer.
HTH!
Le 1 août 2020 11:17:36 GMT-04:00, divoplade <d@divoplade.fr> a écrit :
>Hello,
>
>I am trying to add a file named ".tarball-version" containing a fixed
>string at the root of my source.
>
>I tried several things, the most promising (I think) being this:
>
>(define-public pomdappi-dist
> (dist-package
> pomdappi
> (origin
> (method git-fetch)
> (uri (git-reference
> (url "@REPO@")
> (commit "@COMMIT@")))
> (sha256
> (base32
> "@COMMIT_BASE32@"))
> (snippet
> #~(symlink #$(plain-file ".tarball-version" "@VERSION@")
> ".tarball-version")))))
>
>However, I get "guix build: error: invalid name: `.tarball-version'"
>when running guix build.
>
>My idea was to create a file in the store containing the fixed string
>@VERSION@, and then symlink it withing the source as ".tarball-
>version".
>
>Could someone help me?
>
>divoplade