Since it's not documented well I thought I'd do a post on how to create a patch for a python-for-android recipe.
If you have to modify an existing recipe you can get the source package p4a downloads from ~/.local/share/python-for-android/packages/<recipe-name>.
This is typically a tar.gz or zipped source bundle. Extract it and create a copy. Rename the copy to something like "<recipe-name>-patched" or simply "patched".
I'm working with the openssl recipe, so mine looks like this

Now modify the patched source to apply all your fixes as needed. Once done you can create a patch file by going to the directory containing both versions and using the "git diff <original> <patched>" command. Then save it to a file by adding "> fix-some-issue.patch" to the end.

Now copy this patch file into your recipe package and add it to the "patches" list (or call "self.apply_patch('fix-some-issue.patch', arch)" ).

Rerun and p4a will apply the patch to the downloaded recipe before attempting to use build and install it!
If you get any errors related to "could not find the file to patch" make sure that the patch files for "a/" are relative to the recipe build directory where the patches are actually applied (may need modified depending on your git diff command).
Happy coding!
If you have to modify an existing recipe you can get the source package p4a downloads from ~/.local/share/python-for-android/packages/<recipe-name>.
This is typically a tar.gz or zipped source bundle. Extract it and create a copy. Rename the copy to something like "<recipe-name>-patched" or simply "patched".
I'm working with the openssl recipe, so mine looks like this
Now modify the patched source to apply all your fixes as needed. Once done you can create a patch file by going to the directory containing both versions and using the "git diff <original> <patched>" command. Then save it to a file by adding "> fix-some-issue.patch" to the end.
Now copy this patch file into your recipe package and add it to the "patches" list (or call "self.apply_patch('fix-some-issue.patch', arch)" ).
Rerun and p4a will apply the patch to the downloaded recipe before attempting to use build and install it!
If you get any errors related to "could not find the file to patch" make sure that the patch files for "a/" are relative to the recipe build directory where the patches are actually applied (may need modified depending on your git diff command).
Happy coding!
Comments
Post a Comment