99 Commits

Author SHA1 Message Date
Ralph Lange
ba5508b39e travis: update README
(fixes #19)
2020-05-20 18:59:45 +02:00
Ralph Lange
d5eab412b4 Readme: small updates and fixes 2020-05-20 18:42:04 +02:00
Ralph Lange
fff4249771 appveyor: fix VisualStudio parallel build for older Base versions 2020-05-14 18:18:50 +02:00
Ralph Lange
11e2f1852b Do not run 'make test-results' on Base 3.14
- also add tests for this
2020-05-13 12:35:38 +02:00
Ralph Lange
53e23e3684 appveyor: update README
- fixes #37
2020-05-11 09:10:42 +02:00
Ralph Lange
f0ce39129c appveyor: clean-up install; move 'prepare' to 'build_script'
fixes #38
2020-05-07 18:47:35 +02:00
Ralph Lange
1583d41197 Skip running test-results target if not defined 2020-05-05 11:59:25 +02:00
Ralph Lange
98bc1d8f1f Readme: add links to lower level readme pages, fix badge URL 2020-04-30 15:23:56 +02:00
Ralph Lange
4484a9c302 appveyor: explicitly set default build worker image
- also update paragraph on worker images to AppVeyor README
2020-04-30 12:00:15 +02:00
Ralph Lange
ebc4b5ca2a Readme: update references; advise to clear cache after update 2020-04-30 11:21:50 +02:00
Ralph Lange
26c268eb28 Merge pull request #36 from mdavidsaver:msi314
- updated with a required change to the AppVeyor script
2020-04-30 09:41:51 +02:00
Ralph Lange
02c1c016c4 example: add host-side expanded substitutions file
- checks availablity of a working MSI tool (see #20 and #36)
2020-04-30 09:34:04 +02:00
Michael Davidsaver
27a1224d6d Refresh MSI 3.14 patch to allow using it
- set MSI to $EPICS_BASE_BIN/msi
- make patch file more symmetrical (patch with -p1)
- closes #20 (again), closes #36
2020-04-30 09:19:03 +02:00
Ralph Lange
157a7af098 appveyor: move init part of debugging settings to init section 2020-04-29 16:58:12 +02:00
Ralph Lange
3c1e223dc7 appveyor: don't build for changes in .travis.yml 2020-04-28 15:31:59 +02:00
Ralph Lange
4f4f76a5db appveyor: log name of build worker image 2020-04-28 14:37:30 +02:00
Ralph Lange
e91a588370 travis: copy RELEASE.local to top of checkout
- closes #32
  (fix is in AppVeyor do.py script as per 88831439)
2020-04-27 11:34:01 +02:00
Ralph Lange
29e657d585 Run tests using parallel make (reducing build time) 2020-04-27 11:34:01 +02:00
Ralph Lange
4413c7d75e travis: fix build.sh (set EPICS_BASE correctly) for BASE=SELF 2020-04-24 19:16:12 +02:00
Ralph Lange
48b15417a6 travis: fix RTEMS cross builds for Base 3.15 2020-04-24 19:12:20 +02:00
Ralph Lange
1ac8bf7479 appveyor: fix behavior when BASE set in setup file 2020-04-24 16:16:50 +02:00
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
Ralph Lange
393a470d05 appveyor: add CMP doc to README 2020-04-22 10:25:18 +02:00
Ralph Lange
519b75aef2 appveyor: use pre-installed strawberry perl on vs2019 image 2020-04-22 10:25:18 +02:00
Ralph Lange
e8b01bf1a0 Merge pull request #29 from ralphlange:devel/add-appveyor
- closes #29, closes #6
2020-04-21 18:32:12 +02:00
Ralph Lange
79cc560594 appveyor: add minimal example file 2020-04-21 17:48:26 +02:00
Ralph Lange
32bdf84806 appveyor: improve RDP debugging options 2020-04-21 17:40:29 +02:00
Ralph Lange
070eab1473 appveyor: re-add recursive submodule update 2020-04-21 17:31:24 +02:00
Ralph Lange
11e0a60e3b appveyor: update example and README files 2020-04-08 15:56:00 +02:00
Ralph Lange
22d3a9db15 appveyor: add MSI 1.7 to any Base 3.14 dependency
- add test for patch being applied
2020-04-08 15:14:43 +02:00
Ralph Lange
a3532d3c55 appveyor: make cachedir configurable 2020-04-08 15:14:43 +02:00
Ralph Lange
b502aa7049 appveyor: update .appveyor.yml.example-full 2020-04-08 15:14:43 +02:00
Ralph Lange
d8e53e84fd appveyor: CC -> CMP for compiler toolchain setting 2020-04-08 15:14:43 +02:00
Ralph Lange
16bb305d24 appveyor: add setup_for_build() tests 2020-04-08 15:14:43 +02:00
Michael Davidsaver
6d0f34ac65 appveyor: do --add-path 2020-04-08 15:14:43 +02:00
Michael Davidsaver
2fd1f9ec16 appveyor: show test-results after .tap upload 2020-04-08 15:14:43 +02:00
Ralph Lange
ca74a8424b appveyor: create jobs for base 7.0, 3.15, 3.14
- default Base 7.0 / recursive = no
- add base 3.15 and 3.14 on vs2019
2020-04-08 15:14:43 +02:00
Ralph Lange
ddf6b961b1 appveyor: use VV to set logging level and silence dependency builds 2020-04-08 15:14:43 +02:00
Ralph Lange
e5af5c2bfe appveyor: print dependency table and RELEASE.local 2020-04-08 15:14:43 +02:00
Ralph Lange
d02dda5775 appveyor: add keys to call_make(); make test-results 2020-04-08 15:14:43 +02:00
Ralph Lange
4a6a979f89 appveyor: choco install re2c (for the sequencer) 2020-04-08 15:14:43 +02:00
Ralph Lange
81bf29b8ca appveyor: fix modlist() to allow MODULES in setup files 2020-04-08 15:14:43 +02:00
Ralph Lange
a8321aff92 appveyor: add binary locations to PATH for tools and DLLs 2020-04-08 15:14:42 +02:00
Michael Davidsaver
48832354da appveyor: export MAKE executable to environment
Save user scripts from having to compute
2020-04-08 15:14:42 +02:00
Michael Davidsaver
dbfba732fd appveyor: build action accepts arguments (passed on to make) 2020-04-08 15:14:42 +02:00
Ralph Lange
2f8f4e7fb1 appveyor: add tests for _RECURSIVE and _DEPTH 2020-04-08 15:14:42 +02:00
Ralph Lange
e96f77d8b1 appveyor: fix _DEPTH option 2020-04-08 15:14:42 +02:00
Michael Davidsaver
e14b97b18e appveyor: fix _RECURSIVE option 2020-04-08 15:14:42 +02:00
Michael Davidsaver
5d4fdec627 appveyor: add newlines when writing to CONFIG_SITE 2020-04-08 15:14:42 +02:00
Ralph Lange
fc141f874a appveyor: run unit tests via matrix 'only' setting 2020-04-08 15:14:42 +02:00
Michael Davidsaver
a006293461 appveyor: fixup argument parsing 2020-04-08 15:14:42 +02:00
Ralph Lange
b7d505c2e2 appveyor: use '/' in RELEASE.local paths 2020-04-08 15:14:42 +02:00
Ralph Lange
eceeab66cf appveyor: test full matrix (no 64bit builds on <= vs2012) 2020-04-08 15:14:42 +02:00
Ralph Lange
e50271765f appveyor: add build cache for external tools 2020-04-08 15:14:42 +02:00
Ralph Lange
d9e1df2367 appveyor: add HOST_ARCH suffix for -debug and -static 2020-04-08 15:14:42 +02:00
Ralph Lange
7881b3527c appveyor: fix for older vcvars.bat manipulating PLATFORM 2020-04-08 15:14:42 +02:00
Ralph Lange
0ac6c96e2a appveyor: add call_make() wrapper, forward returncode 2020-04-08 15:14:41 +02:00
Ralph Lange
eb5dd2a86c appveyor: read Base location from RELEASE.local 2020-04-08 15:14:41 +02:00
Ralph Lange
b3efae2451 appveyor: improve logging / print formatting 2020-04-08 15:14:41 +02:00
Ralph Lange
9c58196b6d appveyor: use Base 3.15 for tests to speed up build 2020-04-08 15:14:41 +02:00
Ralph Lange
421fe54fe6 appveyor: move environment setting into setup_for_build() 2020-04-08 15:14:41 +02:00
Ralph Lange
11f5c94236 appveyor: use r'' string constants for all Windows paths 2020-04-08 15:14:41 +02:00
Ralph Lange
ff14d5ceb4 appveyor: adding make calls for 'build' and 'test' actions 2020-04-08 15:14:41 +02:00
Ralph Lange
11cb469fb9 appveyor: silence Perl relocation batch script 2020-04-08 15:14:41 +02:00
Ralph Lange
0ae628673c appveyor: reduce number of SET=test00 runs 2020-04-08 15:14:41 +02:00
Ralph Lange
e11632798a appveyor: print make version 2020-04-08 15:14:41 +02:00
Ralph Lange
24a70882d0 appveyor: use parallel make (except for Base 3.14) 2020-04-08 15:14:41 +02:00
Ralph Lange
430a699d7f appveyor: add mingw definitions 2020-04-08 15:14:41 +02:00
Ralph Lange
c056b5ad0f appveyor: only grep 'vcvarsall.bat' in VS install list 2020-04-08 15:14:41 +02:00
Ralph Lange
a88300bdd7 appveyor: put strawberry perl in the PATH 2020-04-08 15:14:41 +02:00
Ralph Lange
85f570ac09 appveyor: set EPICS_HOST_ARCH 2020-04-08 15:14:41 +02:00
Ralph Lange
d5c419bc8e appveyor: don't run TestVCVars unless on Windows 2020-04-08 15:14:40 +02:00
Ralph Lange
08cdff9495 appveyor: don't run host_info() twice for compile tests 2020-04-08 15:14:40 +02:00
Ralph Lange
d052350738 appveyor: add complete_setup() and do a complete log 2020-04-08 15:14:40 +02:00
Ralph Lange
b53468e50e appveyor: make modlist a function 2020-04-08 15:14:40 +02:00
Michael Davidsaver
e47e35bae4 appveyor: add do_exec() action; 'make' dependencies 2020-04-08 15:14:40 +02:00
Michael Davidsaver
6071fdf198 appveyor: minor fixes
- using 'place' as both a local and a global is confusing
- use "with open()" instead of "open() / close()"
2020-04-08 15:14:40 +02:00
Michael Davidsaver
00f003afa5 appveyor: add with_vcvars to read VS environment settings
- writes and calls a "trampoline" batch that calls the
  appropriate "vcvarsall" script, then calls back into python
2020-04-08 15:14:40 +02:00
Michael Davidsaver
c3918cdbaa appveyor: add printing host_info (python settings, VS versions) 2020-04-08 15:14:40 +02:00
Michael Davidsaver
e2399dc7f3 appveyor: avoid chdir, use 'cwd' key instead 2020-04-08 15:14:40 +02:00
Ralph Lange
5d17fdf98d appveyor: configure EPICS build; install make and Perl 2020-04-08 15:14:40 +02:00
Ralph Lange
249db7db22 appveyor: add cloning the dependency modules to 'prepare' action 2020-04-08 15:14:40 +02:00
Ralph Lange
4dcfbb2079 appveyor: add default repo URL test 2020-04-08 15:14:40 +02:00
Ralph Lange
9742c5f9c6 appveyor: use portable os.chdir() instead of "cd" 2020-04-08 15:14:40 +02:00
Ralph Lange
2847f78ab2 appveyor: add error handler to fix shutil.rmtree on Windows 2020-04-08 15:14:39 +02:00
Ralph Lange
28aeda558b appveyor: use decode() on git hashes 2020-04-08 15:14:39 +02:00
Ralph Lange
2dfa55420f appveyor-test: always chdir into builddir 2020-04-08 15:14:39 +02:00
Ralph Lange
22d0feaa05 appveyor: enable debugging 2020-04-08 15:14:39 +02:00
Ralph Lange
cd0becff06 appveyor: add add_dependency() 2020-04-08 15:14:39 +02:00
Ralph Lange
355a5c2fb7 appveyor: fix logging in do.py 2020-04-08 15:14:39 +02:00
Ralph Lange
139b491614 appveyor: improve tests (capture stdout; use dictionaries) 2020-04-08 15:14:39 +02:00
Ralph Lange
b15d9bb62e appveyor: first version (source_set, update_release_local) 2020-04-08 15:14:39 +02:00
Ralph Lange
761152babe appveyor: first version 2020-04-08 15:14:39 +02:00
Michael Davidsaver
a34bb7d2b2 travis: always show test-results
even if one of the tests crashes
2020-04-08 14:52:06 +02:00
Ralph Lange
94fdfbe802 travis: fix MSI patch file location 2020-04-08 14:50:06 +02:00
15 changed files with 1792 additions and 36 deletions

165
.appveyor.yml Normal file
View File

@@ -0,0 +1,165 @@
# .appveyor.yml for testing EPICS Base ci-scripts
# (see: https://github.com/epics-base/ci-scripts)
# Note:
# Paths to scripts are different in this test configuration
# (your module has one more directory level: .ci)
# Ralph Lange <ralph.lange@gmx.de>
# Copyright (c) 2020 ITER Organization
#---------------------------------#
# build cache #
#---------------------------------#
cache:
- C:\Users\appveyor\.tools -> appveyor\do.py
#---------------------------------#
# repository cloning #
#---------------------------------#
# Called at very beginning, before repo cloning
init:
# Set autocrlf to make batch files work
- git config --global core.autocrlf true
# print the connection info for RDP connections (see 'debugging' below)
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# Set clone depth (do not fetch complete history)
clone_depth: 50
# Skipping commits affecting only specific files
skip_commits:
files:
- 'documentation/*'
- 'templates/*'
- '**/*.html'
- '**/*.md'
- '.travis.yml'
#---------------------------------#
# additional packages #
#---------------------------------#
install:
# fetch submodules (like ci-scripts)
- cmd: git submodule update --init --recursive
# for the sequencer
- cinst re2c
#---------------------------------#
# build matrix configuration #
#---------------------------------#
# Default build worker image
image: Visual Studio 2015
# Build Configurations: dll/static, regular/debug
configuration:
- dynamic
- static
- dynamic-debug
- static-debug
# Environment variables: compiler toolchain, base version, setup file, ...
environment:
# common / default variables for all jobs
SETUP_PATH: .:.ci
SET: test01
BASE_RECURSIVE: NO
VV: 1
matrix:
- CMP: vs2019
SET: test00
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- CMP: mingw
- CMP: vs2019
VV: 0
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- CMP: vs2019
BASE: 3.15
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- CMP: vs2019
BASE: 3.14
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- CMP: vs2017
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- CMP: vs2015
- CMP: vs2013
- CMP: vs2012
- CMP: vs2010
- CMP: vs2008
# Platform: architecture
platform:
- x86
- x64
# Matrix configuration: allow specific failing jobs
matrix:
exclude:
# Run test00 only once: x64 dynamic
- platform: x86
SET: test00
- configuration: static
SET: test00
- configuration: dynamic-debug
SET: test00
- configuration: static-debug
SET: test00
# VS2012 and older installs don't have the 64 bit compiler
- platform: x64
CMP: vs2012
- platform: x64
CMP: vs2010
- platform: x64
CMP: vs2008
# Run test script for unit tests (SET = test00)
for:
-
matrix:
only:
- SET: test00
build_script:
- cmd: python appveyor-test.py
test_script:
- cmd: echo Tests have been run in the build phase
#---------------------------------#
# building & testing #
#---------------------------------#
build_script:
- cmd: python appveyor/do.py prepare
- cmd: python appveyor/do.py build
test_script:
- cmd: python appveyor/do.py test
#---------------------------------#
# debugging #
#---------------------------------#
## if you want to connect by remote desktop to a failed build, uncomment these lines
## note that you will need to connect within the usual build timeout limit (60 minutes)
## so you may want to adjust the build matrix above to just build the one of interest
#on_failure:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
#---------------------------------#
# notifications #
#---------------------------------#
notifications:
# - provider: Email
# to:
# - core-talk@aps.anl.gov
# on_build_success: false
# - provider: GitHubPullRequest

View File

@@ -1,5 +1,6 @@
<a target="_blank" href="http://semver.org">![Version][badge.version]</a>
<a target="_blank" href="https://travis-ci.org/epics-base/ci-scripts">![Travis status][badge.travis]</a>
<a target="_blank" href="https://ci.appveyor.com/project/epics-base/ci-scripts">![AppVeyor status][badge.appveyor]</a>
# Continuous Integration Scripts for EPICS Modules
@@ -48,19 +49,29 @@ example.
## Supported CI Services
### Travis-CI
### [Travis-CI](https://travis-ci.org/)
- Use different compilers (gcc, clang)
- Use different gcc versions
- Cross-compile for Windows 32bit and 64bit using MinGW and WINE
- Cross-compile for RTEMS 4.9 and 4.10 (Base >= 3.16.2)
- Compile on MacOS
- Built dependencies are cached (for faster builds)
See specific **[ci-scripts on Travis-CI README](travis/README.md)** for more details.
### [AppVeyor](https://www.appveyor.com/)
- Use different compilers (Visual Studio, MinGW)
- Use different Visual Studio versions: \
2008, 2010, 2012, 2013, 2015, 2017, 2019
- Compile for Windows 32bit and 64bit
See specific **[ci-scripts on AppVeyor README](appveyor/README.md)** for more details.
## How to Use the CI-Scripts
1. Get an account on a supported CI service provider platform.
(e.g. [Travis-CI](https://travis-ci.org/),
AppVeyor, Azure Pipelines...)
[AppVeyor](https://www.appveyor.com/), Azure Pipelines...)
(More details in the specific README of the subdirectory.)
@@ -79,10 +90,10 @@ example.
BASE=3.15
ASYN=R4-34
SNCSEQ=R2-2-7
SNCSEQ=R2-2-8
```
will compile against the EPICS Base 3.15 branch, the Sequencer
release 2.2.7 and release 4.34 of asyn.
release 2.2.8 and release 4.34 of asyn.
(Any settings can be overridden from the specific job configuration
in e.g. `.travis.yml`.)
@@ -187,19 +198,30 @@ specific job will run the job with high verbosity,
printing every command as it is being executed and switching the dependency
builds to higher verbosity.
For local debugging, you may set `CACHEDIR` to change the location for the
dependency builds. [default is `$HOME/.cache`]
For debugging on your local machine, you may set `CACHEDIR` to change the
location for the dependency builds. [default is `$HOME/.cache`]
## References: EPICS Modules Using ci-scripts
EPICS Base: [pvData](https://github.com/epics-base/pvDataCPP),
[EPICS Base](https://github.com/epics-base/epics-base) and its submodules
[pvData](https://github.com/epics-base/pvDataCPP),
[pvAccess](https://github.com/epics-base/pvAccessCPP),
[pva2pva](https://github.com/epics-base/pva2pva)
EPICS Modules: [PCAS](https://github.com/epics-modules/pcas),
[ASYN](https://github.com/epics-modules/asyn)
EPICS Modules:
[ASYN](https://github.com/epics-modules/asyn),
[devlib2](https://github.com/epics-modules/devlib2),
[ecmc](https://github.com/epics-modules/ecmc),
[ip](https://github.com/epics-modules/ip),
[lua](https://github.com/epics-modules/lua),
[MCoreUtils](https://github.com/epics-modules/MCoreUtils),
[modbus](https://github.com/epics-modules/modbus),
[motor](https://github.com/epics-modules/motor),
[PCAS](https://github.com/epics-modules/pcas),
[sscan](https://github.com/epics-modules/sscan),
[vac](https://github.com/epics-modules/vac)
ESS: [Motor driver (model 3) for EtherCAT Motion Controller][ref.ethercatmc]
ESS: [EtherCAT MC Motor Driver][ref.ethercatmc]
ITER: [OPC UA Device Support](https://github.com/ralphlange/opcua)
@@ -214,22 +236,27 @@ This will make all builds (not just for your module) verbose.
Update the submodule in `.ci` first, then change your CI configuration
(if needed) and commit both to your module. E.g., to update your Travis
setup to release 2.1.0 of ci-scripts:
setup to release 2.3.5 of ci-scripts:
```bash
cd .ci
git pull origin v2.1.0
git pull origin v2.3.5
cd -
git add .ci
# if needed:
edit .travis.yml
git add .travis.yml
git commit -m "Update ci-scripts submodule to v2.1.0"
git commit -m "Update ci-scripts submodule to v2.3.5"
```
Check the example configuration files inside ci-scripts (and their
changes) to see what might be needed and/or interesting to change
in your configuration.
Depending on the changes contained in the ci-scripts update, it might
be advisable to clear the CI caches after updating ci-scripts. E.g.,
a change in setting up EPICS Base will not be applied if Base is found
in the cache.
**Why does running the scripts locally on my MacOS machine fail?**
The ci-scripts for Travis-CI require Bash version 4.
@@ -266,6 +293,7 @@ in file LICENSE that is included with this distribution.
<!-- Links -->
[badge.version]: https://badge.fury.io/gh/epics-base%2Fci-scripts.svg
[badge.travis]: https://travis-ci.org/epics-base/ci-scripts.svg?branch=master
[badge.appveyor]: https://ci.appveyor.com/api/projects/status/8b578alg974axvux?svg=true
[reddit.bash]: https://www.reddit.com/r/bash/comments/393oqv/why_is_the_version_of_bash_included_in_os_x_so_old/

View File

@@ -1,7 +1,39 @@
diff -ruN ../3.14/src/dbtools/Makefile ./src/dbtools/Makefile
--- ../3.14/src/dbtools/Makefile 2017-03-16 21:37:51.278140900 +0100
+++ ./src/dbtools/Makefile 2020-04-06 12:40:51.723550846 +0200
@@ -11,6 +11,11 @@
diff --git a/config/RULES.Db b/config/RULES.Db
index b4946c7aa..90b76ed08 100644
--- a/config/RULES.Db
+++ b/config/RULES.Db
@@ -12,11 +12,7 @@
#
MAKEBPT = $(EPICS_BASE_HOST_BIN)/makeBpt$(EXE)
-ifndef MSI
-# Tool from R3.14 extensions bin, R3.13 extensions bin, or user path
-MSI = $(firstword $(wildcard $(EPICS_EXTENSIONS_HOST_BIN)/msi$(HOSTEXE) \
- $(EPICS_EXTENSIONS)/bin/$(HOST_ARCH)/msi$(HOSTEXE)) msi$(HOSTEXE))
-endif
+MSI = $(EPICS_BASE_HOST_BIN)/msi$(HOSTEXE)
DBEXPAND = $(EPICS_BASE_HOST_BIN)/dbExpand$(EXE)
DBST = dbst
diff --git a/configure/CONFIG_BASE b/configure/CONFIG_BASE
index 7ee5a5b89..9a9793093 100644
--- a/configure/CONFIG_BASE
+++ b/configure/CONFIG_BASE
@@ -112,8 +112,5 @@ ifndef DBST
DBST = dbst
endif
-ifndef MSI
-MSI = msi
-endif
-
+MSI = $(EPICS_BASE_HOST_BIN)/msi$(HOSTEXE)
diff --git a/src/dbtools/Makefile b/src/dbtools/Makefile
index 38ed52c9e..8655a5337 100644
--- a/src/dbtools/Makefile
+++ b/src/dbtools/Makefile
@@ -11,6 +11,11 @@ TOP=../..
include $(TOP)/configure/CONFIG
@@ -13,9 +45,11 @@ diff -ruN ../3.14/src/dbtools/Makefile ./src/dbtools/Makefile
INC += dbLoadTemplate.h
INC += dbtoolsIocRegister.h
diff -ruN ../3.14/src/dbtools/msi.c ./src/dbtools/msi.c
--- ../3.14/src/dbtools/msi.c 1970-01-01 01:00:00.000000000 +0100
+++ ./src/dbtools/msi.c 2013-05-13 19:00:43.000000000 +0200
diff --git a/src/dbtools/msi.c b/src/dbtools/msi.c
new file mode 100644
index 000000000..525d4f25b
--- /dev/null
+++ b/src/dbtools/msi.c
@@ -0,0 +1,798 @@
+/*************************************************************************\
+* Copyright (c) 2002 The University of Chicago, as Operator of Argonne

437
appveyor-test.py Normal file
View File

@@ -0,0 +1,437 @@
#!/usr/bin/env python
"""Module ci-scripts AppVeyor unit tests
"""
# SET=test00 in the environment (.appveyor.yml) runs the tests in this script
# all other jobs are started as compile jobs
from __future__ import print_function
import sys, os, shutil, fileinput
import distutils.util
import re
import subprocess as sp
import unittest
import logging
from argparse import Namespace
builddir = os.getcwd()
def find_in_file(regex, filename):
file = open (filename, "r")
for line in file:
if re.search(regex, line):
return True
return False
def getStringIO():
if (sys.version_info > (3, 0)):
import io
return io.StringIO()
else:
import StringIO
return StringIO.StringIO()
sys.path.append('appveyor')
import do
# we're working with tags (detached heads) a lot: suppress advice
do.call_git(['config', '--global', 'advice.detachedHead', 'false'])
class TestSourceSet(unittest.TestCase):
def setUp(self):
os.environ['SETUP_PATH'] = '.:appveyor'
if 'BASE' in os.environ:
del os.environ['BASE']
do.clear_lists()
os.chdir(builddir)
def test_EmptySetupDirsPath(self):
del os.environ['SETUP_PATH']
self.assertRaisesRegexp(NameError, '\(SETUP_PATH\) is empty', do.source_set, 'test01')
def test_InvalidSetupName(self):
self.assertRaisesRegexp(NameError, 'does not exist in SETUP_PATH', do.source_set, 'xxdoesnotexistxx')
def test_ValidSetupName(self):
capturedOutput = getStringIO()
sys.stdout = capturedOutput
do.source_set('test01')
sys.stdout = sys.__stdout__
self.assertEqual(do.setup['BASE'], '7.0', 'BASE was not set to \'7.0\'')
def test_SetupDoesNotOverridePreset(self):
os.environ['BASE'] = 'foo'
capturedOutput = getStringIO()
sys.stdout = capturedOutput
do.source_set('test01')
sys.stdout = sys.__stdout__
self.assertEqual(do.setup['BASE'], 'foo',
'Preset BASE was overridden by test01 setup (expected \'foo\' got {0})'
.format(do.setup['BASE']))
def test_IncludeSetupFirstSetWins(self):
capturedOutput = getStringIO()
sys.stdout = capturedOutput
do.source_set('test02')
sys.stdout = sys.__stdout__
self.assertEqual(do.setup['BASE'], 'foo',
'BASE set in test02 was overridden by test01 setup (expected \'foo\' got {0})'
.format(do.setup['BASE']))
self.assertEqual(do.setup['FOO'], 'bar', 'Setting of single word does not work')
self.assertEqual(do.setup['FOO2'], 'bar bar2', 'Setting of multiple words does not work')
self.assertEqual(do.setup['FOO3'], 'bar bar2', 'Indented setting of multiple words does not work')
self.assertEqual(do.setup['SNCSEQ'], 'R2-2-7', 'Setup test01 was not included')
def test_DoubleIncludeGetsIgnored(self):
capturedOutput = getStringIO()
sys.stdout = capturedOutput
do.source_set('test03')
sys.stdout = sys.__stdout__
self.assertRegexpMatches(capturedOutput.getvalue(), 'Ignoring already included setup file')
class TestUpdateReleaseLocal(unittest.TestCase):
release_local = os.path.join(do.cachedir, 'RELEASE.local')
def setUp(self):
if os.path.exists(self.release_local):
os.remove(self.release_local)
os.chdir(builddir)
def test_SetModule(self):
do.update_release_local('MOD1', '/foo/bar')
found = 0
for line in fileinput.input(self.release_local, inplace=1):
if 'MOD1=' in line:
self.assertEqual(line.strip(), 'MOD1=/foo/bar', 'MOD1 not set correctly')
found += 1
fileinput.close()
self.assertEqual(found, 1, 'MOD1 not written once to RELEASE.local (found {0})'.format(found))
def test_SetBaseAndMultipleModules(self):
do.update_release_local('EPICS_BASE', '/bar/foo')
do.update_release_local('MOD1', '/foo/bar')
do.update_release_local('MOD2', '/foo/bar2')
do.update_release_local('MOD1', '/foo/bar1')
found = {}
foundat = {}
for line in fileinput.input(self.release_local, inplace=1):
if 'MOD1=' in line:
self.assertEqual(line.strip(), 'MOD1=/foo/bar1',
'MOD1 not set correctly (expected \'MOD1=/foo/bar1\' found \'{0}\')'
.format(line))
if 'mod1' in found:
found['mod1'] += 1
else:
found['mod1'] = 1
foundat['mod1'] = fileinput.filelineno()
if 'MOD2=' in line:
self.assertEqual(line.strip(), 'MOD2=/foo/bar2',
'MOD2 not set correctly (expected \'MOD2=/foo/bar2\' found \'{0}\')'
.format(line))
if 'mod2' in found:
found['mod2'] += 1
else:
found['mod2'] = 1
foundat['mod2'] = fileinput.filelineno()
if 'EPICS_BASE=' in line:
self.assertEqual(line.strip(), 'EPICS_BASE=/bar/foo',
'EPICS_BASE not set correctly (expected \'EPICS_BASE=/bar/foo\' found \'{0}\')'
.format(line))
if 'base' in found:
found['base'] += 1
else:
found['base'] = 1
foundat['base'] = fileinput.filelineno()
fileinput.close()
self.assertEqual(found['mod1'], 1,
'MOD1 does not appear once in RELEASE.local (found {0})'.format(found['mod1']))
self.assertEqual(found['mod2'], 1,
'MOD2 does not appear once in RELEASE.local (found {0})'.format(found['mod2']))
self.assertEqual(found['base'], 1,
'EPICS_BASE does not appear once in RELEASE.local (found {0})'.format(found['base']))
self.assertGreater(foundat['base'], foundat['mod2'],
'EPICS_BASE (line {0}) appears before MOD2 (line {1})'
.format(foundat['base'], foundat['mod2']))
self.assertGreater(foundat['mod2'], foundat['mod1'],
'MOD2 (line {0}) appears before MOD1 (line {1})'.format(foundat['mod2'], foundat['mod1']))
class TestAddDependencyUpToDateCheck(unittest.TestCase):
hash_3_15_6 = "ce7943fb44beb22b453ddcc0bda5398fadf72096"
location = os.path.join(do.cachedir, 'base-R3.15.6')
licensefile = os.path.join(location, 'LICENSE')
checked_file = os.path.join(location, 'checked_out')
release_file = os.path.join(location, 'configure', 'RELEASE')
def setUp(self):
os.environ['SETUP_PATH'] = '.:appveyor'
if os.path.exists(self.location):
shutil.rmtree(self.location, onerror=do.remove_readonly)
do.clear_lists()
os.chdir(builddir)
do.source_set('defaults')
do.complete_setup('BASE')
def test_MissingDependency(self):
do.setup['BASE'] = 'R3.15.6'
do.add_dependency('BASE')
self.assertTrue(os.path.exists(self.licensefile), 'Missing dependency was not checked out')
self.assertTrue(os.path.exists(self.checked_file), 'Checked-out commit marker was not written')
with open(self.checked_file, 'r') as bfile:
checked_out = bfile.read().strip()
bfile.close()
self.assertEqual(checked_out, self.hash_3_15_6,
'Wrong commit of dependency checked out (expected=\"{0}\" found=\"{1}\")'
.format(self.hash_3_15_6, checked_out))
self.assertFalse(find_in_file('include \$\(TOP\)/../RELEASE.local', self.release_file),
'RELEASE in Base includes TOP/../RELEASE.local')
def test_UpToDateDependency(self):
do.setup['BASE'] = 'R3.15.6'
do.add_dependency('BASE')
os.remove(self.licensefile)
do.add_dependency('BASE')
self.assertFalse(os.path.exists(self.licensefile), 'Check out on top of existing up-to-date dependency')
def test_OutdatedDependency(self):
do.setup['BASE'] = 'R3.15.6'
do.add_dependency('BASE')
os.remove(self.licensefile)
with open(self.checked_file, "w") as fout:
print('XXX not the right hash XXX', file=fout)
fout.close()
do.add_dependency('BASE')
self.assertTrue(os.path.exists(self.licensefile), 'No check-out on top of out-of-date dependency')
with open(self.checked_file, 'r') as bfile:
checked_out = bfile.read().strip()
bfile.close()
self.assertEqual(checked_out, self.hash_3_15_6,
"Wrong commit of dependency checked out (expected='{0}' found='{1}')"
.format(self.hash_3_15_6, checked_out))
def is_shallow_repo(place):
check = sp.check_output(['git', 'rev-parse', '--is-shallow-repository'], cwd=place).strip()
if check == '--is-shallow-repository':
if os.path.exists(os.path.join(place, '.git', 'shallow')):
check = 'true'
else:
check = 'false'
return check == 'true'
class TestAddDependencyOptions(unittest.TestCase):
location = os.path.join(do.cachedir, 'mcoreutils-master')
testfile = os.path.join(location, '.ci', 'LICENSE')
def setUp(self):
os.environ['SETUP_PATH'] = '.:appveyor'
if os.path.exists(do.cachedir):
shutil.rmtree(do.cachedir, onerror=do.remove_readonly)
do.clear_lists()
do.source_set('defaults')
do.complete_setup('MCoreUtils')
do.setup['MCoreUtils'] = 'master'
def test_Default(self):
do.add_dependency('MCoreUtils')
self.assertTrue(os.path.exists(self.testfile),
'Submodule (.ci) not checked out recursively (requested: default=YES')
self.assertTrue(is_shallow_repo(self.location),
'Module not checked out shallow (requested: default=5)')
def test_SetRecursiveNo(self):
do.setup['MCoreUtils_RECURSIVE'] = 'NO'
do.add_dependency('MCoreUtils')
self.assertFalse(os.path.exists(self.testfile), 'Submodule (.ci) checked out recursively')
def test_SetDepthZero(self):
do.setup['MCoreUtils_DEPTH'] = '0'
do.add_dependency('MCoreUtils')
self.assertFalse(is_shallow_repo(self.location), 'Module checked out shallow (requested full)')
def test_SetDepthThree(self):
do.setup['MCoreUtils_DEPTH'] = '3'
do.add_dependency('MCoreUtils')
self.assertTrue(is_shallow_repo(self.location),
'Module not checked out shallow (requested: default=5)')
def test_AddMsiTo314(self):
do.complete_setup('BASE')
do.setup['BASE'] = 'R3.14.12.1'
msifile = os.path.join(do.cachedir, 'base-R3.14.12.1', 'src', 'dbtools', 'msi.c')
do.add_dependency('BASE')
self.assertTrue(os.path.exists(msifile), 'MSI was not added to Base 3.14')
def repo_access(dep):
do.set_setup_from_env(dep)
do.setup.setdefault(dep + "_DIRNAME", dep.lower())
do.setup.setdefault(dep + "_REPONAME", dep.lower())
do.setup.setdefault('REPOOWNER', 'epics-modules')
do.setup.setdefault(dep + "_REPOOWNER", do.setup['REPOOWNER'])
do.setup.setdefault(dep + "_REPOURL", 'https://github.com/{0}/{1}.git'
.format(do.setup[dep + '_REPOOWNER'], do.setup[dep + '_REPONAME']))
with open(os.devnull, 'w') as devnull:
return do.call_git(['ls-remote', '--quiet', '--heads', do.setup[dep + '_REPOURL']],
stdout=devnull, stderr=devnull)
class TestDefaultModuleURLs(unittest.TestCase):
modules = ['BASE', 'PVDATA', 'PVACCESS', 'NTYPES',
'SNCSEQ', 'STREAM', 'ASYN', 'STD',
'CALC', 'AUTOSAVE', 'BUSY', 'SSCAN',
'IOCSTATS', 'MOTOR', 'IPAC', ]
def setUp(self):
os.environ['SETUP_PATH'] = '.:appveyor'
do.clear_lists()
os.chdir(builddir)
do.source_set('defaults')
def test_Repos(self):
for mod in self.modules:
self.assertEqual(repo_access(mod), 0, 'Defaults for {0} do not point to a valid git repository at {1}'
.format(mod, do.setup[mod + '_REPOURL']))
class TestVCVars(unittest.TestCase):
def test_vcvars(self):
if ('CMP' in os.environ and os.environ['CMP'] in ('mingw',)) \
or distutils.util.get_platform() != "win32":
raise unittest.SkipTest()
do.with_vcvars('env')
class TestSetupForBuild(unittest.TestCase):
configuration = os.environ['CONFIGURATION']
platform = os.environ['PLATFORM']
cc = os.environ['CMP']
args = Namespace(paths=[])
do.building_base = True
def setUp(self):
os.environ.pop('EPICS_HOST_ARCH', None)
do.clear_lists()
def tearDown(self):
os.environ['CONFIGURATION'] = self.configuration
os.environ['PLATFORM'] = self.platform
os.environ['CMP'] = self.cc
def test_AddPathsOption(self):
os.environ['FOOBAR'] = 'BAR'
args = Namespace(paths=['/my/{FOOBAR}/dir', '/my/foobar'])
do.setup_for_build(args)
self.assertTrue(re.search('/my/BAR/dir', os.environ['PATH']), 'Expanded path not in PATH')
self.assertTrue(re.search('/foobar', os.environ['PATH']), 'Plain path not in PATH')
os.environ.pop('FOOBAR', None)
def test_HostArchConfiguration(self):
for config in ['dynamic', 'dynamic-debug', 'static', 'static-debug']:
os.environ['CONFIGURATION'] = config
do.setup_for_build(self.args)
self.assertTrue('EPICS_HOST_ARCH' in os.environ,
'EPICS_HOST_ARCH is not set for Configuration={0}'.format(config))
if re.search('static', config):
self.assertTrue(re.search('-static$', os.environ['EPICS_HOST_ARCH']),
'EPICS_HOST_ARCH is not -static for Configuration={0}'.format(config))
self.assertFalse(re.search('debug', os.environ['EPICS_HOST_ARCH']),
'EPICS_HOST_ARCH is -debug for Configuration={0}'.format(config))
elif re.search('debug', config):
self.assertFalse(re.search('static', os.environ['EPICS_HOST_ARCH']),
'EPICS_HOST_ARCH is -static for Configuration={0}'.format(config))
self.assertTrue(re.search('-debug$', os.environ['EPICS_HOST_ARCH']),
'EPICS_HOST_ARCH is not -debug for Configuration={0}'.format(config))
else:
self.assertFalse(re.search('static', os.environ['EPICS_HOST_ARCH']),
'EPICS_HOST_ARCH is -static for Configuration={0}'.format(config))
self.assertFalse(re.search('debug', os.environ['EPICS_HOST_ARCH']),
'EPICS_HOST_ARCH is -debug for Configuration={0}'.format(config))
def test_HostArchPlatform(self):
for platform in ['x86', 'x64', 'X64']:
for cc in ['vs2019', 'mingw']:
os.environ['PLATFORM'] = platform
os.environ['CMP'] = cc
os.environ['CONFIGURATION'] = 'dynamic'
do.setup_for_build(self.args)
self.assertTrue('EPICS_HOST_ARCH' in os.environ,
'EPICS_HOST_ARCH is not set for {0} / {1}'.format(cc, platform))
if platform == 'x86':
self.assertTrue(re.search('^win32-x86', os.environ['EPICS_HOST_ARCH']),
'EPICS_HOST_ARCH is not win32-x86 for {0} / {1}'.format(cc, platform))
else:
self.assertTrue(re.search('^windows-x64', os.environ['EPICS_HOST_ARCH']),
'EPICS_HOST_ARCH is not windows-x64 for {0} / {1}'.format(cc, platform))
if cc == 'mingw':
self.assertTrue(re.search('-mingw$', os.environ['EPICS_HOST_ARCH']),
'EPICS_HOST_ARCH is not -mingw for {0} / {1}'.format(cc, platform))
if platform == 'x86':
pattern = 'mingw32'
else:
pattern = 'mingw64'
self.assertTrue(re.search(pattern, os.environ['PATH']),
'Binary location for {0} not in PATH'.format(pattern))
self.assertTrue(re.search(pattern, os.environ['INCLUDE']),
'Include location for {0} not in INCLUDE'.format(pattern))
def test_StrawberryInPath(self):
os.environ['CMP'] = 'vs2019'
do.setup_for_build(self.args)
self.assertTrue(re.search('strawberry', os.environ['PATH'], flags=re.IGNORECASE),
'Strawberry Perl location not in PATH for vs2019')
def setBase314(self, yesno):
cfg_base_version = os.path.join('configure', 'CONFIG_BASE_VERSION')
fout = open(cfg_base_version, 'w')
print('# test file for base version detection', file=fout)
print('BASE_3_14={0}'.format(yesno), file=fout)
fout.close()
def setTestResultsTarget(self, target):
rules_build = os.path.join('configure', 'RULES_BUILD')
fout = open(rules_build, 'w')
print('# test file for target detection', file=fout)
print('{0}: something'.format(target), file=fout)
fout.close()
def test_DetectionBase314No(self):
self.setBase314('NO')
do.setup_for_build(self.args)
self.assertFalse(do.isbase314, 'Falsely detected Base 3.14')
def test_DetectionBase314Yes(self):
self.setBase314('YES')
do.setup_for_build(self.args)
self.assertTrue(do.isbase314, 'Base 3.14 = YES not detected')
def test_DetectionTestResultsTarget314No(self):
self.setBase314('YES')
self.setTestResultsTarget('nottherighttarget')
do.setup_for_build(self.args)
self.assertFalse(do.has_test_results, 'Falsely detected test-results target')
def test_DetectionTestResultsTarget314Yes(self):
self.setBase314('YES')
self.setTestResultsTarget('test-results')
do.setup_for_build(self.args)
self.assertFalse(do.has_test_results, 'Falsely found test-results on Base 3.14')
def test_DetectionTestResultsTargetNot314Yes(self):
self.setBase314('NO')
self.setTestResultsTarget('test-results')
do.setup_for_build(self.args)
self.assertTrue(do.has_test_results, 'Target test-results not detected')
if __name__ == "__main__":
if 'VV' in os.environ and os.environ['VV'] == '1':
logging.basicConfig(level=logging.DEBUG)
do.silent_dep_builds = False
do.host_info()
if sys.argv[1:]==['env']:
# testing with_vcvars
[print(K,'=',V) for K, V in os.environ.items()]
else:
unittest.main()

View File

@@ -0,0 +1,155 @@
# .appveyor.yml for use with EPICS Base ci-scripts
# (see: https://github.com/epics-base/ci-scripts)
# This is YAML - indentation levels are crucial
#---------------------------------#
# build cache #
#---------------------------------#
# The AppVeyor cache allowance is way too small (1GB per account across all projects, branches and jobs)
# to be used for the dependency builds.
cache:
- C:\Users\appveyor\.tools
#---------------------------------#
# repository cloning #
#---------------------------------#
# Called at very beginning, before repo cloning
init:
# Set autocrlf to make batch files work
- git config --global core.autocrlf true
# print the connection info for RDP connections (see 'debugging' below)
#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# Set clone depth (do not fetch complete history)
clone_depth: 50
# Skipping commits affecting only specific files
skip_commits:
files:
- 'documentation/*'
- 'templates/*'
- '**/*.html'
- '**/*.md'
- '.travis.yml'
#---------------------------------#
# additional packages #
#---------------------------------#
install:
# fetch submodules (like ci-scripts)
- cmd: git submodule update --init --recursive
# for the sequencer
- cinst re2c
#---------------------------------#
# build matrix configuration #
#---------------------------------#
# Since dependencies cannot be cached and AppVeyor only grants a single builder VM, all jobs
# are executed sequentially, each one taking 10-15 minutes.
# Consider this when defining your build matrix. (A full matrix build takes more than 8 hours.)
# Default build worker image
image: Visual Studio 2015
# Build Configurations: dll/static, regular/debug
configuration:
- dynamic
- static
- dynamic-debug
- static-debug
# Environment variables: compiler toolchain, base version, setup file, ...
environment:
# common / default variables for all jobs
SETUP_PATH: .ci-local:.ci
matrix:
- CMP: vs2019
SET: test00
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- CMP: mingw
- CMP: vs2019
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- CMP: vs2019
BASE: 3.15
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- CMP: vs2019
BASE: 3.14
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- CMP: vs2017
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- CMP: vs2015
- CMP: vs2013
- CMP: vs2012
- CMP: vs2010
- CMP: vs2008
# Platform: processor architecture
platform:
- x86
- x64
# Matrix configuration: exclude sets of jobs
matrix:
exclude:
# VS2012 and older installs don't have the 64 bit compiler
- platform: x64
CMP: vs2012
- platform: x64
CMP: vs2010
- platform: x64
CMP: vs2008
# Exclude more jobs to reduce build time
# E.g., skip 32-bit for newer compilers
#- platform: x86
# CMP: vs2019
#- platform: x86
# CMP: vs2017
#---------------------------------#
# building & testing #
#---------------------------------#
build_script:
- cmd: python .ci/appveyor/do.py prepare
- cmd: python .ci/appveyor/do.py build
test_script:
- cmd: python .ci/appveyor/do.py test
on_finish:
- ps: Get-ChildItem *.tap -Recurse -Force | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
- cmd: python .ci/appveyor/do.py build test-results -s
#---------------------------------#
# debugging #
#---------------------------------#
## if you want to connect by remote desktop to a failed build, uncomment these lines
## note that you will need to connect within the usual build timeout limit (60 minutes)
## so you may want to adjust the build matrix above to just build the one of interest
# to print the RDP connection info
# uncomment the appropriate line in the init: section above
# block a failed build (until the watchdog barks)
#on_failure:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
#---------------------------------#
# notifications #
#---------------------------------#
notifications:
- provider: Email
to:
- me@example.com
on_build_success: false
- provider: GitHubPullRequest

View File

@@ -0,0 +1,72 @@
# .appveyor.yml for use with EPICS Base ci-scripts
# (see: https://github.com/epics-base/ci-scripts)
# This is YAML - indentation levels are crucial
cache:
- C:\Users\appveyor\.tools
init:
- git config --global core.autocrlf true
clone_depth: 50
skip_commits:
files:
- 'documentation/*'
- 'templates/*'
- '**/*.html'
- '**/*.md'
- '.travis.yml'
install:
- cmd: git submodule update --init --recursive
image: Visual Studio 2019
# Build Configurations: dll/static, regular/debug
configuration:
- dynamic
# - static
- dynamic-debug
# - static-debug
environment:
# common / default variables for all jobs
SETUP_PATH: .ci-local:.ci
matrix:
- CMP: vs2019
BASE: 7.0
- CMP: vs2019
BASE: 3.15
# Platform: processor architecture
platform:
# - x86
- x64
# Matrix configuration: exclude sets of jobs
matrix:
exclude:
# VS2012 and older installs don't have the 64 bit compiler
- platform: x64
CMP: vs2012
- platform: x64
CMP: vs2010
- platform: x64
CMP: vs2008
build_script:
- cmd: python .ci/appveyor/do.py prepare
- cmd: python .ci/appveyor/do.py build
test_script:
- cmd: python .ci/appveyor/do.py test
on_finish:
- ps: Get-ChildItem *.tap -Recurse -Force | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
- cmd: python .ci/appveyor/do.py build test-results -s
notifications:
- provider: GitHubPullRequest

112
appveyor/README.md Normal file
View File

@@ -0,0 +1,112 @@
# AppVeyor Scripts for EPICS Modules
## Features
- Use different compilers (Visual Studio, MinGW)
- Use different VS versions (2008, 2010, 2012, 2013, 2015, 2017, 2019)
- Compile for Windows 32bit and 64bit
- Create static libraries or DLLs (plus the matching executables)
- Create optimized or debug builds
## How to Use these Scripts
1. Get an account on [AppVeyor](https://www.appveyor.com/), connect
it to your GitHub account and activate your support module's
repository. For more details, please see below and refer to the
[AppVeyor documentation](https://www.appveyor.com/docs/).
2. Add the ci-scripts respository as a Git Submodule
(see [README](../README.md) one level above).
3. Add settings files defining which dependencies in which versions
you want to build against
(see [README](../README.md) one level above).
4. Create an AppVeyor configuration by copying one of the examples into
the root directory of your module.
```
$ cp .ci/appveyor/.appveyor.yml.example-full .appveyor.yml
```
5. Edit the `.appveyor.yml` configuration to include the jobs you want
AppVeyor to run.
AppVeyor automatically creates a build matrix with the following axes:
1. `configuration:` \
Select static or dynamic (DLL) as well as regular or debug builds.
2. `platform:` \
Select 32bit or 64bit processor architecture.
3. `environment: / matrix:` \
List of environment variable settings. Each list element (starting with
a dash) is one step on the axis of the build matrix. \
Set `CMP` to select the compiler: `mingw` for the native
[MinGW](http://mingw-w64.org/) GNU compiler, `vs2008` ...`vs2019`
(options listed above) for the Microsoft Visual Studio compilers.
Your builds will take long. \
AppVeyor only grants a single worker VM - all jobs of the matrix are
executed sequentially. Each job will take between 6 and 15 minutes,
plus testing time.
The `matrix: / exclude:` setting can be used to reduce the number of
jobs. Check the [AppVeyor docs][appveyor.doc.matrix]
for more ways to reduce the build matrix size.
E.g., you can opt for not creating matrix axes for `configuration:`
and`platform:` by moving these configurations into the job lines
under `environment: / matrix:`.
6. Push your changes and check
[ci.appveyor.com](https://ci.appveyor.com/) for your build results.
## GitHub / AppVeyor Integration and Authentication
### Security
Enabling Two-Factor-Authentication (2FA) is always a good idea, for all
your web based services, including GitHub and AppVeyor. \
Get an app for your phone (Authy works fine for me, but there are plenty),
and your phone will generate one-time passwords to verify your identity
to the service if required (e.g., when logging in from a new device).
### Authentication
You can use different ways and services to authenticate when you log into
your AppVeyor account. The easiest way - at least when you're using the
service with repositories on GitHub - is to use GitHub authentication.
### GitHub Integration
AppVeyor offers two ways to integrate with GitHub: through a GitHub
application or through an OAuth application. GitHub applications are using
the newer API, allow easier fine-grained access rights tuning and are
preferred.
The differences are mostly visible when you work with repositories under
organizational GitHub accounts: Using OAuth, AppVeyor always has the full
rights of your personal GitHub account.
GitHub applications on the other hand have separate instances and
configuration for every organizational account you are using on GitHub.
### Enabling Builds for your Repository
On the 'Projects' tab of your AppVeyor web interface, create a new project.
If the repository is not listed on the project creation page,
verify the Integration settings. Most of the relevant configuration
is taken from GitHub and has to be set up there.
### AppVeyor Account Sharing
You can always invite other AppVeyor users to have access to an AppVeyor
account, forming a team. Such additional shared accounts are a way to make
the AppVeyor limits (e.g., one parallel builder per account) more manageable.
## Known Issues
#### Build Worker Images
The AppVeyor documentation on build worker images doesn't seem to fully
describe the way things are handled internally.
The tested and suggested reproducible way of defining the build worker image
is shown in the example configuration files:
- Set the default image using the `image:` tag.
- Override the image for specific jobs by setting the
`APPVEYOR_BUILD_WORKER_IMAGE` environment variable.
<!-- Links -->
[appveyor.doc.matrix]: https://www.appveyor.com/docs/build-configuration/#build-matrix

671
appveyor/do.py Normal file
View File

@@ -0,0 +1,671 @@
#!/usr/bin/env python
"""Windows (AppVeyor) ci build script
"""
from __future__ import print_function
import sys, os, stat, shutil
import fileinput
import logging
import re
import subprocess as sp
import distutils.util
logger = logging.getLogger(__name__)
# Setup ANSI Colors
ANSI_RED = "\033[31;1m"
ANSI_GREEN = "\033[32;1m"
ANSI_YELLOW = "\033[33;1m"
ANSI_BLUE = "\033[34;1m"
ANSI_MAGENTA = "\033[35;1m"
ANSI_CYAN = "\033[36;1m"
ANSI_RESET = "\033[0m"
ANSI_CLEAR = "\033[0K"
seen_setups = []
modules_to_compile = []
setup = {}
places = {}
if 'HomeDrive' in os.environ:
cachedir = os.path.join(os.getenv('HomeDrive'), os.getenv('HomePath'), '.cache')
toolsdir = os.path.join(os.getenv('HomeDrive'), os.getenv('HomePath'), '.tools')
elif 'HOME' in os.environ:
cachedir = os.path.join(os.getenv('HOME'), '.cache')
toolsdir = os.path.join(os.getenv('HOME'), '.tools')
else:
cachedir = os.path.join('.', '.cache')
toolsdir = os.path.join('.', '.tools')
if 'CACHEDIR' in os.environ:
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]))
if os.path.basename(ciscriptsdir) == 'appveyor':
ciscriptsdir = ciscriptsdir.rstrip(os.pathsep+'appveyor')
if 'BASE' in os.environ and os.environ['BASE'] == 'SELF':
building_base = True
places['EPICS_BASE'] = '.'
else:
building_base = False
def modlist():
if building_base:
ret = []
else:
for var in ['ADD_MODULES', 'MODULES']:
setup.setdefault(var, '')
if var in os.environ:
setup[var] = os.environ[var]
logger.debug('ENV assignment: %s = %s', var, setup[var])
ret = ['BASE'] + setup['ADD_MODULES'].upper().split() + setup['MODULES'].upper().split()
logger.debug('Effective module list: %s', ret)
return ret
zip7 = r'C:\Program Files\7-Zip\7z'
make = ''
isbase314 = False
has_test_results = False
silent_dep_builds = True
def host_info():
print('{0}AppVeyor Build Worker Image:{1} {2}'
.format(ANSI_CYAN, ANSI_RESET, os.environ['APPVEYOR_BUILD_WORKER_IMAGE']))
print('{0}Python setup{1}'.format(ANSI_CYAN, ANSI_RESET))
print(sys.version)
print('PYTHONPATH')
for dname in sys.path:
print(' ', dname)
print('platform =', distutils.util.get_platform())
print('{0}Available Visual Studio versions{1}'.format(ANSI_CYAN, ANSI_RESET))
for key in vcvars_table:
if os.path.exists(vcvars_table[key]):
print('Found', key, 'in', vcvars_table[key])
sys.stdout.flush()
# Used from unittests
def clear_lists():
global isbase314, has_test_results
del seen_setups[:]
del modules_to_compile[:]
setup.clear()
places.clear()
isbase314 = False
has_test_results = False
# Error-handler to make shutil.rmtree delete read-only files on Windows
def remove_readonly(func, path, excinfo):
os.chmod(path, stat.S_IWRITE)
func(path)
# source_set(setup)
#
# Source a settings file (extension .set) found in the setup_dirs path
# May be called recursively (from within a setup file)
def source_set(name):
# allowed separators: colon or whitespace
setup_dirs = os.getenv('SETUP_PATH', "").replace(':', ' ').split()
if len(setup_dirs) == 0:
raise NameError("{0}Search path for setup files (SETUP_PATH) is empty{1}".format(ANSI_RED,ANSI_RESET))
for set_dir in setup_dirs:
set_file = os.path.join(set_dir, name) + ".set"
if set_file in seen_setups:
print("Ignoring already included setup file {0}".format(set_file))
return
if os.path.isfile(set_file):
seen_setups.append(set_file)
print("Loading setup file {0}".format(set_file))
sys.stdout.flush()
with open(set_file) as fp:
for line in fp:
logger.debug('Next line: %s', line.strip())
if not line.strip() or line.strip()[0] == '#':
continue
if line.startswith("include"):
logger.debug('Found an include, reading %s', line.split()[1])
source_set(line.split()[1])
continue
assign = line.replace('"', '').strip().split("=", 1)
logger.debug('Interpreting as assignment')
setup.setdefault(assign[0], os.getenv(assign[0], ""))
if not setup[assign[0]].strip():
logger.debug('Doing assignment: %s = %s', assign[0], assign[1])
setup[assign[0]] = assign[1]
break
else:
raise NameError("{0}Setup file {1} does not exist in SETUP_PATH search path ({2}){3}"
.format(ANSI_RED, name, setup_dirs, ANSI_RESET))
# update_release_local(var, location)
# var name of the variable to set in RELEASE.local
# location location (absolute path) of where variable should point to
#
# Manipulate RELEASE.local in the cache location:
# - replace "$var=$location" line if it exists and has changed
# - otherwise add "$var=$location" line and possibly move EPICS_BASE=... line to the end
# Set places[var] = location
def update_release_local(var, location):
release_local = os.path.join(cachedir, 'RELEASE.local')
updated_line = '{0}={1}'.format(var, location.replace('\\', '/'))
places[var] = location
if not os.path.exists(release_local):
logger.debug('RELEASE.local does not exist, creating it')
try:
os.makedirs(cachedir)
except:
pass
fout = open(release_local, 'w')
fout.close()
base_line = ''
found = False
logger.debug("Opening RELEASE.local for adding '%s'", updated_line)
for line in fileinput.input(release_local, inplace=1):
outputline = line.strip()
if 'EPICS_BASE=' in line:
base_line = line.strip()
logger.debug("Found EPICS_BASE line '%s', not writing it", base_line)
continue
elif '{0}='.format(var) in line:
logger.debug("Found '%s=' line, replacing", var)
found = True
outputline = updated_line
logger.debug("Writing line to RELEASE.local: '%s'", outputline)
print(outputline)
fileinput.close()
fout = open(release_local,"a")
if not found:
logger.debug("Adding new definition: '%s'", updated_line)
print(updated_line, file=fout)
if base_line:
logger.debug("Writing EPICS_BASE line: '%s'", base_line)
print(base_line, file=fout)
fout.close()
def set_setup_from_env(dep):
for postf in ['', '_DIRNAME', '_REPONAME', '_REPOOWNER', '_REPOURL',
'_VARNAME', '_RECURSIVE', '_DEPTH', '_HOOK']:
if dep+postf in os.environ:
setup[dep+postf] = os.environ[dep+postf]
logger.debug('ENV assignment: %s = %s', dep+postf, setup[dep+postf])
def call_git(args, **kws):
if 'cwd' in kws:
place = kws['cwd']
else:
place = os.getcwd()
logger.debug("EXEC '%s' in %s", ' '.join(['git'] + args), place)
sys.stdout.flush()
exitcode = sp.call(['git'] + args, **kws)
logger.debug('EXEC DONE')
return exitcode
def call_make(args=[], **kws):
place = kws.get('cwd', os.getcwd())
parallel = kws.pop('parallel', 2)
silent = kws.pop('silent', False)
# no parallel make for Base 3.14
if parallel <= 0 or isbase314:
makeargs = []
else:
makeargs = ['-j{0}'.format(parallel), '-Otarget']
if silent:
makeargs += ['-s']
logger.debug("EXEC '%s' in %s", ' '.join([make] + makeargs + args), place)
sys.stdout.flush()
exitcode = sp.call([make] + makeargs + args, **kws)
logger.debug('EXEC DONE')
if exitcode != 0:
sys.exit(exitcode)
def get_git_hash(place):
logger.debug("EXEC 'git log -n1 --pretty=format:%%H' in %s", place)
sys.stdout.flush()
head = sp.check_output(['git', 'log', '-n1', '--pretty=format:%H'], cwd=place).decode()
logger.debug('EXEC DONE')
return head
def complete_setup(dep):
set_setup_from_env(dep)
setup.setdefault(dep, 'master')
setup.setdefault(dep+"_DIRNAME", dep.lower())
setup.setdefault(dep+"_REPONAME", dep.lower())
setup.setdefault('REPOOWNER', 'epics-modules')
setup.setdefault(dep+"_REPOOWNER", setup['REPOOWNER'])
setup.setdefault(dep+"_REPOURL", 'https://github.com/{0}/{1}.git'
.format(setup[dep+'_REPOOWNER'], setup[dep+'_REPONAME']))
setup.setdefault(dep+"_VARNAME", dep)
setup.setdefault(dep+"_RECURSIVE", 'YES')
setup.setdefault(dep+"_DEPTH", -1)
# 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
def add_dependency(dep):
recurse = setup[dep+'_RECURSIVE'].lower()
if recurse not in ['0', 'no']:
recursearg = ["--recursive"]
elif recurse not in ['1', 'yes']:
recursearg = []
else:
raise RuntimeError("Invalid value for {}_RECURSIVE='{}' not 0/NO/1/YES".format(dep, recurse))
deptharg = {
'-1':['--depth', '5'],
'0':[],
}.get(str(setup[dep+'_DEPTH']), ['--depth', str(setup[dep+'_DEPTH'])])
tag = setup[dep]
logger.debug('Adding dependency %s with tag %s', dep, setup[dep])
# determine if dep points to a valid release or branch
if call_git(['ls-remote', '--quiet', '--exit-code', '--refs', setup[dep+'_REPOURL'], tag]):
raise RuntimeError("{0}{1} is neither a tag nor a branch name for {2} ({3}){4}"
.format(ANSI_RED, tag, dep, setup[dep+'_REPOURL'], ANSI_RESET))
dirname = setup[dep+'_DIRNAME']+'-{0}'.format(tag)
place = os.path.join(cachedir, dirname)
checked_file = os.path.join(place, "checked_out")
if os.path.isdir(place):
logger.debug('Dependency %s: directory %s exists, comparing checked-out commit', dep, place)
# check HEAD commit against the hash in marker file
if os.path.exists(checked_file):
with open(checked_file, 'r') as bfile:
checked_out = bfile.read().strip()
bfile.close()
else:
checked_out = 'never'
head = get_git_hash(place)
logger.debug('Found checked_out commit %s, git head is %s', checked_out, head)
if head != checked_out:
logger.debug('Dependency %s out of date - removing', dep)
shutil.rmtree(place, onerror=remove_readonly)
else:
print('Found {0} of dependency {1} up-to-date in {2}'.format(tag, dep, place))
sys.stdout.flush()
if not os.path.isdir(place):
if not os.path.isdir(cachedir):
os.makedirs(cachedir)
# clone dependency
print('Cloning {0} of dependency {1} into {2}'
.format(tag, dep, place))
sys.stdout.flush()
call_git(['clone', '--quiet'] + deptharg + recursearg + ['--branch', tag, setup[dep+'_REPOURL'], dirname], cwd=cachedir)
sp.check_call(['git', 'log', '-n1'], cwd=place)
modules_to_compile.append(place)
if dep == 'BASE':
# add MSI 1.7 to Base 3.14
versionfile = os.path.join(place, 'configure', 'CONFIG_BASE_VERSION')
if os.path.exists(versionfile):
with open(versionfile) as f:
if 'BASE_3_14=YES' in f.read():
print('Adding MSI 1.7 to {0}'.format(place))
sys.stdout.flush()
sp.check_call(['patch', '-p1', '-i', os.path.join(ciscriptsdir, 'add-msi-to-314.patch')],
cwd=place)
else:
# force including RELEASE.local for non-base modules by overwriting their configure/RELEASE
release = os.path.join(place, "configure", "RELEASE")
if os.path.exists(release):
with open(release, 'w') as fout:
print('-include $(TOP)/../RELEASE.local', file=fout)
# run hook if defined
if dep+'_HOOK' in setup:
hook = os.path.join(place, setup[dep+'_HOOK'])
if os.path.exists(hook):
print('Running hook {0} in {1}'.format(setup[dep+'_HOOK'], place))
sys.stdout.flush()
sp.check_call(hook, shell=True, cwd=place)
# write checked out commit hash to marker file
head = get_git_hash(place)
logger.debug('Writing hash of checked-out dependency (%s) to marker file', head)
with open(checked_file, "w") as fout:
print(head, file=fout)
fout.close()
update_release_local(setup[dep+"_VARNAME"], place)
def setup_for_build(args):
global make, isbase314, has_test_results
dllpaths = []
# there is no combined static and debug EPICS_HOST_ARCH target,
# so a combined debug and static target will appear to be just static
# but debug will have been specified in CONFIG_SITE by prepare()
hostarchsuffix=''
if re.search('debug', os.environ['CONFIGURATION']):
hostarchsuffix = '-debug'
if re.search('static', os.environ['CONFIGURATION']):
hostarchsuffix = '-static'
if os.environ['PLATFORM'].lower() == 'x86':
os.environ['EPICS_HOST_ARCH'] = 'win32-x86' + hostarchsuffix
elif os.environ['PLATFORM'].lower() == 'x64':
os.environ['EPICS_HOST_ARCH'] = 'windows-x64' + hostarchsuffix
if os.environ['CMP'] == 'vs2019':
# put strawberry perl in the PATH
os.environ['PATH'] = os.pathsep.join([os.path.join(r'C:\Strawberry\perl\site\bin'),
os.path.join(r'C:\Strawberry\perl\bin'),
os.environ['PATH']])
if os.environ['CMP'] == 'mingw':
if 'INCLUDE' not in os.environ:
os.environ['INCLUDE'] = ''
if os.environ['PLATFORM'].lower() == 'x86':
os.environ['EPICS_HOST_ARCH'] = 'win32-x86-mingw'
os.environ['INCLUDE'] = os.pathsep.join([r'C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\include',
os.environ['INCLUDE']])
os.environ['PATH'] = os.pathsep.join([r'C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin',
os.environ['PATH']])
elif os.environ['PLATFORM'].lower() == 'x64':
os.environ['EPICS_HOST_ARCH'] = 'windows-x64-mingw'
os.environ['INCLUDE'] = os.pathsep.join([r'C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\include',
os.environ['INCLUDE']])
os.environ['PATH'] = os.pathsep.join([r'C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin',
os.environ['PATH']])
make = os.path.join(toolsdir, 'make.exe')
base_place = '.'
if not building_base:
with open(os.path.join(cachedir, 'RELEASE.local'), 'r') as f:
lines = f.readlines()
for line in lines:
(mod, place) = line.strip().split('=')
bindir = os.path.join(place, 'bin', os.environ['EPICS_HOST_ARCH'])
if os.path.isdir(bindir):
dllpaths.append(bindir)
if mod == 'EPICS_BASE':
base_place = place
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():
isbase314 = True
if not isbase314:
rules_build = os.path.join(base_place, 'configure', 'RULES_BUILD')
if os.path.exists(rules_build):
with open(rules_build) as myfile:
for line in myfile:
if re.match('^test-results:', line):
has_test_results = True
bindir = os.path.join(os.getcwd(), 'bin', os.environ['EPICS_HOST_ARCH'])
if os.path.isdir(bindir):
dllpaths.append(bindir)
os.environ['PATH'] = os.pathsep.join(dllpaths + [os.environ['PATH']])
# apparently %CD% is handled automagically
os.environ['TOP'] = os.getcwd()
addpaths = []
for path in args.paths:
try:
addpaths.append(path.format(**os.environ))
except KeyError:
print('Environment')
[print(' ',K,'=',repr(V)) for K,V in os.environ.items()]
raise
os.environ['PATH'] = os.pathsep.join([os.environ['PATH']] + addpaths)
def prepare(args):
host_info()
print('{0}Loading setup files{1}'.format(ANSI_YELLOW, ANSI_RESET))
source_set('defaults')
if 'SET' in os.environ:
source_set(os.environ['SET'])
[complete_setup(mod) for mod in modlist()]
logger.debug('Loaded setup')
kvs = list(setup.items())
kvs.sort()
[logger.debug(' %s = "%s"', *kv) for kv in kvs]
# we're working with tags (detached heads) a lot: suppress advice
call_git(['config', '--global', 'advice.detachedHead', 'false'])
print('{0}Checking/cloning dependencies{1}'.format(ANSI_YELLOW, ANSI_RESET))
sys.stdout.flush()
[add_dependency(mod) for mod in modlist()]
if not building_base:
if os.path.isdir('configure'):
targetdir = 'configure'
else:
targetdir = '.'
shutil.copy(os.path.join(cachedir, 'RELEASE.local'), targetdir)
print('{0}Configuring EPICS build system{1}'.format(ANSI_YELLOW, ANSI_RESET))
with open(os.path.join(places['EPICS_BASE'], 'configure', 'CONFIG_SITE'), 'a') as config_site:
if re.search('static', os.environ['CONFIGURATION']):
config_site.write('SHARED_LIBRARIES=NO\n')
config_site.write('STATIC_BUILD=YES\n')
linktype = 'static'
else:
linktype = 'dynamic (DLL)'
if re.search('debug', os.environ['CONFIGURATION']):
config_site.write('HOST_OPT=NO\n')
optitype = 'debug'
else:
optitype = 'optimized'
# Enable/fix parallel build for VisualStudio compiler on older Base versions
add_vs_fix = True
config_win = os.path.join(places['EPICS_BASE'], 'configure', 'os', 'CONFIG.win32-x86.win32-x86')
with open(config_win) as myfile:
for line in myfile:
if re.match(r'^ifneq \(\$\(VisualStudioVersion\),11\.0\)', line):
add_vs_fix = False
if add_vs_fix:
with open(config_win, 'a') as myfile:
myfile.write('''
# Fix parallel build for some VisualStudio versions
ifneq ($(VisualStudioVersion),)
ifneq ($(VisualStudioVersion),11.0)
ifeq ($(findstring -FS,$(OPT_CXXFLAGS_NO)),)
OPT_CXXFLAGS_NO += -FS
OPT_CFLAGS_NO += -FS
endif
else
OPT_CXXFLAGS_NO := $(filter-out -FS,$(OPT_CXXFLAGS_NO))
OPT_CFLAGS_NO := $(filter-out -FS,$(OPT_CFLAGS_NO))
endif
endif''')
print('EPICS Base build system set up for {0} build with {1} linking'
.format(optitype, linktype))
if not os.path.isdir(toolsdir):
os.makedirs(toolsdir)
makever = '4.2.1'
if not os.path.exists(os.path.join(toolsdir, 'make.exe')):
print('Installing Make 4.2.1 from ANL web site')
sys.stdout.flush()
sp.check_call(['curl', '-fsS', '--retry', '3', '-o', 'make-{0}.zip'.format(makever),
'https://epics.anl.gov/download/tools/make-{0}-win64.zip'.format(makever)],
cwd=toolsdir)
sp.check_call([zip7, 'e', 'make-{0}.zip'.format(makever)], cwd=toolsdir)
os.remove(os.path.join(toolsdir, 'make-{0}.zip'.format(makever)))
setup_for_build(args)
print('{0}EPICS_HOST_ARCH = {1}{2}'.format(ANSI_CYAN, os.environ['EPICS_HOST_ARCH'], ANSI_RESET))
print('{0}$ {1} --version{2}'.format(ANSI_CYAN, make, ANSI_RESET))
sys.stdout.flush()
call_make(['--version'], parallel=0)
print('{0}$ perl --version{1}'.format(ANSI_CYAN, ANSI_RESET))
sys.stdout.flush()
sp.check_call(['perl', '--version'])
if os.environ['CMP'] == 'mingw':
print('{0}$ gcc --version{1}'.format(ANSI_CYAN, ANSI_RESET))
sys.stdout.flush()
sp.check_call(['gcc', '--version'])
else:
print('{0}$ cl{1}'.format(ANSI_CYAN, ANSI_RESET))
sys.stdout.flush()
sp.check_call(['cl'])
if not building_base:
for mod in modlist():
place = places[setup[mod+"_VARNAME"]]
print('{0}Building dependency {1} in {2}{3}'.format(ANSI_YELLOW, mod, place, ANSI_RESET))
call_make(cwd=place, silent=silent_dep_builds)
print('{0}Dependency module information{1}'.format(ANSI_CYAN, ANSI_RESET))
print('Module Tag Binaries Commit')
print(100 * '-')
for mod in modlist():
commit = sp.check_output(['git', 'log', '-n1', '--oneline'], cwd=places[setup[mod+"_VARNAME"]]).strip()
print("%-10s %-12s %-11s %s" % (mod, setup[mod], 'rebuilt', commit))
print('{0}Contents of RELEASE.local{1}'.format(ANSI_CYAN, ANSI_RESET))
with open(os.path.join(cachedir, 'RELEASE.local'), 'r') as f:
print(f.read().strip())
def build(args):
setup_for_build(args)
print('{0}Building the main module{1}'.format(ANSI_YELLOW, ANSI_RESET))
call_make(args.makeargs)
def test(args):
setup_for_build(args)
print('{0}Running the main module tests{1}'.format(ANSI_YELLOW, ANSI_RESET))
call_make(['tapfiles'])
if has_test_results:
call_make(['test-results'], parallel=0, silent=True)
def doExec(args):
'exec user command with vcvars'
setup_for_build(args)
os.environ['MAKE'] = make
print('Execute command {}'.format(args.cmd))
sys.stdout.flush()
sp.check_call(' '.join(args.cmd), shell=True)
def with_vcvars(cmd):
'''re-exec main script with a (hopefully different) command
'''
CC = os.environ['CMP']
# cf. https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line
info = {
'python': sys.executable,
'self': sys.argv[0],
'cmd':cmd,
}
info['arch'] = {
'x86': 'x86', # 'amd64_x86' ??
'x64': 'amd64',
}[os.environ['PLATFORM'].lower()] # 'x86' or 'x64'
info['vcvars'] = vcvars_table[CC]
script='''
call "{vcvars}" {arch}
"{python}" "{self}" {cmd}
'''.format(**info)
logger.debug('----- Creating vcvars-trampoline.bat -----')
for line in script.split('\n'):
logger.debug(line)
logger.debug('----- snip -----')
with open('vcvars-trampoline.bat', 'w') as F:
F.write(script)
print('{0}Calling vcvars-trampoline.bat to set environment for {1} on {2}{3}'
.format(ANSI_YELLOW, CC, os.environ['PLATFORM'], ANSI_RESET))
sys.stdout.flush()
returncode = sp.call('vcvars-trampoline.bat', shell=True)
if returncode != 0:
sys.exit(returncode)
def getargs():
from argparse import ArgumentParser, REMAINDER
P = ArgumentParser()
P.add_argument('--no-vcvars', dest='vcvars', default=True, action='store_false',
help='Assume vcvarsall.bat has already been run')
P.add_argument('--add-path', dest='paths', default=[], action='append',
help='Append directory to %PATH%. Expands {ENVVAR}')
SP = P.add_subparsers()
CMD = SP.add_parser('prepare')
CMD.set_defaults(func=prepare)
CMD = SP.add_parser('build')
CMD.add_argument('makeargs', nargs=REMAINDER)
CMD.set_defaults(func=build)
CMD = SP.add_parser('test')
CMD.set_defaults(func=test)
CMD = SP.add_parser('exec')
CMD.add_argument('cmd', nargs=REMAINDER)
CMD.set_defaults(func=doExec)
return P
def main(raw):
global silent_dep_builds
args = getargs().parse_args(raw)
if 'VV' in os.environ and os.environ['VV'] == '1':
logging.basicConfig(level=logging.DEBUG)
silent_dep_builds = False
if args.vcvars and os.environ['CMP'].startswith('vs'):
# re-exec with MSVC in PATH
with_vcvars(' '.join(['--no-vcvars']+raw))
else:
args.func(args)
if __name__=='__main__':
main(sys.argv[1:])

View File

@@ -9,6 +9,9 @@ DB += dbExample2.db
DB += dbSubExample.db
DB += user.substitutions
# Host-side expansion of substitutions file with MSI
DB += dbExample3.db
# If <anyname>.db template is not named <anyname>*.template add
# <anyname>_TEMPLATE = <templatename>

View File

@@ -0,0 +1,8 @@
# Example host-side substitutions file
file dbExample2.db {
pattern { user, no, scan }
{ "ralph", 4, "1 second" }
{ "ralph", 5, "2 second" }
{ "ralph", 6, "5 second" }
}

View File

@@ -53,6 +53,8 @@ script:
# SET source setup file
# ADD_MODULES extra modules (for a specific job)
# 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)
# TEST set to NO to skip running the tests (default: YES)
# VV set to make build scripts verbose (default: unset)

View File

@@ -43,3 +43,18 @@
6. Push your changes and check
[travis-ci.org](https://travis-ci.org/) for your build results.
## Caches
Travis keeps the caches separate for different jobs. As soon as the job
description (in the `.travis.yml` configuration file) or its environment
settings change (adding a space character is enough), the cache is different
and will be rebuilt when the job runs.
This also means that changing a value inside a setup file will _not_
invalidate the cache - in that case you will have to manually delete the cache
through the Travis web interface. (Or add a space character in the job
configuration.)
Caches are automatically removed after approx. four weeks.
Your jobs will have to rebuild them once in a while.

View File

@@ -6,17 +6,41 @@ set -e
CACHEDIR=${CACHEDIR:-${HOME}/.cache}
eval $(grep "EPICS_BASE=" ${CACHEDIR}/RELEASE.local)
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
make -j2 $EXTRA
# 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
make tapfiles
make -s test-results
make -j2 tapfiles || ret=$?
if grep -q "BASE_3_14=NO" $EPICS_BASE/configure/CONFIG_BASE_VERSION
then
grep -q "^test-results:" $EPICS_BASE/configure/RULES_BUILD && make -sk test-results
fi
fi
exit $ret

View File

@@ -29,6 +29,23 @@ CACHEDIR=${CACHEDIR:-${HOME}/.cache}
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
# -------------
@@ -45,23 +62,32 @@ fold_end load.settings
# Check out dependencies
# ----------------------
fold_start check.out.dependencies "Checking/cloning 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
[ -e ./configure ] && cp ${CACHEDIR}/RELEASE.local ./configure/RELEASE.local
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
fold_end check.out.dependencies
fi
# Set up compiler
# ---------------
fold_start set.up.epics_build "Setting up EPICS build system"
eval $(grep "EPICS_BASE=" ${CACHEDIR}/RELEASE.local)
if [ "$BASE" = "SELF" ]
then
EPICS_BASE=$CURDIR
else
eval $(grep "EPICS_BASE=" ${CACHEDIR}/RELEASE.local)
fi
export EPICS_BASE
echo "EPICS_BASE=$EPICS_BASE"
@@ -70,7 +96,7 @@ echo "EPICS_BASE=$EPICS_BASE"
export 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
# requires wine and g++-mingw-w64-i686
@@ -158,8 +184,10 @@ EOF
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
CROSS_COMPILER_TARGET_ARCHS += RTEMS-pc386$QEMU
EOF
fi
@@ -180,6 +208,8 @@ fold_end set.up.compiler
echo "\$ make --version"
make --version
[ "$BASE" = "SELF" ] && exit 0
# Build required dependencies
# ---------------------------

View File

@@ -185,7 +185,7 @@ add_dependency() {
if [ -e ${versionfile} ] && grep -q "BASE_3_14=YES" ${versionfile}
then
echo "Adding MSI 1.7 to $CACHEDIR/$dirname-$TAG"
( cd $dirname-$TAG; patch -p0 < $curdir/add-msi-to-314.patch )
( 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