all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Apply a patch to a given package definition
@ 2024-08-19  8:19 Christoph Buck
  2024-08-19 23:02 ` Ian Eure
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Buck @ 2024-08-19  8:19 UTC (permalink / raw)
  To: help-guix

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


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

end of thread, other threads:[~2024-08-27 14:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-19  8:19 Apply a patch to a given package definition Christoph Buck
2024-08-19 23:02 ` Ian Eure
2024-08-20  9:15   ` Christoph Buck
2024-08-20 21:15     ` Ian Eure
2024-08-27 14:19     ` Simon Tournier

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.