unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* HELP: Apply local patch in phase
@ 2022-12-28  1:48 phodina via
  2022-12-28  7:21 ` Wojtek Kosior via
  0 siblings, 1 reply; 2+ messages in thread
From: phodina via @ 2022-12-28  1:48 UTC (permalink / raw)
  To: help-guix

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

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

* Re: HELP: Apply local patch in phase
  2022-12-28  1:48 HELP: Apply local patch in phase phodina via
@ 2022-12-28  7:21 ` Wojtek Kosior via
  0 siblings, 0 replies; 2+ messages in thread
From: Wojtek Kosior via @ 2022-12-28  7:21 UTC (permalink / raw)
  To: phodina via; +Cc: phodina

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

> 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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

end of thread, other threads:[~2022-12-28  7:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-28  1:48 HELP: Apply local patch in phase phodina via
2022-12-28  7:21 ` Wojtek Kosior via

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).