Commit 924f1ca5 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

generate slapos.recipe.build.env.sh if keep-compile-dir is true.

parent 071fd7c2
Pipeline #18638 failed with stage
in 0 seconds
......@@ -279,26 +279,13 @@ class Recipe(EnvironMixin):
and os.path.exists(self.buildout_prefix)):
log.info('Getting installed file lists')
parts += self.get_installed_files(compile_dir)
if is_true(
self.options.get('keep-compile-dir') or
self.buildout['buildout'].get('keep-compile-dir')):
self.generate_build_environment_script(configure_cmd, make_cmd, install_cmd)
log.info('A shell script slapos.recipe.build.env.sh has been generated.')
except:
with open('slapos.recipe.build.env.sh', 'w') as env_script:
for key, v in sorted(self.environ.items()):
if v != startup_environ.get(key):
env_script.write('%sexport %s=%s\n' % (
'#'[:key in ('TEMP', 'TMP', 'TMPDIR')],
key, quote(v)))
env_script.write('''\
echo "If this recipe does not use pre/post hooks or commands, you can re-run as below."
echo configure with:
echo %s
echo
echo make with:
echo %s
echo
echo install with:
echo %s
''' % (quote(" " + configure_cmd), quote(" " + make_cmd), quote(" " + install_cmd)))
self.generate_build_environment_script(configure_cmd, make_cmd, install_cmd)
log.error('Compilation error. The package is left as is at %s where '
'you can inspect what went wrong.\n'
'A shell script slapos.recipe.build.env.sh has been generated. '
......@@ -320,6 +307,25 @@ echo %s
self.fix_shebang(location)
return parts
def generate_build_environment_script(self, configure_cmd, make_cmd, install_cmd):
with open('slapos.recipe.build.env.sh', 'w') as env_script:
for key, v in sorted(self.environ.items()):
if v != startup_environ.get(key):
env_script.write('%sexport %s=%s\n' % (
'#'[:key in ('TEMP', 'TMP', 'TMPDIR')],
key, quote(v)))
env_script.write('''\
echo "If this recipe does not use pre/post hooks or commands, you can re-run as below."
echo configure with:
echo %s
echo
echo make with:
echo %s
echo
echo install with:
echo %s
''' % (quote(" " + configure_cmd), quote(" " + make_cmd), quote(" " + install_cmd)))
def fix_shebang(self, location):
# Workaround for shebang line limit by renaming the script and
# putting a wrapper shell script.
......
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