From eaaa1118ad6e8204f9d276b868e06ffc53bb5864 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Mon, 30 Sep 2019 14:13:16 +0200 Subject: [PATCH] DIB: default to installing pip and virtualenv from packages This reduces the size of the image slightly. We don't need latest versions since we update pip in our venv anyway. Change-Id: I7729b8c286c641a7b70a775ffe73f9f1c9dbff2d --- .../60-ironic-python-agent-ramdisk-install | 4 ++-- ironic_python_agent_builder/__init__.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dib/ironic-python-agent-ramdisk/install.d/ironic-python-agent-ramdisk-source-install/60-ironic-python-agent-ramdisk-install b/dib/ironic-python-agent-ramdisk/install.d/ironic-python-agent-ramdisk-source-install/60-ironic-python-agent-ramdisk-install index 2dc5211..53f91fb 100755 --- a/dib/ironic-python-agent-ramdisk/install.d/ironic-python-agent-ramdisk-source-install/60-ironic-python-agent-ramdisk-install +++ b/dib/ironic-python-agent-ramdisk/install.d/ironic-python-agent-ramdisk-source-install/60-ironic-python-agent-ramdisk-install @@ -13,8 +13,8 @@ VENVDIR=/opt/ironic-python-agent # Generate upper-constraints $IPADIR/imagebuild/common/generate_upper_constraints.sh $IPADIR/upper-constraints.txt -# create the virtual environment -virtualenv $VENVDIR +# create the virtual environment using the default python +$DIB_PYTHON -m virtualenv -- $VENVDIR # pip might be an older version which does not support the -c option, therefore upgrade first $VENVDIR/bin/pip install pip --upgrade diff --git a/ironic_python_agent_builder/__init__.py b/ironic_python_agent_builder/__init__.py index 6ec6d8a..20d4e4b 100644 --- a/ironic_python_agent_builder/__init__.py +++ b/ironic_python_agent_builder/__init__.py @@ -48,6 +48,11 @@ def main(): help="Additional DIB element to use") # TODO(dtantsur): handle distribution == tinyipa os.environ['ELEMENTS_PATH'] = find_elements_path() + if not os.environ.get('DIB_INSTALLTYPE_pip_and_virtualenv'): + # DIB updates these to latest versions from source. However, we do the + # same in our virtualenv, so it's not needed and just increases the + # size of the image. + os.environ['DIB_INSTALLTYPE_pip_and_virtualenv'] = 'package' args = parser.parse_args() try: subprocess.check_call(['disk-image-create', '-o', args.output,