[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: HELP: Apply local patch in phase
From: |
Wojtek Kosior |
Subject: |
Re: HELP: Apply local patch in phase |
Date: |
Wed, 28 Dec 2022 08:21:42 +0100 |
> Hello,
>
> could you please suggest how to apply local patch using gexp?
>
> The reason the patch is not applied to source is that it patches code from
> submodule which is downloaded after unpack phase finishes.
Hi!
I'd personally avoid having anything download during build phases.
Actually, I thought Guix would disable network access at that point
anyway.
Are you using `(git-fetch)` with `(git-reference)` in `(origin)`? If
so, you can instruct Guix to automatically pull git submodules by
adding `(recursive? #t)` to `(git-reference)`. You can look at how it
is done in existing packages.
grep -RE 'recursive\?' -A2 -B4
~/.config/guix/current/share/guile/site/3.0/gnu/packages
Once you do this, you should be able to utilize the `(patches)` field
of `(origin)` as you normally would.
If the "submodule" you mentioned is not an actual git submodule, you
could probably instead write a separate `(origin)` definition for it
and `(ungexp)` that origin inside your phases definitions. See how it
is done in the gnome-recipes package[1].
Btw, you can use `$+` (aka `gexp-native`) instead of `#$`. The result,
in case of an origin, is the same (since origin's gexp compiler ignores
its `target` argument) but it's going to make more sense to the human
reader (I think).
Good luck,
Wojtek
[1]
https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/gnome.scm?id=5f222e7b7a088d741027b8ab9908ecb4cc79751a#n843
-- (sig_start)
website: https://koszko.org/koszko.html
PGP: https://koszko.org/key.gpg
fingerprint: E972 7060 E3C5 637C 8A4F 4B42 4BC5 221C 5A79 FD1A
Meet Kraków saints! #41: blessed Piotr Dańkowski
Poznaj świętych krakowskich! #41: błogosławiony Piotr Dańkowski
https://pl.wikipedia.org/wiki/Piotr_Dańkowski
-- (sig_end)
On Wed, 28 Dec 2022 01:48:00 +0000
phodina via <help-guix@gnu.org> wrote:
> Hello,
>
> could you please suggest how to apply local patch using gexp?
>
> The reason the patch is not applied to source is that it patches code from
> submodule which is downloaded after unpack phase finishes.
>
> There's nice example in the file 'gnu/packages/games.scm'
>
> Here we list the patch as dependency:
> ```
> (native-inputs
> `(("unzip" ,unzip)
> ("patch" ,patch) ("love-11.patch" ,(search-patch
> "mrrescue-support-love-11.patch"))))
> ```
> Here's transformation to inputs without labels for my case:
> ```
> (native-inputs
> `(("unzip" ,unzip)
> ("patch" ,patch) ("love-11.patch" ,(search-patch
> "mrrescue-support-love-11.patch"))))
> ```
> And later we apply the patch:
> ```
> (invoke patch "-p1" "-i"
> (assoc-ref %build-inputs "love-11.patch")))
> ```
> The issue here is when I attempt to do so with following code the expression
> returns #f as the patch is not found:
> ```
> (invoke (search-input-file inputs "/bin/patch") "-p1" "-i" (search-input-file
> inputs "zenlib_dynamic_physfs.diff"))
> ```
>
> Any ideas what to change?
>
> ----
> Petr
pgpghKCphgKen.pgp
Description: OpenPGP digital signature