From 5a28792a98712585d02801540a7e192ddb51972d Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Fri, 26 Aug 2016 10:31:53 +0100 Subject: [PATCH] Fix venv build error introduced in a822fc7 The recent patch merged [1] had two errors: 1) The 'requires_pip_packages' list was taken as part of the list of packages which should go into the venv. This should not be the case as these packages go on to the host. 2) When looping through each list set of packages for the role, each list in turn would replace the last - therefore only the last set would be built into the venv. This patch ensures that the 'requires_pip_packages' list is ignored (along with the optional and proprietary lists) and also ensures that each list processed that should be included is properly merged into a consolidated list before executing the build. [1] https://review.openstack.org/360406 Change-Id: I35ca4305803d55fdad23039851a25915b2cf0100 --- templates/op-venv-script.sh.j2 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/templates/op-venv-script.sh.j2 b/templates/op-venv-script.sh.j2 index af19f95..269328b 100644 --- a/templates/op-venv-script.sh.j2 +++ b/templates/op-venv-script.sh.j2 @@ -49,13 +49,17 @@ function venv_create { {% for role_name, role_data in local_packages.results.0.item.role_requirements.items() %} {% set _host_group = role_data['project_group'] %} {% if ("os_" in role_name) and ((not repo_build_venv_selective | bool) or ((groups[_host_group] is defined) and (groups[_host_group] | length > 0))) %} +{% set requirement_list = [] %} {% for requirement_key, requirement_data in role_data.items() %} -{% if '_pip_packages' in requirement_key and 'optional' not in requirement_key and 'proprietary' not in requirement_key %} -# venv to build {{ role_name }} -# * packages within the {{ role_name }} venv: {{ requirement_data }} -{% set _ = os_group.update({role_name: requirement_data}) %} +{% if '_pip_packages' in requirement_key and 'requires' not in requirement_key and 'optional' not in requirement_key and 'proprietary' not in requirement_key %} +{% for requirement in requirement_data %} +{% set _ = requirement_list.append(requirement) %} +{% endfor %} {% endif %} {% endfor %} +# venv to build {{ role_name }} +# * packages within the {{ role_name }} venv: {{ requirement_list }} +{% set _ = os_group.update({role_name: requirement_list}) %} {% endif %} {% endfor %}