unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Wojtek Kosior via <help-guix@gnu.org>
To: phodina via <help-guix@gnu.org>
Cc: phodina <phodina@protonmail.com>
Subject: Re: HELP: Apply local patch in phase
Date: Wed, 28 Dec 2022 08:21:42 +0100	[thread overview]
Message-ID: <20221228082142.3455ba2a.koszko@koszko.org> (raw)
In-Reply-To: <CGUqYiCfbeyX7I6LDCeAK9zXb4x4ToQ_ewucjZhUJjTr-SBIQT6v6DqWFxSYgaxc_k88qsJM-AEDWPJeKGTwlUvH9hnti1wCV2M1c31dpgs=@protonmail.com>

[-- 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 --]

      reply	other threads:[~2022-12-28  7:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-28  1:48 HELP: Apply local patch in phase phodina via
2022-12-28  7:21 ` Wojtek Kosior via [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221228082142.3455ba2a.koszko@koszko.org \
    --to=help-guix@gnu.org \
    --cc=koszko@koszko.org \
    --cc=phodina@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).