summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-03-25 22:49:54 +0800
committerruki <[email protected]>2021-03-25 22:49:54 +0800
commit6f4cdb2998faa46527d3f54b9b70aafdf9a79820 (patch)
tree5c31feef7b1dc5399c4b5d3dc46b89ec37196c10
parentdf6916d52a29ce6b66ad913016c90f8c0e4cbebb (diff)
pass oldenvs to package/on_install
-rw-r--r--xmake/modules/private/action/require/impl/actions/install.lua3
-rw-r--r--xmake/modules/private/action/require/impl/utils/filter.lua4
2 files changed, 4 insertions, 3 deletions
diff --git a/xmake/modules/private/action/require/impl/actions/install.lua b/xmake/modules/private/action/require/impl/actions/install.lua
index 57511a930..c059a6e86 100644
--- a/xmake/modules/private/action/require/impl/actions/install.lua
+++ b/xmake/modules/private/action/require/impl/actions/install.lua
@@ -158,6 +158,7 @@ function main(package)
patch_sources(package)
-- enter the environments of all package dependencies
+ local oldenvs = os.getenvs()
for _, dep in ipairs(package:orderdeps()) do
dep:envs_enter()
end
@@ -167,7 +168,7 @@ function main(package)
-- do install
if script ~= nil then
- filter.call(script, package)
+ filter.call(script, package, {oldenvs = oldenvs})
end
-- leave the environments of all package dependencies
diff --git a/xmake/modules/private/action/require/impl/utils/filter.lua b/xmake/modules/private/action/require/impl/utils/filter.lua
index 11bdf70de..75bba1d42 100644
--- a/xmake/modules/private/action/require/impl/utils/filter.lua
+++ b/xmake/modules/private/action/require/impl/utils/filter.lua
@@ -109,7 +109,7 @@ function _handler(package, strval)
end
-- attach filter to the given script and call it
-function call(script, package)
+function call(script, package, opt)
-- get sandbox filter and handlers of the given script
local sandbox_filter = sandbox.filter(script)
@@ -122,7 +122,7 @@ function call(script, package)
sandbox_filter:register("package", _handler(package))
-- call it
- script(package)
+ script(package, opt)
-- restore handlers
sandbox_filter:set_handlers(sandbox_handlers)