all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Store path in package definition
@ 2022-08-25 19:21 Saku Laesvuori
  2022-08-27 10:44 ` Hartmut Goebel
  0 siblings, 1 reply; 6+ messages in thread
From: Saku Laesvuori @ 2022-08-25 19:21 UTC (permalink / raw)
  To: help-guix

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

Hi,

I'm writing a package definition for
[passff-host](https://github.com/passff/passff-host) which requires a
file to reference another file with an absolute path (passff.json must
reference passff.py). How can I get the resulting store path to patch it
to the file? I would assume I have to do something with gexps but
couldn't figure it out by reading the documentation.

- Saku Laesvuori

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Store path in package definition
@ 2022-08-26 20:39 Nathan Dehnel
  2022-08-26 20:45 ` (
  2022-08-26 21:09 ` Tobias Geerinckx-Rice
  0 siblings, 2 replies; 6+ messages in thread
From: Nathan Dehnel @ 2022-08-26 20:39 UTC (permalink / raw)
  To: saku, help-guix

Would something like this work?

(string-append (assoc-ref %outputs "out") "/passff.py")

https://guix.gnu.org/cookbook/en/html_node/Extended-example.html#Build-system-arguments


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

* Re: Store path in package definition
  2022-08-26 20:39 Nathan Dehnel
@ 2022-08-26 20:45 ` (
  2022-08-26 21:09 ` Tobias Geerinckx-Rice
  1 sibling, 0 replies; 6+ messages in thread
From: ( @ 2022-08-26 20:45 UTC (permalink / raw)
  To: Nathan Dehnel, saku, help-guix

On Fri Aug 26, 2022 at 9:39 PM BST, Nathan Dehnel wrote:
> (string-append (assoc-ref %outputs "out") "/passff.py")

s/\(assoc-ref %outputs "out"\)/#$output/ :)

    -- (


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

* Re: Store path in package definition
  2022-08-26 20:39 Nathan Dehnel
  2022-08-26 20:45 ` (
@ 2022-08-26 21:09 ` Tobias Geerinckx-Rice
  2022-08-28 14:30   ` Saku Laesvuori
  1 sibling, 1 reply; 6+ messages in thread
From: Tobias Geerinckx-Rice @ 2022-08-26 21:09 UTC (permalink / raw)
  To: help-guix, Nathan Dehnel, saku

Hi,

On 26 August 2022 20:39:55 UTC, Nathan Dehnel <ncdehnel@gmail.com> wrote:
>Would something like this work?
>
>(string-append (assoc-ref %outputs "out") "/passff.py")

Consider this deprecated.  It's unreliable and even where it appears to work can break for what seems to be no reason when, e.g., cross-compiling.

Modulo typos, and indentation being weird because 'phone,

(arguments
 (list
  #:make-flags
  #~(list (string-append "HELLO=" #$output "/bin/hello"))
  #:phases
  #~(modify-phases %standard-phases
     (add-after 'unpack 'option-one
      (lambda _
       (substitute* "foo.c"
        (("hello")
         (string-append #$output "/bin/hello")))))
     (add-after 'unpack 'option-two
      (lambda* (#:key outputs #:allow-other-keys
       (let ((out (assoc-ref outputs "out")))
        (substitute* "foo.c"
         (("hello")
         (string-append out "/bin/hello"))))))))))

From what you describe it sounds like you're using a phase, but I included make-flags to show that they work the same way.

I used to prefer option one, but actually prefer option two nowadays, because it's less magical.

>https://guix.gnu.org/cookbook/en/html_node/Extended-example.html#Build-system-arguments

This should be updated.





Kind regards,

T G-R

Sent on the go.  Excuse or enjoy my brevity.


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

* Re: Store path in package definition
  2022-08-25 19:21 Store path in package definition Saku Laesvuori
@ 2022-08-27 10:44 ` Hartmut Goebel
  0 siblings, 0 replies; 6+ messages in thread
From: Hartmut Goebel @ 2022-08-27 10:44 UTC (permalink / raw)
  To: Saku Laesvuori, help-guix

Am 25.08.22 um 21:21 schrieb Saku Laesvuori:
> I'm writing a package definition for
> [passff-host](https://github.com/passff/passff-host) which requires a
> file to reference another file with an absolute path (passff.json must
> reference passff.py). How can I get the resulting store path to patch it
> to the file? I would assume I have to do something with gexps but
> couldn't figure it out by reading the documentation.

Please have a look at

- phase set-python-file-name of python-ipykernel

or

- phase call-wrapper-not-wrapped-snakemake of snakemake

HTH

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |



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

* Re: Store path in package definition
  2022-08-26 21:09 ` Tobias Geerinckx-Rice
@ 2022-08-28 14:30   ` Saku Laesvuori
  0 siblings, 0 replies; 6+ messages in thread
From: Saku Laesvuori @ 2022-08-28 14:30 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: help-guix, Nathan Dehnel

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

> Modulo typos, and indentation being weird because 'phone,
> 
> (arguments
>  (list
>   #:make-flags
>   #~(list (string-append "HELLO=" #$output "/bin/hello"))
>   #:phases
>   #~(modify-phases %standard-phases
>      (add-after 'unpack 'option-one
>       (lambda _
>        (substitute* "foo.c"
>         (("hello")
>          (string-append #$output "/bin/hello")))))
>      (add-after 'unpack 'option-two
>       (lambda* (#:key outputs #:allow-other-keys
>        (let ((out (assoc-ref outputs "out")))
>         (substitute* "foo.c"
>          (("hello")
>          (string-append out "/bin/hello"))))))))))

Thanks all. I got that part working. Unfortunately I found out that
firefox/icecat tries to find native messaging manifests only from a
hardcoded /usr/lib/... path so packaging a native messaging host
manifest is impossible without patching the browser (as far as I know).

- Saku Laesvuori

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2022-08-28 14:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-25 19:21 Store path in package definition Saku Laesvuori
2022-08-27 10:44 ` Hartmut Goebel
  -- strict thread matches above, loose matches on Subject: below --
2022-08-26 20:39 Nathan Dehnel
2022-08-26 20:45 ` (
2022-08-26 21:09 ` Tobias Geerinckx-Rice
2022-08-28 14:30   ` Saku Laesvuori

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.