From a8cfa931cd7660f58ae85c89ec7b808cd97c5551 Mon Sep 17 00:00:00 2001 From: crouzet Date: Thu, 4 Jul 2019 15:23:28 +0200 Subject: [PATCH] sat #17137 : expend environment variables and linux shell rules for the path specified in check_install field --- src/compilation.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/compilation.py b/src/compilation.py index 3fa13ee..4951c55 100644 --- a/src/compilation.py +++ b/src/compilation.py @@ -20,6 +20,7 @@ import os import subprocess import sys import shutil +import glob import src @@ -313,17 +314,24 @@ CC=\\"hack_libtool\\"%g" libtool''' else: return 1 + # this function checks wether a list of file patterns (specified by check_install keyword) + # exixts after the make install. The objective is to ensure the installation is complete. + # patterns are given relatively to the install dir of the product def check_install(self): res=0 if "check_install" in self.product_info: self.log_command("Check installation of files") - for f in self.product_info.check_install: - complete_path=os.path.join(self.product_info.install_dir, f) - self.log_command(" -> check %s" % complete_path) - if os.path.isfile(complete_path) == False : + for pattern in self.product_info.check_install: + # pattern is given relatively to the install dir + complete_pattern=os.path.join(self.product_info.install_dir, pattern) + self.log_command(" -> check %s" % complete_pattern) + # expansion of pattern : takes into account environment variables and unix shell rules + list_of_path=glob.glob(os.path.expandvars(complete_pattern)) + if not list_of_path: + # we expect to find at least one entry, if not we consider the test failed res+=1 - self.logger.write("Error, sat check install failed for file %s\n" % complete_path, 1) - self.log_command("Error, sat check install failed for file %s" % complete_path) + self.logger.write("Error, sat check install failed for file pattern %s\n" % complete_pattern, 1) + self.log_command("Error, sat check install failed for file pattern %s" % complete_pattern) return res ## -- 2.39.2