[tinyipa] allow skipping python compileall
Somtimes it is useful to have tinyipa image with normal Python experience (access to source code for debugging, Python interpreter). This patch allows to skip compiling all Python to *.pyo and removing all *.py[c] files by setting export PYOPTIMIZE_TINYIPA=false in the shell before running the build scripts. Change-Id: I570d5a30af0f6a0c9de533e61d03ad5c198c2864 Closes-Bug: #1629953
This commit is contained in:
parent
bc1cf13889
commit
67bd15c1b5
@ -72,12 +72,29 @@ or::
|
||||
Advanced options
|
||||
----------------
|
||||
|
||||
(De)Optimizing the image
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If you want the build script to preinstall everything into the ramdisk,
|
||||
instead of loading some things at runtime (this results in a slightly bigger
|
||||
ramdisk), before running make or build-tinyipa.sh run::
|
||||
|
||||
export BUILD_AND_INSTALL_TINYIPA=true
|
||||
|
||||
By default, building TinyIPA will compile most of the Python code to
|
||||
optimized ``*.pyo`` files, completely remove most of ``*.py`` and ``*.pyc``
|
||||
files, and run ironic-python-agent with ``PYTHONOPTIMIZE=1``
|
||||
to save space on the ramdisk.
|
||||
If instead you want a normal Python experience inside the image,
|
||||
for example for debugging/hacking on IPA in a running ramdisk,
|
||||
before running make or build-tinyipa.sh run::
|
||||
|
||||
export PYOPTIMIZE_TINYIPA=false
|
||||
|
||||
|
||||
Enabling SSH access to the ramdisk
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If you want to enable SSH access to the image, set ``ENABLE_SSH`` variable in
|
||||
your shell before building the tinyipa::
|
||||
|
||||
|
@ -8,6 +8,7 @@ BUILD_AND_INSTALL_TINYIPA=${BUILD_AND_INSTALL_TINYIPA:-true}
|
||||
TINYCORE_MIRROR_URL=${TINYCORE_MIRROR_URL:-"http://repo.tinycorelinux.net/"}
|
||||
ENABLE_SSH=${ENABLE_SSH:-false}
|
||||
SSH_PUBLIC_KEY=${SSH_PUBLIC_KEY:-}
|
||||
PYOPTIMIZE_TINYIPA=${PYOPTIMIZE_TINYIPA:-true}
|
||||
|
||||
TC=1001
|
||||
STAFF=50
|
||||
@ -147,12 +148,16 @@ sudo cp "$WORKDIR/build_files/bootlocal.sh" "$FINALDIR/opt/."
|
||||
sudo sed -i '/# Main/a NOZSWAP=1' "$FINALDIR/etc/init.d/tc-config"
|
||||
# sudo cp $WORKDIR/build_files/tc-config $FINALDIR/etc/init.d/tc-config
|
||||
|
||||
# Precompile all python
|
||||
set +e
|
||||
$CHROOT_CMD /bin/bash -c "python -OO -m compileall /usr/local/lib/python2.7"
|
||||
set -e
|
||||
find $FINALDIR/usr/local/lib/python2.7 -name "*.py" -not -path "*ironic_python_agent/api/config.py" | sudo xargs rm
|
||||
find $FINALDIR/usr/local/lib/python2.7 -name "*.pyc" | sudo xargs rm
|
||||
if $PYOPTIMIZE_TINYIPA; then
|
||||
# Precompile all python
|
||||
set +e
|
||||
$CHROOT_CMD /bin/bash -c "python -OO -m compileall /usr/local/lib/python2.7"
|
||||
set -e
|
||||
find $FINALDIR/usr/local/lib/python2.7 -name "*.py" -not -path "*ironic_python_agent/api/config.py" | sudo xargs rm
|
||||
find $FINALDIR/usr/local/lib/python2.7 -name "*.pyc" | sudo xargs rm
|
||||
else
|
||||
sudo sed -i "s/PYTHONOPTIMIZE=1/PYTHONOPTIMIZE=0/" "$FINALDIR/opt/bootlocal.sh"
|
||||
fi
|
||||
|
||||
# Delete unnecessary Babel .dat files
|
||||
find $FINALDIR -path "*babel/locale-data/*.dat" -not -path "*en_US*" | sudo xargs rm
|
||||
|
Loading…
Reference in New Issue
Block a user