Allow repeated patch applys

The patches were not idempotent, as in after the first attempt to
build locally using the ci scripts, subsequent builds would fail
in the apply patch step.

This patch checks for the presence of the patch by attempting to apply the inverse of the patch. If that works, then the patch was already applied.

Change-Id: I9ba4267f6a0a567ae13dcaf2c98a7dff204347ce
1 file changed