5 Commits

Author SHA1 Message Date
Ralph Lange
d0f93f1920 travis: fix for EXTRA arguments with spaces/quotes
- feed EXTRA variables into an array to be properly expanded
2020-04-24 12:27:30 +02:00
Ralph Lange
27f823139a appveyor: don't walk() through the file system in host_info()
- was taking ~3min on AppVeyor builders
2020-04-23 14:12:03 +02:00
Ralph Lange
88831439b1 appveyor: consider base build (BASE=SELF) 2020-04-23 14:11:18 +02:00
Ralph Lange
177dfd4615 travis: fix /etc/hosts issue on bionic image 2020-04-23 14:11:17 +02:00
Ralph Lange
3bd2bb6dff travis: consider base build (BASE=SELF) 2020-04-22 13:36:16 +02:00
4 changed files with 120 additions and 66 deletions

View File

@@ -41,11 +41,31 @@ else:
if 'CACHEDIR' in os.environ: if 'CACHEDIR' in os.environ:
cachedir = os.environ['CACHEDIR'] cachedir = os.environ['CACHEDIR']
vcvars_table = {
# https://en.wikipedia.org/wiki/Microsoft_Visual_Studio#History
'vs2019':r'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat',
'vs2017':r'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat',
'vs2015':r'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat',
'vs2013':r'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat',
'vs2012':r'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat',
'vs2010':r'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat',
'vs2008':r'C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat',
}
ciscriptsdir = os.path.abspath(os.path.dirname(sys.argv[0])) ciscriptsdir = os.path.abspath(os.path.dirname(sys.argv[0]))
if os.path.basename(ciscriptsdir) == 'appveyor': if os.path.basename(ciscriptsdir) == 'appveyor':
ciscriptsdir = ciscriptsdir.rstrip(os.pathsep+'appveyor') ciscriptsdir = ciscriptsdir.rstrip(os.pathsep+'appveyor')
if 'BASE' not in os.environ or os.environ['BASE'] == 'SELF':
building_base = True
places['EPICS_BASE'] = '.'
else:
building_base = False
def modlist(): def modlist():
if building_base:
ret = []
else:
for var in ['ADD_MODULES', 'MODULES']: for var in ['ADD_MODULES', 'MODULES']:
setup.setdefault(var, '') setup.setdefault(var, '')
if var in os.environ: if var in os.environ:
@@ -69,12 +89,9 @@ def host_info():
print('platform =', distutils.util.get_platform()) print('platform =', distutils.util.get_platform())
print('{0}Available Visual Studio versions{1}'.format(ANSI_CYAN, ANSI_RESET)) print('{0}Available Visual Studio versions{1}'.format(ANSI_CYAN, ANSI_RESET))
from fnmatch import fnmatch for key in vcvars_table:
for base in (r'C:\Program Files (x86)', r'C:\Program Files'): if os.path.exists(vcvars_table[key]):
for root, dirs, files in os.walk(base): print('Found', key, 'in', vcvars_table[key])
for fname in files:
if fnmatch(fname, 'vcvarsall.bat'):
print('Found', os.path.join(root, fname))
sys.stdout.flush() sys.stdout.flush()
# Used from unittests # Used from unittests
@@ -377,6 +394,8 @@ def setup_for_build(args):
make = os.path.join(toolsdir, 'make.exe') make = os.path.join(toolsdir, 'make.exe')
base_place = '.'
if not building_base:
with open(os.path.join(cachedir, 'RELEASE.local'), 'r') as f: with open(os.path.join(cachedir, 'RELEASE.local'), 'r') as f:
lines = f.readlines() lines = f.readlines()
for line in lines: for line in lines:
@@ -386,7 +405,10 @@ def setup_for_build(args):
dllpaths.append(bindir) dllpaths.append(bindir)
if mod == 'EPICS_BASE': if mod == 'EPICS_BASE':
base_place = place base_place = place
with open(os.path.join(base_place, 'configure', 'CONFIG_BASE_VERSION')) as myfile:
cfg_base_version = os.path.join(base_place, 'configure', 'CONFIG_BASE_VERSION')
if os.path.exists(cfg_base_version):
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 isbase314 = True
@@ -433,9 +455,12 @@ def prepare(args):
[add_dependency(mod) for mod in modlist()] [add_dependency(mod) for mod in modlist()]
if not building_base:
if os.path.isdir('configure'): if os.path.isdir('configure'):
release_local = os.path.join(cachedir, 'RELEASE.local') targetdir = 'configure'
shutil.copy(release_local, 'configure') else:
targetdir = '.'
shutil.copy(os.path.join(cachedir, 'RELEASE.local'), targetdir)
print('{0}Configuring EPICS build system{1}'.format(ANSI_YELLOW, ANSI_RESET)) print('{0}Configuring EPICS build system{1}'.format(ANSI_YELLOW, ANSI_RESET))
@@ -487,6 +512,7 @@ def prepare(args):
sys.stdout.flush() sys.stdout.flush()
sp.check_call(['cl']) sp.check_call(['cl'])
if not building_base:
for mod in modlist(): for mod in modlist():
place = places[setup[mod+"_VARNAME"]] place = places[setup[mod+"_VARNAME"]]
print('{0}Building dependency {1} in {2}{3}'.format(ANSI_YELLOW, mod, place, ANSI_RESET)) print('{0}Building dependency {1} in {2}{3}'.format(ANSI_YELLOW, mod, place, ANSI_RESET))
@@ -540,16 +566,7 @@ def with_vcvars(cmd):
'x64': 'amd64', 'x64': 'amd64',
}[os.environ['PLATFORM'].lower()] # 'x86' or 'x64' }[os.environ['PLATFORM'].lower()] # 'x86' or 'x64'
info['vcvars'] = { info['vcvars'] = vcvars_table[CC]
# https://en.wikipedia.org/wiki/Microsoft_Visual_Studio#History
'vs2019':r'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat',
'vs2017':r'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat',
'vs2015':r'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat',
'vs2013':r'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat',
'vs2012':r'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat',
'vs2010':r'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat',
'vs2008':r'C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat',
}[CC]
script=''' script='''
call "{vcvars}" {arch} call "{vcvars}" {arch}

View File

@@ -53,6 +53,8 @@ script:
# SET source setup file # SET source setup file
# ADD_MODULES extra modules (for a specific job) # ADD_MODULES extra modules (for a specific job)
# EXTRA content will be added to make command line # EXTRA content will be added to make command line
# EXTRA1..5 additional arguments for the make command
# (one argument per variable)
# STATIC set to YES for static build (default: NO) # STATIC set to YES for static build (default: NO)
# TEST set to NO to skip running the tests (default: YES) # TEST set to NO to skip running the tests (default: YES)
# VV set to make build scripts verbose (default: unset) # VV set to make build scripts verbose (default: unset)

View File

@@ -13,7 +13,15 @@ export EPICS_BASE
[ -z "$EPICS_HOST_ARCH" -a -f $EPICS_BASE/startup/EpicsHostArch.pl ] && EPICS_HOST_ARCH=$(perl $EPICS_BASE/startup/EpicsHostArch.pl) [ -z "$EPICS_HOST_ARCH" -a -f $EPICS_BASE/startup/EpicsHostArch.pl ] && EPICS_HOST_ARCH=$(perl $EPICS_BASE/startup/EpicsHostArch.pl)
export EPICS_HOST_ARCH export EPICS_HOST_ARCH
make -j2 $EXTRA # use array variable to get the quoting right while using separate words for arguments
[ -n "$EXTRA0" ] && EXTRA[0]="$EXTRA0"
[ -n "$EXTRA1" ] && EXTRA[1]="$EXTRA1"
[ -n "$EXTRA2" ] && EXTRA[2]="$EXTRA2"
[ -n "$EXTRA3" ] && EXTRA[3]="$EXTRA3"
[ -n "$EXTRA4" ] && EXTRA[4]="$EXTRA4"
[ -n "$EXTRA5" ] && EXTRA[5]="$EXTRA5"
make -j2 "${EXTRA[@]}"
ret=0 ret=0
@@ -21,7 +29,7 @@ if [ "$TEST" != "NO" ]
then then
make tapfiles || ret=$? make tapfiles || ret=$?
make -s test-results make -sk test-results
fi fi
exit $ret exit $ret

View File

@@ -29,6 +29,23 @@ CACHEDIR=${CACHEDIR:-${HOME}/.cache}
echo -e "${ANSI_YELLOW}Using bash version $BASH_VERSION${ANSI_RESET}" echo -e "${ANSI_YELLOW}Using bash version $BASH_VERSION${ANSI_RESET}"
if [ -f /etc/hosts ]
then
# The travis-ci "bionic" image throws us a curveball in /etc/hosts
# by including two entries for localhost. The first for 127.0.1.1
# which causes epicsSockResolveTest to fail.
# cat /etc/hosts
# ...
# 127.0.1.1 localhost localhost ip4-loopback
# 127.0.0.1 localhost nettuno travis vagrant travis-job-....
sudo sed -i -e '/^127\.0\.1\.1/ s|localhost\s*||g' /etc/hosts
echo "==== /etc/hosts"
cat /etc/hosts
echo "===="
fi
# Load settings # Load settings
# ------------- # -------------
@@ -45,6 +62,8 @@ fold_end load.settings
# Check out dependencies # Check out dependencies
# ---------------------- # ----------------------
if [ "$BASE" != "SELF" ]
then
fold_start check.out.dependencies "Checking/cloning dependencies" fold_start check.out.dependencies "Checking/cloning dependencies"
for mod in BASE $ADD_MODULES $MODULES for mod in BASE $ADD_MODULES $MODULES
@@ -55,13 +74,19 @@ done
[ -e ./configure ] && cp ${CACHEDIR}/RELEASE.local ./configure/RELEASE.local [ -e ./configure ] && cp ${CACHEDIR}/RELEASE.local ./configure/RELEASE.local
fold_end check.out.dependencies fold_end check.out.dependencies
fi
# Set up compiler # Set up compiler
# --------------- # ---------------
fold_start set.up.epics_build "Setting up EPICS build system" fold_start set.up.epics_build "Setting up EPICS build system"
if [ "$BASE" = "SELF" ]
then
EPICS_BASE=$CURDIR
else
eval $(grep "EPICS_BASE=" ${CACHEDIR}/RELEASE.local) eval $(grep "EPICS_BASE=" ${CACHEDIR}/RELEASE.local)
fi
export EPICS_BASE export EPICS_BASE
echo "EPICS_BASE=$EPICS_BASE" echo "EPICS_BASE=$EPICS_BASE"
@@ -70,7 +95,7 @@ echo "EPICS_BASE=$EPICS_BASE"
export EPICS_HOST_ARCH export EPICS_HOST_ARCH
echo "EPICS_HOST_ARCH=$EPICS_HOST_ARCH" echo "EPICS_HOST_ARCH=$EPICS_HOST_ARCH"
if echo ${modules_to_compile} | grep -q "$EPICS_BASE" if echo ${modules_to_compile} | grep -q "$EPICS_BASE" || [ "$BASE" = "SELF" ]
then then
# requires wine and g++-mingw-w64-i686 # requires wine and g++-mingw-w64-i686
@@ -180,6 +205,8 @@ fold_end set.up.compiler
echo "\$ make --version" echo "\$ make --version"
make --version make --version
[ "$BASE" = "SELF" ] && exit 0
# Build required dependencies # Build required dependencies
# --------------------------- # ---------------------------