Skip to content

Commit

Permalink
Merge 8bca58a into b816423
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Jan 16, 2019
2 parents b816423 + 8bca58a commit 32363dc
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions cmake/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,8 @@ macro(check_files DIRNAME FILENAMES SHA1_VALUES)
# By default, everything is OK

set(CHECK_FILES_OK TRUE)
set(INVALID_SHA1_FILES)
set(MISSING_FILES)

# See our parameters as lists

Expand Down Expand Up @@ -997,11 +999,15 @@ macro(check_files DIRNAME FILENAMES SHA1_VALUES)
file(REMOVE ${REAL_FILENAME})

set(CHECK_FILES_OK FALSE)

list(APPEND INVALID_SHA1_FILES ${FILENAME})
endif()
elseif(CHECK_FILES_OK)
else()
# The file is missing, so fail the checks

set(CHECK_FILES_OK FALSE)

list(APPEND MISSING_FILES ${FILENAME})
endif()
endforeach()
endif()
Expand All @@ -1015,6 +1021,8 @@ macro(check_file DIRNAME FILENAME SHA1_VALUE)
check_files(${DIRNAME} ${FILENAME} ${SHA1_VALUE})

set(CHECK_FILE_OK ${CHECK_FILES_OK})
set(INVALID_SHA1_FILE ${INVALID_SHA1_FILES})
set(MISSING_FILE ${MISSING_FILES})
endmacro()

#===============================================================================
Expand Down Expand Up @@ -1126,10 +1134,20 @@ macro(retrieve_package_file PACKAGE_NAME PACKAGE_VERSION DIRNAME SHA1_VALUE)
check_files(${REAL_DIRNAME} "${ARG_SHA1_FILES}" "${ARG_SHA1_VALUES}")

if(NOT CHECK_FILES_OK)
message(FATAL_ERROR "The files in the '${PACKAGE_NAME}' package do not have the expected SHA-1 values...")
message("The '${PACKAGE_NAME}' package is invalid:")

foreach(SHA1_FILE ${ARG_SHA1_FILES})
if("${SHA1_FILE}" IN_LIST INVALID_SHA1_FILES)
message(" - '${SHA1_FILE}' does not have the expected SHA-1 value...")
elseif("${SHA1_FILE}" IN_LIST MISSING_FILES)
message(" - '${SHA1_FILE}' is missing...")
endif()
endforeach()

message(FATAL_ERROR)
endif()
else()
message(FATAL_ERROR "The files in the '${PACKAGE_NAME}' package could not be uncompressed...")
message(FATAL_ERROR "The '${PACKAGE_NAME}' package could not be uncompressed...")
endif()
endif()
endmacro()

0 comments on commit 32363dc

Please sign in to comment.