version 1.19, 2014/05/22 23:01:34
|
version 1.31, 2022/02/04 22:24:38
|
|
|
#!/usr/bin/python |
#!/usr/bin/env python |
| |
# When run with the -s flag, localize.py configures the SUMS-server component of NetDRMS. | # When run with the -s flag, localize.py configures the SUMS-server component of NetDRMS. |
from __future__ import print_function |
|
import sys | import sys |
import getopt | import getopt |
import re | import re |
|
|
import xml.etree.ElementTree as ET | import xml.etree.ElementTree as ET |
from subprocess import check_output, CalledProcessError | from subprocess import check_output, CalledProcessError |
| |
|
|
# Constants | # Constants |
VERS_FILE = 'jsoc_version.h' | VERS_FILE = 'jsoc_version.h' |
SDP_CFG = 'configsdp.txt' | SDP_CFG = 'configsdp.txt' |
Line 74 PERL_FXNS_B = """sub get |
|
Line 74 PERL_FXNS_B = """sub get |
|
} | } |
1;""" | 1;""" |
| |
PY_BINPATH = '#/usr/bin/python\n' |
PY_BINPATH = '#!/usr/bin/env python3\n' |
|
|
|
PY_ALL = f"__all__ = [ 'DPError', 'DPMissingParameterError', 'DRMSParams' ]" |
|
|
|
PY_ERROR_CLASSES = """ |
|
class DPError(Exception): |
|
def __init__(self): |
|
self._msg = 'DRMS Parameter Error: ' |
|
|
|
class DPMissingParameterError(DPError): |
|
def __init__(self, parameter): |
|
super().__init__() |
|
self._msg += 'missing DRMS parameter ' + parameter |
|
|
|
def __str__(self): |
|
return self._msg |
|
""" |
| |
PY_FXNS_A = """ | PY_FXNS_A = """ |
class DRMSParams: |
class DRMSParams(object): |
def __init__(self): | def __init__(self): |
self.params = {} | self.params = {} |
self.initialize() | self.initialize() |
Line 90 class DRMSParams: |
|
Line 106 class DRMSParams: |
|
| |
PY_FXNS_B = """ def get(self, name): | PY_FXNS_B = """ def get(self, name): |
if name in self.params: | if name in self.params: |
return self.parms[name] |
return self.params[name] |
else: | else: |
return None | return None |
""" | """ |
| |
|
PY_FXNS_C = """ def get_required(self, name): |
|
try: |
|
value = self.params[name] |
|
except: |
|
raise DPMissingParameterError(name) |
|
|
|
return value |
|
|
|
def getBool(self, name): |
|
if name in self.params: |
|
return bool(self.params[name] == '1') |
|
else: |
|
return None |
|
|
|
def __getattr__(self, name): |
|
# only called if object.__getattribute__(self, name) raises; and if that is true, then we want |
|
# to look in self.params for it, and set the instance attribute if it does exist in self.params |
|
if name in self.params: |
|
attr = self.params[name] |
|
self.__setattr__(name, attr) |
|
else: |
|
attr = None |
|
|
|
return attr |
|
|
|
def __setattr__(self, name, value): |
|
# call neither __setattr__ nor __getattr__ |
|
try: |
|
params = object.__getattr__(self, 'params') |
|
|
|
# put into self.params dict, overwriting if necessary |
|
params[name] = value |
|
except: |
|
pass |
|
|
|
# store in instance dict as well |
|
object.__setattr__(self, name, value) |
|
""" |
|
|
|
SH_BINPATH = '#!/bin/bash\n' |
|
|
|
|
SUMRM_COMMENT = """# This is the configuration file for the sum_rm program. It was auto-generated by the DRMS master configure script. | SUMRM_COMMENT = """# This is the configuration file for the sum_rm program. It was auto-generated by the DRMS master configure script. |
# It controls the behavior of the sum_rm program, and is loaded each time sum_rm runs. To change the | # It controls the behavior of the sum_rm program, and is loaded each time sum_rm runs. To change the |
# parameter values in this configuration file, modify config.local, then re-run configure. This configuration | # parameter values in this configuration file, modify config.local, then re-run configure. This configuration |
Line 253 def createPyConst(key, val, keyColLen, s |
|
Line 311 def createPyConst(key, val, keyColLen, s |
|
status = bool(0) | status = bool(0) |
return key + ' = ' + spaces + val + '\n' | return key + ' = ' + spaces + val + '\n' |
| |
|
def createShConst(key, val, status): |
|
status = bool(0) |
|
return key + '=' + val + '\n' |
|
|
|
|
def isSupportedPlat(plat): | def isSupportedPlat(plat): |
regexp = re.compile(r"\s*(^x86_64|^ia32|^ia64|^avx)", re.IGNORECASE) | regexp = re.compile(r"\s*(^x86_64|^ia32|^ia64|^avx)", re.IGNORECASE) |
matchobj = regexp.match(plat); | matchobj = regexp.match(plat); |
Line 288 def processMakeParam(mDefs, key, val, pl |
|
Line 351 def processMakeParam(mDefs, key, val, pl |
|
machDict[varMach] = {} | machDict[varMach] = {} |
machDict[varMach][varName] = varValu | machDict[varMach][varName] = varValu |
| |
def processParam(cfgfile, line, regexpQuote, regexp, keymap, defs, cDefs, mDefsGen, mDefsMake, perlConstSection, perlInitSection, pyConstSection, pyInitSection, platDict, machDict, section): |
def processParam(cfgfile, line, regexpQuote, regexp, keymap, defs, cDefs, mDefsGen, mDefsMake, perlConstSection, perlInitSection, pyConstSection, pyInitSection, shConstSection, platDict, machDict, section): |
status = 0 | status = 0 |
| |
if ''.join(section) == 'defs' or not cfgfile: | if ''.join(section) == 'defs' or not cfgfile: |
Line 350 def processParam(cfgfile, line, regexpQu |
|
Line 413 def processParam(cfgfile, line, regexpQu |
|
# Python file | # Python file |
pyConstSection.extend(list(createPyConst(key, "'" + val + "'", 40, status))) | pyConstSection.extend(list(createPyConst(key, "'" + val + "'", 40, status))) |
| |
|
# Shell source file |
|
shConstSection.extend(list(createShConst(key, "'" + val + "'", status))) |
|
|
if status: | if status: |
raise Exception('paramNameTooLong', key) | raise Exception('paramNameTooLong', key) |
| |
Line 426 def processXML(xml, projRules, projTarge |
|
Line 492 def processXML(xml, projRules, projTarge |
|
| |
return rv | return rv |
| |
def determineSection(line, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg): |
def determineSection(line, regexpStyle, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg): |
|
matchobj = regexpStyle.match(line) |
|
if matchobj: |
|
return 'style' |
|
|
matchobj = regexpDefs.match(line) | matchobj = regexpDefs.match(line) |
if not matchobj is None: | if not matchobj is None: |
return 'defs' | return 'defs' |
Line 454 def determineSection(line, regexpDefs, r |
|
Line 524 def determineSection(line, regexpDefs, r |
|
# projMkRules is the list containing the make_basic.mk content. | # projMkRules is the list containing the make_basic.mk content. |
# projRules is the list containing the Rules.mk content. | # projRules is the list containing the Rules.mk content. |
# projTargert is the list containing the target.mk content. | # projTargert is the list containing the target.mk content. |
def parseConfig(fin, keymap, addenda, defs, cDefs, mDefsGen, mDefsMake, projCfg, projMkRules, projRules, projTarget, perlConstSection, perlInitSection, pyConstSection, pyInitSection): |
def parseConfig(fin, keymap, addenda, defs, cDefs, mDefsGen, mDefsMake, projCfg, projMkRules, projRules, projTarget, perlConstSection, perlInitSection, pyConstSection, pyInitSection, shConstSection): |
rv = bool(0) | rv = bool(0) |
| |
# Open required config file (config.local) | # Open required config file (config.local) |
try: | try: |
# Examine each line, looking for key=value pairs. | # Examine each line, looking for key=value pairs. |
|
regexpStyle = re.compile(r"^__STYLE__") |
regexpDefs = re.compile(r"^__DEFS__") | regexpDefs = re.compile(r"^__DEFS__") |
regexpMake = re.compile(r"^__MAKE__") | regexpMake = re.compile(r"^__MAKE__") |
regexpProjMkRules = re.compile(r"__PROJ_MK_RULES__") | regexpProjMkRules = re.compile(r"__PROJ_MK_RULES__") |
Line 473 def parseConfig(fin, keymap, addenda, de |
|
Line 544 def parseConfig(fin, keymap, addenda, de |
|
regexpDiv = re.compile(r"^__") | regexpDiv = re.compile(r"^__") |
regexp = re.compile(r"^\s*(\S+)\s+(\S.*)") | regexp = re.compile(r"^\s*(\S+)\s+(\S.*)") |
| |
|
ignoreKeymap = False |
platDict = {} | platDict = {} |
machDict = {} | machDict = {} |
| |
Line 491 def parseConfig(fin, keymap, addenda, de |
|
Line 563 def parseConfig(fin, keymap, addenda, de |
|
# Skip whitespace line | # Skip whitespace line |
continue | continue |
| |
newSection = determineSection(line, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg) |
newSection = determineSection(line, regexpStyle, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg) |
if not newSection is None: | if not newSection is None: |
section = newSection | section = newSection |
| |
if section == 'make': |
if not section: |
|
raise Exception('invalidConfigFile', 'line ' + line.strip() + ' is not in any section') |
|
|
|
if section == 'style': |
|
# if the config.local file has new in the __STYLE__ section, then ignore the keymap and treat config.local like configsdp.txt; |
|
# do not map from NetDRMS config.local parameter names to configsdp.txt names |
|
for line in fin: |
|
matchobj = regexpDiv.match(line) |
|
if matchobj: |
|
break; |
|
if line.strip(' \n').lower() == 'new' and keymap: |
|
ignoreKeymap = True |
|
|
|
newSection = determineSection(line, regexpStyle, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg) |
|
if not newSection is None: |
|
section = newSection |
|
continue |
|
elif section == 'make': |
| |
# There are some blocks of lines in the __MAKE__ section that must be copied ver batim to the output make file. | # There are some blocks of lines in the __MAKE__ section that must be copied ver batim to the output make file. |
# The blocks are defined by _CUST_/_ENDCUST_ tags. | # The blocks are defined by _CUST_/_ENDCUST_ tags. |
Line 508 def parseConfig(fin, keymap, addenda, de |
|
Line 597 def parseConfig(fin, keymap, addenda, de |
|
if not matchobj is None: | if not matchobj is None: |
break; | break; |
mDefsMake.extend(list(line)) | mDefsMake.extend(list(line)) |
newSection = determineSection(line, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg) |
newSection = determineSection(line, regexpStyle, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg) |
if not newSection is None: | if not newSection is None: |
section = newSection | section = newSection |
continue | continue |
# Intentional fall through to next if statement | # Intentional fall through to next if statement |
if section == 'defs' or section == 'make': | if section == 'defs' or section == 'make': |
iscfg = bool(1) | iscfg = bool(1) |
ppRet = processParam(iscfg, line, regexpQuote, regexp, keymap, defs, cDefs, mDefsGen, mDefsMake, perlConstSection, perlInitSection, pyConstSection, pyInitSection, platDict, machDict, section) |
if ignoreKeymap: |
|
keymapActual = None |
|
else: |
|
keymapActual = keymap |
|
ppRet = processParam(iscfg, line, regexpQuote, regexp, keymapActual, defs, cDefs, mDefsGen, mDefsMake, perlConstSection, perlInitSection, pyConstSection, pyInitSection, shConstSection, platDict, machDict, section) |
| |
if ppRet: | if ppRet: |
break | break |
Line 526 def parseConfig(fin, keymap, addenda, de |
|
Line 619 def parseConfig(fin, keymap, addenda, de |
|
if not matchobj is None: | if not matchobj is None: |
break; | break; |
projCfg.extend(list(line)) | projCfg.extend(list(line)) |
newSection = determineSection(line, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg) |
newSection = determineSection(line, regexpStyle, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg) |
if not newSection is None: | if not newSection is None: |
section = newSection | section = newSection |
continue | continue |
Line 537 def parseConfig(fin, keymap, addenda, de |
|
Line 630 def parseConfig(fin, keymap, addenda, de |
|
if not matchobj is None: | if not matchobj is None: |
break; | break; |
projMkRules.extend(list(line)) | projMkRules.extend(list(line)) |
newSection = determineSection(line, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg) |
newSection = determineSection(line, regexpStyle, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg) |
if not newSection is None: | if not newSection is None: |
section = newSection | section = newSection |
continue | continue |
Line 545 def parseConfig(fin, keymap, addenda, de |
|
Line 638 def parseConfig(fin, keymap, addenda, de |
|
# Must parse xml and use the project-specific information to populate the Rules.mk and target.mk files. | # Must parse xml and use the project-specific information to populate the Rules.mk and target.mk files. |
# Collect all xml lines for now, then process after file-read loop. | # Collect all xml lines for now, then process after file-read loop. |
if xml is None: | if xml is None: |
xml = line |
# The first time through this section, line is the config.local div, __PROJ__. Discard that. |
|
xml = '' |
|
continue |
else: | else: |
xml += line | xml += line |
else: | else: |
Line 557 def parseConfig(fin, keymap, addenda, de |
|
Line 652 def parseConfig(fin, keymap, addenda, de |
|
else: | else: |
# re-raise the exception | # re-raise the exception |
raise | raise |
if msg == 'badKeyMapKey': |
|
|
if msg == 'invalidConfigFile': |
|
violator = exc.args[1] |
|
print(violator, file=sys.stderr) |
|
rv = bool(1) |
|
elif msg == 'badKeyMapKey': |
# If we are here, then there was a non-empty keymap, and the parameter came from | # If we are here, then there was a non-empty keymap, and the parameter came from |
# the configuration file. | # the configuration file. |
violator = exc.args[1] | violator = exc.args[1] |
Line 588 def parseConfig(fin, keymap, addenda, de |
|
Line 688 def parseConfig(fin, keymap, addenda, de |
|
if not rv: | if not rv: |
if not xml is None: | if not xml is None: |
# Process xml. | # Process xml. |
projRules.extend(list(RULESPREFIX)) |
|
projTarget.extend(list(TARGETPREFIX)) |
|
rv = processXML(xml, projRules, projTarget) | rv = processXML(xml, projRules, projTarget) |
projRules.extend(RULESSUFFIX) |
|
| |
# Process addenda - these are parameters that are not configurable and must be set in the | # Process addenda - these are parameters that are not configurable and must be set in the |
# NetDRMS build. | # NetDRMS build. |
Line 599 def parseConfig(fin, keymap, addenda, de |
|
Line 696 def parseConfig(fin, keymap, addenda, de |
|
iscfg = bool(0) | iscfg = bool(0) |
for key in addenda: | for key in addenda: |
item = key + ' ' + addenda[key] | item = key + ' ' + addenda[key] |
ppRet = processParam(iscfg, item, regexpQuote, regexp, keymap, defs, cDefs, mDefsGen, mDefsMake, perlConstSection, perlInitSection, pyConstSection, pyInitSection, platDict, machDict, 'defs') |
if ignoreKeymap: |
|
keymapActual = None |
|
else: |
|
keymapActual = keymap |
|
ppRet = processParam(iscfg, item, regexpQuote, regexp, keymapActual, defs, cDefs, mDefsGen, mDefsMake, perlConstSection, perlInitSection, pyConstSection, pyInitSection, shConstSection, platDict, machDict, 'defs') |
if ppRet: | if ppRet: |
break; | break; |
| |
Line 750 def configureComps(defs, mDefs): |
|
Line 851 def configureComps(defs, mDefs): |
|
rv = bool(1) | rv = bool(1) |
elif hasicc: | elif hasicc: |
mDefs.extend(list('\nCOMPILER = icc')) | mDefs.extend(list('\nCOMPILER = icc')) |
|
# mDefs.extend(list('\nICC_VERSION = blah')) |
else: | else: |
mDefs.extend(list('\nCOMPILER = gcc')) | mDefs.extend(list('\nCOMPILER = gcc')) |
| |
Line 766 def configureComps(defs, mDefs): |
|
Line 868 def configureComps(defs, mDefs): |
|
| |
return rv | return rv |
| |
def writeParamsFiles(base, cfile, mfile, pfile, pyfile, cDefs, mDefsGen, mDefsMake, mDefsComps, perlConstSection, perlInitSection, pyConstSection, pyInitSection): |
def writeParamsFiles(base, cfile, mfile, pfile, pyfile, shfile, cDefs, mDefsGen, mDefsMake, mDefsComps, perlConstSection, perlInitSection, pyConstSection, pyInitSection, shConstSection): |
rv = bool(0) | rv = bool(0) |
| |
# Merge mDefsGen, mDefsMake, and mDefsComps into a single string with compiler configuration first, general parameters next, then | # Merge mDefsGen, mDefsMake, and mDefsComps into a single string with compiler configuration first, general parameters next, then |
Line 774 def writeParamsFiles(base, cfile, mfile, |
|
Line 876 def writeParamsFiles(base, cfile, mfile, |
|
mDefs = '\n# Compiler Selection\n' + ''.join(mDefsComps) + '\n\n# General Parameters\n' + ''.join(mDefsGen) + '\n\n# Parameters to Configure make\n' + ''.join(mDefsMake) | mDefs = '\n# Compiler Selection\n' + ''.join(mDefsComps) + '\n\n# General Parameters\n' + ''.join(mDefsGen) + '\n\n# Parameters to Configure make\n' + ''.join(mDefsMake) |
| |
try: | try: |
with open(cfile, 'w') as cout, open(mfile, 'w') as mout, open(pfile, 'w') as pout, open(pyfile, 'w') as pyout: |
with open(cfile, 'w') as cout, open(mfile, 'w') as mout, open(pfile, 'w') as pout, open(pyfile, 'w') as pyout, open(shfile, 'w') as shout: |
# C file of macros | # C file of macros |
print(C_PREFIX, file=cout) | print(C_PREFIX, file=cout) |
print('/* This file contains a set of preprocessor macros - one for each configuration parameter. */\n', file=cout) | print('/* This file contains a set of preprocessor macros - one for each configuration parameter. */\n', file=cout) |
Line 808 def writeParamsFiles(base, cfile, mfile, |
|
Line 910 def writeParamsFiles(base, cfile, mfile, |
|
print(PY_BINPATH, file=pyout) | print(PY_BINPATH, file=pyout) |
print(PREFIX, file=pyout) | print(PREFIX, file=pyout) |
print('# This file contains a set of constants - one for each configuration parameter.\n', file=pyout) | print('# This file contains a set of constants - one for each configuration parameter.\n', file=pyout) |
|
print(PY_ALL, file=pyout) |
print(''.join(pyConstSection), file=pyout) | print(''.join(pyConstSection), file=pyout) |
|
|
|
print(PY_ERROR_CLASSES, file=pyout) |
print(PY_FXNS_A, file=pyout, end='') | print(PY_FXNS_A, file=pyout, end='') |
print(''.join(pyInitSection), file=pyout) | print(''.join(pyInitSection), file=pyout) |
print(PY_FXNS_B, file=pyout) | print(PY_FXNS_B, file=pyout) |
|
print(PY_FXNS_C, file=pyout) |
|
|
|
# Shell (bash) source file |
|
print(SH_BINPATH, file=shout) |
|
print(PREFIX, file=shout) |
|
print('# This file contains a set of variable assignments - one for each configuration parameter.\n', file=shout) |
|
print(''.join(shConstSection), file=shout) |
| |
except IOError as exc: | except IOError as exc: |
type, value, traceback = sys.exc_info() | type, value, traceback = sys.exc_info() |
Line 975 def generateSumRmCfg(defs): |
|
Line 1087 def generateSumRmCfg(defs): |
|
| |
return rv | return rv |
| |
def configureNet(cfgfile, cfile, mfile, pfile, pyfile, pCfile, pMfile, pRfile, pTfile, base, keymap, createSumRmCfg): |
def configureNet(cfgfile, cfile, mfile, pfile, pyfile, shfile, pCfile, pMfile, pRfile, pTfile, base, keymap, createSumRmCfg): |
rv = bool(0) | rv = bool(0) |
| |
defs = {} | defs = {} |
Line 991 def configureNet(cfgfile, cfile, mfile, |
|
Line 1103 def configureNet(cfgfile, cfile, mfile, |
|
perlInitSection = list() | perlInitSection = list() |
pyConstSection = list() | pyConstSection = list() |
pyInitSection = list() | pyInitSection = list() |
|
shConstSection = list() |
addenda = {} | addenda = {} |
| |
# There are three parameters that were not included in the original config.local parameter set, for some reason. | # There are three parameters that were not included in the original config.local parameter set, for some reason. |
Line 1008 def configureNet(cfgfile, cfile, mfile, |
|
Line 1121 def configureNet(cfgfile, cfile, mfile, |
|
try: | try: |
with open(cfgfile, 'r') as fin: | with open(cfgfile, 'r') as fin: |
# Process configuration parameters | # Process configuration parameters |
rv = parseConfig(fin, keymap, addenda, defs, cDefs, mDefsGen, mDefsMake, projCfg, projMkRules, projRules, projTarget, perlConstSection, perlInitSection, pyConstSection, pyInitSection) |
|
|
# Always create a Rules.mk and target.mk, even if no proj XML is provided. All builds should have the proj/example and |
|
# proj/cookbook directories. The required make information is in RULESPREFIX, TARGETPREFIX, and RULESSUFFIX. RULESSUFFIX |
|
# must be added after the xml has been parsed. |
|
projRules.extend(list(RULESPREFIX)) |
|
projTarget.extend(list(TARGETPREFIX)) |
|
|
|
rv = parseConfig(fin, keymap, addenda, defs, cDefs, mDefsGen, mDefsMake, projCfg, projMkRules, projRules, projTarget, perlConstSection, perlInitSection, pyConstSection, pyInitSection, shConstSection) |
if not rv: | if not rv: |
|
projRules.extend(RULESSUFFIX) |
|
|
# Must add a parameter for the SUMS_MANAGER UID (for some reason). This must be done after the | # Must add a parameter for the SUMS_MANAGER UID (for some reason). This must be done after the |
# config file is processed since an input to getMgrUIDLine() is one of the config file's | # config file is processed since an input to getMgrUIDLine() is one of the config file's |
# parameter values. | # parameter values. |
|
|
|
# CANNOT run this unless sunroom2 home directories are accessible |
uidParam = {} | uidParam = {} |
rv = getMgrUIDLine(defs, uidParam) | rv = getMgrUIDLine(defs, uidParam) |
|
|
if rv == bool(0): | if rv == bool(0): |
rv = parseConfig(None, keymap, uidParam, defs, cDefs, mDefsGen, None, projCfg, projMkRules, projRules, projTarget, perlConstSection, perlInitSection, pyConstSection, pyInitSection) |
rv = parseConfig(None, keymap, uidParam, defs, cDefs, mDefsGen, None, projCfg, projMkRules, projRules, projTarget, perlConstSection, perlInitSection, pyConstSection, pyInitSection, shConstSection) |
|
|
|
# ignore the error where the SUMS manager UID cannot be determined |
|
rv = 0 |
|
|
# Configure the compiler-selection make variables. | # Configure the compiler-selection make variables. |
if not rv: | if not rv: |
rv = configureComps(defs, mDefsComps) | rv = configureComps(defs, mDefsComps) |
| |
# Write out the parameter files. | # Write out the parameter files. |
if not rv: | if not rv: |
rv = writeParamsFiles(base, cfile, mfile, pfile, pyfile, cDefs, mDefsGen, mDefsMake, mDefsComps, perlConstSection, perlInitSection, pyConstSection, pyInitSection) |
rv = writeParamsFiles(base, cfile, mfile, pfile, pyfile, shfile, cDefs, mDefsGen, mDefsMake, mDefsComps, perlConstSection, perlInitSection, pyConstSection, pyInitSection, shConstSection) |
| |
# Write out the project-specific make files (make_basic.mk, Rules.mk, and target.mk). | # Write out the project-specific make files (make_basic.mk, Rules.mk, and target.mk). |
if not rv: | if not rv: |
Line 1060 def configureNet(cfgfile, cfile, mfile, |
|
Line 1189 def configureNet(cfgfile, cfile, mfile, |
|
| |
return rv | return rv |
| |
def configureSdp(cfgfile, cfile, mfile, pfile, pyfile, pCfile, pMfile, pRfile, pTfile, base): |
def configureSdp(cfgfile, cfile, mfile, pfile, pyfile, shfile, pCfile, pMfile, pRfile, pTfile, base): |
rv = bool(0) | rv = bool(0) |
| |
defs = {} | defs = {} |
Line 1076 def configureSdp(cfgfile, cfile, mfile, |
|
Line 1205 def configureSdp(cfgfile, cfile, mfile, |
|
perlInitSection = list() | perlInitSection = list() |
pyConstSection = list() | pyConstSection = list() |
pyInitSection = list() | pyInitSection = list() |
|
shConstSection = list() |
| |
addenda = {} | addenda = {} |
| |
Line 1090 def configureSdp(cfgfile, cfile, mfile, |
|
Line 1220 def configureSdp(cfgfile, cfile, mfile, |
|
| |
try: | try: |
with open(cfgfile, 'r') as fin: | with open(cfgfile, 'r') as fin: |
rv = parseConfig(fin, None, addenda, defs, cDefs, mDefsGen, mDefsMake, projCfg, projMkRules, projRules, projTarget, perlConstSection, perlInitSection, pyConstSection, pyInitSection) |
|
|
# Always create a Rules.mk and target.mk, even if no proj XML is provided. All builds should have the proj/example and |
|
# proj/cookbook directories. The required make information is in RULESPREFIX, TARGETPREFIX, and RULESSUFFIX. RULESSUFFIX |
|
# must be added after the xml has been parsed. |
|
projRules.extend(list(RULESPREFIX)) |
|
projTarget.extend(list(TARGETPREFIX)) |
|
|
|
rv = parseConfig(fin, None, addenda, defs, cDefs, mDefsGen, mDefsMake, projCfg, projMkRules, projRules, projTarget, perlConstSection, perlInitSection, pyConstSection, pyInitSection, shConstSection) |
| |
if not rv: | if not rv: |
|
projRules.extend(RULESSUFFIX) |
|
|
# Must add a parameter for the SUMS_MANAGER UID (for some reason) | # Must add a parameter for the SUMS_MANAGER UID (for some reason) |
uidParam = {} | uidParam = {} |
rv = getMgrUIDLine(defs, uidParam) | rv = getMgrUIDLine(defs, uidParam) |
if not rv: | if not rv: |
rv = parseConfig(None, None, uidParam, defs, cDefs, mDefsGen, None, projCfg, projMkRules, projRules, projTarget, perlConstSection, perlInitSection, pyConstSection, pyInitSection) |
rv = parseConfig(None, None, uidParam, defs, cDefs, mDefsGen, None, projCfg, projMkRules, projRules, projTarget, perlConstSection, perlInitSection, pyConstSection, pyInitSection, shConstSection) |
|
|
|
# ignore the error where the SUMS manager UID cannot be determined |
|
rv = 0 |
| |
# Configure the compiler-selection make variables. | # Configure the compiler-selection make variables. |
if not rv: | if not rv: |
Line 1105 def configureSdp(cfgfile, cfile, mfile, |
|
Line 1247 def configureSdp(cfgfile, cfile, mfile, |
|
| |
# Write out the parameter files. | # Write out the parameter files. |
if not rv: | if not rv: |
rv = writeParamsFiles(base, cfile, mfile, pfile, pyfile, cDefs, mDefsGen, mDefsMake, mDefsComps, perlConstSection, perlInitSection, pyConstSection, pyInitSection) |
rv = writeParamsFiles(base, cfile, mfile, pfile, pyfile, shfile, cDefs, mDefsGen, mDefsMake, mDefsComps, perlConstSection, perlInitSection, pyConstSection, pyInitSection, shConstSection) |
| |
# Write out the project-specific make files (make_basic.mk, Rules.mk, and target.mk). | # Write out the project-specific make files (make_basic.mk, Rules.mk, and target.mk). |
if not rv: | if not rv: |
Line 1172 if rv == RET_SUCCESS: |
|
Line 1314 if rv == RET_SUCCESS: |
|
mfile = optD['dir'] + '/' + optD['base'] + '.mk' | mfile = optD['dir'] + '/' + optD['base'] + '.mk' |
pfile = optD['dir'] + '/' + optD['base'] + '.pm' | pfile = optD['dir'] + '/' + optD['base'] + '.pm' |
pyfile = optD['dir'] + '/' + optD['base'] + '.py' | pyfile = optD['dir'] + '/' + optD['base'] + '.py' |
|
shfile = optD['dir'] + '/' + optD['base'] + '.sh' |
pCfile = optD['dir'] + '/configure' | pCfile = optD['dir'] + '/configure' |
pMfile = optD['dir'] + '/make_basic.mk' | pMfile = optD['dir'] + '/make_basic.mk' |
pRfile = optD['dir'] + '/Rules.mk' | pRfile = optD['dir'] + '/Rules.mk' |
Line 1202 if rv == RET_SUCCESS: |
|
Line 1345 if rv == RET_SUCCESS: |
|
| |
# We also need to set the UID of the SUMS manager. We have the name of the | # We also need to set the UID of the SUMS manager. We have the name of the |
# SUMS manager (it is in the configuration file) | # SUMS manager (it is in the configuration file) |
configureNet(NET_CFG, cfile, mfile, pfile, pyfile, pCfile, pMfile, pRfile, pTfile, optD['base'], keymap, 'server' in optD) |
configureNet(NET_CFG, cfile, mfile, pfile, pyfile, shfile, pCfile, pMfile, pRfile, pTfile, optD['base'], keymap, 'server' in optD) |
else: | else: |
# A Stanford user can override the parameters in configsdp.txt by copying that file to config.local, | # A Stanford user can override the parameters in configsdp.txt by copying that file to config.local, |
# and then editing config.local. So, if config.local exists, use that. | # and then editing config.local. So, if config.local exists, use that. |
if os.path.isfile(cdir + '/' + NET_CFG): | if os.path.isfile(cdir + '/' + NET_CFG): |
configureSdp(NET_CFG, cfile, mfile, pfile, pyfile, pCfile, pMfile, pRfile, pTfile, optD['base']) |
configureSdp(NET_CFG, cfile, mfile, pfile, pyfile, shfile, pCfile, pMfile, pRfile, pTfile, optD['base']) |
else: | else: |
configureSdp(SDP_CFG, cfile, mfile, pfile, pyfile, pCfile, pMfile, pRfile, pTfile, optD['base']) |
configureSdp(SDP_CFG, cfile, mfile, pfile, pyfile, shfile, pCfile, pMfile, pRfile, pTfile, optD['base']) |