If applying patches fails, revert and try again

Reverting will delete our copied gyp files, so we have to make sure to
copy them *after* applying patches.