Skip to content
Commits on Source (12)
---
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BreakBeforeBraces: Allman
ColumnLimit: 160
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 2
Cpp11BracedListStyle: true
DerivePointerAlignment: false
IndentWidth: 2
Language: Cpp
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
PointerAlignment: Left
SortIncludes: false
Standard: Cpp11
TabWidth: 2
UseTab: Never
...
# http://EditorConfig.org
# top-most EditorConfig file
root = true
# Apply to all code files
[*]
# A newline ending every file
insert_final_newline = true
# Set default charset
charset = utf-8
# 4 space indentation
indent_style = space
indent_size = 2
# Various options
trim_trailing_whitespace = true
Data/**/*.[0-9][0-9][0-9] filter=lfs diff=lfs merge=lfs -text
Data/**/*.BIL filter=lfs diff=lfs merge=lfs -text
Data/**/*.bsq filter=lfs diff=lfs merge=lfs -text
Data/**/*.c[0-9] filter=lfs diff=lfs merge=lfs -text
Data/**/*.c[0-9][0-9] filter=lfs diff=lfs merge=lfs -text
Data/**/*.ci4 filter=lfs diff=lfs merge=lfs -text
Data/**/*.cr4 filter=lfs diff=lfs merge=lfs -text
Data/**/*.dat filter=lfs diff=lfs merge=lfs -text
Data/**/*.dbf filter=lfs diff=lfs merge=lfs -text
Data/**/*.grd filter=lfs diff=lfs merge=lfs -text
Data/**/*.hdf filter=lfs diff=lfs merge=lfs -text
Data/**/*.he5 filter=lfs diff=lfs merge=lfs -text
Data/**/*.hgt filter=lfs diff=lfs merge=lfs -text
Data/**/*.id filter=lfs diff=lfs merge=lfs -text
Data/**/*.idx filter=lfs diff=lfs merge=lfs -text
Data/**/*.ima filter=lfs diff=lfs merge=lfs -text
Data/**/*.img filter=lfs diff=lfs merge=lfs -text
Data/**/*.index filter=lfs diff=lfs merge=lfs -text
Data/**/*.j2k filter=lfs diff=lfs merge=lfs -text
Data/**/*.jp2 filter=lfs diff=lfs merge=lfs -text
Data/**/*.jpeg filter=lfs diff=lfs merge=lfs -text
Data/**/*.jpg filter=lfs diff=lfs merge=lfs -text
Data/**/*.kmz filter=lfs diff=lfs merge=lfs -text
Data/**/*.las filter=lfs diff=lfs merge=lfs -text
Data/**/*.lum filter=lfs diff=lfs merge=lfs -text
Data/**/*.map filter=lfs diff=lfs merge=lfs -text
Data/**/*.mw filter=lfs diff=lfs merge=lfs -text
Data/**/*.pack filter=lfs diff=lfs merge=lfs -text
Data/**/*.pix filter=lfs diff=lfs merge=lfs -text
Data/**/*.png filter=lfs diff=lfs merge=lfs -text
Data/**/*.raw filter=lfs diff=lfs merge=lfs -text
Data/**/*.shp filter=lfs diff=lfs merge=lfs -text
Data/**/*.shx filter=lfs diff=lfs merge=lfs -text
Data/**/*.sqlite filter=lfs diff=lfs merge=lfs -text
# Data/**/*.tar filter=lfs diff=lfs merge=lfs -text
Data/**/*.tif filter=lfs diff=lfs merge=lfs -text
Data/**/*.TIF filter=lfs diff=lfs merge=lfs -text
Data/**/*.tiff filter=lfs diff=lfs merge=lfs -text
Data/**/*.tts filter=lfs diff=lfs merge=lfs -text
#
# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# WARNING!
# OTB uses Git-LFS to store the (large) tests data.
# Git-LFS is mostly transparent for the user and recent versions
# are able to use Git-LFS quite efficiently.
# But Git fails to manage efficiently numerous LFS data.
# We have to use directly git-lfs wrapping commands to have an
# efficient cloning step.
# Furthermore, Git-LFS and Gitlab sufer a bug preventing usage of
# GIT_STRATEGY=fetch (https://gitlab.com/gitlab-org/gitlab-runner/issues/3318)
variables:
BUILD_IMAGE_REGISTRY: $CI_REGISTRY/orfeotoolbox/otb-build-env
GIT_CLONE_PATH: $CI_BUILDS_DIR/otb
DOCKER_DRIVER: overlay2
GIT_DEPTH: "3"
# Disable automatic checkout to let us fetch LFS before
GIT_CHECKOUT: "false"
# The fetch strategy fails with LFS and GitLab
GIT_STRATEGY: "clone"
stages:
- precheck
- prepare
- build
- report
- deploy
.general:
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
.common:
extends: .general
before_script:
# Provision efficiently the local LFS cache before checkout
- git lfs fetch origin $CI_COMMIT_SHA
- git checkout -f -q $CI_COMMIT_SHA
after_script:
- python3 -u CI/cdash_handler.py
.common-build:
extends: .common
only:
- merge_requests
- develop
- /^release-[0-9]+\.[0-9]+$/
stage: build
artifacts:
when: always
expire_in: 24 hrs
paths:
- build/*/*.log #CMake log
- log/*.txt # Others
- CookBook-*-html.tar.gz
- CookBook-*.pdf
- OTB-Doxygen-*.tar.bz2
- OTB-*.run
- OTB-*.zip
- build/compile_commands.json
- build/ctest_report.xml
- build/cppcheck_report.xml
- build/coverage_report.xml
.common-prepare:
extends: .general
only:
- merge_requests
- develop
- /^release-[0-9]+\.[0-9]+$/
stage: prepare
before_script:
- export GIT_LFS_SKIP_SMUDGE=1
- git checkout -f -q $CI_COMMIT_SHA
- export GIT_LFS_SKIP_SMUDGE=0
artifacts:
expire_in: 24 hrs
when: always
paths:
- sb_branch.txt # Needed to checkout correct branch in build step
- build/*/*/*/*.log # Superbuild log
- build/*/*/*/*.cmake
#-------------------------- precheck job ---------------------------------------
fast-build:
extends: .common
only: [merge_requests, branches]
stage: precheck
image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-native-develop:latest
before_script:
- export GIT_LFS_SKIP_SMUDGE=1
- git checkout -f -q $CI_COMMIT_SHA
- python3 CI/check_twin_pipelines.py
script:
- ctest -V -S CI/main_ci.cmake -DIMAGE_NAME:string=ubuntu-18.04-fast
- ccache -s
legal-check:
extends: .common
only:
- merge_requests
- develop
- /^release-[0-9]+\.[0-9]+$/
stage: precheck
image: $BUILD_IMAGE_REGISTRY/otb-alpine:3.7
variables:
GIT_DEPTH: ""
allow_failure: true
script:
- ./CI/contributors_check.sh
- ./CI/headers_check.py
after_script: []
#------------------------- prepare & build jobs --------------------------------
debian-build:
extends: .common-build
image: $BUILD_IMAGE_REGISTRY/otb-debian-native:unstable
script:
- xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_ci.cmake -DIMAGE_NAME:string=debian-unstable-gcc
dependencies: []
## Ubuntu superbuild
ubuntu-xdk-prepare:
extends: .common-prepare
image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base:18.04
script:
- ctest -VV -S CI/prepare_superbuild.cmake -DIMAGE_NAME:string=ubuntu-18.04-llvm
ubuntu-xdk-build-doc:
extends: .common-build
image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base:18.04
script:
- xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=ubuntu-18.04-llvm-xdk
- mv build/CookBook-*-html.tar.gz . || true
- mv build/Documentation/Cookbook/latex/CookBook-*.pdf . || true
- mv build/Documentation/Doxygen/OTB-Doxygen-*.tar.bz2 . || true
- xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_packages.cmake -DIMAGE_NAME:string=ubuntu-18.04-llvm-xdk -DNAME_SUFFIX:string=-glibc-2.27
- mv build_packages/OTB-*.run . || true
dependencies:
- ubuntu-xdk-prepare
## CentOS superbuild
centos-xdk-prepare:
extends: .common-prepare
image: $BUILD_IMAGE_REGISTRY/otb-centos-superbuild-base:6.6
script:
- ctest -VV -S CI/prepare_superbuild.cmake -DIMAGE_NAME:string=centos-6.6-gcc
centos-xdk-build:
extends: .common-build
image: $BUILD_IMAGE_REGISTRY/otb-centos-superbuild-base:6.6
script:
- xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=centos-6.6-gcc
- xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_packages.cmake -DIMAGE_NAME:string=centos-6.6-gcc
- mv build_packages/OTB-*.run . || true
dependencies:
- centos-xdk-prepare
## MacOS superbuild
macos-xdk-prepare:
extends: .common-prepare
tags:
- macos
script:
- ctest -VV -S CI/prepare_superbuild.cmake -DIMAGE_NAME:string=macos-10.11.6-clang
macos-xdk-build:
tags:
- macos
extends: .common-build
script:
- ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=macos-10.11.6-clang
- ctest -V -S CI/main_packages.cmake -DIMAGE_NAME:string=macos-10.11.6-clang
- mv build_packages/OTB-*.run . || true
dependencies:
- macos-xdk-prepare
## Windows
.windows-prepare:
extends: .common-prepare
before_script:
# This override the previous before_script
- set GIT_LFS_SKIP_SMUDGE=1
- git checkout -f -q %CI_COMMIT_SHA%
- set GIT_LFS_SKIP_SMUDGE=0
.windows-build:
extends: .common-build
before_script:
- git lfs fetch origin %CI_COMMIT_SHA%
- git checkout -f -q %CI_COMMIT_SHA%
# - Win10
windows-10-prepare:
extends: .windows-prepare
tags:
- windows10
script:
- call ./CI/dev_env.bat x64 xdk 10
- clcache.exe -s
- ctest -C Release -V -S CI/prepare_superbuild.cmake
- clcache.exe -s
windows-10-build:
extends: .windows-build
tags:
- windows10
script:
- call ./CI/dev_env.bat x64 otb 10
- clcache.exe -s
- ctest -V -S CI/main_superbuild.cmake
- clcache.exe -s
- ctest -V -S CI/main_packages.cmake
- move "build_packages\OTB-*.zip" . || dir build_packages
dependencies:
- windows-10-prepare
# - Win8.1
windows-8-prepare:
extends: .windows-prepare
tags:
- windows8
script:
- call ./CI/dev_env.bat x86 xdk 8.1
- clcache.exe -s
- ctest -C Release -V -S CI/prepare_superbuild.cmake
- clcache.exe -s
windows-8-build:
extends: .windows-build
tags:
- windows8
script:
- call ./CI/dev_env.bat x86 otb 8.1
- clcache.exe -s
- ctest -V -S CI/main_superbuild.cmake
- clcache.exe -s
- ctest -V -S CI/main_packages.cmake
- move "build_packages\OTB-*.zip" . || dir build_packages
dependencies:
- windows-8-prepare
#------------------------- QA related jobs -------------------------------------
ubuntu-xdk-qa-code-coverage:
extends: .common-build
only:
refs:
- merge_requests
- develop
- /^release-[0-9]+\.[0-9]+$/
variables:
- $SONAR_OTB_TOKEN
image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-qa:18.04
script:
- xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96"
ctest -V -S CI/main_qa.cmake
-DIMAGE_NAME:string=ubuntu-18.04-llvm-qa
-DQA:BOOL=ON
- ./CI/otb_coverage.sh
- saxon-xslt -o build/ctest_report.xml
build/Testing/`head -n 1 build/Testing/TAG`/Test.xml
CI/ctest2junit.xsl
dependencies:
- ubuntu-xdk-prepare
ubuntu-xdk-qa-static-analysis:
extends: .common-build
only:
refs:
- merge_requests
- develop
- /^release-[0-9]+\.[0-9]+$/
variables:
- $SONAR_OTB_TOKEN
image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-qa:18.04
script:
- find Modules -type f -regextype posix-extended -regex '.*\.(h|hxx)$' -exec dirname '{}' \; |
grep -vE '^Modules/ThirdParty/' |
sort -u > header_directories
- cppcheck -j 8 -q --xml --xml-version=2 --enable=all
--language=c++ --std=c++14 --platform=unix64
--includes-file=header_directories
-i Modules/ThirdParty Modules
2> build/cppcheck_report.xml
after_script: []
dependencies:
- ubuntu-xdk-prepare
ubuntu-xdk-report:
extends: .common
variables:
GIT_DEPTH: ""
image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-qa:18.04
stage: report
only:
refs:
- merge_requests
- develop
- /^release-[0-9]+\.[0-9]+$/
variables:
- $SONAR_OTB_TOKEN
script:
- sonar-scanner -Dproject.settings=sonar-project.properties
-Dsonar.host.url=https://sonar.orfeo-toolbox.org
-Dsonar.login=$SONAR_OTB_TOKEN
`test -z "$CI_COMMIT_TAG" || echo "-Dsonar.projectVersion=$CI_COMMIT_TAG"`
-Dsonar.branch.name=$CI_COMMIT_REF_NAME
after_script: []
dependencies:
- ubuntu-xdk-qa-code-coverage
- ubuntu-xdk-qa-static-analysis
#---------------------------- Deploy job ---------------------------------------
deploy:
tags:
- deploy
image: $BUILD_IMAGE_REGISTRY/otb-alpine:3.7
stage: deploy
extends: .general
only:
- develop@orfeotoolbox/otb
- /^release-[0-9]+\.[0-9]+$/@orfeotoolbox/otb
before_script:
# Provision efficiently the local LFS cache before checkout
- git lfs fetch origin $CI_COMMIT_SHA
- git checkout -f -q $CI_COMMIT_SHA
script:
- ./CI/deploy.sh $CI_COMMIT_REF_NAME $RC_NUMBER
dependencies:
- ubuntu-xdk-build-doc
- centos-xdk-build
- macos-xdk-build
- windows-8-build
- windows-10-build
release-container:
image: $BUILD_IMAGE_REGISTRY/otb-alpine:3.7
stage: deploy
extends: .general
only:
refs:
- tags@orfeotoolbox/otb
variables:
- $CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/
script:
- curl --request POST
--form token=$K8S_SECRET_RELEASE
--form ref=master
--form variables[OTB_TAG]=$CI_COMMIT_TAG
https://gitlab.orfeo-toolbox.org/api/v4/projects/126/trigger/pipeline
### Target documentation ressources
### Target documentation resources
Can be a combination of Software guide, cookbook, doxygen, blog, applications doc, websites
Can be a combination of CookBook, doxygen, blog, applications doc, websites
### Change requested
......
We are ready to release OTB version MAJOR.MINOR.PATCH. The following steps need to be done:
### 1. Branches
* [ ] **(if major or minor release)** Feature freeze: [create the new release branch](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/wikis/Help-for-release-actions#create-release-branch)
* [ ] **(if patch release)** Work on the already existing branch `release-MAJOR-MINOR`
* [ ] Make sure the version number in `CMakeLists.txt` is MAJOR.MINOR.PATCH
### 2. Housekeeping
* [ ] In this story, make a list of blocking issues for the release (if any)
* [ ] [Update the SuperBuild archive](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/wikis/Help-for-release-actions#superbuild-archive) (if needed)
* [ ] Update release notes (walk the GitLab MR merged history and log all improvements)
* [ ] Update the date in RELEASE_NOTES.txt
* [ ] Run Debian [spelling](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/wikis/Help-for-release-actions#spelling-check) checker
* [ ] Run shellcheck script from [OTB-Devutils/Scripts/](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb-devutils/blob/master/Scripts/run_shellcheck.sh)
* [ ] [Update translation](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/wikis/Help-for-release-actions#translation-for-monteverdi-mapla) for Monteverdi and Mapla
* [ ] [Sanity check the binary packages](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/wikis/Help-for-release-actions#standalone-packages-sanity-check)
* [ ] Windows
* [ ] Linux
* [ ] Mac
### 3. Actual release
Once all blocking issues are closed, and the previous steps are done:
* [ ] [Tag the release or RC](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/wikis/Help-for-release-actions#release-tag)
* [ ] **(if major or minor release)**: Merge the release into develop
* [ ] **(if it's the latest release)**: Merge the release into master
* [ ] **(if patch release)**: Backport fixes
* [ ] Update GIT_TAG for all official remote modules (if needed)
### 4. Publish and plan next release
* [ ] [Prepare and upload source packages](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/wikis/Help-for-release-actions#prepare-and-upload-source-packages)
* [ ] [Promote staging packages](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/wikis/Help-for-release-actions#promote-staging-packages)
* [ ] [Update documentation](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/wikis/Help-for-release-actions#update-documentation)
* [ ] Cookbook
* [ ] Doxygen
* [ ] WordPress page "Home" and "Download" pages
* [ ] Upload OTB source archive to [Zenodo](https://zenodo.org/) to create a unique Digital Object Identifier (DOI)
* [ ] Send email to mailing list to announce the release
* [ ] Release announcement on the blog
* [ ] Announcement on social networks (twitter, google+)
* [ ] Forward announcement to news_item@osgeo.org ([OSGeo news](https://www.osgeo.org/foundation-news/))
* [ ] Plan the next release (nominate new release manager, setup PSC meeting on IRC)
* [ ] Remove public branches related to MR or bugfix merged before the release
/label ~story
### Summary
#### Summary
Gives a short summary of the changes.
### Rationale
#### Rationale
Explain the rationale for the changes (possible link to a Request For Comments or to an issue).
### Implementation Details
#### Classes and files
#### Implementation Details
<!---
##### Classes and files
Give an overview of the implementation: main changes made to classes, files and modules. Do not paste complete diff, as it is available in the merge request already.
-->
#### Applications
<!---
##### Applications
Describe any changes made to existing applications, or new applications that have been added.
-->
#### Tests
<!---
##### Tests
Describe the testing strategy for new features.
-->
### Documentation
<!---
##### Documentation
List or link documentation modifications that were made (doxygen, example, Software Guide, application documentation, CookBook).
-->
#### Additional notes
<!--- List remaining open issues if any, and additional notes. -->
#### Copyright
### Additional notes
The copyright owner is *COPYRIGHT OWNER (OR OWNER'S AGENT)* and has signed the ORFEO ToolBox Contributor License Agreement.
List remaining open issues if any, and additional notes.
<hr>
### Copyright
***Check before merging:***
The copyright owner is *COPYRIGHT OWNER (OR OWNER'S AGENT)* and has signed the ORFEO ToolBox Contributor License Agreement
- All discussions are resolved
- At least 2 :thumbsup: votes from core developers, no :thumbsdown: vote.
- The feature branch is (reasonably) up-to-date with the base branch
- Dashboard is green
- Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
- Optionally, run `git diff develop... -U0 --no-color | clang-format-diff.py -p1 -i` on latest changes and commit
Alexia Mondot <alexia.mondot@c-s.fr>
Amit Kulkarni <amitkulz@gmail.com>
Angelos Tzotsos <tzotsos@gmail.com>
Antoine Regimbeau <antoine.regimbeau@c-s.fr>
Antoine Regimbeau <antoine.regimbeau@c-s.fr> aregimbe <antoine.regimbeau@c-s.fr>
Antoine Regimbeau <antoine.regimbeau@c-s.fr> aregimbeau <antoine.regimbeau@c-s.fr>
Arnaud Jaen <arnaud.jaen@c-s.fr>
Aurélie Emilien <aurelie.emilien@c-s.fr> Aurelie Emilien <aurelie.emilien@c-s.fr>
Aurélie Emilien <aurelie.emilien@c-s.fr>
Aurelien Bricier <aurelien.bricier@c-s.fr>
Bas Couwenberg <sebastic@debian.org>
Bas Couwenberg <sebastic@debian.org> Bas Couwenberg <sebastic@xs4all.nl>
Caroline Ruffel <caroline.ruffel@c-s.fr>
Cédric Traizet <cedric.traizet@c-s.fr> Cedric <cedric.traizet@c-s.fr>
Cédric Traizet <cedric.traizet@c-s.fr> Cédric Traizet <traizetc@cesbio.cnes.fr>
Cédric Traizet <cedric.traizet@c-s.fr> ctraizet <cedric.traizet@c-s.fr>
Cédric Traizet <cedric.traizet@c-s.fr> Traizet Cedric <cedric.traizet@cesbio.cnes.fr>
Charles Peyrega <charles.peyrega@c-s.fr>
Chia Aik Song <crscas@nus.edu.sg>
Christophe Palmann <christophe.palmann@c-s.fr>
Conrad Bielski <conrad.bielski@yahoo.com>
Cyrille Valladeau <cyrille.valladeau@c-s.fr>
Daniel McInerney <daniel.o.mcinerney@gmail.com>
Daniel McInerney <daniel.o.mcinerney@gmail.com> dmci <daniel.o.mcinerney@gmail.com>
Daphne Deleflie <daphne.deleflie@thalesgroup.com>
David Youssefi <david.youssefi@cnes.fr>
Emmanuel Christophe <emmanuel.christophe@gmail.com>
Emmanuel Christophe <emmanuel.christophe@gmail.com> Emmanuel Christophe <emmanuel.christophe@nus.edu.sg>
Emmanuel Christophe <emmanuel.christophe@gmail.com> Emmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org>
Emmanuelle Sarrazin <emmanuelle.sarrazin@cnes.fr>
Emmanuelle Sarrazin <emmanuelle.sarrazin@cnes.fr> esarrazin <emmanuelle.sarrazin@cnes.fr>
Emmanuelle Sarrazin <emmanuelle.sarrazin@cnes.fr> sarrazin <emmanuelle.sarrazin@cnes.fr>
Etienne Bougoin <etienne.bougoin@c-s.fr>
Gaëlle Usseglio <gaelle.usseglio@cnes.fr> Gaëlle USSEGLIO <gaelle.usseglio@cnes.fr>
Grégoire Mercier <gregoire.mercier@telecom-bretagne.eu> Gregoire Mercier <gregoire.mercier@telecom-bretagne.eu>
Guilhem Bonnefille <guilhem.bonnefille@c-s.fr>
Guillaume Borrut <guillaume.borrut@c-s.fr>
Guillaume Pasero <guillaume.pasero@c-s.fr>
janestar <janestar92@163.com>
Jee Roen <jeroen.staab@posteo.de>
Jonathan Guinet <jonathan.guinet@c-s.fr>
Jordi Inglada <jordi.inglada@cesbio.eu>
Jordi Inglada <jordi.inglada@cesbio.eu> Jordi Inglada <jordi.inglada@cesbio.cnes.fr>
Jordi Inglada <jordi.inglada@cesbio.eu> Jordi Inglada <jordi.inglada@orfeo-toolbox.org>
Julien Malik <julien.malik@c-s.fr>
Julien Malik <julien.malik@c-s.fr> Julien Malik <julien.malik@gmail.com>
Julien Malik <julien.malik@c-s.fr> Julien Malik <julien.malik@orfeo-toolbox.org>
Julien Michel <julien.michel@cnes.fr>
Julien Michel <julien.michel@cnes.fr> Julien Michel <julien.michel@c-s.fr>
Julien Michel <julien.michel@cnes.fr> Julien Michel <julien.michel@orfeo-toolbox.org>
Laurențiu Nicola <lnicola@dend.ro> Laurentiu Nicola <lnicola@dend.ro>
Laurențiu Nicola <lnicola@dend.ro> Laurențiu Nicola <grayshade@gmail.com>
Luc Hermitte <luc.hermitte@c-s.fr>
Ludovic Hussonnois <ludovic.hussonnois@c-s.fr>
Manuel Grizonnet <manuel.grizonnet@cnes.fr>
Manuel Grizonnet <manuel.grizonnet@cnes.fr> Grizonnet Manuel <manuel.grizonnet@cnes.fr>
Manuel Grizonnet <manuel.grizonnet@cnes.fr> Manuel Grizonnet <manuel.grizonnet@gmail.com>
Manuel Grizonnet <manuel.grizonnet@cnes.fr> Manuel Grizonnet <manuel.grizonnet@orfeo-toolbox.org>
Marina Bertolino <marina.bertolino@c-s.fr>
Mathieu Deltorre <mathieu.deltorre@c-s.fr>
Mickaël Savinaud <mickael.savinaud@c-s.fr>
Mickaël Savinaud <mickael.savinaud@c-s.fr> Mickael Savinaud <mickael.savinaud@c-s.fr>
Mickaël Savinaud <mickael.savinaud@c-s.fr> msavinaud <mickael.savinaud@c-s.fr>
OTB Bot <otbbot@orfeo-toolbox.org>
Otmane Lahlou <otmane.lahlou@c-s.fr>
Patrick Imbo <patrick.imbo@c-s.fr>
Rashad Kanavath <rashad.kanavath@c-s.fr>
Rashad Kanavath <rashad.kanavath@c-s.fr> Rashad Kanavath <mohammed.rashad-km@cnes.fr>
Rashad Kanavath <rashad.kanavath@c-s.fr> Rashad Kanavath <mohammedrashadkm@gmail.com>
Rashad Kanavath <rashad.kanavath@c-s.fr> Rashad Kanavath <rashad.kanavath.email.com>
Rashad Kanavath <rashad.kanavath@c-s.fr> Rashad Kanavath <rashad.kanvath@c-s.fr>
Rashad Kanavath <rashad.kanavath@c-s.fr> Rashad M <rashad.kanavath@c-s.fr>
Rémi Cresson <remi.cresson@irstea.fr> remicres <remi.cresson@teledetection.fr>
Rémi Cresson <remi.cresson@irstea.fr> Remi Cresson <remi.cresson@irstea.fr>
Rémi Cresson <remi.cresson@irstea.fr> remi cresson <remi.cresson@teledetection.fr>
Rémi Cresson <remi.cresson@irstea.fr> remi <remi.cresson@irstea.fr>
Rémi Cresson <remi.cresson@irstea.fr> Rémi <remi.cresson@teledetection.fr>
Romain Garrigues <romain.garrigues@c-s.fr>
Rosa Ruiloba <rosario.ruiloba@c-s.fr>
Sébastien Dinot <sebastien.dinot@c-s.fr>
Sébastien Dinot <sebastien.dinot@c-s.fr> Sebastien Dinot <sebastien.dinot@c-s.fr>
Sébastien Dinot <sebastien.dinot@c-s.fr> Achille Talon <atalon@dinot.net>
Sebastien Harasse <sebastien.harasse@c-s.fr>
Stephane Albert <stephane.albert@c-s.fr>
Stephane Albert <stephane.albert@c-s.fr> Stephane Albert <salbert@dora.si.c-s.fr>
Stephane Albert <stephane.albert@c-s.fr> Stephane ALBERT <stephane.albert@c-s.fr>
Sylvain Poulain <kikislater@users.noreply.github.com> Sylvain POULAIN <kikislater@users.noreply.github.com>
Thomas Feuvrier <thomas.feuvrier@c-s.fr>
Tishampati Dhar <devnull@localhost>
Victor Poughon <victor.poughon@cnes.fr>
Vincent Poulain <vincent.poulain@thalesgroup.com>
Yannick Tanguy <yannick.tanguy@cnes.fr> Yannick TANGUY <yannick.tanguy@cnes.fr>
Yannick Tanguy <yannick.tanguy@cnes.fr> Yannick TANGUY <tanguyy@visu01.sis.cnes.fr>
Yannick Tanguy <yannick.tanguy@cnes.fr> ytanguy <yannick.tanguy@cnes.fr>
Yin Tiangang <crsyt@nus.edu.sg>
#
# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
language: cpp
sudo: false
......
# CI
This folder contains files for the continuous integration.
## Docker files
The docker files are:
* Dockerfile.nat: native environment to test OTB. Shark is not on this one as the version OTB is using is not packaged (since 6.7)
* Dockerfile.shark.1.3.4: native environment and Shark version 3.1.4.
## CMake files
The docker files are:
* main_ci.cmake: main script that will launch configure, build and soon test. It aims at configuring Ctest before running the different jobs (site name, build command...)
* configure_option.cmake: script that gathers all options needed by OTB.
## Yaml file
The last file needed for the CI is the *.gitlab-ci.yml* it aims at interfacing with GitLab. Here is the basic structure:
```
Job-name:
stage: job-type
image: docker_image_that_will_be_used
script:
- script that will be launch inside the docker
```
# CDash interaction
Results of build can be seen in CDash on the track "Experimental". The site is the image docker that run the build, and the build name should be the branch name that is tested.
\ No newline at end of file
#
# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import os
import os.path
import urllib.request
import urllib.parse
import glob
import re
import unittest
import sys
import json
import time
import xml.etree.ElementTree as ET
trace = False
"""
Check needed environment parameters
"""
def CheckEnvParameters(params, verbose=True):
for p in params:
if not p in os.environ.keys():
if verbose:
print("Missing environment variable '"+p+"'")
return False
return True
"""
Handler class to retrieve build informations
"""
class Handler:
def __init__ (self):
self.build_dir = ""
self.configure_path = ""
self.url = "https://cdash.orfeo-toolbox.org"
self.project = "OTB"
self.site = ""
self.stamp = ""
self.name = ""
self.buildid = ""
def GetConfigureFile (self , build_dir = "" ):
if build_dir == "":
build_dir = self.build_dir
build_dir = os.path.normpath(build_dir)
test_path = os.path.join( build_dir , "Testing/")
list_folder = os.listdir(test_path)
if trace:
print(list_folder)
configure_xml = ""
for folder in list_folder:
if folder == "Temporary" or folder == "TAG":
pass
configure_xml = os.path.join( test_path , folder , "Configure.xml" )
if os.path.exists( configure_xml ):
break
if os.path.exists( configure_xml ):
if trace:
print ( configure_xml )
self.configure_path = configure_xml
return self.configure_path
print("Could not find the Configure.xml produced by ctest")
sys.exit(1)
def ParseConfigureFile(self):
"""
Parse the configuration file to get Name, Site and BuildStamp
"""
configure_file = open( self.configure_path, "r" )
content = configure_file.read()
configure_file.close()
# strip the Log section as it can mess up the XML parser
startLog=content.find('<Log>')
endLog=content.rfind('</Log>')
if startLog > 0 and endLog > startLog:
content = content[:(startLog+5)]+content[endLog:]
# parse XML
root = ET.fromstring(content)
if trace:
print( root.attrib )
if not 'Name' in root.keys():
print("Can't find site name in Configure.XML")
sys.exit(1)
if not 'BuildName' in root.keys():
print("Can't find build name in Configure.XML")
sys.exit(1)
if not 'BuildStamp' in root.keys():
print("Can't find build stamp in Configure.XML")
sys.exit(1)
self.site = root.get('Name')
self.name = root.get('BuildName')
self.stamp = root.get('BuildStamp')
def GetBuildId (self, **kwargs):
"""
This function is returning the buildid. Dict can be passed with the
different informations
"""
site = self.site
stamp = self.stamp
name = self.name
project = self.project
for key , value in kwargs.items():
if key == "site":
site = value
if key == "stamp":
stamp = value
if key == "name":
name = value
if key == "project":
project = value
if ( site == "" or stamp == "" or name == "" or project == ""):
print( "Missing argument for buildid request site:"+site+", stamp:"+stamp+", name:"+name+", project:"+project+".")
sys.exit(1)
elif trace:
print( "Argument for buildid request site:"+site+", stamp:"+stamp+", name:"+name+", project:"+project+".")
buildid_api = "/api/v1/getbuildid.php?"
buildid_params = urllib.parse.urlencode({'project': project, 'site': site, 'stamp': stamp , 'name': name})
full_url = self.url + buildid_api + buildid_params
if trace:
print("full_url: "+full_url)
max_retry = 11
nb_try = max_retry
build_id_regex = re.compile( "<buildid>([0-9]+)</buildid>" )
while nb_try:
response = urllib.request.urlopen(full_url).read().decode()
if trace:
print ( "response: " + response )
buildid = build_id_regex.search( response )
nb_try -= 1
if buildid or (nb_try == 0):
break
print("No build id, retry "+str(max_retry-nb_try)+"/"+str(max_retry)+" ...")
time.sleep(30)
if buildid:
self.buildid = buildid.group(1)
if trace:
print ( "build id is ", self.buildid)
return buildid.group(1)
else:
print("Error in recovering buildid")
sys.exit(1)
def GetBuildUrl (self , buildid = "" ):
"""
This function is returning the build url. It can be called only when
everything is set
"""
if ( buildid == "" ):
buildid = self.buildid
if ( buildid == "" ):
print( "Missing argument to build url")
return
build_url = self.url
build_url +="/buildSummary.php?"
build_url += "buildid=" + buildid
return build_url
def GetBuildStatus(self, buildid = "" ):
"""
This function returns the status of a build id as a pair 'state' + 'errors'
"""
if ( buildid == "" ):
buildid = self.buildid
if ( buildid == "" ):
print( "Missing argument to build Status")
return
full_url = self.url + "/api/v1/buildSummary.php?buildid=" + buildid
response = urllib.request.urlopen(full_url).read().decode()
full_status = json.loads(response)
state = "success"
if full_status["configure"]["nerrors"] or full_status["build"]["nerrors"] \
or full_status["test"]["nerrors"] or full_status["test"]["nfailed"]:
state = 'failed'
errors = ""
if full_status["configure"]["nerrors"]:
errors = "Errors occur during configure"
elif full_status["build"]["nerrors"]:
errors = "Errors occur during build"
elif full_status["test"]["nerrors"] or full_status["test"]["nfailed"]:
errors = "Errors occur during tests"
return ( state , errors)
def GetReturnValue(self, logfile):
fd = open(logfile)
content = fd.readlines()[0]
fd.close()
return int(content.strip("\n"))
def GetLogStatus(self, logdir):
"""
This function returns the log status of a build as a pair 'state' + 'errors'
"""
configure_rv = os.path.join(logdir, "configure_return_value_log.txt")
build_rv = os.path.join(logdir, "build_return_value_log.txt")
test_rv = os.path.join(logdir, "test_return_value_log.txt")
if os.path.exists( configure_rv ):
if (self.GetReturnValue(configure_rv) != 0):
return ( 'failed' , 'Configure failed')
else:
return ( 'failed' , 'Configure not run')
if os.path.exists( build_rv ):
if (self.GetReturnValue(build_rv) != 0):
return ( 'failed' , 'Build failed')
else:
return ( 'failed' , 'Build not run')
if os.path.exists( test_rv ):
if (self.GetReturnValue(test_rv) != 0):
return ( 'failed' , 'Tests failed')
return ('success', '')
"""
This script aims only at recovering the build url
It uses environment variables setup by Gitlab Runner as default:
CI_COMMIT_SHA -> Commit SHA1
CI_PROJECT_ID -> Project ID
CI_PROJECT_DIR -> Project source directory
K8S_SECRET_API_TOKEN -> Token for Gitlab API
CI_MERGE_REQUEST_REF_PATH -> Ref name to push the status (only for merge request pipeline)
CI_COMMIT_REF_NAME -> Ref name to push the status
They can be overridden by a full command line :
cdash_handler.py commit_sha1 project_id project_directory token ref_name
"""
if __name__ == "__main__":
if trace:
print(sys.argv)
if ( len(sys.argv) < 6 and len(sys.argv) > 1 ):
print("Usage : "+sys.argv[0]+" commit_sha1 project_id project_directory token ref_name")
sys.exit(1)
if ( len(sys.argv) >= 6):
sha1 = sys.argv[1]
proj = sys.argv[2]
pdir = sys.argv[3]
token = sys.argv[4]
refn = sys.argv[5]
else:
if not CheckEnvParameters(['CI_COMMIT_SHA', 'CI_PROJECT_ID', 'CI_PROJECT_DIR', 'CI_COMMIT_REF_NAME']):
sys.exit(1)
sha1 = os.environ['CI_COMMIT_SHA']
refn = os.environ['CI_COMMIT_REF_NAME']
proj = os.environ['CI_PROJECT_ID']
pdir = os.environ['CI_PROJECT_DIR']
if CheckEnvParameters(['CI_MERGE_REQUEST_REF_PATH', 'CI_MERGE_REQUEST_PROJECT_ID'], verbose=False):
targetProj = os.environ['CI_MERGE_REQUEST_PROJECT_ID']
if proj == targetProj:
refn = os.environ['CI_MERGE_REQUEST_REF_PATH']
if CheckEnvParameters(['K8S_SECRET_API_TOKEN']):
token = os.environ['K8S_SECRET_API_TOKEN']
else:
token = None
handler = Handler()
build_dir = os.path.join( pdir , "build/")
if trace:
print("build_dir is: " + build_dir)
handler.build_dir = build_dir
handler.GetConfigureFile()
handler.ParseConfigureFile()
if handler.GetBuildId() is None:
cdash_url = "https://cdash.orfeo-toolbox.org"
state = 'failed'
error = "Failed to get build id"
else:
cdash_url = handler.GetBuildUrl()
( state , error ) = handler.GetLogStatus( os.path.join( pdir , "log") )
print("CDash build URL : "+cdash_url)
if token is None:
sys.exit(0)
gitlab_url = "https://gitlab.orfeo-toolbox.org/api/v4/projects/"
gitlab_url += proj + "/statuses/" + sha1
params = urllib.parse.urlencode({'name':'cdash:' + handler.site , 'state': state ,\
'target_url' : cdash_url , 'description' : error , 'ref' : refn })
gitlab_request = urllib.request.Request(gitlab_url)
gitlab_request.add_header('PRIVATE-TOKEN' , token )
if trace:
print ("gitlab_request.url: " + gitlab_request.full_url)
res = urllib.request.urlopen(gitlab_request, data=params.encode('ascii'))
if trace:
print ("gitlab_request.text: " + res.read().decode())
#
# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import os
import urllib.request
import urllib.parse
import json
import re
import time
import sys
"""
Send a request to Gitlab and return the answer
The request parameter is added after `project/:id/`
WARNING: when data is given, the request will be a POST
Otherwise, it is a GET
"""
def GitlabRequest(request, project=53, data=None, token=''):
gitlab_url = "https://gitlab.orfeo-toolbox.org/api/v4/projects/"
gitlab_url+= str(project) + '/' + request
params = None
myHeader = {}
if not data is None:
params = urllib.parse.urlencode(data).encode('ascii')
if token:
myHeader = {'PRIVATE-TOKEN':token}
gitlab_request = urllib.request.Request(gitlab_url, data=params, headers=myHeader)
res = urllib.request.urlopen(gitlab_request)
return json.loads(res.read().decode())
"""
Check needed environment parameters
"""
def CheckEnvParameters(params):
for p in params:
if not p in os.environ.keys():
print("Missing environment variable '"+p+"'")
return False
return True
"""
Check for any duplicated twin pipeline and cancel it
"""
if __name__ == "__main__":
if not CheckEnvParameters(['CI_COMMIT_SHA']):
sys.exit(1)
env = os.environ
sha1 = env['CI_COMMIT_SHA']
# are we in a merge_request pipeline ?
if 'CI_MERGE_REQUEST_IID' in env.keys():
if not CheckEnvParameters(['K8S_SECRET_API_TOKEN']):
print("WARNING: Make sure you have set a valid access token for Gitlab API." \
+ "The K8S_SECRET_API_TOKEN environment variable should be set in 'Settings -> CI/CD -> Variables'" \
+ "Without this token, some feature of the CI platform will be disabled.")
sys.exit(0)
if not CheckEnvParameters(['CI_PROJECT_ID','CI_PIPELINE_ID']):
sys.exit(1)
mrInfo = GitlabRequest('merge_requests/'+env['CI_MERGE_REQUEST_IID'],token=env['K8S_SECRET_API_TOKEN'])
wip_regex = re.compile("^[Ww][Ii][Pp]:")
# is it a "WIP" merge request ?
if wip_regex.search(mrInfo["title"]):
# Yes: cancel the current pipeline
print("Cancel current pipeline "+env['CI_PIPELINE_ID'])
GitlabRequest('pipelines/'+env['CI_PIPELINE_ID']+'/cancel', data={}, \
project=env['CI_PROJECT_ID'], token=env['K8S_SECRET_API_TOKEN'])
time.sleep(180)
print("Error: this pipeline should have been canceled")
sys.exit(1)
else:
# No: cancel any previous "normal" pipeline on the same SHA1
jres = GitlabRequest('pipelines?sha='+sha1, project=env['CI_PROJECT_ID'], token=env['K8S_SECRET_API_TOKEN'])
for item in jres:
if item["id"] < int(env['CI_PIPELINE_ID']) and item["status"] == "running":
print("Cancel pipeline "+str(item["id"]))
jres2 = GitlabRequest('pipelines/'+str(item["id"])+'/cancel', data={}, \
project=env['CI_PROJECT_ID'], token=env['K8S_SECRET_API_TOKEN'])
#
# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This script is a prototype for the future CI, it may evolve rapidly in a near future
#This file set the following variable :
# * otb_build_project_option
# * otb_use_option
# * otb_wrap_option
# * CONFIGURE_OPTIONS
set (otb_build_project_option
"BUILD_COOKBOOK:BOOL=OFF
BUILD_EXAMPLES:BOOL=ON
BUILD_SHARED_LIBS:BOOL=ON
BUILD_TESTING:BOOL=ON")
set (otb_qa_option
"CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON")
set (otb_use_option
"OTB_USE_6S:BOOL=ON
OTB_USE_CURL:BOOL=ON
OTB_USE_GLEW:BOOL=ON
OTB_USE_GLFW:BOOL=ON
OTB_USE_GLUT:BOOL=ON
OTB_USE_GSL:BOOL=ON
OTB_USE_LIBKML:BOOL=OFF
OTB_USE_LIBSVM:BOOL=ON
OTB_USE_MPI:BOOL=OFF
OTB_USE_MUPARSER:BOOL=ON
OTB_USE_MUPARSERX:BOOL=ON
OTB_USE_OPENCV:BOOL=ON
OTB_USE_OPENGL:BOOL=ON
OTB_USE_OPENMP:BOOL=OFF
OTB_USE_QT:BOOL=ON
OTB_USE_QWT:BOOL=ON
OTB_USE_SHARK:BOOL=ON
OTB_USE_SIFTFAST:BOOL=ON
OTB_USE_SPTW:BOOL=ON
OTB_USE_SSE_FLAGS:BOOL=ON")
# Useful if MPI is ON : OTB_MPIEXEC_OPT:STRING=--allow-run-as-root
set (otb_wrap_option
"OTB_WRAP_PYTHON:BOOL=ON")
set (cmake_configure_option
"CMAKE_BUILD_TYPE=${CTEST_BUILD_CONFIGURATION}
CMAKE_INSTALL_PREFIX:PATH=${CTEST_INSTALL_DIRECTORY}")
# extra options for XDK builds
if(XDK_PATH)
set(cmake_configure_option
"${cmake_configure_option}
CMAKE_PREFIX_PATH=${XDK_PATH}")
foreach(remote_module OTBTemporalGapFilling SertitObject otbGRM DiapOTBModule)
set(cmake_configure_option
"${cmake_configure_option}
Module_${remote_module}:BOOL=ON")
endforeach()
endif()
if((CTEST_SITE) AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/${CTEST_SITE}.cmake")
# will set its output in 'site_option'
include("${CMAKE_CURRENT_LIST_DIR}/${CTEST_SITE}.cmake")
endif()
set(concat_options
"${otb_build_project_option}
${otb_use_option}
${otb_wrap_option}
${otb_data_option}
${cmake_configure_option}
${site_option}
")
if (QA)
set(concat_options
"${concat_options}
${otb_qa_option}
")
endif()
#Transform the previous string in list
string (REPLACE "\n" ";" otb_options ${concat_options})
foreach(item ${otb_options})
set( CONFIGURE_OPTIONS "${CONFIGURE_OPTIONS}-D${item};")
endforeach(item)
#!/bin/bash
#
# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This script aims to identify the unreferenced authors to invite the team to
# check if they have already signed the contributor license agreement (CLA).
# When this is done, the author must be added to the reference list.
GITLAB_PROJECT_URL=https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb-devutils
GIT_CONTRIBUTORS=/tmp/git-contributors.txt
KNOWN_CONTRIBUTORS=/tmp/known-contributors.txt
UNKNOWN_CONTRIBUTORS=/tmp/unknown-contributors.txt
# According to the Git documentation, the reference ("HEAD" in the present
# case) must be passed on the command line when the standard input of "git
# shortlog" command is not a terminal. Without the reference in such
# situation, the output of "git shortlog" is empty.
git shortlog -es HEAD | cut -f 2- \
| sort -u > ${GIT_CONTRIBUTORS}
curl -s ${GITLAB_PROJECT_URL}/raw/master/CI/contributors/known-contributors.txt \
| sort -u > ${KNOWN_CONTRIBUTORS}
diff ${KNOWN_CONTRIBUTORS} ${GIT_CONTRIBUTORS} > ${UNKNOWN_CONTRIBUTORS}
if [ "$?" -ne "0" ] ; then
echo ""
echo "WARNING: ***************************************************************"
echo "WARNING: Unknown contributors found:"
sed -n -e 's,^> ,WARNING: - ,p' ${UNKNOWN_CONTRIBUTORS}
echo "WARNING: Check if they have signed the contributor license agreements."
echo "WARNING: ***************************************************************"
echo ""
exit 1
else
echo "All contributors are already known."
exit 0
fi
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<!-- convert ctest output to junit format -->
<!--
Inspired by https://stackoverflow.com/questions/6329215/how-to-get-ctest-results-in-hudson-jenkins
Based on https://github.com/zanata/zanata-tests/blob/master/scripts/CTest2JUnit.xsl
Extended by providing total Start date, total time, total test stats
-->
<xsl:template match="/Site">
<xsl:variable name="StartDate"><xsl:value-of select="Testing/StartDateTime"/></xsl:variable>
<xsl:variable name="DoTime"><xsl:value-of select="Testing/EndTestTime - Testing/StartTestTime"/></xsl:variable>
<xsl:variable name="TotalTests"><xsl:value-of select="count(Testing/Test)"/></xsl:variable>
<xsl:variable name="Skipped"><xsl:value-of select="count(Testing/Test[@Status='notrun'])"/></xsl:variable>
<xsl:variable name="Disabled"><xsl:value-of select="count(Testing/Test/Results/Measurement[Value='Disabled'])"/></xsl:variable>
<xsl:variable name="Failed"><xsl:value-of select="count(Testing/Test[@Status='failed'])"/></xsl:variable>
<testsuite time="{$DoTime}" timestamp="{$StartDate}" tests="{$TotalTests}" failures="{$Failed}" skipped="{$Skipped}" disabled="{$Disabled}">
<xsl:variable name="BuildName"><xsl:value-of select="@BuildName"/></xsl:variable>
<xsl:variable name="BuildStamp"><xsl:value-of select="@BuildStamp"/></xsl:variable>
<xsl:variable name="Name"><xsl:value-of select="@Name"/></xsl:variable>
<xsl:variable name="Generator"><xsl:value-of select="@Generator"/></xsl:variable>
<xsl:variable name="CompilerName"><xsl:value-of select="@CompilerName"/></xsl:variable>
<xsl:variable name="OSName"><xsl:value-of select="@OSName"/></xsl:variable>
<xsl:variable name="Hostname"><xsl:value-of select="@Hostname"/></xsl:variable>
<xsl:variable name="OSRelease"><xsl:value-of select="@OSRelease"/></xsl:variable>
<xsl:variable name="OSVersion"><xsl:value-of select="@OSVersion"/></xsl:variable>
<xsl:variable name="OSPlatform"><xsl:value-of select="@OSPlatform"/></xsl:variable>
<xsl:variable name="Is64Bits"><xsl:value-of select="@Is64Bits"/></xsl:variable>
<xsl:variable name="VendorString"><xsl:value-of select="@VendorString"/></xsl:variable>
<xsl:variable name="VendorID"><xsl:value-of select="@VendorID"/></xsl:variable>
<xsl:variable name="FamilyID"><xsl:value-of select="@FamilyID"/></xsl:variable>
<xsl:variable name="ModelID"><xsl:value-of select="@ModelID"/></xsl:variable>
<xsl:variable name="ProcessorCacheSize"><xsl:value-of select="@ProcessorCacheSize"/></xsl:variable>
<xsl:variable name="NumberOfLogicalCPU"><xsl:value-of select="@NumberOfLogicalCPU"/></xsl:variable>
<xsl:variable name="NumberOfPhysicalCPU"><xsl:value-of select="@NumberOfPhysicalCPU"/></xsl:variable>
<xsl:variable name="TotalVirtualMemory"><xsl:value-of select="@TotalVirtualMemory"/></xsl:variable>
<xsl:variable name="TotalPhysicalMemory"><xsl:value-of select="@TotalPhysicalMemory"/></xsl:variable>
<xsl:variable name="LogicalProcessorsPerPhysical"><xsl:value-of select="@LogicalProcessorsPerPhysical"/></xsl:variable>
<xsl:variable name="ProcessorClockFrequency"><xsl:value-of select="@ProcessorClockFrequency"/></xsl:variable>
<properties>
<property name="BuildName" value="{$BuildName} {$DoTime}" />
<property name="BuildStamp" value="{$BuildStamp}" />
<property name="Name" value="{$Name}" />
<property name="Generator" value="{$Generator}" />
<property name="CompilerName" value="{$CompilerName}" />
<property name="OSName" value="{$OSName}" />
<property name="Hostname" value="{$Hostname}" />
<property name="OSRelease" value="{$OSRelease}" />
<property name="OSVersion" value="{$OSVersion}" />
<property name="OSPlatform" value="{$OSPlatform}" />
<property name="Is64Bits" value="{$Is64Bits}" />
<property name="VendorString" value="{$VendorString}" />
<property name="VendorID" value="{$VendorID}" />
<property name="FamilyID" value="{$FamilyID}" />
<property name="ModelID" value="{$ModelID}" />
<property name="ProcessorCacheSize" value="{$ProcessorCacheSize}" />
<property name="NumberOfLogicalCPU" value="{$NumberOfLogicalCPU}" />
<property name="NumberOfPhysicalCPU" value="{$NumberOfPhysicalCPU}" />
<property name="TotalVirtualMemory" value="{$TotalVirtualMemory}" />
<property name="TotalPhysicalMemory" value="{$TotalPhysicalMemory}" />
<property name="LogicalProcessorsPerPhysical" value="{$LogicalProcessorsPerPhysical}" />
<property name="ProcessorClockFrequency" value="{$ProcessorClockFrequency}" />
</properties>
<xsl:apply-templates select="Testing/Test"/>
<system-out>
BuildName: <xsl:value-of select="$BuildName" />
BuildStamp: <xsl:value-of select="$BuildStamp" />
Name: <xsl:value-of select="$Name" />
Generator: <xsl:value-of select="$Generator" />
CompilerName: <xsl:value-of select="$CompilerName" />
OSName: <xsl:value-of select="$OSName" />
Hostname: <xsl:value-of select="$Hostname" />
OSRelease: <xsl:value-of select="$OSRelease" />
OSVersion: <xsl:value-of select="$OSVersion" />
OSPlatform: <xsl:value-of select="$OSPlatform" />
Is64Bits: <xsl:value-of select="$Is64Bits" />
VendorString: <xsl:value-of select="$VendorString" />
VendorID: <xsl:value-of select="$VendorID" />
FamilyID: <xsl:value-of select="$FamilyID" />
ModelID: <xsl:value-of select="$ModelID" />
ProcessorCacheSize: <xsl:value-of select="$ProcessorCacheSize" />
NumberOfLogicalCPU: <xsl:value-of select="$NumberOfLogicalCPU" />
NumberOfPhysicalCPU: <xsl:value-of select="$NumberOfPhysicalCPU" />
TotalVirtualMemory: <xsl:value-of select="$TotalVirtualMemory" />
TotalPhysicalMemory: <xsl:value-of select="$TotalPhysicalMemory" />
LogicalProcessorsPerPhysical: <xsl:value-of select="$LogicalProcessorsPerPhysical" />
ProcessorClockFrequency: <xsl:value-of select="$ProcessorClockFrequency" />
</system-out>
</testsuite>
</xsl:template>
<xsl:template match="Testing/Test">
<xsl:variable name="testcasename"><xsl:value-of select="Name"/></xsl:variable>
<xsl:variable name="testclassname"><xsl:value-of select=" concat('this', substring(Path,2))"/></xsl:variable>
<xsl:variable name="exectime">
<xsl:for-each select="Results/NamedMeasurement">
<xsl:if test="@name='Execution Time'">
<xsl:value-of select="Value"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<testcase name="{$testcasename}" classname="{$testclassname}" time="{$exectime}">
<xsl:if test="@Status = 'passed'">
<system-out><xsl:value-of select="Results/Measurement/Value/text()"/></system-out>
</xsl:if>
<xsl:if test="@Status = 'failed'">
<xsl:variable name="failtype">
<xsl:for-each select="Results/NamedMeasurement">
<xsl:if test="@name = 'Exit Code'">
<xsl:value-of select="Value"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="failcode">
<xsl:for-each select="Results/NamedMeasurement">
<xsl:if test="@name = 'Exit Value'">
<xsl:value-of select="Value"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<failure message="{$failtype} ({$failcode})"><xsl:value-of select="Results/Measurement/Value/text()" /></failure>
</xsl:if>
<xsl:if test="@Status = 'notrun'">
<skipped><xsl:value-of select="Results/Measurement/Value/text()" /></skipped>
</xsl:if>
</testcase>
</xsl:template>
</xsl:stylesheet>
#
# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Configuration options for debian-unstable-gcc
set(site_option
"opencv_INCLUDE_DIR:PATH=/usr/include
OTB_USE_MPI:BOOL=OFF
OTB_USE_SHARK:BOOL=OFF
")
#!/bin/bash
#
# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Configure git for tar.xz
git config tar.tar.xz.command "xz -c"
pack_suffix=""
if [ $1 = "develop" ] # check if the branch name is develop or not
then # we are on develop
jobs_directory=/home/otbpush/test/$(date +%F)
else # we are on a release branch
jobs_directory=/home/otbpush/test/staging
if [ "$#" -eq 2 ]
then # there is a rc tag, we need a suffix for packages
pack_suffix=-$(echo "$2" | grep -o "rc[0-9]*") # this retrieve the rc number
fi
fi
echo "jobs_directory=${jobs_directory}"
echo "pack_suffix=${pack_suffix}"
# Create today's directory on serveur otb5-vm2
echo "Creating today's directory"
ssh otbpush@otb5-vm2.orfeo-toolbox.org mkdir -p ${jobs_directory}
# Delete latest
echo "Deleting latest directory"
if [ $1 = "develop" ]
then # On develop
ssh otbpush@otb5-vm2.orfeo-toolbox.org rm -rf /home/otbpush/test/latest
# Create symilink
ssh otbpush@otb5-vm2.orfeo-toolbox.org ln -s ${jobs_directory} /home/otbpush/test/latest
# Cleaning old directory
matching_dirs=$(ls -1 | grep -oE '^20[0-9]{2}-[0-9]{2}-[0-9]{2}$' | sort)
history_length=11
rm -rf $(echo $matching_dirs | tr ' ' '\n' | head -n -${history_length})
else # On release
# Remove what is inside staging area
ssh otbpush@otb5-vm2.orfeo-toolbox.org rm -rf ${jobs_directory}/*
fi
# Push package
echo "Renaming binary packages"
for name in $(find . -regex "./OTB-.*\(run\|zip\)"); do
len=(${#name})
mv "$name" "${name:0:$len-4}${pack_suffix}${name:$len-4}"
done
echo "Pushing binary packages"
scp OTB-*.{run,zip} otbpush@otb5-vm2.orfeo-toolbox.org:${jobs_directory}/.
# Push doc
echo "Pushing documentation"
scp {CookBook-*-html.tar.gz,OTB-Doxygen-*.tar.bz2} otbpush@otb5-vm2.orfeo-toolbox.org:${jobs_directory}/.
# Create zip, tar.gz and tar.xy source
echo "Creating source tarball and zip"
git archive --format=zip -o OTB-sources-$CI_COMMIT_SHORT_SHA.zip HEAD
git archive --format=tgz -o OTB-sources-$CI_COMMIT_SHORT_SHA.tar.gz HEAD
git archive --format=tar.xz -o OTB-sources-$CI_COMMIT_SHORT_SHA.tar.xz HEAD
# Remove old source file
echo "Removing old sources"
ssh otbpush@otb5-vm2.orfeo-toolbox.org \
rm ${jobs_directory}/OTB-sources-*.zip \
${jobs_directory}/OTB-sources-*.tar.*
# Push new source file
echo "Pushing new sources"
scp OTB-sources-$CI_COMMIT_SHORT_SHA.* \
otbpush@otb5-vm2.orfeo-toolbox.org:${jobs_directory}/
::
:: Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
::
:: This file is part of Orfeo Toolbox
::
:: https://www.orfeo-toolbox.org/
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
@echo off
:: check input arguments
if %1.==. (
echo "No arch"
call :Help
goto :eof
)
if %2.==. (
echo "No project"
call :Help
goto :eof
)
if /I "%1"=="help" (
call :Help
goto :eof
)
if /I "%1"=="/help" (
call :Help
goto :eof
)
if /I "%1"=="-help" (
call :Help
goto :eof
)
set ARCH=%1
set PROJECT=%2
if %3.==. (
set SHORT_TARGET=10
) else (
set SHORT_TARGET=%3
)
if %4.==. (
set VCVER=14.0
) else (
set VCVER=%4
)
set TARGET=%SHORT_TARGET%
if "%TARGET%"=="10" (
set TARGET=10.0.17763.0
)
:: Setup home dir (so that ssh configuration works fine)
:: if "%USERNAME%"=="otbbot" (
set HOMEDRIVE=C:
set HOMEPATH=\Users\otbbot
::)
echo Home dir: %HOMEDRIVE%%HOMEPATH%
:: Setup Python
set PATH=C:\tools\Python35-%ARCH%;%PATH%
set PATH=C:\tools\Python35-%ARCH%\Scripts;%PATH%
:: Setup GL dlls
set PATH=%PATH%;C:\tools\GL\%ARCH%\bin
:: Setup compiler
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" %ARCH% %TARGET% -vcvars_ver=%VCVER%
:: Setup Clcache
set CLCACHE_DIR=C:\clcache\%PROJECT%-%ARCH%-%TARGET%-%VCVER%
set CLCACHE_HARDLINK=1
:: set CLCACHE_SERVER=1
set CLCACHE_CL=
for /F "delims=" %%a in ('where cl.exe') do @if defined CLCACHE_CL (break ) else (set CLCACHE_CL=%%a)
echo CL path: "%CLCACHE_CL%"
:: install clcache.exe as cl.exe
copy C:\tools\Python35-%ARCH%\Scripts\clcache.exe C:\clcache\cl.exe
set PATH=C:\clcache;%PATH%
:: we need to change cache max size: clcache -M <size-in-bytes>
if "%PROJECT%"=="xdk" (
call "clcache.exe" -M 3000000000
)
if "%PROJECT%"=="otb" (
call "clcache.exe" -M 2000000000
)
set IMAGE_NAME=windows-%SHORT_TARGET%-%ARCH%-vc%VCVER%
echo Generated IMAGE_NAME: %IMAGE_NAME%
:: setup path to perl, but add it last ... (there is a libstdc++.dll in that folder...)
set PATH=%PATH%;C:\tools\perl\perl\bin
goto :eof
:Help
setlocal
echo "Usage: dev_env.bat <compiler_arch> <project> [<target-os> [<vc_version>]]"
echo " <compiler_arch> : 'x86' | 'x64'"
echo " <project> : 'xdk' | 'otb'"
echo " <target-os> : '8.1' | '10' (default)"
echo " <vc_version> :"
echo " '14.20' (i.e. VS 2019)"
echo " '14.16' (i.e. VS 2017)"
echo " '14.0' (i.e. VS 2015) (default)"
endlocal
#!/usr/bin/python3
#
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import os, re
# Root search directory
topdir = '.'
# Header to associate to each file extension
# - C++ and JavaScript comments are defined by /* ... */ (=> C++ header)
# - Shell, Python, Perl comments are defubed by # ... (=> Shell header)
# - Text files must be processed on a case-by-case basis according to their
# content and what is done with them
# - It is complicated to insert a comment in an image file and most of them
# were not created by the OTB project (=> no header)
# - There is no need to insert a copyright header in the generated files or
# configuration files (=> no header)
# - Most of CSS files were not created by the OTB project (=> no header)
# - etc.
fileext = {
'.cpp': 'cpp',
'.cxx': 'cpp',
'.txx': 'cpp',
'.h': 'cpp',
'.hpp': 'cpp',
'.hxx': 'cpp',
'.h.in': 'cpp',
'.includes': 'cpp',
'.i': 'cpp',
'.js': 'cpp',
'.sh': 'shell',
'.sh.in': 'shell',
'.bash': 'shell',
'.profile': 'shell',
'.py': 'shell',
'.py.in': 'shell',
'.cmake': 'shell',
'.cmake.in': 'shell',
'.yml': 'shell',
'.pl': 'shell',
'.bat': 'batch',
'.bat.in': 'batch',
'.png': 'none',
'.jpg': 'none',
'.tif': 'none',
'.xpm': 'none',
'.ico': 'none',
'.eps': 'none',
'.svg': 'none',
'.txt': 'none',
'.md': 'none',
'.rst': 'none',
'.xml': 'none',
'.html': 'none',
'.dox': 'none',
'.dox.in': 'none',
'.ts': 'none',
'.ui': 'none',
'.qrc': 'none',
'.rc': 'none',
'.rc.in': 'none',
'.css': 'none'
}
specialfiles = {
'CMakeLists.txt': 'shell', # i.e. CMake file but Shell like comments
'StandaloneWrapper.in': 'shell', # i.e. CMake file but Shell like comments
'macx_pkgsetup.in': 'shell',
'linux_pkgsetup.in': 'shell'
}
# Directories to exclude from the header checking for various reasons (third
# party works, data, patches, ...)
excludeddirs = set([
'./.git',
'./Data',
'./Modules/ThirdParty',
'./Packaging/makeself',
'./SuperBuild/Copyright',
'./SuperBuild/patches'
])
# Files to exclude from the header checking for various reasons (full text of
# licenses, binary archives, ...)
excludedfiles = set([
'./.clang-format',
'./.editorconfig',
'./.gitattributes',
'./.gitignore',
'./.mailmap',
'./sonar-project.properties',
'./LICENSE',
'./NOTICE',
'./VERSION',
'./CI/ctest2junit.xsl',
'./CI/test/README',
'./CMake/CppcheckTargets.cmake',
'./CMake/FindGLEW.cmake',
'./CMake/FindKWStyle.cmake',
'./CMake/FindLibSVM.cmake',
'./CMake/FindOpenThreads.cmake',
'./CMake/Findcppcheck.cmake',
'./CMake/Findcppcheck.cpp',
'./CMake/GenerateExportHeaderCustom.cmake',
'./CMake/InsightValgrind-RHEL6.supp',
'./CMake/InsightValgrind.supp',
'./CMake/OTB_CheckCCompilerFlag.cmake',
'./CMake/PythonCompile.py',
'./CMake/TopologicalSort.cmake',
'./CMake/exportheader.cmake.in',
'./CMake/pre-commit',
'./CMake/qt.conf.in',
'./Documentation/Cookbook/Art/residual_registration-figure.tex',
'./Documentation/Cookbook/rst/Makefile.in',
'./Documentation/Cookbook/rst/conf.py.in',
'./Modules/Visualization/Ice/README',
'./Modules/Wrappers/SWIG/src/numpy.i',
'./Packaging/Files/Monteverdi.icns',
'./Packaging/Files/OTB Project.zip',
'./Packaging/Files/qt.conf',
'./Packaging/Files/template.app/Contents/Info.plist',
'./Packaging/LICENSE',
'./Packaging/howto_update_makeself',
'./Packaging/otb_update_makeself',
'./SuperBuild/LICENSE',
'./Utilities/Data/Icons/LICENSE.TXT',
'./Utilities/Data/Icons/NOTES',
'./Utilities/Data/monteverdi.desktop.in',
'./Utilities/Data/monteverdi2.desktop',
'./Utilities/Doxygen/doxygen.config.in',
'./Utilities/Maintenance/BuildHeaderTest.py',
'./Utilities/Maintenance/fix_typos.sh'
])
regcppheader = re.compile(
r'''/\*
( \* Copyright \(C\) 1999-2011 Insight Software Consortium
| \* Copyright \(C\) 20\d\d(-20\d\d)? Centre National d'Etudes Spatiales \(CNES\)
| \* Copyright \(C\) 20\d\d(-20\d\d)? CS Systemes d'Information \(CS SI\)
| \* Copyright \(C\) 2007-2012 Institut Mines Telecom / Telecom Bretagne
| \* Copyright \(C\) 20\d\d(-20\d\d)? IRSTEA
| \* Copyright \(C\) 2008 Jan Wegner
| \* Copyright \(C\) 2007 Julien Radoux
)+ \*
\* This file is part of Orfeo Toolbox
\*
\* https://www\.orfeo-toolbox\.org/
\*
\* Licensed under the Apache License, Version 2\.0 \(the "License"\);
\* you may not use this file except in compliance with the License\.
\* You may obtain a copy of the License at
\*
\* http://www\.apache\.org/licenses/LICENSE-2\.0
\*
\* Unless required by applicable law or agreed to in writing, software
\* distributed under the License is distributed on an "AS IS" BASIS,
\* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
\* See the License for the specific language governing permissions and
\* limitations under the License\.
\*/
''', flags=re.MULTILINE)
regshellheader = re.compile(
r'''(.*
)+(# Copyright \(C\) 1999-2011 Insight Software Consortium
|# Copyright \(C\) 20\d\d(-20\d\d)? Centre National d'Etudes Spatiales \(CNES\)
|# Copyright \(C\) 20\d\d(-20\d\d)? CS Systemes d'Information \(CS SI\)
|# Copyright \(C\) 20\d\d(-20\d\d)? IRSTEA
|# Copyright \(C\) 2007-2012 Institut Mines Telecom / Telecom Bretagne
)+#
# This file is part of Orfeo Toolbox
#
# https://www\.orfeo-toolbox\.org/
#
# Licensed under the Apache License, Version 2\.0 \(the "License"\);
# you may not use this file except in compliance with the License\.
# You may obtain a copy of the License at
#
# http://www\.apache\.org/licenses/LICENSE-2\.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
# See the License for the specific language governing permissions and
# limitations under the License\.
''', flags=re.MULTILINE)
regbatchheader = re.compile(
r'''(.*
)+(:: Copyright \(C\) 1999-2011 Insight Software Consortium
|:: Copyright \(C\) 20\d\d(-20\d\d)? Centre National d'Etudes Spatiales \(CNES\)
|:: Copyright \(C\) 20\d\d(-20\d\d)? CS Systemes d'Information \(CS SI\)
|:: Copyright \(C\) 2007-2012 Institut Mines Telecom / Telecom Bretagne
)+::
:: This file is part of Orfeo Toolbox
::
:: https://www\.orfeo-toolbox\.org/
::
:: Licensed under the Apache License, Version 2\.0 \(the "License"\);
:: you may not use this file except in compliance with the License\.
:: You may obtain a copy of the License at
::
:: http://www\.apache\.org/licenses/LICENSE-2\.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
:: See the License for the specific language governing permissions and
:: limitations under the License\.
''', flags=re.MULTILINE)
debug = False
returnvalue = 0
def verifyheader(filename, category):
global returnvalue
if category == 'none':
if debug: print('File type ignored ({} style comment): {}'.format(category, filename))
return True
sourceFile = open(filename)
sourceContent = sourceFile.read().lstrip()
sourceFile.close()
if category == 'cpp':
m = regcppheader.match(sourceContent)
elif category == 'shell':
m = regshellheader.match(sourceContent)
elif category == 'batch':
m = regbatchheader.match(sourceContent)
else:
print('WARNING: Unable to evaluate header ({} style comment): {}'.format(category, filename))
returnvalue = 1
return False
if m:
if debug: print('Conform header ({} style comment): {}'.format(category, filename))
return True
else:
print('WARNING: Non-compliant header ({} style comment): {}'.format(category, filename))
returnvalue = 1
return False
# Regular expression catching the file extension (with patterns '.xxx' or
# '.xxx.yyy', like '.cmake' or '.cmake.in')
# NOTE: '+?' operator is the not greedy / hungry version of '+' operator.
extreg = re.compile(r'^.+?(\.[^.]+(\.[^.]+)?)$')
for root, dirs, files in os.walk(topdir, topdown=True):
# "dirs[:]" modify dirs "in-place". In doing so, we can ignore some
# directories (here, the directories listed in the 'excludeddirs' set.
dirs[:] = [d for d in dirs if os.path.join(root, d) not in excludeddirs]
for f in sorted(files):
fullpathname = os.path.join(root, f)
# 1. Exclusion of files in which we do not want to search for the
# copyright header.
if fullpathname in excludedfiles:
if debug: print('File excluded: {}'.format(fullpathname))
# 2. Early identification of files with a misleading extension
elif f in specialfiles.keys():
verifyheader(fullpathname, specialfiles[f])
# 3. Processing of other files according to their extension
else:
m = extreg.match(f)
if m:
# NOTE: m.group(0) = Whole string matched by the regular
# expression (here, the whole name of the file)
ext1 = m.group(1) # '.xxx' or '.xxx.yyy' form
ext2 = m.group(2) # '.yyy' form (optional and included in group #1)
# The test of two extensions (ext1, ext2) rather than only one
# make possible to distinguish known extensions, such ".cmake"
# or ".cmake.in", from patterns that look like a double
# extension, but are not, like ".remote.cmake". So, the
# appropriate processing can be applied (".remote.cmake" must
# be identified as ".cmake" and not as an unknown extension).
if ext1 in fileext.keys():
verifyheader(fullpathname, fileext[ext1])
elif ext2 in fileext.keys():
verifyheader(fullpathname, fileext[ext2])
else:
print('WARNING: File with an unknown extension: {}'.format(fullpathname))
returnvalue = 1
else:
print('WARNING: File without extension and not excluded: {}'.format(fullpathname))
returnvalue = 1
exit(returnvalue)
#
# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Configuration options for macOS
set(site_option
"OTB_USE_GLUT=OFF
OTB_USE_GLFW=OFF
CMAKE_C_COMPILER_LAUNCHER:STRING=ccache
CMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache
OTB_DATA_USE_LARGEINPUT:BOOL=ON")
# Large input path are in an environment variable on macOS