Commit 77c724a8 authored by Jérome Perrin's avatar Jérome Perrin

check_software: only check shared parts that are used in software

check_software was checking all shared parts, which was an easy
implementation but turned out to be problematic, both when running on
test nodes because if one software installs broken shared parts all
softwares being tested afterwards were failing and also during
development because we needed to prune broken shared parts when
fixing problems reported by check_software.

This inspects buildout's .installed.cfg to guess which shared parts
are used.
parent 809c5777
Pipeline #19236 failed with stage
in 0 seconds
...@@ -34,6 +34,7 @@ import warnings ...@@ -34,6 +34,7 @@ import warnings
import pkg_resources import pkg_resources
import requests import requests
from six.moves.configparser import ConfigParser
try: try:
import subprocess32 as subprocess import subprocess32 as subprocess
...@@ -209,14 +210,24 @@ def checkSoftware(slap, software_url): ...@@ -209,14 +210,24 @@ def checkSoftware(slap, software_url):
**locals())) **locals()))
return executable_link_error_list return executable_link_error_list
paths_to_check = ( software_directory = os.path.join(slap.software_directory, software_hash)
os.path.join(slap.software_directory, software_hash), paths_to_check = set((software_directory, ))
slap.shared_directory,
) # Compute the paths to check by inspecting buildout installed database
# for this software. We are looking for shared parts installed by recipes.
config_parser = ConfigParser()
config_parser.read(os.path.join(software_directory, '.installed.cfg'))
for section_name in config_parser.sections():
for option_name in 'location', '__buildout_installed__':
if config_parser.has_option(section_name, option_name):
for section_path in config_parser.get(section_name, option_name).splitlines():
if section_path and not section_path.startswith(software_directory):
paths_to_check.add(section_path)
error_list.extend( error_list.extend(
checkExecutableLink( checkExecutableLink(
paths_to_check, paths_to_check,
paths_to_check + tuple(slap._shared_part_list), tuple(paths_to_check) + tuple(slap._shared_part_list),
)) ))
# check this software is not referenced in any shared parts. # check this software is not referenced in any shared parts.
......
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