summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2024-03-01 00:50:16 +0800
committerruki <[email protected]>2024-03-01 00:50:16 +0800
commit9b8384ff002380fce4ba8ca4cd3f6e0e354fb9dc (patch)
tree440df557186868b57313538be1526bce47d87dfe /xmake/modules
parent95029452b5b1ebf71986a6bd2d2d45f459861c19 (diff)
apply reversed patches for package
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/private/action/require/impl/actions/patch_sources.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/xmake/modules/private/action/require/impl/actions/patch_sources.lua b/xmake/modules/private/action/require/impl/actions/patch_sources.lua
index b5203471f..49f4363cb 100644
--- a/xmake/modules/private/action/require/impl/actions/patch_sources.lua
+++ b/xmake/modules/private/action/require/impl/actions/patch_sources.lua
@@ -49,7 +49,10 @@ function _check_sha256(patch_hash, patch_file)
end
-- do patch
-function _patch(package, patch_url, patch_hash)
+function _patch(package, patchinfo)
+ local patch_url = patchinfo.url
+ local patch_hash = patchinfo.hash
+ local patch_extra = patchinfo.extra or {}
-- trace
patch_url = proxy.mirror(patch_url) or patch_url
@@ -116,12 +119,12 @@ function _patch(package, patch_url, patch_hash)
-- apply patch files
for _, file in ipairs(os.files(path.join(patchdir, "**"))) do
vprint("applying patch %s", file)
- git.apply(file)
+ git.apply(file, {reverse = patch_extra.reverse})
end
else
-- apply single plain patch file
vprint("applying patch %s", patch_file)
- git.apply(patch_file)
+ git.apply(patch_file, {reverse = patch_extra.reverse})
end
end
@@ -141,6 +144,6 @@ function main(package)
-- do all patches
for _, patchinfo in ipairs(patches) do
- _patch(package, patchinfo.url, patchinfo.sha256)
+ _patch(package, patchinfo)
end
end