32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
import sys, os, argparse, tempfile
|
|
sys.path.append(os.path.dirname(__file__) + '/lib')
|
|
import tamarin
|
|
|
|
def get_args_parser():
|
|
parser = argparse.ArgumentParser(description="Tamarin's container entrypoint")
|
|
# Define available/required arguments and flags
|
|
parser.add_argument("profile", help="The selected profile to use for the build")
|
|
parser.add_argument("arch", help="The selected profile to use for the build")
|
|
return parser
|
|
|
|
def get_buildtools_dir():
|
|
return os.path.realpath(os.path.dirname(os.path.abspath(__file__)) + "/buildtools")
|
|
|
|
if __name__ == '__main__':
|
|
|
|
parser = get_args_parser()
|
|
args = parser.parse_args()
|
|
|
|
profile = tamarin.load_profile(args.profile)
|
|
|
|
workspace = tempfile.mkdtemp(prefix="tamarin_")
|
|
|
|
env = os.environ.copy()
|
|
env['TAMARIN_TARGET_ARCH'] = args.arch
|
|
env['TAMARIN_WORKSPACE'] = workspace
|
|
env['PATH'] = env['PATH'] + ':' + get_buildtools_dir()
|
|
|
|
tamarin.run_profile_hooks(profile, 'prebuild', cwd=workspace, env=env)
|
|
tamarin.run_profile_hooks(profile, 'build', cwd=workspace, env=env)
|
|
tamarin.run_profile_hooks(profile, 'postbuild', cwd=workspace, env=env)
|