Rebase from hash-predef source.

This commit is contained in:
Rene Rivera
2018-08-25 23:36:20 -05:00
parent 560ff5298e
commit 759400b413
7 changed files with 133 additions and 181 deletions

5
.gitignore vendored
View File

@ -1,3 +1,4 @@
/bin
/boost-build.jam
bin
boost-build.jam
project-config.jam
*.pyc

View File

@ -2,7 +2,7 @@
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# Copyright Rene Rivera 2015-2016.
# Copyright Rene Rivera 2015-2018.
# Setting up notifications like this is optional as the default behavior
# of Travis is to notify the commiter of problems. But setting a specific
@ -13,13 +13,6 @@ notifications:
recipients:
- grafikrobot@gmail.com
# For now the CI scripts only support the two main branches available
# on the boost super-project.
branches:
only:
- master
- develop
# We specify a generic language instead of C++ as Travis sets up
# additional environment vars that point to its default toolset
# instead of the one we install. The extra env doesn't interfere,
@ -28,7 +21,7 @@ branches:
language: generic
# Speficy the default as Linux here, to avoid duplication in the matrix
# below. We use Trausty as that's the latest we can use. And it's better
# below. We use Trusty as that's the latest we can use. And it's better
# supported by the whole range of C++ toolsets we like to test on.
dist: trusty
os: linux
@ -68,14 +61,18 @@ matrix:
- env: TOOLSET=gcc-4.9
- env: TOOLSET=gcc-5
- env: TOOLSET=gcc-6
- env: TOOLSET=gcc-7 CXXFLAGS=-std=c++03
- env: TOOLSET=gcc-7 CXXFLAGS=-std=c++11
- env: TOOLSET=gcc-7 CXXFLAGS=-std=c++14
- env: TOOLSET=gcc-7 CXXFLAGS=-std=c++1z
- env: TOOLSET=gcc-7 CXXFLAGS=-std=gnu++03
- env: TOOLSET=gcc-7 CXXFLAGS=-std=gnu++11
- env: TOOLSET=gcc-7 CXXFLAGS=-std=gnu++14
- env: TOOLSET=gcc-7 CXXFLAGS=-std=gnu++1z
- env: TOOLSET=gcc-7
- env: TOOLSET=gcc-8
- env: TOOLSET=gcc-8 CXXFLAGS=-std=c++03
- env: TOOLSET=gcc-8 CXXFLAGS=-std=c++11
- env: TOOLSET=gcc-8 CXXFLAGS=-std=c++14
- env: TOOLSET=gcc-8 CXXFLAGS=-std=c++17
- env: TOOLSET=gcc-8 CXXFLAGS=-std=c++2a
- env: TOOLSET=gcc-8 CXXFLAGS=-std=gnu++03
- env: TOOLSET=gcc-8 CXXFLAGS=-std=gnu++11
- env: TOOLSET=gcc-8 CXXFLAGS=-std=gnu++14
- env: TOOLSET=gcc-8 CXXFLAGS=-std=gnu++17
- env: TOOLSET=gcc-8 CXXFLAGS=-std=gnu++2a
- env: TOOLSET=xcode-6.1
os: osx
- env: TOOLSET=xcode-6.4
@ -84,18 +81,27 @@ matrix:
- env: TOOLSET=xcode-7.3
os: osx
osx_image: xcode7.3
- env: TOOLSET=xcode-8.3 CXXFLAGS=-std=c++03
- env: TOOLSET=xcode-8.3
os: osx
osx_image: xcode8.3
- env: TOOLSET=xcode-8.3 CXXFLAGS=-std=c++11
- env: TOOLSET=xcode-9.4 CXXFLAGS=-std=c++03
os: osx
osx_image: xcode8.3
- env: TOOLSET=xcode-8.3 CXXFLAGS=-std=c++14
osx_image: xcode9.4
- env: TOOLSET=xcode-9.4 CXXFLAGS=-std=c++11
os: osx
osx_image: xcode8.3
- env: TOOLSET=xcode-8.3 CXXFLAGS=-std=c++1z
osx_image: xcode9.4
- env: TOOLSET=xcode-9.4 CXXFLAGS=-std=c++14
os: osx
osx_image: xcode8.3
osx_image: xcode9.4
- env: TOOLSET=xcode-9.4 CXXFLAGS=-std=c++17
os: osx
osx_image: xcode9.4
- env: TOOLSET=xcode-9.4 CXXFLAGS=-std=c++2a
os: osx
osx_image: xcode9.4
- env: TOOLSET=xcode-10.0
os: osx
osx_image: xcode10.0
install: python "${TRAVIS_BUILD_DIR}/tools/ci/library_test.py" install
before_script: python "${TRAVIS_BUILD_DIR}/tools/ci/library_test.py" before_script
@ -104,6 +110,3 @@ before_cache: python "${TRAVIS_BUILD_DIR}/tools/ci/library_test.py" before_cache
after_success: python "${TRAVIS_BUILD_DIR}/tools/ci/library_test.py" after_success
after_failure: python "${TRAVIS_BUILD_DIR}/tools/ci/library_test.py" after_failure
after_script: python "${TRAVIS_BUILD_DIR}/tools/ci/library_test.py" after_script
cache:
directories:
- $HOME/boostorg/boost

View File

@ -235,7 +235,7 @@ commonly emulated by other compilers by defining the same base macros. To
account for this detection headers are allowed to define `*_EMULATED` predefs
when this situation is detected. The emulated predefs will be set to the
version number of the detection instead of the regular predef macro for that
detection. For example MSVC will set `BOOST_COMP_MSVC_EMULATED` but not set `BOOST_COM_MSVC`, and it will also set `BOOST_COMP_MSVC_AVAILABLE`.
detection. For example MSVC will set `BOOST_COMP_MSVC_EMULATED` but not set `BOOST_COMP_MSVC`, and it will also set `BOOST_COMP_MSVC_AVAILABLE`.
[heading Using the `BOOST_VERSION_NUMBER` macro]
@ -401,7 +401,7 @@ We also need to provide the `*_AVAILABLE` versions of the predef.
And for convenience we also want to provide a `*_NAME` macro:
``
#define BOOST_catagory_tag_NAME "Name"
#define BOOST_category_tag_NAME "Name"
``
The testing of the predef macros is automated to generate checks for all
@ -507,7 +507,7 @@ uses a simple 3-digit version macro (M,N,P). It can be decomposed
and defined as:
``
#define BOOST_CCOMP_EDG BOOST_PREDEF_MAKE_N_N_N(__EDG_VERSION__)
#define BOOST_COMP_EDG BOOST_PREDEF_MAKE_N_N_N(__EDG_VERSION__)
``
The decomposition macros are split into three types: decimal

View File

@ -38,7 +38,7 @@ Version number available as major, minor, and patch.
# define BOOST_COMP_DEC_DETECTION BOOST_PREDEF_MAKE_10_VVRR0PP00(__DECC_VER)
# endif
# if !defined(BOOST_COMP_DEC_DETECTION)
# define BOOST_COM_DEC_DETECTION BOOST_VERSION_NUMBER_AVAILABLE
# define BOOST_COMP_DEC_DETECTION BOOST_VERSION_NUMBER_AVAILABLE
# endif
#endif

View File

@ -102,8 +102,8 @@ local rule change_term_to_def ( term )
if $(parts[3])
{
local version_number = [ regex.split $(parts[3]) "[.]" ] ;
if ! $(version_number[3]) { version_number += "0" ; }
if ! $(version_number[2]) { version_number += "0" ; }
if ! $(version_number[3]) { version_number += "0" ; }
parts = $(parts[1-2]) BOOST_VERSION_NUMBER($(version_number:J=",")) ;
}
return <define>CHECK=\"$(parts:J=" ")\" ;

View File

@ -254,6 +254,26 @@ toolset_info = {
'toolset' : 'clang',
'version' : ''
},
'xcode-9.2' : {
'command' : 'clang++',
'toolset' : 'clang',
'version' : ''
},
'xcode-9.3' : {
'command' : 'clang++',
'toolset' : 'clang',
'version' : ''
},
'xcode-9.4' : {
'command' : 'clang++',
'toolset' : 'clang',
'version' : ''
},
'xcode-10.0' : {
'command' : 'clang++',
'toolset' : 'clang',
'version' : ''
},
}
class SystemCallError(Exception):
@ -435,24 +455,24 @@ class utils:
return boost_version
@staticmethod
def git_clone(sub_repo, branch, commit = None, cwd = None, no_submodules = False):
def git_clone(owner, repo, branch, commit = None, repo_dir = None, submodules = False, url_format = "https://github.com/%(owner)s/%(repo)s.git"):
'''
This clone mimicks the way Travis-CI clones a project's repo. So far
Travis-CI is the most limiting in the sense of only fetching partial
history of the repo.
'''
if not cwd:
cwd = cwd = os.getcwd()
root_dir = os.path.join(cwd,'boostorg',sub_repo)
if not os.path.exists(os.path.join(root_dir,'.git')):
if not repo_dir:
repo_dir = os.path.join(os.getcwd(), owner+','+repo)
utils.makedirs(os.path.dirname(repo_dir))
if not os.path.exists(os.path.join(repo_dir,'.git')):
utils.check_call("git","clone",
"--depth=1",
"--branch=%s"%(branch),
"https://github.com/boostorg/%s.git"%(sub_repo),
root_dir)
os.chdir(root_dir)
url_format%{'owner':owner,'repo':repo},
repo_dir)
os.chdir(repo_dir)
else:
os.chdir(root_dir)
os.chdir(repo_dir)
utils.check_call("git","pull",
# "--depth=1", # Can't do depth as we get merge errors.
"--quiet","--no-recurse-submodules")
@ -463,12 +483,12 @@ class utils:
utils.check_call('dir',os.path.join('.git','modules'))
else:
utils.check_call('ls','-la',os.path.join('.git','modules'))
if not no_submodules:
if submodules:
utils.check_call("git","submodule","--quiet","update",
"--quiet","--init","--recursive",
)
utils.check_call("git","submodule","--quiet","foreach","git","fetch")
return root_dir
return repo_dir
class parallel_call(threading.Thread):
'''
@ -496,7 +516,7 @@ def set_arg(args, k, v = None):
class script_common(object):
'''
Main script to run Boost C++ Libraries continuous integration.
Main script to run continuous integration.
'''
def __init__(self, ci_klass, **kargs):
@ -521,7 +541,7 @@ class script_common(object):
set_arg(kargs,'branch',None)
set_arg(kargs,'commit',None)
set_arg(kargs,'repo',None)
set_arg(kargs,'root_dir',None)
set_arg(kargs,'repo_dir',None)
set_arg(kargs,'actions',None)
set_arg(kargs,'pull_request', None)
@ -533,9 +553,9 @@ class script_common(object):
self.actions = kargs.get('actions',None)
if not self.actions or self.actions == []:
self.actions = [ 'info' ]
if not self.root_dir:
self.root_dir = os.getcwd()
self.build_dir = os.path.join(os.path.dirname(self.root_dir), "build")
if not self.repo_dir:
self.repo_dir = os.getcwd()
self.build_dir = os.path.join(os.path.dirname(self.repo_dir), "build")
# API keys.
self.bintray_key = os.getenv('BINTRAY_KEY')
@ -562,8 +582,8 @@ class script_common(object):
ci_script = getattr(self, action_m, None)
if ci_command or ci_script:
utils.log( "### %s.."%(action) )
if os.path.exists(self.root_dir):
os.chdir(self.root_dir)
if os.path.exists(self.repo_dir):
os.chdir(self.repo_dir)
if ci_command:
ci_command()
elif ci_script:
@ -614,9 +634,9 @@ class ci_cli(object):
The common way to use this variant is to invoke something like:
mkdir boost-ci
cd boost-ci
python path-to/ci_boost_<script>.py --branch=develop [--repo=mylib] ...
mkdir ci
cd ci
python path-to/library_test.py --branch=develop [--repo=mylib] ...
Status: In working order.
'''
@ -630,31 +650,23 @@ class ci_cli(object):
if os.path.isdir(doxygen_path):
os.environ["PATH"] = doxygen_path+':'+os.environ['PATH']
self.script = script
self.work_dir = os.getcwd()
self.repo_dir = os.getcwd()
self.exit_result = 0
def init(self, opt, kargs):
kargs['actions'] = [
'clone',
# 'clone',
'install',
'before_build',
'build',
'before_cache',
'finish'
]
opt.add_option( '--repo',
help="Boost repo short name we are testing with, and hence the repo we clone.")
set_arg(kargs,'repo','boost')
return kargs
def finish(self, result):
self.exit_result = result
def command_clone(self):
self.script.root_dir = os.path.join(self.work_dir,'boostorg',self.script.repo)
self.script.build_dir = os.path.join(os.path.dirname(self.script.root_dir), "build")
utils.git_clone(self.script.repo, self.script.branch, self.script.commit, self.work_dir)
def command_finish(self):
exit(self.exit_result)
@ -665,10 +677,9 @@ class ci_travis(object):
def __init__(self,script):
self.script = script
self.work_dir = os.getenv("HOME")
def init(self, opt, kargs):
set_arg(kargs,'root_dir', os.getenv("TRAVIS_BUILD_DIR"))
set_arg(kargs,'repo_dir', os.getenv("TRAVIS_BUILD_DIR"))
set_arg(kargs,'branch', os.getenv("TRAVIS_BRANCH"))
set_arg(kargs,'commit', os.getenv("TRAVIS_COMMIT"))
set_arg(kargs,'repo', os.getenv("TRAVIS_REPO_SLUG").split("/")[1])
@ -686,7 +697,7 @@ class ci_travis(object):
'''
info = toolset_info[toolset]
if sys.platform.startswith('linux'):
os.chdir(self.work_dir)
os.chdir(self.script.build_dir)
if 'ppa' in info:
for ppa in info['ppa']:
utils.check_call(
@ -748,10 +759,9 @@ class ci_circleci(object):
def __init__(self,script):
self.script = script
self.work_dir = os.getenv("HOME")
def init(self, opt, kargs):
set_arg(kargs,'root_dir', os.path.join(os.getenv("HOME"),os.getenv("CIRCLE_PROJECT_REPONAME")))
set_arg(kargs,'repo_dir', os.path.join(os.getenv("HOME"),os.getenv("CIRCLE_PROJECT_REPONAME")))
set_arg(kargs,'branch', os.getenv("CIRCLE_BRANCH"))
set_arg(kargs,'commit', os.getenv("CIRCLE_SHA1"))
set_arg(kargs,'repo', os.getenv("CIRCLE_PROJECT_REPONAME").split("/")[1])
@ -768,7 +778,7 @@ class ci_circleci(object):
utils.check_call("pip","install","--user","PyYAML")
def command_checkout_post(self):
os.chdir(self.script.root_dir)
os.chdir(self.script.repo_dir)
utils.check_call("git","submodule","update","--quiet","--init","--recursive")
def command_dependencies_pre(self):
@ -777,7 +787,7 @@ class ci_circleci(object):
import yaml
utils.check_call('sudo','-E','apt-get','-yqq','update')
utils.check_call('sudo','apt-get','-yqq','purge','texlive*')
with open(os.path.join(self.script.root_dir,'.travis.yml')) as yml:
with open(os.path.join(self.script.repo_dir,'.travis.yml')) as yml:
travis_yml = yaml.load(yml)
utils.check_call('sudo','apt-get','-yqq',
'--no-install-suggests','--no-install-recommends','--force-yes','install',
@ -817,10 +827,9 @@ class ci_appveyor(object):
def __init__(self,script):
self.script = script
self.work_dir = os.path.dirname(os.getenv("APPVEYOR_BUILD_FOLDER"))
def init(self, opt, kargs):
set_arg(kargs,'root_dir',os.getenv("APPVEYOR_BUILD_FOLDER"))
set_arg(kargs,'repo_dir',os.getenv("APPVEYOR_BUILD_FOLDER"))
set_arg(kargs,'branch',os.getenv("APPVEYOR_REPO_BRANCH"))
set_arg(kargs,'commit',os.getenv("APPVEYOR_REPO_COMMIT"))
set_arg(kargs,'repo',os.getenv("APPVEYOR_REPO_NAME").split("/")[1])
@ -839,7 +848,7 @@ class ci_appveyor(object):
self.script.command_install()
def command_before_build(self):
os.chdir(self.script.root_dir)
os.chdir(self.script.repo_dir)
utils.check_call("git","submodule","update","--quiet","--init","--recursive")
self.script.command_before_build()

View File

@ -36,39 +36,12 @@ class script(script_common):
set_arg(kargs, 'variant', os.getenv("VARIANT","debug"))
set_arg(kargs, 'cxxflags', os.getenv("CXXFLAGS",None))
return kargs
def start(self):
script_common.start(self)
# Some setup we need to redo for each invocation.
self.boost_root = os.path.join(self.ci.work_dir,'boostorg','boost')
@property
def repo_path(self):
if not hasattr(self,'_repo_path'):
# Find the path for the submodule of the repo we are testing.
if self.repo != 'boost':
self._repo_path = None
with open(os.path.join(self.boost_root,'.gitmodules'),"rU") as f:
path = None
url = None
for line in f:
line = line.strip()
if line.startswith("[submodule"):
path = None
url = None
else:
name = line.split("=")[0].strip()
value = line.split("=")[1].strip()
if name == "path":
path = value
elif name == "url":
url = value
if name and url and url.endswith("/%s.git"%(self.repo)):
self._repo_path = path
if not self._repo_path:
self._repo_path = "libs/%s"%(self.repo)
return self._repo_path
self.b2_dir = os.path.join(self.build_dir, 'b2')
def command_install(self):
script_common.command_install(self)
# Fetch & install toolset..
@ -79,38 +52,16 @@ class script(script_common):
def command_before_build(self):
script_common.command_before_build(self)
# Clone boost super-project.
if self.repo != 'boost':
utils.git_clone('boost',self.branch,cwd=self.ci.work_dir,no_submodules=True)
utils.check_call("git","submodule","update","--quiet","--init","tools/build")
utils.check_call("git","submodule","update","--quiet","--init","tools/boostdep")
# The global jamfiles require config as they trigger build config checks.
utils.check_call("git","submodule","update","--quiet","--init","libs/config")
# Fetch dependencies.
utils.git_clone('boostorg','build','develop',repo_dir=self.b2_dir)
# Find the path for the submodule of the repo we are testing.
if self.repo != 'boost':
self.repo_dir = os.path.join(self.boost_root,self.repo_path)
if self.repo != 'boost':
# Copy in the existing library tree checkout.
shutil.rmtree(self.repo_path)
shutil.copytree(self.root_dir, self.repo_path)
# Fetch the dependencies for the library we are testing.
if self.repo != 'boost':
os.chdir(self.boost_root)
utils.check_call(
sys.executable,
'tools/boostdep/depinst/depinst.py',
self.repo)
# Create config file for toolset.
# Create config file for b2 toolset.
if not isinstance(self.ci, ci_cli):
cxxflags = None
if self.cxxflags:
cxxflags = self.cxxflags.split()
cxxflags = " <cxxflags>".join(cxxflags)
utils.make_file(os.path.join(self.boost_root, 'project-config.jam'),
utils.make_file(os.path.join(self.repo_dir, 'project-config.jam'),
"""
using %(toolset)s : %(version)s : %(command)s : %(cxxflags)s ;
using python : %(pyversion)s : "%(python)s" ;
@ -127,72 +78,60 @@ using python : %(pyversion)s : "%(python)s" ;
script_common.command_build(self)
# Set up tools.
utils.makedirs(os.path.join(self.build_dir,'dist','bin'))
if not isinstance(self.ci, ci_cli) and toolset_info[self.toolset]['command']:
os.environ['PATH'] = os.pathsep.join([
os.path.dirname(toolset_info[self.toolset]['command']),
os.path.join(self.build_dir,'dist','bin'),
os.environ['PATH']])
else:
os.environ['PATH'] = os.pathsep.join([
os.path.join(self.build_dir,'dist','bin'),
os.environ['PATH']])
os.environ['BOOST_BUILD_PATH'] = self.build_dir
# Bootstrap Boost Build engine.
os.chdir(os.path.join(self.boost_root,"tools","build"))
os.chdir(self.b2_dir)
if sys.platform == 'win32':
utils.check_call(".\\bootstrap.bat")
shutil.copy2("b2.exe", os.path.join(self.build_dir,"dist","bin","b2.exe"))
else:
utils.check_call("./bootstrap.sh")
shutil.copy2("b2", os.path.join(self.build_dir,"dist","bin","b2"))
utils.check_call("git","clean","-dfqx")
os.environ['PATH'] = os.pathsep.join([self.b2_dir, os.environ['PATH']])
os.environ['BOOST_BUILD_PATH'] = self.b2_dir
# Run the limited tests.
if self.repo != 'boost':
print("--- Testing %s ---"%(self.repo_path))
os.chdir(os.path.join(self.boost_root,'status'))
to_test = self.repo_path.split("/")
del to_test[0]
toolset_to_test = ""
if self.toolset:
if not isinstance(self.ci, ci_cli):
toolset_to_test = toolset_info[self.toolset]['toolset']
else:
toolset_to_test = self.toolset
self.b2(
'-d1',
'-p0',
'--include-tests=%s'%("/".join(to_test)),
'preserve-test-targets=off',
'--dump-tests',
'--build-dir=%s'%(self.build_dir),
'--out-xml=%s'%(os.path.join(self.build_dir,'regression.xml')),
'' if not toolset_to_test else 'toolset=%s'%(toolset_to_test),
'' if not self.address_model else 'address-model=%s'%(self.address_model),
'variant=%s'%(self.variant),
'--test-type=%s'%(self.target),
'--verbose-test'
)
# Generate a readable test report.
import build_log
log_main = build_log.Main([
'--output=console',
os.path.join(self.build_dir,'regression.xml')])
# And exit with an error if the report contains failures.
# This lets the CI notice the error and report a failed build.
# And hence trigger the failure machinery, like sending emails.
if log_main.failed:
self.ci.finish(-1)
print("--- Testing %s ---"%(self.repo_dir))
os.chdir(os.path.join(self.repo_dir,'test'))
toolset_to_test = ""
if self.toolset:
if not isinstance(self.ci, ci_cli):
toolset_to_test = toolset_info[self.toolset]['toolset']
else:
toolset_to_test = self.toolset
self.b2(
'-d1',
'-p0',
'preserve-test-targets=off',
'--dump-tests',
'--verbose-test',
'--build-dir=%s'%(self.build_dir),
'--out-xml=%s'%(os.path.join(self.build_dir,'regression.xml')),
'' if not toolset_to_test else 'toolset=%s'%(toolset_to_test),
'' if not self.address_model else 'address-model=%s'%(self.address_model),
'variant=%s'%(self.variant),
self.target
)
# Generate a readable test report.
import build_log
log_main = build_log.Main([
'--output=console',
os.path.join(self.build_dir,'regression.xml')])
# And exit with an error if the report contains failures.
# This lets the CI notice the error and report a failed build.
# And hence trigger the failure machinery, like sending emails.
if log_main.failed:
self.ci.finish(-1)
def command_before_cache(self):
script_common.command_before_cache(self)
os.chdir(self.boost_root)
os.chdir(self.b2_dir)
utils.check_call("git","clean","-dfqx")
utils.check_call("git","submodule","--quiet","foreach","git","clean","-dfqx")
utils.check_call("git","status","-bs")
utils.check_call("git","submodule","foreach","git","status","-bs")
# utils.check_call("git","submodule","--quiet","foreach","git","clean","-dfqx")
# utils.check_call("git","submodule","foreach","git","status","-bs")
main(script)