Applying git patches

In one of our use cases, we want to figure out a way that our partner companies can create their own private snaps based on our public ones, by applying their patches to the codes. In particular, some parts of the snap are sourced from a git repository, the user may have some uncommitted git patches for them, which now he likes to apply before proceeding to the build phase. The most convenient way to do it would be that snapcraft tries to apply any patches that are located in a specific directory (say patches/part-name), before the building phase. Now the question is how this can be achieved or is there something alternative to this for our scenario?

just use override-build (or override-pull) and add some shell scripting that checks for files and calls “git apply -v ./path/to/patch” …

1 Like