# Poudriere : How to make custom patches for ports and apply those patches using poudriere ?



## Alain De Vos (Dec 15, 2021)

If someone could describe this a bit in detail, for the handbook or howto's/faqs, that would be nice ...
You must be in the correct directory ; must create & place patches in the correct directory  ; use make correct step i.e. extract/patch/ etc  ; use correct patch flags ; etc ...


----------



## driesm (Dec 15, 2021)

I'm not entirely sure I understand your goal, but creating patches for a port is rather easy.



> make extract
> cd work/portname # typically
> cp fileiwanttocreatepatchfor fileiwanttocreatepatchfor.orig
> vim fileiwanttocreatepatchfor # change what I want
> ...



This will create a patch in the files dir (/usr/ports/category/portname/files). If you run poudriere it picks up patches automatically from there.


----------



## Alain De Vos (Dec 15, 2021)

The sooner we are able to create yourself patches the better for the community.


----------



## SirDice (Dec 15, 2021)

If you have patches for existing ports, submit them. Then we can all benefit from them.


----------



## cy@ (Dec 15, 2021)

Poudriere doesn't apply patches. It uses the ports infrastructure to apply patches through the patch target. Put your patches into the files/ directory of whatever port you want to patch.


----------



## Alain De Vos (Dec 19, 2021)

The port /usr/ports/audio/soundtouch quarterly is broken.
I created 3 diff files and if you apply them on the port the port will compile fine.

Here are the 3 very short diff files:

1.distinfo_diff1

```
c3
< SIZE (soundtouch-soundtouch-762f56024b7ade81f6565903161dffec0ad4741e_GL0.tar.gz) = 523946
---
> SIZE (soundtouch-soundtouch-762f56024b7ade81f6565903161dffec0ad4741e_GL0.tar.gz) = 523846
```
To apply "patch distinfo  distinfo_diff1"

2.distinfo_diff2

```
2c2
< SHA256 (soundtouch-soundtouch-762f56024b7ade81f6565903161dffec0ad4741e_GL0.tar.gz) = b2515ce4a1b8b69e401ca9d442d1913b23b7447157a76939b2f8791118941bd1
---
> SHA256 (soundtouch-soundtouch-762f56024b7ade81f6565903161dffec0ad4741e_GL0.tar.gz) = e4c54cb6088e1d483eeb16d1fd6fc2236d2c7cd86e7141411d150099fb8a1da6
```
To apply "patch distinfo distinfo_diff2"

3. Makefile_diff1:

```
cat Makefile_diff1
32a33,39
> post-extract:
>       mkdir  ${WRKSRC}
>       cd    "${WRKSRC}/.."
>       rmdir  ${WRKSRC}
>       echo $PWD
>       ln -s ./soundtouch-762f56024b7ade81f6565903161dffec0ad4741e-762f56024b7ade81f6565903161dffec0ad4741e ${WRKSRC}
>
```
To apply "patch Makefile Makefile_diff1"

This procedure works because distfile /Makefile is part of the ports-tree. For patching c-files i don't know.


----------

