Skip to content

Commit a714ea2

Browse files
authored
Merge pull request #275 from patrickelectric/exclude_list_warnings
Add exclude list messages and tests in project
2 parents 88aba55 + 65ceffe commit a714ea2

File tree

4 files changed

+56
-11
lines changed

4 files changed

+56
-11
lines changed

CMakeLists.txt

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,53 @@ cmake_minimum_required(VERSION 3.2)
55

66
project(linuxdeployqt)
77

8-
# read Git revision ID
9-
execute_process(
10-
COMMAND git rev-parse --short HEAD
11-
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
12-
OUTPUT_VARIABLE GIT_COMMIT
13-
OUTPUT_STRIP_TRAILING_WHITESPACE
14-
)
8+
find_program(GIT git)
159

1610
# make sure Git revision ID and latest tag is not stored in the CMake cache
1711
# otherwise, one would have to reset the CMake cache on every new commit to make sure the Git commit ID is up to date
1812
unset(GIT_COMMIT CACHE)
1913
unset(GIT_LATEST_TAG CACHE)
2014

15+
if("${GIT}" STREQUAL "GIT-NOTFOUND")
16+
message(FATAL_ERROR "Could not find git")
17+
endif()
18+
2119
# read Git revision ID and latest tag number
2220
execute_process(
23-
COMMAND git rev-parse --short HEAD
21+
COMMAND "${GIT}" rev-parse --short HEAD
2422
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
2523
OUTPUT_VARIABLE GIT_COMMIT
2624
OUTPUT_STRIP_TRAILING_WHITESPACE
25+
RESULT_VARIABLE GIT_COMMIT_RESULT
2726
)
27+
if(NOT GIT_COMMIT_RESULT EQUAL 0)
28+
message(FATAL_ERROR "Failed to determine git commit ID")
29+
endif()
30+
mark_as_advanced(GIT_COMMIT GIT_COMMIT_RESULT)
31+
2832
execute_process(
29-
COMMAND git rev-list --tags --skip=1 --max-count=1
33+
COMMAND "${GIT}" rev-list --tags --skip=1 --max-count=1
3034
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
3135
OUTPUT_VARIABLE GIT_TAG_ID
3236
OUTPUT_STRIP_TRAILING_WHITESPACE
37+
RESULT_VARIABLE GIT_TAG_ID_RESULT
3338
)
39+
if(NOT GIT_TAG_ID_RESULT EQUAL 0)
40+
message(FATAL_ERROR "Failed to determine git tag ID")
41+
endif()
42+
mark_as_advanced(GIT_TAG_ID GIT_TAG_ID_RESULT)
43+
3444
execute_process(
35-
COMMAND git describe --tags ${GIT_TAG_ID} --abbrev=0
45+
COMMAND "${GIT}" describe --tags ${GIT_TAG_ID} --abbrev=0
3646
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
3747
OUTPUT_VARIABLE GIT_TAG_NAME
3848
OUTPUT_STRIP_TRAILING_WHITESPACE
49+
RESULT_VARIABLE GIT_TAG_NAME_RESULT
3950
)
51+
if(NOT GIT_TAG_NAME_RESULT EQUAL 0)
52+
message(FATAL_ERROR "Failed to determine git tag name")
53+
endif()
54+
mark_as_advanced(GIT_TAG_NAME GIT_TAG_NAME_RESULT)
4055

4156
# set version and build number
4257
set(VERSION 1-alpha)
@@ -51,6 +66,11 @@ execute_process(
5166
COMMAND env LC_ALL=C date -u "+%Y-%m-%d %H:%M:%S %Z"
5267
OUTPUT_VARIABLE DATE
5368
OUTPUT_STRIP_TRAILING_WHITESPACE
69+
RESULT_VARIABLE DATE_RESULT
5470
)
71+
if(NOT DATE_RESULT EQUAL 0)
72+
message(FATAL_ERROR "Failed to determine date string")
73+
endif()
74+
mark_as_advanced(DATE DATE_RESULT)
5575

5676
add_subdirectory(tools/linuxdeployqt)

tools/excludelist.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#!/bin/bash
22

3+
set -e
4+
35
# Download excludelist
46
blacklisted=($(wget --quiet https://raw.githubusercontent.com/probonopd/AppImages/master/excludelist -O - | sort | uniq | grep -v "^#.*" | grep "[^-\s]"))
7+
58
# Create array
69
for item in ${blacklisted[@]:0:${#blacklisted[@]}-1}; do
710
echo -ne '\\"'$item'\\" << '

tools/linuxdeployqt/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ execute_process(
1313
COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/../excludelist.sh
1414
OUTPUT_VARIABLE EXCLUDELIST
1515
TIMEOUT 10
16+
RESULT_VARIABLE EXCLUDELIST_RESULT
1617
)
18+
if(NOT EXCLUDELIST_RESULT EQUAL 0)
19+
message(FATAL_ERROR "Failed to fetch and generate excludelist")
20+
endif()
21+
mark_as_advanced(EXCLUDELIST EXCLUDELIST_RESULT)
1722

1823
add_executable(linuxdeployqt main.cpp shared.cpp)
1924
target_include_directories(linuxdeployqt PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})

tools/linuxdeployqt/linuxdeployqt.pro

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,21 @@ isEmpty(_BUILD_NUMBER) {
3535
}
3636

3737
DEFINES += LINUXDEPLOYQT_VERSION="'\"$(shell cd $$PWD && git describe --tags $(shell cd $$PWD && git rev-list --tags --skip=1 --max-count=1) --abbrev=0)\"'"
38-
DEFINES += EXCLUDELIST=\""$$system($$_PRO_FILE_PWD_/../excludelist.sh)"\"
38+
contains(DEFINES, EXCLUDELIST.*) {
39+
message("EXCLUDELIST specified, to use the most recent exclude list, please run qmake without EXCLUDELIST definition and with internet.")
40+
} else {
41+
message("Creating exclude list.")
42+
43+
# check whether command _would_ run successfully
44+
EXCLUDELIST_GENERATION_WORKS = FALSE
45+
system($$_PRO_FILE_PWD_/../excludelist.sh): EXCLUDELIST_GENERATION_WORKS = TRUE
46+
isEqual(EXCLUDELIST_GENERATION_WORKS, FALSE) {
47+
error("Generating excludelist failed")
48+
}
49+
50+
EXCLUDELIST = $$system($$_PRO_FILE_PWD_/../excludelist.sh)
51+
isEmpty(EXCLUDELIST) {
52+
error("Generated excludelist is empty")
53+
}
54+
DEFINES += EXCLUDELIST=\""$$EXCLUDELIST"\"
55+
}

0 commit comments

Comments
 (0)