Merge "[tinyipa] allow skipping python compileall"

This commit is contained in:
Jenkins 2016-10-10 10:32:24 +00:00 committed by Gerrit Code Review
commit 5c1084c7e3
2 changed files with 28 additions and 6 deletions

View File

@ -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::

View File

@ -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