# Apply own patches automatically with poudriere



## mix_room (Apr 23, 2014)

I have a patch that I apply to a port, this patch removes part of the functionality of the port. I do not want it to be committed upstream, but I would like it to be automatically applied to my pkg builds. Is there a way to accomplish this with Poudriere? 

I have: PortA_src_fileA.patch, which applied cleanly when in $PORTA/files/, and a poudriere machine which builds packages. 
I would like to have this pulled in automatically, applied, and then built. 

Anybody have any suggestions?


----------



## dpejesh (Apr 23, 2014)

I've been using ports-mgmt/portshaker for this.

Create an empty ports tree for poudriere.
`poudriere ports -cF myports`

This tells portshaker that you have a ports tree named myports, the path to where you want the tree to be located, and the ports trees you want to be merged which will be defined in /usr/local/etc/portshaker.d/.


```
# /usr/local/etc/portshaker.conf
mirror_base_dir="/var/cache/portshaker"

ports_trees="myports"

myports_ports_tree="/usr/local/poudriere/ports/myports"
myports_merge_from="freebsd myports"
```

The git repository for the FreeBSD ports tree.


```
# /usr/local/etc/portshaker.d/freebsd
. /usr/local/share/portshaker/portshaker.subr

method="git"
git_clone_uri="https://github.com/freebsd/freebsd-ports.git"
run_portshaker_command $*
```

Your custom ports tree.


```
# /usr/local/etc/portshaker.d/myports
. /usr/local/share/portshaker/portshaker.subr

method="git"
git_clone_uri="https://path_to_your_git_repo"
run_portshaker_command $*
```

Your custom ports tree just needs to follow the standard category/port scheme and `portshaker` should be able to merge them for you.  It will check out the ports trees into /var/cache/portshaker and then merge them into /usr/local/poudriere/ports/myports for `poudriere` to use.


----------



## mix_room (Apr 25, 2014)

Was just what I was looking for. Thanks! 

Portshaker is a little difficult in getting set up correctly to start with, but after a little playing around everything worked fine. The ports are now being built and packaged nicely. 
Additionally I also finally got around to having my packages signed.


----------

