travis: remove bash scripts (v2.x implementation)
This commit is contained in:
@@ -1,77 +0,0 @@
|
|||||||
From 00ee7bf7d3618c748491c88742c011a8353abeba Mon Sep 17 00:00:00 2001
|
|
||||||
From: Andrew Johnson <anj@anl.gov>
|
|
||||||
Date: Wed, 24 Oct 2018 14:27:15 -0500
|
|
||||||
Subject: [PATCH] Add RTEMS-pc368-qemu target, use in Travis-CI builds
|
|
||||||
|
|
||||||
---
|
|
||||||
configure/os/CONFIG.Common.RTEMS-pc386-qemu | 11 +++++++++++
|
|
||||||
configure/os/CONFIG_SITE.Common.RTEMS-pc386 | 5 -----
|
|
||||||
configure/os/CONFIG_SITE.Common.RTEMS-pc386-qemu | 9 +++++++++
|
|
||||||
src/libCom/RTEMS/Makefile | 2 +-
|
|
||||||
src/tools/makeTestfile.pl | 2 +-
|
|
||||||
6 files changed, 24 insertions(+), 10 deletions(-)
|
|
||||||
create mode 100644 configure/os/CONFIG.Common.RTEMS-pc386-qemu
|
|
||||||
delete mode 100644 configure/os/CONFIG_SITE.Common.RTEMS-pc386
|
|
||||||
create mode 100644 configure/os/CONFIG_SITE.Common.RTEMS-pc386-qemu
|
|
||||||
|
|
||||||
diff --git a/configure/os/CONFIG.Common.RTEMS-pc386-qemu b/configure/os/CONFIG.Common.RTEMS-pc386-qemu
|
|
||||||
new file mode 100644
|
|
||||||
index 000000000..684f01a19
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/configure/os/CONFIG.Common.RTEMS-pc386-qemu
|
|
||||||
@@ -0,0 +1,11 @@
|
|
||||||
+# CONFIG.Common.RTEMS-pc386-qemu
|
|
||||||
+#
|
|
||||||
+# Definitions for the RTEMS-pc386-qemu target
|
|
||||||
+# Site-specific overrides go in CONFIG_SITE.Common.RTEMS-pc386-qemu
|
|
||||||
+#
|
|
||||||
+#-------------------------------------------------------
|
|
||||||
+
|
|
||||||
+# Include definitions from RTEMS-pc386
|
|
||||||
+include $(CONFIG)/os/CONFIG.Common.RTEMS-pc386
|
|
||||||
+
|
|
||||||
+RTEMS_QEMU_FIXUPS = YES
|
|
||||||
diff --git a/configure/os/CONFIG_SITE.Common.RTEMS-pc386-qemu b/configure/os/CONFIG_SITE.Common.RTEMS-pc386-qemu
|
|
||||||
new file mode 100644
|
|
||||||
index 000000000..027dcf4ab
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/configure/os/CONFIG_SITE.Common.RTEMS-pc386-qemu
|
|
||||||
@@ -0,0 +1,9 @@
|
|
||||||
+# CONFIG_SITE.Common.RTEMS-pc386-qemu
|
|
||||||
+#
|
|
||||||
+# Site-specific overrides for the RTEMS-pc386-qemu target
|
|
||||||
+#
|
|
||||||
+
|
|
||||||
+# If you're building this architecture you _probably_ want to
|
|
||||||
+# run the tests for it under QEMU, but if not you can turn
|
|
||||||
+# them off here by commenting out this line:
|
|
||||||
+CROSS_COMPILER_RUNTEST_ARCHS += RTEMS-pc386-qemu
|
|
||||||
diff --git a/src/libCom/RTEMS/Makefile b/src/libCom/RTEMS/Makefile
|
|
||||||
index 2f12b7bf0..22a92733c 100644
|
|
||||||
--- a/src/libCom/RTEMS/Makefile
|
|
||||||
+++ b/src/libCom/RTEMS/Makefile
|
|
||||||
@@ -24,7 +24,7 @@ rtemsCom_SRCS += epicsRtemsInitHookPre.c
|
|
||||||
rtemsCom_SRCS += epicsRtemsInitHookPost.c
|
|
||||||
rtemsCom_SRCS += epicsMemFs.c
|
|
||||||
|
|
||||||
-ifeq ($(T_A),RTEMS-pc386)
|
|
||||||
+ifeq ($(RTEMS_BSP),pc386)
|
|
||||||
rtemsCom_SRCS += ne2kpci.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
diff --git a/src/tools/makeTestfile.pl b/src/tools/makeTestfile.pl
|
|
||||||
index 73f522034..fb431fe7a 100644
|
|
||||||
--- a/src/tools/makeTestfile.pl
|
|
||||||
+++ b/src/tools/makeTestfile.pl
|
|
||||||
@@ -37,7 +37,7 @@ if( $TA =~ /^win32-x86/ && $HA !~ /^win/ ) {
|
|
||||||
$exec = "wine64 $exe";
|
|
||||||
|
|
||||||
# Run pc386 test harness w/ QEMU
|
|
||||||
-} elsif( $TA =~ /^RTEMS-pc386$/ ) {
|
|
||||||
+} elsif( $TA =~ /^RTEMS-pc386-qemu$/ ) {
|
|
||||||
$exec = "qemu-system-i386 -m 64 -no-reboot -serial stdio -display none -net nic,model=ne2k_pci -net user,restrict=yes -kernel $exe";
|
|
||||||
|
|
||||||
# Explicitly fail for other RTEMS targets
|
|
||||||
--
|
|
||||||
2.21.0.windows.1
|
|
||||||
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Set VV in .travis.yml to make scripts verbose
|
|
||||||
[ "$VV" ] && set -x
|
|
||||||
|
|
||||||
CURDIR="$PWD"
|
|
||||||
CACHEDIR=${CACHEDIR:-${HOME}/.cache}
|
|
||||||
|
|
||||||
if [ "$BASE" = "SELF" ]
|
|
||||||
then
|
|
||||||
EPICS_BASE=$CURDIR
|
|
||||||
else
|
|
||||||
eval $(grep "EPICS_BASE=" ${CACHEDIR}/RELEASE.local)
|
|
||||||
fi
|
|
||||||
export EPICS_BASE
|
|
||||||
|
|
||||||
[ -z "$EPICS_HOST_ARCH" -a -f $EPICS_BASE/src/tools/EpicsHostArch.pl ] && EPICS_HOST_ARCH=$(perl $EPICS_BASE/src/tools/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
|
|
||||||
|
|
||||||
# Base 3.15 doesn't have -qemu target architecture and needs an extra define
|
|
||||||
[ -e $EPICS_BASE/configure/os/CONFIG.Common.RTEMS-pc386-qemu ] || EXTRA_QEMU=RTEMS_QEMU_FIXUPS=YES
|
|
||||||
|
|
||||||
# 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_QEMU "${EXTRA[@]}"
|
|
||||||
|
|
||||||
ret=0
|
|
||||||
|
|
||||||
if [ "$TEST" != "NO" ]
|
|
||||||
then
|
|
||||||
if grep -q "BASE_3_14\s*=\s*NO" $EPICS_BASE/configure/CONFIG_BASE_VERSION && grep -q "^test-results:" $EPICS_BASE/configure/RULES_BUILD
|
|
||||||
then
|
|
||||||
make -j2 tapfiles || ret=$?
|
|
||||||
make -sk test-results
|
|
||||||
else
|
|
||||||
make runtests
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit $ret
|
|
||||||
@@ -1,247 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# The following if clause can be removed for ci-scripts major version 3
|
|
||||||
if [ "$TRAVIS_OS_NAME" == osx -a "$BASH_VERSINFO" -lt 4 ]
|
|
||||||
then
|
|
||||||
brew install bash
|
|
||||||
if [ $(/usr/local/bin/bash -c 'echo $BASH_VERSINFO') -lt 4 ]
|
|
||||||
then
|
|
||||||
echo "Failed to install a recent bash" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
exec /usr/local/bin/bash $0 "$@"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Set VV in .travis.yml to make scripts verbose
|
|
||||||
[ "$VV" ] && set -x
|
|
||||||
|
|
||||||
# Perl version of "readlink -f" (which MacOS does not provide)
|
|
||||||
readlinkf() { perl -MCwd -e 'print Cwd::abs_path shift' "$1"; }
|
|
||||||
|
|
||||||
SCRIPTDIR=$(dirname $(readlinkf $0))
|
|
||||||
CURDIR="$PWD"
|
|
||||||
CACHEDIR=${CACHEDIR:-${HOME}/.cache}
|
|
||||||
[ -e ${CACHEDIR} ] || mkdir -p ${CACHEDIR}
|
|
||||||
|
|
||||||
# source functions
|
|
||||||
. $SCRIPTDIR/utils.sh
|
|
||||||
|
|
||||||
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
|
|
||||||
# -------------
|
|
||||||
|
|
||||||
fold_start load.settings "Loading settings"
|
|
||||||
|
|
||||||
# load default settings for well-known modules
|
|
||||||
source_set defaults
|
|
||||||
|
|
||||||
# source configured settings
|
|
||||||
[ -z "${SET+x}" ] || source_set $SET
|
|
||||||
|
|
||||||
fold_end load.settings
|
|
||||||
|
|
||||||
# Check out dependencies
|
|
||||||
# ----------------------
|
|
||||||
|
|
||||||
if [ "$BASE" != "SELF" ]
|
|
||||||
then
|
|
||||||
fold_start check.out.dependencies "Checking/cloning dependencies"
|
|
||||||
|
|
||||||
for mod in BASE $ADD_MODULES $MODULES
|
|
||||||
do
|
|
||||||
mod_uc=${mod^^}
|
|
||||||
eval add_dependency $mod_uc \${${mod_uc}:=master}
|
|
||||||
done
|
|
||||||
[ -d ./configure ] && target=./configure/RELEASE.local || target=./RELEASE.local
|
|
||||||
cp ${CACHEDIR}/RELEASE.local $target
|
|
||||||
|
|
||||||
fold_end check.out.dependencies
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Set up compiler
|
|
||||||
# ---------------
|
|
||||||
|
|
||||||
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)
|
|
||||||
fi
|
|
||||||
export EPICS_BASE
|
|
||||||
echo "EPICS_BASE=$EPICS_BASE"
|
|
||||||
|
|
||||||
[ -z "$EPICS_HOST_ARCH" -a -f $EPICS_BASE/src/tools/EpicsHostArch.pl ] && EPICS_HOST_ARCH=$(perl $EPICS_BASE/src/tools/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
|
|
||||||
echo "EPICS_HOST_ARCH=$EPICS_HOST_ARCH"
|
|
||||||
|
|
||||||
if echo ${modules_to_compile} | grep -q "$EPICS_BASE" || [ "$BASE" = "SELF" ]
|
|
||||||
then
|
|
||||||
|
|
||||||
# requires wine and g++-mingw-w64-i686
|
|
||||||
if [ "$WINE" = "32" ]
|
|
||||||
then
|
|
||||||
echo "Cross mingw32"
|
|
||||||
sed -i -e '/CMPLR_PREFIX/d' $EPICS_BASE/configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw
|
|
||||||
cat << EOF >> $EPICS_BASE/configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw
|
|
||||||
CMPLR_PREFIX=i686-w64-mingw32-
|
|
||||||
EOF
|
|
||||||
cat << EOF >> $EPICS_BASE/configure/CONFIG_SITE
|
|
||||||
CROSS_COMPILER_TARGET_ARCHS+=win32-x86-mingw
|
|
||||||
EOF
|
|
||||||
|
|
||||||
elif [ "$WINE" = "64" ]
|
|
||||||
then
|
|
||||||
echo "Cross mingw64"
|
|
||||||
sed -i -e '/CMPLR_PREFIX/d' $EPICS_BASE/configure/os/CONFIG_SITE.linux-x86.windows-x64-mingw
|
|
||||||
cat << EOF >> $EPICS_BASE/configure/os/CONFIG_SITE.linux-x86.windows-x64-mingw
|
|
||||||
CMPLR_PREFIX=x86_64-w64-mingw32-
|
|
||||||
EOF
|
|
||||||
cat << EOF >> $EPICS_BASE/configure/CONFIG_SITE
|
|
||||||
CROSS_COMPILER_TARGET_ARCHS+=windows-x64-mingw
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$STATIC" = "YES" ]
|
|
||||||
then
|
|
||||||
echo "Build static libraries/executables"
|
|
||||||
cat << EOF >> $EPICS_BASE/configure/CONFIG_SITE
|
|
||||||
SHARED_LIBRARIES=NO
|
|
||||||
STATIC_BUILD=YES
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
HOST_CCMPLR_NAME=`echo "$TRAVIS_COMPILER" | sed -E 's/^([[:alpha:]][^-]*(-[[:alpha:]][^-]*)*)+(-[0-9\.]+)?$/\1/g'`
|
|
||||||
HOST_CMPLR_VER_SUFFIX=`echo "$TRAVIS_COMPILER" | sed -E 's/^([[:alpha:]][^-]*(-[[:alpha:]][^-]*)*)+(-[0-9\.]+)?$/\3/g'`
|
|
||||||
HOST_CMPLR_VER=`echo "$HOST_CMPLR_VER_SUFFIX" | cut -c 2-`
|
|
||||||
|
|
||||||
case "$HOST_CCMPLR_NAME" in
|
|
||||||
clang)
|
|
||||||
echo "Host compiler is clang"
|
|
||||||
HOST_CPPCMPLR_NAME=$(echo "$HOST_CCMPLR_NAME" | sed 's/clang/clang++/g')
|
|
||||||
cat << EOF >> $EPICS_BASE/configure/os/CONFIG_SITE.Common.$EPICS_HOST_ARCH
|
|
||||||
GNU = NO
|
|
||||||
CMPLR_CLASS = clang
|
|
||||||
CC = ${HOST_CCMPLR_NAME}$HOST_CMPLR_VER_SUFFIX
|
|
||||||
CCC = ${HOST_CPPCMPLR_NAME}$HOST_CMPLR_VER_SUFFIX
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# hack
|
|
||||||
sed -i -e 's/CMPLR_CLASS = gcc/CMPLR_CLASS = clang/' $EPICS_BASE/configure/CONFIG.gnuCommon
|
|
||||||
|
|
||||||
${HOST_CCMPLR_NAME}$HOST_CMPLR_VER_SUFFIX --version
|
|
||||||
;;
|
|
||||||
gcc)
|
|
||||||
echo "Host compiler is GCC"
|
|
||||||
HOST_CPPCMPLR_NAME=$(echo "$HOST_CCMPLR_NAME" | sed 's/gcc/g++/g')
|
|
||||||
cat << EOF >> $EPICS_BASE/configure/os/CONFIG_SITE.Common.$EPICS_HOST_ARCH
|
|
||||||
CC = ${HOST_CCMPLR_NAME}$HOST_CMPLR_VER_SUFFIX
|
|
||||||
CCC = ${HOST_CPPCMPLR_NAME}$HOST_CMPLR_VER_SUFFIX
|
|
||||||
EOF
|
|
||||||
|
|
||||||
${HOST_CCMPLR_NAME}$HOST_CMPLR_VER_SUFFIX --version
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Host compiler is default"
|
|
||||||
gcc --version
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
cat <<EOF >> $EPICS_BASE/configure/CONFIG_SITE
|
|
||||||
USR_CPPFLAGS += $USR_CPPFLAGS
|
|
||||||
USR_CFLAGS += $USR_CFLAGS
|
|
||||||
USR_CXXFLAGS += $USR_CXXFLAGS
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# set RTEMS to eg. "4.9" or "4.10"
|
|
||||||
# requires qemu, bison, flex, texinfo, install-info
|
|
||||||
if [ -n "$RTEMS" ]
|
|
||||||
then
|
|
||||||
echo "Cross RTEMS${RTEMS} for pc386"
|
|
||||||
sed -i -e '/^RTEMS_VERSION/d' -e '/^RTEMS_BASE/d' $EPICS_BASE/configure/os/CONFIG_SITE.Common.RTEMS
|
|
||||||
cat << EOF >> $EPICS_BASE/configure/os/CONFIG_SITE.Common.RTEMS
|
|
||||||
RTEMS_VERSION=$RTEMS
|
|
||||||
RTEMS_BASE=$HOME/.rtems
|
|
||||||
EOF
|
|
||||||
# Base 3.15 doesn't have -qemu target architecture
|
|
||||||
[ -e $EPICS_BASE/configure/os/CONFIG.Common.RTEMS-pc386-qemu ] && QEMU=-qemu
|
|
||||||
cat << EOF >> $EPICS_BASE/configure/CONFIG_SITE
|
|
||||||
CROSS_COMPILER_TARGET_ARCHS += RTEMS-pc386$QEMU
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
echo -e "${ANSI_GREEN}EPICS build system already set up (Base was loaded from cache)${ANSI_RESET}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Download RTEMS cross compiler
|
|
||||||
if [ -n "$RTEMS" ]
|
|
||||||
then
|
|
||||||
echo "Downloading RTEMS${RTEMS} cross compiler for pc386"
|
|
||||||
curl -L "https://github.com/mdavidsaver/rsb/releases/download/20171203-${RTEMS}/i386-rtems${RTEMS}-trusty-20171203-${RTEMS}.tar.bz2" \
|
|
||||||
| tar -C / -xmj
|
|
||||||
fi
|
|
||||||
|
|
||||||
fold_end set.up.compiler
|
|
||||||
|
|
||||||
echo "\$ make --version"
|
|
||||||
make --version
|
|
||||||
|
|
||||||
[ "$BASE" = "SELF" ] && exit 0
|
|
||||||
|
|
||||||
# Build required dependencies
|
|
||||||
# ---------------------------
|
|
||||||
|
|
||||||
fold_start build.dependencies "Build missing/outdated dependencies"
|
|
||||||
|
|
||||||
[ "$VV" ] && silent="-s" || silent=
|
|
||||||
|
|
||||||
[ -z "$modules_to_compile" ] && echo -e "${ANSI_GREEN}All dependency modules are up-to-date (nothing to do)${ANSI_RESET}"
|
|
||||||
|
|
||||||
for module in ${modules_to_compile}
|
|
||||||
do
|
|
||||||
eval name=\${module#${CACHEDIR}/}
|
|
||||||
fold_start build.$name "Build $name"
|
|
||||||
make -j2 $silent -C $module $EXTRA
|
|
||||||
fold_end build.$name
|
|
||||||
done
|
|
||||||
|
|
||||||
fold_end build.dependencies
|
|
||||||
|
|
||||||
echo -e "${ANSI_BLUE}Dependency module information${ANSI_RESET}"
|
|
||||||
|
|
||||||
echo "Module Tag Binaries Commit"
|
|
||||||
echo "-----------------------------------------------------------------------------------"
|
|
||||||
for mod in base $MODULES $ADD_MODULES
|
|
||||||
do
|
|
||||||
mod_uc=${mod^^}
|
|
||||||
eval tag=\${${mod_uc}}
|
|
||||||
eval dir=${CACHEDIR}/\${${mod_uc}_DIRNAME}-$tag
|
|
||||||
echo "$modules_to_compile" | grep -q "$dir" && stat="rebuilt" || stat="from cache"
|
|
||||||
commit=$(git -C $dir log -n1 --oneline)
|
|
||||||
printf "%-10s %-12s %-11s %s\n" "$mod" "$tag" "$stat" "$commit"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo -e "${ANSI_BLUE}Contents of RELEASE.local${ANSI_RESET}"
|
|
||||||
cat ${CACHEDIR}/RELEASE.local
|
|
||||||
218
travis/utils.sh
218
travis/utils.sh
@@ -1,218 +0,0 @@
|
|||||||
# Utility functions for Travis scripts in ci-scripts
|
|
||||||
#
|
|
||||||
# This file is sourced by the executable scripts
|
|
||||||
# CACHEDIR must be defined and existing before calling these functions
|
|
||||||
|
|
||||||
# Portable version of 'sed -i' (that MacOS doesn't provide)
|
|
||||||
|
|
||||||
# sedi (cmd, file)
|
|
||||||
# Do the equivalent of "sed -i cmd file"
|
|
||||||
sedi () {
|
|
||||||
cat $2 | sed "$1" > $2.tmp$$; mv -f $2.tmp$$ $2
|
|
||||||
}
|
|
||||||
|
|
||||||
# Setup ANSI Colors
|
|
||||||
export ANSI_RED="\033[31;1m"
|
|
||||||
export ANSI_GREEN="\033[32;1m"
|
|
||||||
export ANSI_YELLOW="\033[33;1m"
|
|
||||||
export ANSI_BLUE="\033[34;1m"
|
|
||||||
export ANSI_RESET="\033[0m"
|
|
||||||
export ANSI_CLEAR="\033[0K"
|
|
||||||
|
|
||||||
# Travis log fold control
|
|
||||||
# from https://github.com/travis-ci/travis-rubies/blob/build/build.sh
|
|
||||||
|
|
||||||
fold_start() {
|
|
||||||
echo -e "travis_fold:start:$1\\r${ANSI_YELLOW}$2${ANSI_RESET}"
|
|
||||||
}
|
|
||||||
|
|
||||||
fold_end() {
|
|
||||||
echo -en "travis_fold:end:$1\\r"
|
|
||||||
}
|
|
||||||
|
|
||||||
die() {
|
|
||||||
echo -e "${ANSI_RED}$1${ANSI_RESET}"
|
|
||||||
[ "$UTILS_UNITTEST" ] || exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# source_set(settings)
|
|
||||||
#
|
|
||||||
# Source a settings file (extension .set) found in SETUP_PATH
|
|
||||||
# May be called recursively (from within a settings file)
|
|
||||||
declare -a SEEN_SETUPS
|
|
||||||
source_set() {
|
|
||||||
local set_file=${1//[$'\r']}
|
|
||||||
local set_dir
|
|
||||||
local found=0
|
|
||||||
[ "${SETUP_PATH}" ] || die "Search path for setup files (SETUP_PATH) is empty"
|
|
||||||
for set_dir in ${SETUP_PATH//:/ }
|
|
||||||
do
|
|
||||||
if [ -e $set_dir/$set_file.set ]
|
|
||||||
then
|
|
||||||
if [[ " ${SEEN_SETUPS[@]} " =~ " $set_dir/$set_file.set " ]]
|
|
||||||
then
|
|
||||||
echo "Ignoring already included setup file $set_dir/$set_file.set"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
SEEN_SETUPS+=($set_dir/$set_file.set)
|
|
||||||
echo "Loading setup file $set_dir/$set_file.set"
|
|
||||||
local line
|
|
||||||
while read -r line
|
|
||||||
do
|
|
||||||
[ -z "$line" ] && continue
|
|
||||||
echo $line | grep -q "^#" && continue
|
|
||||||
if echo $line | grep -q "^include\W"
|
|
||||||
then
|
|
||||||
source_set $(echo $line | awk '{ print $2 }')
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if echo "$line" | grep -q "^\w\+="
|
|
||||||
then
|
|
||||||
IFS== read var value <<< "${line//[$'\r']}"
|
|
||||||
value=$(sed "s/^\(\"\)\(.*\)\1\$/\2/g" <<< "$value") # remove surrounding quotes
|
|
||||||
eval [ "\${$var}" ] || eval "$var=\$value"
|
|
||||||
fi
|
|
||||||
done < $set_dir/$set_file.set
|
|
||||||
found=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
[ $found -ne 0 ] || die "Setup file $set_file.set does not exist in SETUP_PATH search path ($SETUP_PATH)"
|
|
||||||
}
|
|
||||||
|
|
||||||
# update_release_local(varname, place)
|
|
||||||
# varname name of the variable to set in RELEASE.local
|
|
||||||
# place place (absolute path) of where variable should point to
|
|
||||||
#
|
|
||||||
# Manipulate RELEASE.local in the cache location:
|
|
||||||
# - replace "$varname=$place" line if it exists and has changed
|
|
||||||
# - otherwise add "$varname=$place" line and possibly move EPICS_BASE=... line to the end
|
|
||||||
update_release_local() {
|
|
||||||
local var=$1
|
|
||||||
local place=$2
|
|
||||||
local release_local=${CACHEDIR}/RELEASE.local
|
|
||||||
local updated_line="${var}=${place}"
|
|
||||||
|
|
||||||
local ret=0
|
|
||||||
[ -e ${release_local} ] && grep -q "${var}=" ${release_local} || ret=$?
|
|
||||||
if [ $ret -eq 0 ]
|
|
||||||
then
|
|
||||||
existing_line=$(grep "${var}=" ${release_local})
|
|
||||||
if [ "${existing_line}" != "${updated_line}" ]
|
|
||||||
then
|
|
||||||
sedi "s|${var}=.*|${var}=${place}|g" ${release_local}
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "$var=$place" >> ${release_local}
|
|
||||||
ret=0
|
|
||||||
grep -q "EPICS_BASE=" ${release_local} || ret=$?
|
|
||||||
if [ $ret -eq 0 ]
|
|
||||||
then
|
|
||||||
base_line=$(grep "EPICS_BASE=" ${release_local})
|
|
||||||
sedi '\|EPICS_BASE=|d' ${release_local}
|
|
||||||
echo ${base_line} >> ${release_local}
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# add_dependency(dep, tag)
|
|
||||||
#
|
|
||||||
# Add a dependency to the cache area:
|
|
||||||
# - check out (recursive if configured) in the CACHE area unless it already exists and the
|
|
||||||
# required commit has been built
|
|
||||||
# - Defaults:
|
|
||||||
# $dep_DIRNAME = lower case ($dep)
|
|
||||||
# $dep_REPONAME = lower case ($dep)
|
|
||||||
# $dep_REPOURL = GitHub / $dep_REPOOWNER (or $REPOOWNER or epics-modules) / $dep_REPONAME .git
|
|
||||||
# $dep_VARNAME = $dep
|
|
||||||
# $dep_DEPTH = 5
|
|
||||||
# $dep_RECURSIVE = 1/YES (0/NO to for a flat clone)
|
|
||||||
# - Add $dep_VARNAME line to the RELEASE.local file in the cache area (unless already there)
|
|
||||||
# - Add full path to $modules_to_compile
|
|
||||||
add_dependency() {
|
|
||||||
curdir="$PWD"
|
|
||||||
DEP=$1
|
|
||||||
TAG=$2
|
|
||||||
dep_lc=${DEP,,}
|
|
||||||
eval dirname=\${${DEP}_DIRNAME:=${dep_lc}}
|
|
||||||
eval reponame=\${${DEP}_REPONAME:=${dep_lc}}
|
|
||||||
eval repourl=\${${DEP}_REPOURL:="https://github.com/\${${DEP}_REPOOWNER:=${REPOOWNER:-epics-modules}}/${reponame}.git"}
|
|
||||||
eval varname=\${${DEP}_VARNAME:=${DEP}}
|
|
||||||
eval recursive=\${${DEP}_RECURSIVE:=1}
|
|
||||||
recursive=${recursive,,}
|
|
||||||
local recurse=""
|
|
||||||
[ "$recursive" != "0" -a "$recursive" != "no" ] && recurse="--recursive"
|
|
||||||
|
|
||||||
# determine if $DEP points to a valid release or branch
|
|
||||||
git ls-remote --quiet --exit-code --refs $repourl "$TAG" > /dev/null 2>&1 ||
|
|
||||||
die "$TAG is neither a tag nor a branch name for $DEP ($repourl)"
|
|
||||||
|
|
||||||
if [ -e $CACHEDIR/$dirname-$TAG ]
|
|
||||||
then
|
|
||||||
[ -e $CACHEDIR/$dirname-$TAG/built ] && BUILT=$(cat $CACHEDIR/$dirname-$TAG/built) || BUILT="never"
|
|
||||||
HEAD=$(cd "$CACHEDIR/$dirname-$TAG" && git log -n1 --pretty=format:%H)
|
|
||||||
if [ "$HEAD" != "$BUILT" ]
|
|
||||||
then
|
|
||||||
rm -fr $CACHEDIR/$dirname-$TAG
|
|
||||||
else
|
|
||||||
echo "Found $TAG of dependency $DEP in $CACHEDIR/$dirname-$TAG"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e $CACHEDIR/$dirname-$TAG ]
|
|
||||||
then
|
|
||||||
cd $CACHEDIR
|
|
||||||
eval depth=\${${DEP}_DEPTH:-"-1"}
|
|
||||||
case ${depth} in
|
|
||||||
-1 )
|
|
||||||
deptharg="--depth 5"
|
|
||||||
;;
|
|
||||||
0 )
|
|
||||||
deptharg=""
|
|
||||||
;;
|
|
||||||
* )
|
|
||||||
deptharg="--depth $depth"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
echo "Cloning $TAG of dependency $DEP into $CACHEDIR/$dirname-$TAG"
|
|
||||||
git clone --quiet $deptharg $recurse --branch "$TAG" $repourl $dirname-$TAG
|
|
||||||
( cd $dirname-$TAG && git log -n1 )
|
|
||||||
do_recompile=yes
|
|
||||||
# add MSI to Base 3.14
|
|
||||||
if [ $DEP == "BASE" ]
|
|
||||||
then
|
|
||||||
versionfile=$CACHEDIR/$dirname-$TAG/configure/CONFIG_BASE_VERSION
|
|
||||||
if [ -e ${versionfile} ] && grep -q "BASE_3_14=YES" ${versionfile}
|
|
||||||
then
|
|
||||||
echo "Adding MSI 1.7 to $CACHEDIR/$dirname-$TAG"
|
|
||||||
( cd $dirname-$TAG; patch -p1 < $SCRIPTDIR/../add-msi-to-314.patch )
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# fix non-base modules that do not include the .local files in configure/RELEASE
|
|
||||||
release=$CACHEDIR/$dirname-$TAG/configure/RELEASE
|
|
||||||
if [ -e $release ]
|
|
||||||
then
|
|
||||||
echo "-include \$(TOP)/../RELEASE.local" > $release
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# run hook
|
|
||||||
eval hook="\${${DEP}_HOOK}"
|
|
||||||
if [ "$hook" ]
|
|
||||||
then
|
|
||||||
if [ -x "$curdir/$hook" ]
|
|
||||||
then
|
|
||||||
echo "Running hook $hook in $CACHEDIR/$dirname-$TAG"
|
|
||||||
( cd $CACHEDIR/$dirname-$TAG; "$curdir/$hook" )
|
|
||||||
else
|
|
||||||
die "Hook script $hook is not executable or does not exist."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
HEAD=$(cd "$CACHEDIR/$dirname-$TAG" && git log -n1 --pretty=format:%H)
|
|
||||||
echo "$HEAD" > "$CACHEDIR/$dirname-$TAG/built"
|
|
||||||
cd "$curdir"
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ "${do_recompile}" ] && modules_to_compile="${modules_to_compile} $CACHEDIR/$dirname-$TAG"
|
|
||||||
|
|
||||||
update_release_local ${varname} $CACHEDIR/$dirname-$TAG
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user