| 1 |
# @HEADER |
| 2 |
# ***************************************************************************** |
| 3 |
# TriBITS: Tribal Build, Integrate, and Test System |
| 4 |
# |
| 5 |
# Copyright 2013-2016 NTESS and the TriBITS contributors. |
| 6 |
# SPDX-License-Identifier: BSD-3-Clause |
| 7 |
# ***************************************************************************** |
| 8 |
# @HEADER |
| 9 |
|
| 10 |
|
| 11 |
include(SetCacheOnOffEmpty) |
| 12 |
include(MultilineSet) |
| 13 |
include(AdvancedOption) |
| 14 |
include(AssertDefined) |
| 15 |
include(Split) |
| 16 |
include(MessageWrapper) |
| 17 |
include(TribitsSortListAccordingToMasterList) |
| 18 |
|
| 19 |
|
| 20 |
# @MACRO: tribits_project_define_extra_repositories() |
| 21 |
# |
| 22 |
# Declare a set of extra repositories for the `TriBITS Project`_ (i.e. in the |
| 23 |
# project's `<projectDir>/cmake/ExtraRepositoriesList.cmake`_ file). |
| 24 |
# |
| 25 |
# Usage:: |
| 26 |
# |
| 27 |
# tribits_project_define_extra_repositories( |
| 28 |
# <repo0_name> <repo0_dir> <repo0_vctype> <repo0_url> <repo0_packstat> <repo0_classif> |
| 29 |
# <repo1_name> <repo1_dir> <repo1_vctype> <repo1_url> <rep10_packstat> <repo1_classif> |
| 30 |
# ... |
| 31 |
# ) |
| 32 |
# |
| 33 |
# This macro takes in a 2D array with 6 columns, where each row defines an |
| 34 |
# extra repository. The 6 columns (ordered 0-5) are: |
| 35 |
# |
| 36 |
# 0. **REPO_NAME** (``<repoi_name>``): The name given to the repository |
| 37 |
# ``REPOSITORY_NAME``. |
| 38 |
# |
| 39 |
# 1. **REPO_DIR** (``<repoi_dir>``): The relative directory for the repository |
| 40 |
# under the project directory ``${PROJECT_SOURCE_DIR}`` (or |
| 41 |
# ``<projectDir>``). If this is set to empty quoted string ``""``, then |
| 42 |
# the relative directory name is assumed to be same as the repository name |
| 43 |
# ``<repoi_name>``. NOTE: If the repo is a `TriBITS Repository`_ (see |
| 44 |
# ``REPO_PACKSTAT`` below) then, currently, the repo dir must be the same |
| 45 |
# as the package name. |
| 46 |
# |
| 47 |
# 2. **REPO_VCTYPE** (``<repoi_vctype>``): The version control (VC) type of |
| 48 |
# the repo. Value choices include ``GIT``, ``SVN`` (i.e. Subversion) or |
| 49 |
# empty ``""`` (in which case ``<repoi_url>`` must be empty as well). |
| 50 |
# WARNING: Only VC repos of type ``GIT`` can fully participate in the |
| 51 |
# TriBITS development tool workflows. The other VC types are only |
| 52 |
# supported for basic cloning and updating using `tribits_ctest_driver()`_ |
| 53 |
# scripts. |
| 54 |
# |
| 55 |
# 3. **REPO_URL** (``<repoi_url>``): The URL of the VC repo. This info is |
| 56 |
# used to initially obtain the repo source code using the VC tool listed in |
| 57 |
# ``<repoi_vctype>``. If the repo does not need to be cloned for the |
| 58 |
# needed use cases, then this can be the empty quoted string ``""``. Also, |
| 59 |
# this field must be the empty string ``""`` if ``<repoi_vctype>`` is empty |
| 60 |
# ``""``. |
| 61 |
# |
| 62 |
# 4. **REPO_PACKSTAT** (``<repoi_packstat>``): Determines if the repository is |
| 63 |
# a `TriBITS Repository`_ and contains any TriBITS packages (or if it just |
| 64 |
# provides directories and files) and if its packages are listed before or |
| 65 |
# after the project's own native packages. If this is a TriBITS Repository |
| 66 |
# (and therefore contains `TriBITS Repository Core Files`_) then this field |
| 67 |
# must contain the keyword ``HASPACKAGES`` or left empty. If the listed |
| 68 |
# repository is **not** a TriBITS repository, and just provides directories |
| 69 |
# and files, then this field must contain the keyword ``NOPACKAGES``. The |
| 70 |
# default is assumed to be ``HASPACKAGES`` if neither of these keywords are |
| 71 |
# provided. If the keyword ``PRE`` is provided, then the TriBITS packages |
| 72 |
# in this repo come before the project's native packages. If the keyword |
| 73 |
# ``POST`` is provided then the packages are listed after the project's |
| 74 |
# native packages. The default is assumed to be ``POST`` if neither of |
| 75 |
# these keywords are provided. The keywords must be separated by a comma |
| 76 |
# with no spaces such as with "``PRE,HASPACKAGES``", |
| 77 |
# "``HASPACKAGES,POST``", "``POST,NOPACKAGES``", etc. If no keywords are |
| 78 |
# provided, then the empty string "" must be used (which defaults to |
| 79 |
# ``"HASPACKAGES,POST"``). |
| 80 |
# |
| 81 |
# 5. **REPO_CLASSIFICATION** (``<repoi_classif>``): Gives the `Repository Test |
| 82 |
# Classification`_ which also happens to be the CTest/CDash testing mode |
| 83 |
# and the default dashboard track. Valid values are ``Continuous``, |
| 84 |
# ``Nightly``, and ``Experimental``. See `Repository Test Classification`_ |
| 85 |
# for a detailed description. |
| 86 |
# |
| 87 |
# This command is used to put together one or more VC and/or TriBITS |
| 88 |
# repositories to construct a composite `TriBITS Project`_. The option |
| 89 |
# `<Project>_EXTRAREPOS_FILE`_ is used to point to files that call this macro. |
| 90 |
# |
| 91 |
# Repositories with ``<repoi_packstat>=NOPACKAGES`` are **not** TriBITS |
| 92 |
# Repositories and are technically not considered at all during the basic |
| 93 |
# configuration of the a TriBITS project. They are only listed in this file |
| 94 |
# so that they can be used in the version control logic for tools that perform |
| 95 |
# version control with the repositories (such as getting git versions, |
| 96 |
# cloning, updating, looking for changed files, etc.). For example, a |
| 97 |
# non-TriBITS repo can be used to grab a set of directories and files that |
| 98 |
# fill in the definition of a package in an upstream repository (see `How to |
| 99 |
# insert a package into an upstream repo`_). Also, non-TriBITS repos can be |
| 100 |
# used to provide extra test data for a given package or a set of packages so |
| 101 |
# that extra tests can be run. |
| 102 |
# |
| 103 |
# Repositories with ``<repoi_repotype>=''`` are not VC repos. This can be |
| 104 |
# used, for example, to represent the project's native repos or it can be used |
| 105 |
# to point to a TriBITS repository that was cloned in an early listed VC repo. |
| 106 |
# |
| 107 |
# NOTE: These repositories must be listed in the order of package |
| 108 |
# dependencies. That is, all of the packages listed in repository ``i`` must |
| 109 |
# have upstream TPL and package dependencies listed before this package in |
| 110 |
# this repository or in upstream repositories ``i-1``, ``i-2``, etc. |
| 111 |
# |
| 112 |
# NOTE: This module just sets the local variable:: |
| 113 |
# |
| 114 |
# ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY |
| 115 |
# |
| 116 |
# in the current scope. The advantages of using this macro instead of |
| 117 |
# directly setting this variable are that the macro: |
| 118 |
# |
| 119 |
# * Asserts that the variable ``PROJECT_NAME`` is defined and set. |
| 120 |
# |
| 121 |
# * Avoids misspelling the name of the variable |
| 122 |
# ``${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY``. If |
| 123 |
# one misspells the name of a macro, it is an immediate error in CMake. A |
| 124 |
# misspelled set variable is just ignored. |
| 125 |
# |
| 126 |
# * The variable name can change in the future as an implementation detail. |
| 127 |
# |
| 128 |
macro(tribits_project_define_extra_repositories) |
| 129 |
assert_defined(PROJECT_NAME) |
| 130 |
if ("${ARGN}" STREQUAL "") |
| 131 |
set(${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY) |
| 132 |
else() |
| 133 |
set(${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY "${ARGN}") |
| 134 |
endif() |
| 135 |
endmacro() |
| 136 |
|
| 137 |
|
| 138 |
# |
| 139 |
# Field offsets |
| 140 |
# |
| 141 |
|
| 142 |
set(ERP_REPO_NAME_OFFSET 0) |
| 143 |
set(ERP_REPO_DIR_OFFSET 1) |
| 144 |
set(ERP_REPO_VCTYPE_OFFSET 2) |
| 145 |
set(ERP_REPO_REPOURL_OFFSET 3) |
| 146 |
set(ERP_REPO_PACKSTAT_OFFSET 4) |
| 147 |
set(ERP_REPO_CLASSIFICATION_OFFSET 5) |
| 148 |
|
| 149 |
set(ERP_NUM_FIELDS_PER_REPO 6) |
| 150 |
|
| 151 |
# |
| 152 |
# Dump the list of extra repos in verbose mode |
| 153 |
# |
| 154 |
function(tribits_dump_extra_repositories_list) |
| 155 |
if (${PROJECT_NAME}_VERBOSE_CONFIGURE OR TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) |
| 156 |
print_var(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT) |
| 157 |
print_var(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS) |
| 158 |
print_var(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES) |
| 159 |
print_var(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS) |
| 160 |
print_var(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS) |
| 161 |
print_var(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS) |
| 162 |
print_var(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES) |
| 163 |
print_var(${PROJECT_NAME}_PRE_REPOSITORIES_DEFAULT) |
| 164 |
print_var(${PROJECT_NAME}_EXTRA_REPOSITORIES_DEFAULT) |
| 165 |
endif() |
| 166 |
endfunction() |
| 167 |
|
| 168 |
|
| 169 |
# |
| 170 |
# Function that parses the PACKSTAT field in the array |
| 171 |
# ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY and returns |
| 172 |
# HASPKGS and PREPOST. |
| 173 |
# |
| 174 |
function(tribits_parse_extrarepo_packstat PACKSTAT_IN |
| 175 |
HASPKGS_OUT PREPOST_OUT |
| 176 |
) |
| 177 |
|
| 178 |
#print_var(PACKSTAT_IN) |
| 179 |
split("${PACKSTAT_IN}" "," PACKSTAT_IN_ARRAY) |
| 180 |
|
| 181 |
# Set the defaults |
| 182 |
set(HASPKGS "HASPACKAGES") |
| 183 |
set(PREPOST "POST") |
| 184 |
|
| 185 |
foreach(PACKSTAT_ELE ${PACKSTAT_IN_ARRAY}) |
| 186 |
#print_var(PACKSTAT_ELE) |
| 187 |
string(STRIP "${PACKSTAT_ELE}" PACKSTAT_ELE) |
| 188 |
#print_var(PACKSTAT_ELE) |
| 189 |
if (PACKSTAT_ELE STREQUAL "HASPACKAGES") |
| 190 |
set(HASPKGS "HASPACKAGES") |
| 191 |
elseif (PACKSTAT_ELE STREQUAL "NOPACKAGES") |
| 192 |
set(HASPKGS "NOPACKAGES") |
| 193 |
elseif (PACKSTAT_ELE STREQUAL "PRE") |
| 194 |
set(PREPOST "PRE") |
| 195 |
elseif (PACKSTAT_ELE STREQUAL "POST") |
| 196 |
set(PREPOST "POST") |
| 197 |
else() |
| 198 |
message_wrapper(FATAL_ERROR "Error, the value of 'PACKSTAT' element" |
| 199 |
" '${PACKSTAT_ELE}' is not valid! Valid choices are '' (empty)," |
| 200 |
" 'HASPACKAGES', 'NOPACKAGES', 'PRE', and 'POST'. The defaults if all" |
| 201 |
" fields are empty are 'HASPACKAGES' and 'POST'") |
| 202 |
endif() |
| 203 |
endforeach() |
| 204 |
# NOTE: In the above foreach(PACKSTAT_ELE ${PACKSTAT_IN_ARRAY}) loop, empty |
| 205 |
# elements are skipped! |
| 206 |
|
| 207 |
# Set the output arguments |
| 208 |
set(${HASPKGS_OUT} "${HASPKGS}" PARENT_SCOPE) |
| 209 |
set(${PREPOST_OUT} "${PREPOST}" PARENT_SCOPE) |
| 210 |
|
| 211 |
endfunction() |
| 212 |
|
| 213 |
# |
| 214 |
# Macro that processes the list variable contents in |
| 215 |
# ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY into separate arrays: |
| 216 |
# |
| 217 |
# ${PROJECT_NAME}_PRE_REPOSITORIES_DEFAULT |
| 218 |
# ${PROJECT_NAME}_EXTRA_REPOSITORIES_DEFAULT |
| 219 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT |
| 220 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS |
| 221 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES |
| 222 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS |
| 223 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS |
| 224 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS |
| 225 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES |
| 226 |
# |
| 227 |
# The macro responds to ${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE |
| 228 |
# to match the categories. |
| 229 |
# |
| 230 |
macro(tribits_process_extrarepos_lists) |
| 231 |
|
| 232 |
if ( |
| 233 |
("${${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY}" STREQUAL "") |
| 234 |
AND |
| 235 |
(NOT "${${PROJECT_NAME}_EXTRAREPOS_DIR_REPOTYPE_REPOURL_PACKSTAT_CATEGORY}" STREQUAL "") |
| 236 |
) |
| 237 |
message(WARNING "Warning! Usage of the variable" |
| 238 |
" '${PROJECT_NAME}_EXTRAREPOS_DIR_REPOTYPE_REPOURL_PACKSTAT_CATEGORY'" |
| 239 |
" is deprecated. Please use the macro tribits_project_define_extra_repositories()" |
| 240 |
" instead!") |
| 241 |
set( ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY |
| 242 |
"${${PROJECT_NAME}_EXTRAREPOS_DIR_REPOTYPE_REPOURL_PACKSTAT_CATEGORY}" ) |
| 243 |
endif() |
| 244 |
|
| 245 |
# A) Get the total number of extrarepos defined |
| 246 |
|
| 247 |
if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) |
| 248 |
print_var(${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY) |
| 249 |
endif() |
| 250 |
assert_defined(${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY) |
| 251 |
list(LENGTH ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY |
| 252 |
${PROJECT_NAME}_NUM_EXTRAREPOS_AND_FIELDS ) |
| 253 |
math(EXPR ${PROJECT_NAME}_NUM_EXTRAREPOS |
| 254 |
"${${PROJECT_NAME}_NUM_EXTRAREPOS_AND_FIELDS}/${ERP_NUM_FIELDS_PER_REPO}") |
| 255 |
if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) |
| 256 |
print_var(${PROJECT_NAME}_NUM_EXTRAREPOS) |
| 257 |
endif() |
| 258 |
math(EXPR ${PROJECT_NAME}_LAST_EXTRAREPO_IDX "${${PROJECT_NAME}_NUM_EXTRAREPOS}-1") |
| 259 |
if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) |
| 260 |
print_var(${PROJECT_NAME}_LAST_EXTRAREPO_IDX) |
| 261 |
endif() |
| 262 |
|
| 263 |
# B) Process the list of extra repos |
| 264 |
|
| 265 |
set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT) |
| 266 |
set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS) |
| 267 |
set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES) |
| 268 |
set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS) |
| 269 |
set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS) |
| 270 |
set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS) |
| 271 |
set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES) |
| 272 |
set(${PROJECT_NAME}_PRE_REPOSITORIES_DEFAULT) |
| 273 |
set(${PROJECT_NAME}_EXTRA_REPOSITORIES_DEFAULT) |
| 274 |
|
| 275 |
set(PROCESSED_POST_EXTRAREPO FALSE) |
| 276 |
|
| 277 |
foreach(EXTRAREPO_IDX RANGE ${${PROJECT_NAME}_LAST_EXTRAREPO_IDX}) |
| 278 |
|
| 279 |
# B.1) Extract the fields for the current extrarepo row |
| 280 |
|
| 281 |
# NAME |
| 282 |
math(EXPR EXTRAREPO_NAME_IDX |
| 283 |
"${EXTRAREPO_IDX}*${ERP_NUM_FIELDS_PER_REPO}+${ERP_REPO_NAME_OFFSET}") |
| 284 |
if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) |
| 285 |
print_var(EXTRAREPO_NAME_IDX) |
| 286 |
endif() |
| 287 |
list(GET ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY |
| 288 |
${EXTRAREPO_NAME_IDX} EXTRAREPO_NAME ) |
| 289 |
if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) |
| 290 |
print_var(EXTRAREPO_NAME) |
| 291 |
endif() |
| 292 |
|
| 293 |
# DIR |
| 294 |
math(EXPR EXTRAREPO_DIR_IDX |
| 295 |
"${EXTRAREPO_IDX}*${ERP_NUM_FIELDS_PER_REPO}+${ERP_REPO_DIR_OFFSET}") |
| 296 |
if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) |
| 297 |
print_var(EXTRAREPO_DIR_IDX) |
| 298 |
endif() |
| 299 |
list(GET ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY |
| 300 |
${EXTRAREPO_DIR_IDX} EXTRAREPO_DIR ) |
| 301 |
if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) |
| 302 |
print_var(EXTRAREPO_DIR) |
| 303 |
endif() |
| 304 |
if (EXTRAREPO_DIR STREQUAL "") |
| 305 |
set(EXTRAREPO_DIR ${EXTRAREPO_NAME}) |
| 306 |
endif() |
| 307 |
if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) |
| 308 |
print_var(EXTRAREPO_DIR) |
| 309 |
endif() |
| 310 |
|
| 311 |
# VCTYPE |
| 312 |
math(EXPR EXTRAREPO_VCTYPE_IDX |
| 313 |
"${EXTRAREPO_IDX}*${ERP_NUM_FIELDS_PER_REPO}+${ERP_REPO_VCTYPE_OFFSET}") |
| 314 |
if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) |
| 315 |
print_var(EXTRAREPO_VCTYPE_IDX) |
| 316 |
endif() |
| 317 |
list(GET ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY |
| 318 |
${EXTRAREPO_VCTYPE_IDX} EXTRAREPO_VCTYPE ) |
| 319 |
if (EXTRAREPO_VCTYPE STREQUAL GIT |
| 320 |
OR EXTRAREPO_VCTYPE STREQUAL SVN |
| 321 |
) |
| 322 |
# Okay |
| 323 |
elseif (EXTRAREPO_VCTYPE STREQUAL HG) |
| 324 |
# not quite okay |
| 325 |
message(WARNING "Warning: the repo ${EXTRAREPO_NAME} is a Mercurial repo: these are tolerated, but not fully supported.") |
| 326 |
elseif (EXTRAREPO_VCTYPE STREQUAL "") |
| 327 |
# We are okay with no VC type |
| 328 |
else() |
| 329 |
message(FATAL_ERROR "Error, the repo type of '${EXTRAREPO_VCTYPE}' for" |
| 330 |
" extra repo ${EXTRAREPO_NAME} is *not* valid. Valid choices are 'GIT', 'HG' and 'SVN'!") |
| 331 |
endif() |
| 332 |
if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) |
| 333 |
print_var(EXTRAREPO_VCTYPE) |
| 334 |
endif() |
| 335 |
|
| 336 |
# REPOURL |
| 337 |
math(EXPR EXTRAREPO_REPOURL_IDX |
| 338 |
"${EXTRAREPO_IDX}*${ERP_NUM_FIELDS_PER_REPO}+${ERP_REPO_REPOURL_OFFSET}") |
| 339 |
if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) |
| 340 |
print_var(EXTRAREPO_REPOURL_IDX) |
| 341 |
endif() |
| 342 |
list(GET ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY |
| 343 |
${EXTRAREPO_REPOURL_IDX} EXTRAREPO_REPOURL ) |
| 344 |
if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) |
| 345 |
print_var(EXTRAREPO_REPOURL) |
| 346 |
endif() |
| 347 |
|
| 348 |
# PACKSTAT (PACKSTAT and PREPOST) |
| 349 |
math(EXPR EXTRAREPO_PACKSTAT_IDX |
| 350 |
"${EXTRAREPO_IDX}*${ERP_NUM_FIELDS_PER_REPO}+${ERP_REPO_PACKSTAT_OFFSET}") |
| 351 |
list(GET ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY |
| 352 |
${EXTRAREPO_PACKSTAT_IDX} EXTRAREPO_PACKSTAT ) |
| 353 |
if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) |
| 354 |
print_var(EXTRAREPO_PACKSTAT) |
| 355 |
endif() |
| 356 |
tribits_parse_extrarepo_packstat("${EXTRAREPO_PACKSTAT}" |
| 357 |
EXTRAREPO_HASPKGS EXTRAREPO_PREPOST ) |
| 358 |
|
| 359 |
# CLASSIFICATION |
| 360 |
math(EXPR EXTRAREPO_CLASSIFICATION_IDX |
| 361 |
"${EXTRAREPO_IDX}*${ERP_NUM_FIELDS_PER_REPO}+${ERP_REPO_CLASSIFICATION_OFFSET}") |
| 362 |
list(GET ${PROJECT_NAME}_EXTRAREPOS_DIR_VCTYPE_REPOURL_PACKSTAT_CATEGORY |
| 363 |
${EXTRAREPO_CLASSIFICATION_IDX} EXTRAREPO_CLASSIFICATION ) |
| 364 |
if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) |
| 365 |
print_var(EXTRAREPO_CLASSIFICATION) |
| 366 |
endif() |
| 367 |
|
| 368 |
# Assert that PRE repos never come after a POST repo |
| 369 |
if (NOT PROCESSED_POST_EXTRAREPO AND EXTRAREPO_PREPOST STREQUAL "POST") |
| 370 |
set(PROCESSED_POST_EXTRAREPO TRUE) |
| 371 |
elseif (PROCESSED_POST_EXTRAREPO AND EXTRAREPO_PREPOST STREQUAL "PRE") |
| 372 |
message_wrapper(FATAL_ERROR "Error, the 'PRE' extra repo '${EXTRAREPO_NAME}'" |
| 373 |
" specified in the PACKSTAT field '${EXTRAREPO_PACKSTAT}' came directly after" |
| 374 |
" a 'POST' extra repo! All 'PRE' extra repos must be listed before all" |
| 375 |
" 'POST' extra repos!" |
| 376 |
) |
| 377 |
endif() |
| 378 |
|
| 379 |
# B.2) Unconditionally add the extrarepo to the list |
| 380 |
|
| 381 |
list(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT ${EXTRAREPO_NAME}) |
| 382 |
list(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS ${EXTRAREPO_DIR}) |
| 383 |
list(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES ${EXTRAREPO_VCTYPE}) |
| 384 |
list(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS ${EXTRAREPO_REPOURL}) |
| 385 |
list(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS ${EXTRAREPO_HASPKGS}) |
| 386 |
list(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS ${EXTRAREPO_PREPOST}) |
| 387 |
list(APPEND ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES |
| 388 |
${EXTRAREPO_CLASSIFICATION}) |
| 389 |
if (EXTRAREPO_PREPOST STREQUAL "PRE") |
| 390 |
list(APPEND ${PROJECT_NAME}_PRE_REPOSITORIES_DEFAULT ${EXTRAREPO_NAME}) |
| 391 |
elseif (EXTRAREPO_PREPOST STREQUAL "POST") |
| 392 |
list(APPEND ${PROJECT_NAME}_EXTRA_REPOSITORIES_DEFAULT ${EXTRAREPO_NAME}) |
| 393 |
else() |
| 394 |
message(FATAL_ERROR "Error, bad value for EXTRAREPO_PREPOST!") |
| 395 |
endif() |
| 396 |
|
| 397 |
endforeach() |
| 398 |
|
| 399 |
# C) Get the actual number of active extra repos |
| 400 |
|
| 401 |
list(LENGTH ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT ${PROJECT_NAME}_NUM_EXTRAREPOS ) |
| 402 |
if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) |
| 403 |
print_var(${PROJECT_NAME}_NUM_EXTRAREPOS) |
| 404 |
endif() |
| 405 |
math(EXPR ${PROJECT_NAME}_LAST_EXTRAREPO_IDX "${${PROJECT_NAME}_NUM_EXTRAREPOS}-1") |
| 406 |
|
| 407 |
# D) Print the final set of extrarepos in verbose mode |
| 408 |
|
| 409 |
tribits_dump_extra_repositories_list() |
| 410 |
|
| 411 |
endmacro() |
| 412 |
|
| 413 |
|
| 414 |
# |
| 415 |
# Assert the existence and the order of the list of extra repositories in |
| 416 |
# ${PROJECT_NAME}_PRE_REPOSITORIES listed in |
| 417 |
# ${PROJECT_NAME}_EXTRA_REPOSITORIES according to the list read in from the |
| 418 |
# extra repos file as determined by the variable |
| 419 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT. |
| 420 |
# |
| 421 |
function(tribits_extra_repositories_assert_subset_and_order_wrt_file) |
| 422 |
set(ALL_EXTRA_REPOSITORIES_IN |
| 423 |
${${PROJECT_NAME}_PRE_REPOSITORIES} ${${PROJECT_NAME}_EXTRA_REPOSITORIES}) |
| 424 |
set(ALL_EXTRA_REPOSITORIES_SORTED ${ALL_EXTRA_REPOSITORIES_IN}) |
| 425 |
tribits_sort_list_according_to_master_list( |
| 426 |
"${${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT}" ALL_EXTRA_REPOSITORIES_SORTED) |
| 427 |
if (NOT "${ALL_EXTRA_REPOSITORIES_IN}" STREQUAL "${ALL_EXTRA_REPOSITORIES_SORTED}") |
| 428 |
message(FATAL_ERROR |
| 429 |
"ERROR! The list of extra repos passed in '${ALL_EXTRA_REPOSITORIES_IN}'" |
| 430 |
" is not a subset and in the same order as read in from extra repos file" |
| 431 |
" '${${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT}'" |
| 432 |
) |
| 433 |
endif() |
| 434 |
endfunction() |
| 435 |
|
| 436 |
|
| 437 |
# |
| 438 |
# Filter out or assert msising repos read from an extra repos. |
| 439 |
# |
| 440 |
# This function keys off of the variables: |
| 441 |
# |
| 442 |
# ${PROJECT_NAME}_PRE_REPOSITORIES |
| 443 |
# ${PROJECT_NAME}_EXTRA_REPOSITORIES |
| 444 |
# ${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES |
| 445 |
# |
| 446 |
# and the variables: |
| 447 |
# |
| 448 |
# ${PROJECT_NAME}_PRE_REPOSITORIES_DEFAULT |
| 449 |
# ${PROJECT_NAME}_EXTRA_REPOSITORIES_DEFAULT |
| 450 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT |
| 451 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS |
| 452 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES |
| 453 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS |
| 454 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS |
| 455 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS |
| 456 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES |
| 457 |
# |
| 458 |
# which contain the extra repos read from the extra repos file. |
| 459 |
# |
| 460 |
# If ${PROJECT_NAME}_PRE_REPOSITORIES or ${PROJECT_NAME}_EXTRA_REPOSITORIES |
| 461 |
# are non-empty (it is assumed that the extra repos listed are a subset of |
| 462 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT, which can be asserted so by |
| 463 |
# calling tribits_extra_repositories_assert_subset_and_order_wrt_file()), then |
| 464 |
# the set of repos and the associated data will be filtered based on |
| 465 |
# ${PROJECT_NAME}_PRE_REPOSITORIES and ${PROJECT_NAME}_EXTRA_REPOSITORIES. |
| 466 |
# |
| 467 |
# If ${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES==TRUE, then the set of |
| 468 |
# repos will be filtered based on what repos are present. If |
| 469 |
# ${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES==FALSE, then all of the |
| 470 |
# repos must exist or message(FATAL_ERROR ...) is called and will fail the |
| 471 |
# configure. |
| 472 |
# |
| 473 |
# On output the variables: |
| 474 |
# |
| 475 |
# ${PROJECT_NAME}_PRE_REPOSITORIES |
| 476 |
# ${PROJECT_NAME}_EXTRA_REPOSITORIES |
| 477 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES |
| 478 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS |
| 479 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES |
| 480 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS |
| 481 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS |
| 482 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS |
| 483 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES |
| 484 |
# |
| 485 |
# will be set according to the logic described above and the other extra repo |
| 486 |
# variables will be filtered in a consistent way. |
| 487 |
# |
| 488 |
function(tribits_filter_or_assert_extra_repos) |
| 489 |
|
| 490 |
# Get the list of repos to filter |
| 491 |
|
| 492 |
if ("${${PROJECT_NAME}_PRE_REPOSITORIES}" STREQUAL "") |
| 493 |
set(${PROJECT_NAME}_PRE_REPOSITORIES_IN ${${PROJECT_NAME}_PRE_REPOSITORIES_DEFAULT}) |
| 494 |
else() |
| 495 |
set(${PROJECT_NAME}_PRE_REPOSITORIES_IN ${${PROJECT_NAME}_PRE_REPOSITORIES}) |
| 496 |
endif() |
| 497 |
|
| 498 |
if ("${${PROJECT_NAME}_EXTRA_REPOSITORIES}" STREQUAL "") |
| 499 |
set(${PROJECT_NAME}_EXTRA_REPOSITORIES_IN ${${PROJECT_NAME}_EXTRA_REPOSITORIES_DEFAULT}) |
| 500 |
else() |
| 501 |
set(${PROJECT_NAME}_EXTRA_REPOSITORIES_IN ${${PROJECT_NAME}_EXTRA_REPOSITORIES}) |
| 502 |
endif() |
| 503 |
|
| 504 |
set(ALL_EXTRA_REPOSITORIES_IN |
| 505 |
${${PROJECT_NAME}_PRE_REPOSITORIES_IN} ${${PROJECT_NAME}_EXTRA_REPOSITORIES_IN}) |
| 506 |
|
| 507 |
# Get out of function if there are no pre-extra or post-extra repos |
| 508 |
if ("${ALL_EXTRA_REPOSITORIES_IN}" STREQUAL "") |
| 509 |
return() |
| 510 |
endif() |
| 511 |
|
| 512 |
# A) Loop through and copy info for existing repos to temp arrays |
| 513 |
|
| 514 |
set(PRE_REPOSITORIES_TMP) |
| 515 |
set(EXTRA_REPOSITORIES_TMP) |
| 516 |
set(ALL_EXTRA_REPOSITORIES_TMP) |
| 517 |
set(ALL_EXTRA_REPOSITORIES_DIRS_TMP) |
| 518 |
set(ALL_EXTRA_REPOSITORIES_VCTYPES_TMP) |
| 519 |
set(ALL_EXTRA_REPOSITORIES_REPOURLS_TMP) |
| 520 |
set(ALL_EXTRA_REPOSITORIES_HASPKGS_TMP) |
| 521 |
set(ALL_EXTRA_REPOSITORIES_PREPOSTS_TMP) |
| 522 |
set(ALL_EXTRA_REPOSITORIES_CATEGORIES_TMP) |
| 523 |
|
| 524 |
# Set-up for filtering based on ALL_EXTRA_REPOSITORIES_IN != "" |
| 525 |
list(LENGTH ALL_EXTRA_REPOSITORIES_IN ALL_EXTRA_REPOSITORIES_IN_LEN) |
| 526 |
#print_var(ALL_EXTRA_REPOSITORIES_IN_LEN) |
| 527 |
set(EXTRAREPO_IN_IDX 0) |
| 528 |
list(GET ALL_EXTRA_REPOSITORIES_IN ${EXTRAREPO_IN_IDX} EXTRAREPO_IN) |
| 529 |
|
| 530 |
# Loop over full list of extra repos from extra repos file |
| 531 |
set(EXTRAREPO_IDX 0) |
| 532 |
foreach(EXTRAREPO_NAME ${${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT}) |
| 533 |
|
| 534 |
#print_var(EXTRAREPO_NAME) |
| 535 |
#print_var(EXTRAREPO_IN) |
| 536 |
|
| 537 |
# A.1) Extract the data for current extra repo from file |
| 538 |
list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS ${EXTRAREPO_IDX} |
| 539 |
EXTRAREPO_DIR ) |
| 540 |
list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES ${EXTRAREPO_IDX} |
| 541 |
EXTRAREPO_VCTYPE ) |
| 542 |
list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS ${EXTRAREPO_IDX} |
| 543 |
EXTRAREPO_REPOURL ) |
| 544 |
list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS ${EXTRAREPO_IDX} |
| 545 |
EXTRAREPO_HASPKGS ) |
| 546 |
list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS ${EXTRAREPO_IDX} |
| 547 |
EXTRAREPO_PREPOST ) |
| 548 |
list(GET ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES ${EXTRAREPO_IDX} |
| 549 |
EXTRAREPO_CATEGORY ) |
| 550 |
|
| 551 |
# A.2) Determine if to add the extra repo EXTRAREPO_NAME |
| 552 |
if (EXTRAREPO_IN_IDX EQUAL ALL_EXTRA_REPOSITORIES_IN_LEN) |
| 553 |
# All of the extra repos in ALL_EXTRA_REPOSITORIES_IN have already |
| 554 |
# been processed. |
| 555 |
set(ADD_EXTRAREPO FALSE) |
| 556 |
elseif (EXTRAREPO_IN STREQUAL EXTRAREPO_NAME) |
| 557 |
# We have a match, add the extra repo! |
| 558 |
set(ADD_EXTRAREPO TRUE) |
| 559 |
# Update EXTRAREPO_IN to look for next! |
| 560 |
math(EXPR EXTRAREPO_IN_IDX "${EXTRAREPO_IN_IDX}+1") |
| 561 |
if (EXTRAREPO_IN_IDX LESS ALL_EXTRA_REPOSITORIES_IN_LEN) |
| 562 |
list(GET ALL_EXTRA_REPOSITORIES_IN ${EXTRAREPO_IN_IDX} EXTRAREPO_IN) |
| 563 |
else() |
| 564 |
# We have found the last repo already so move on |
| 565 |
set(EXTRAREPO_IN "") |
| 566 |
endif() |
| 567 |
else() |
| 568 |
# We are not at the end of the list in ALL_EXTRA_REPOSITORIES_IN yet |
| 569 |
# and have not reached the next entry in the list so don't add. |
| 570 |
set(ADD_EXTRAREPO FALSE) |
| 571 |
endif() |
| 572 |
|
| 573 |
#print_var(ADD_EXTRAREPO) |
| 574 |
|
| 575 |
# A.3) Determine the match of the category |
| 576 |
|
| 577 |
if (ADD_EXTRAREPO) |
| 578 |
|
| 579 |
set(ADD_EXTRAREPO FALSE) |
| 580 |
|
| 581 |
#assert_defined(${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE) |
| 582 |
if (TRIBITS_PROCESS_EXTRAREPOS_LISTS_DEBUG) |
| 583 |
print_var(${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE) |
| 584 |
endif() |
| 585 |
|
| 586 |
if (${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE STREQUAL "Continuous" AND |
| 587 |
EXTRAREPO_CATEGORY STREQUAL "Continuous" |
| 588 |
) |
| 589 |
set(ADD_EXTRAREPO TRUE) |
| 590 |
elseif (${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE STREQUAL "Nightly" AND |
| 591 |
(EXTRAREPO_CATEGORY STREQUAL "Continuous" |
| 592 |
OR EXTRAREPO_CATEGORY STREQUAL "Nightly") |
| 593 |
) |
| 594 |
set(ADD_EXTRAREPO TRUE) |
| 595 |
endif() |
| 596 |
|
| 597 |
endif() |
| 598 |
|
| 599 |
# A.3) Determine if the repo exists |
| 600 |
set(EXTRAREPO_EXISTS TRUE) |
| 601 |
if (ADD_EXTRAREPO AND ${PROJECT_NAME}_CHECK_EXTRAREPOS_EXIST |
| 602 |
AND NOT UNITTEST_SKIP_FILTER_OR_ASSERT_EXTRA_REPOS |
| 603 |
) |
| 604 |
|
| 605 |
assert_defined(PROJECT_SOURCE_DIR) |
| 606 |
set(EXTRAREPO_SOURCE_DIR "${PROJECT_SOURCE_DIR}/${EXTRAREPO_DIR}") |
| 607 |
if (EXISTS "${EXTRAREPO_SOURCE_DIR}") |
| 608 |
set(EXTRAREPO_EXISTS TRUE) |
| 609 |
else() |
| 610 |
set(EXTRAREPO_EXISTS FALSE) |
| 611 |
endif() |
| 612 |
#print_var(EXTRAREPO_EXISTS) |
| 613 |
|
| 614 |
if (NOT EXTRAREPO_EXISTS) |
| 615 |
set(ADD_EXTRAREPO FALSE) |
| 616 |
if (${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES) |
| 617 |
message("-- " |
| 618 |
"NOTE: Ignoring missing extra repo '${EXTRAREPO_NAME}'" |
| 619 |
" as requested since ${EXTRAREPO_SOURCE_DIR} does not exist" ) |
| 620 |
else() |
| 621 |
message( FATAL_ERROR |
| 622 |
"ERROR! Skipping missing extra repo '${EXTRAREPO_NAME}'" |
| 623 |
" since ${EXTRAREPO_SOURCE_DIR} does not exist!\n") |
| 624 |
endif() |
| 625 |
endif() |
| 626 |
|
| 627 |
endif() |
| 628 |
|
| 629 |
#print_var(ADD_EXTRAREPO) |
| 630 |
|
| 631 |
# A.4) Conditionally copy the info for the extra repo |
| 632 |
if (ADD_EXTRAREPO) |
| 633 |
message("-- " "Adding ${EXTRAREPO_PREPOST} extra ${EXTRAREPO_CATEGORY} repository ${EXTRAREPO_NAME} ...") |
| 634 |
if (EXTRAREPO_PREPOST STREQUAL "PRE") |
| 635 |
list(APPEND PRE_REPOSITORIES_TMP ${EXTRAREPO_NAME}) |
| 636 |
elseif (EXTRAREPO_PREPOST STREQUAL "POST") |
| 637 |
list(APPEND EXTRA_REPOSITORIES_TMP ${EXTRAREPO_NAME}) |
| 638 |
endif() |
| 639 |
list(APPEND ALL_EXTRA_REPOSITORIES_TMP ${EXTRAREPO_NAME}) |
| 640 |
list(APPEND ALL_EXTRA_REPOSITORIES_DIRS_TMP ${EXTRAREPO_DIR}) |
| 641 |
list(APPEND ALL_EXTRA_REPOSITORIES_VCTYPES_TMP ${EXTRAREPO_VCTYPE}) |
| 642 |
list(APPEND ALL_EXTRA_REPOSITORIES_REPOURLS_TMP ${EXTRAREPO_REPOURL}) |
| 643 |
list(APPEND ALL_EXTRA_REPOSITORIES_HASPKGS_TMP ${EXTRAREPO_HASPKGS}) |
| 644 |
list(APPEND ALL_EXTRA_REPOSITORIES_PREPOSTS_TMP ${EXTRAREPO_PREPOST}) |
| 645 |
list(APPEND ALL_EXTRA_REPOSITORIES_CATEGORIES_TMP ${EXTRAREPO_CATEGORY}) |
| 646 |
else() |
| 647 |
list(APPEND CPACK_SOURCE_IGNORE_FILES |
| 648 |
"${${PROJECT_NAME}_SOURCE_DIR}/${EXTRAREPO_DIR}/") |
| 649 |
if (EXTRAREPO_EXISTS) |
| 650 |
message("-- " "*NOT* adding ${EXTRAREPO_PREPOST} extra ${EXTRAREPO_CATEGORY} repository ${EXTRAREPO_NAME}!") |
| 651 |
endif() |
| 652 |
endif() |
| 653 |
|
| 654 |
math(EXPR EXTRAREPO_IDX "${EXTRAREPO_IDX}+1") |
| 655 |
|
| 656 |
endforeach() |
| 657 |
|
| 658 |
# B) Copy over extra repos arrays with filtered arrays |
| 659 |
set(${PROJECT_NAME}_PRE_REPOSITORIES |
| 660 |
${PRE_REPOSITORIES_TMP} PARENT_SCOPE) |
| 661 |
set(${PROJECT_NAME}_EXTRA_REPOSITORIES |
| 662 |
${EXTRA_REPOSITORIES_TMP} PARENT_SCOPE) |
| 663 |
set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES |
| 664 |
${ALL_EXTRA_REPOSITORIES_TMP} PARENT_SCOPE) |
| 665 |
set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS |
| 666 |
${ALL_EXTRA_REPOSITORIES_DIRS_TMP} PARENT_SCOPE) |
| 667 |
set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES |
| 668 |
${ALL_EXTRA_REPOSITORIES_VCTYPES_TMP} PARENT_SCOPE) |
| 669 |
set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS |
| 670 |
${ALL_EXTRA_REPOSITORIES_REPOURLS_TMP} PARENT_SCOPE) |
| 671 |
set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS |
| 672 |
${ALL_EXTRA_REPOSITORIES_HASPKGS_TMP} PARENT_SCOPE) |
| 673 |
set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_PREPOSTS |
| 674 |
${ALL_EXTRA_REPOSITORIES_PREPOSTS_TMP} PARENT_SCOPE) |
| 675 |
set(${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES |
| 676 |
${ALL_EXTRA_REPOSITORIES_CATEGORIES_TMP} PARENT_SCOPE) |
| 677 |
|
| 678 |
tribits_dump_extra_repositories_list() |
| 679 |
|
| 680 |
endfunction() |
| 681 |
|
| 682 |
|
| 683 |
# |
| 684 |
# Macro that reads extra repos file, processes the list of extra repos, etc. |
| 685 |
# |
| 686 |
# On input, the following variables are read: |
| 687 |
# |
| 688 |
# ${PROJECT_NAME}_EXTRAREPOS_FILE |
| 689 |
# ${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES |
| 690 |
# ${PROJECT_NAME}_PRE_REPOSITORIES |
| 691 |
# ${PROJECT_NAME}_EXTRA_REPOSITORIES |
| 692 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT |
| 693 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS |
| 694 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES |
| 695 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS |
| 696 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS |
| 697 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES |
| 698 |
# |
| 699 |
# On output, the following variables are set: |
| 700 |
# |
| 701 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES |
| 702 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DIRS |
| 703 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_VCTYPES |
| 704 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_REPOURLS |
| 705 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_HASPKGS |
| 706 |
# ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_CATEGORIES |
| 707 |
# |
| 708 |
macro(tribits_get_and_process_extra_repositories_lists) |
| 709 |
|
| 710 |
if (${PROJECT_NAME}_EXTRAREPOS_FILE AND ${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE) |
| 711 |
|
| 712 |
# |
| 713 |
# A) Read in the extra repos list variable and process the list |
| 714 |
# |
| 715 |
|
| 716 |
message("") |
| 717 |
message("Reading the list of extra repositories from ${${PROJECT_NAME}_EXTRAREPOS_FILE}") |
| 718 |
message("") |
| 719 |
|
| 720 |
include(${${PROJECT_NAME}_EXTRAREPOS_FILE}) |
| 721 |
|
| 722 |
tribits_process_extrarepos_lists() |
| 723 |
# Above sets ${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT (and DIRS |
| 724 |
# ... CATEGORIES) |
| 725 |
|
| 726 |
# |
| 727 |
# B) Sort and assert the list of extra repos according to the list read into the file |
| 728 |
# |
| 729 |
if ( |
| 730 |
(${PROJECT_NAME}_PRE_REPOSITORIES OR ${PROJECT_NAME}_EXTRA_REPOSITORIES) |
| 731 |
AND |
| 732 |
${PROJECT_NAME}_ALL_EXTRA_REPOSITORIES_DEFAULT |
| 733 |
) |
| 734 |
tribits_extra_repositories_assert_subset_and_order_wrt_file() |
| 735 |
endif() |
| 736 |
|
| 737 |
# |
| 738 |
# C) Filter out the missing extra repos or assert errors |
| 739 |
# |
| 740 |
if (${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES) |
| 741 |
set(SELECT_REPOS_MSG_SUFFIX "(ignoring missing repos)") |
| 742 |
else() |
| 743 |
set(SELECT_REPOS_MSG_SUFFIX "(asserting all selected repos exist)") |
| 744 |
endif() |
| 745 |
message("") |
| 746 |
message("Selecting the set of '${${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE}' extra repos ${SELECT_REPOS_MSG_SUFFIX} ...") |
| 747 |
message("") |
| 748 |
tribits_filter_or_assert_extra_repos() |
| 749 |
|
| 750 |
else() |
| 751 |
|
| 752 |
if (${PROJECT_NAME}_PRE_REPOSITORIES OR ${PROJECT_NAME}_EXTRA_REPOSITORIES) |
| 753 |
message("") |
| 754 |
if (${PROJECT_NAME}_PRE_REPOSITORIES) |
| 755 |
message("Processing list of PRE extra repos from ${PROJECT_NAME}_PRE_REPOSITORIES" |
| 756 |
"='${${PROJECT_NAME}_PRE_REPOSITORIES}' ...") |
| 757 |
endif() |
| 758 |
if (${PROJECT_NAME}_EXTRA_REPOSITORIES) |
| 759 |
message("Processing list of POST extra repos from ${PROJECT_NAME}_EXTRA_REPOSITORIES" |
| 760 |
"='${${PROJECT_NAME}_EXTRA_REPOSITORIES}' ...") |
| 761 |
endif() |
| 762 |
message("") |
| 763 |
endif() |
| 764 |
|
| 765 |
endif() |
| 766 |
|
| 767 |
endmacro() |
| 768 |
|
| 769 |
|
| 770 |
# |
| 771 |
# Extract the final name of the extra repo |
| 772 |
# |
| 773 |
function(tribits_get_extrarepo_base_name EXTRAREPO_NAME EXTRAREPO_NAME_OUT) |
| 774 |
get_filename_component(EXTRAREPO_NAME "${EXTRAREPO_NAME}" NAME) |
| 775 |
set(${EXTRAREPO_NAME_OUT} "${EXTRAREPO_NAME}" PARENT_SCOPE) |
| 776 |
endfunction() |