Kaydet (Commit) 17d7d45a authored tarafından sulincix's avatar sulincix

Actionsapi can works without inary

üst 5c124f68
......@@ -37,6 +37,7 @@ class BinutilsError(inary.actionsapi.Error):
# Globals
inary.actionsapi.variables.initVariables()
env = inary.actionsapi.variables.glb.env
dirs = inary.actionsapi.variables.glb.dirs
config = inary.actionsapi.variables.glb.config
......
......@@ -18,6 +18,7 @@ import glob
import grp
# python standard library
import os
import sys
import pwd
import re
import stat
......@@ -787,52 +788,8 @@ class Builder:
return True
else:
raise Error(_("unable to call function from actions: \'{}\'").format(func))
if func in self.actionLocals:
if ctx.get_option('ignore_sandbox') or \
not ctx.config.values.build.enablesandbox or \
"emul32" in self.build_type:
self.actionLocals[func]()
else:
import catbox
ctx.ui.info(_("Sandbox enabled build..."))
# Configure allowed paths from sandbox.conf
valid_paths = [bytes(self.pkg_dir().encode('utf-8'))]
conf_file = ctx.const.sandbox_conf
if os.path.exists(conf_file):
for line in open(conf_file):
line = line.strip()
if len(line) > 0 and not line.startswith("#"):
if line.startswith("~"):
line = os.environ["HOME"] + line[1:]
valid_paths.append(line.encode('utf-8'))
# Extra path for ccache when needed
if ctx.config.values.build.buildhelper == "ccache":
valid_paths.append(os.environ.get("CCACHE_DIR",
"/root/.ccache"))
ret = catbox.run(self.actionLocals[func],
valid_paths,
logger=self.log_sandbox_violation)
# Retcode can be 0 while there is a sanbox violation, so only
# look for violations to correctly handle it
if ret.violations:
ctx.ui.error(_("Sandbox violation result:"))
for result in ret.violations:
ctx.ui.error("{0} ({1} -> {2})".format(result[0],
result[1],
result[2]))
raise Error(_("Sandbox violations!"))
if ret.code == 1:
raise ActionScriptException
else:
if mandatory:
raise Error(_("unable to call function from actions: \'{}\'").format(func))
if os.system('python3 -c \'import sys\nsys.path.append("{1}")\nimport actions\nactions.{0}()\''.format(func,curDir)):
raise Error(_("unable to call function from actions: \'{}\'").format(func))
os.chdir(curDir)
return True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment