From: Christoph Buck <dev@icepic.de>
To: help-guix@gnu.org
Subject: Apply a patch to a given package definition
Date: Mon, 19 Aug 2024 10:19:55 +0200 [thread overview]
Message-ID: <87sev0sz4k.fsf@icepic.de> (raw)
Hi!
How do i define a new package which is just a variation of a given
package defined in guix?
In my concrete example i try to add a new board definition file via a
patch to the u-boot bootloader. What i come up with, looks like this:
```
;; Defines a package ub which will compile u-boot for the
;; `new-cool-board` description file
(define ub (make-u-boot-package "new-cool-board" "arm-linux-gnueabihf"))
(define-public u-boot-new-cool-board-arm
(package
(inherit ub)
(version "2024.01")
(source (origin
(patches '("0001-Add-board-description-for-new-cool-board.patch"))
(method url-fetch)
(uri (string-append
"https://ftp.denx.de/pub/u-boot/"
"u-boot-" version ".tar.bz2"))
(sha256
(base32
"1czmpszalc6b8cj9j7q6cxcy19lnijv3916w3dag6yr3xpqi35mr"))))))
```
I create a u-boot variant for my "new-cool-board" using the build in
`make-u-boot-package` function, then i define a new package and inherit
from the package variant created with the `make-u-boot-package`
function. Then i overwrite `source` entry with an entry which also
applies my patch file. This works, however the original u-boot package
also apply some patches, which are now lost and must manually added by
me again. This seems rather error prone. Is there a better solution?
I saw that you can also apply patches via package transformation, but i
can't get it to work. I have tried the following:
```test.scm
(define u-boot-new-cool-board
(make-u-boot-package "new-cool-board" "arm-linux-gnueabihf"))
(define transform
(options->transformation
'((with-patch
. "u-boot-new-cool-board=/home/icepic/guix/raspberry/touchscreen/0001-Add-board-description-for-new-cool-board.patch"))))
(transform u-boot-new-cool-board)
```
If i now build the test.scm with
`guix build -f test.scm --target=arm-linux-gnueabihf -v3 -K`
my patch is not applied and the build fails, because there is no target
for "new-cool-board".
Thanks for your help!
--
Best regards
Christoph
next reply other threads:[~2024-08-19 8:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-19 8:19 Christoph Buck [this message]
2024-08-19 23:02 ` Apply a patch to a given package definition Ian Eure
2024-08-20 9:15 ` Christoph Buck
2024-08-20 21:15 ` Ian Eure
2024-08-27 14:19 ` Simon Tournier
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=87sev0sz4k.fsf@icepic.de \
--to=dev@icepic.de \
--cc=help-guix@gnu.org \
/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).