Check make version for "-O" support

fixes #33
This commit is contained in:
Ralph Lange
2020-06-03 15:48:20 +02:00
parent a0f1c7e96e
commit 58cebdd7dd
2 changed files with 24 additions and 14 deletions

View File

@@ -503,6 +503,8 @@ class TestDetectContext(unittest.TestCase):
class TestSetupForBuild(unittest.TestCase): class TestSetupForBuild(unittest.TestCase):
args = Namespace(paths=[]) args = Namespace(paths=[])
cue.building_base = True cue.building_base = True
if ci_os == 'windows':
sp.check_call(['choco', 'install', 'make'])
def setUp(self): def setUp(self):
os.environ.pop('EPICS_HOST_ARCH', None) os.environ.pop('EPICS_HOST_ARCH', None)
@@ -607,12 +609,12 @@ class TestSetupForBuild(unittest.TestCase):
def test_DetectionBase314No(self): def test_DetectionBase314No(self):
self.setBase314('NO') self.setBase314('NO')
cue.setup_for_build(self.args) cue.setup_for_build(self.args)
self.assertFalse(cue.isbase314, 'Falsely detected Base 3.14') self.assertFalse(cue.is_base314, 'Falsely detected Base 3.14')
def test_DetectionBase314Yes(self): def test_DetectionBase314Yes(self):
self.setBase314('YES') self.setBase314('YES')
cue.setup_for_build(self.args) cue.setup_for_build(self.args)
self.assertTrue(cue.isbase314, 'Base 3.14 = YES not detected') self.assertTrue(cue.is_base314, 'Base 3.14 = YES not detected')
def test_DetectionTestResultsTarget314No(self): def test_DetectionTestResultsTarget314No(self):
self.setBase314('YES') self.setBase314('YES')

32
cue.py
View File

@@ -74,15 +74,22 @@ modules_to_compile = []
setup = {} setup = {}
places = {} places = {}
is_base314 = False
is_make3 = False
has_test_results = False
silent_dep_builds = True
def clear_lists(): def clear_lists():
global isbase314, has_test_results, ci global is_base314, has_test_results, silent_dep_builds, is_make3
del seen_setups[:] del seen_setups[:]
del modules_to_compile[:] del modules_to_compile[:]
setup.clear() setup.clear()
places.clear() places.clear()
isbase314 = False is_base314 = False
is_make3 = False
has_test_results = False has_test_results = False
silent_dep_builds = True
ci['service'] = '<none>' ci['service'] = '<none>'
ci['os'] = '<unknown>' ci['os'] = '<unknown>'
ci['platform'] = '<unknown>' ci['platform'] = '<unknown>'
@@ -181,11 +188,6 @@ def modlist():
return ret return ret
isbase314 = False
has_test_results = False
silent_dep_builds = True
def host_info(): def host_info():
print('{0}Build using {1} compiler on {2} ({3}) hosted by {4}{5}' print('{0}Build using {1} compiler on {2} ({3}) hosted by {4}{5}'
.format(ANSI_CYAN, ci['compiler'], ci['os'], ci['platform'], ci['service'], ANSI_RESET)) .format(ANSI_CYAN, ci['compiler'], ci['os'], ci['platform'], ci['service'], ANSI_RESET))
@@ -325,10 +327,12 @@ def call_make(args=[], **kws):
parallel = kws.pop('parallel', 2) parallel = kws.pop('parallel', 2)
silent = kws.pop('silent', False) silent = kws.pop('silent', False)
# no parallel make for Base 3.14 # no parallel make for Base 3.14
if parallel <= 0 or isbase314: if parallel <= 0 or is_base314:
makeargs = [] makeargs = []
else: else:
makeargs = ['-j{0}'.format(parallel), '-Otarget'] makeargs = ['-j{0}'.format(parallel)]
if not is_make3:
makeargs += ['-Otarget']
if silent: if silent:
makeargs += ['-s'] makeargs += ['-s']
logger.debug("EXEC '%s' in %s", ' '.join(['make'] + makeargs + args), place) logger.debug("EXEC '%s' in %s", ' '.join(['make'] + makeargs + args), place)
@@ -468,7 +472,7 @@ def add_dependency(dep):
def setup_for_build(args): def setup_for_build(args):
global isbase314, has_test_results global is_base314, has_test_results, is_make3
dllpaths = [] dllpaths = []
if ci['os'] == 'windows': if ci['os'] == 'windows':
@@ -563,9 +567,9 @@ def setup_for_build(args):
if os.path.exists(cfg_base_version): if os.path.exists(cfg_base_version):
with open(cfg_base_version) as myfile: with open(cfg_base_version) as myfile:
if 'BASE_3_14=YES' in myfile.read(): if 'BASE_3_14=YES' in myfile.read():
isbase314 = True is_base314 = True
if not isbase314: if not is_base314:
rules_build = os.path.join(places['EPICS_BASE'], 'configure', 'RULES_BUILD') rules_build = os.path.join(places['EPICS_BASE'], 'configure', 'RULES_BUILD')
if os.path.exists(rules_build): if os.path.exists(rules_build):
with open(rules_build) as myfile: with open(rules_build) as myfile:
@@ -573,6 +577,10 @@ def setup_for_build(args):
if re.match('^test-results:', line): if re.match('^test-results:', line):
has_test_results = True has_test_results = True
# Check make version
if re.match(r'^GNU Make 3', sp.check_output(['make', '-v'])):
is_make3 = True
# apparently %CD% is handled automagically # apparently %CD% is handled automagically
os.environ['TOP'] = os.getcwd() os.environ['TOP'] = os.getcwd()