Skip to content

Commit 1968398

Browse files
[DEBUG] part n+4 of many debugging
### ChangeLog: Changes in file .github/tool_checkmake.sh: fi function check_command() { Changes in file tests/check_pip: function check_license_when_given_req() {
1 parent ca1be8e commit 1968398

File tree

2 files changed

+31
-15
lines changed

2 files changed

+31
-15
lines changed

.github/tool_checkmake.sh

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,19 @@ export -f check_command
8989
check_command sed ;
9090
check_command grep ;
9191
check_command cut ;
92+
check_command go ;
93+
# WORKAROUND: this is technical debt and will need cleaned up in the future.
94+
if command -v checkmake >/dev/null 2>&1; then
95+
check_command checkmake # it worked
96+
else
97+
check_command xargs ;
98+
check_command find ;
99+
printf "%s\n" "::notice file=${SCRIPT_FILE},line=${BASH_LINENO:-0},title=WORKAROUND::checkmake not found in expected location, trying workaround." ;
100+
find . -type f -iname "checkmake" 2>/dev/null ;
101+
find "/usr/local/bin" -type f -iname "checkmake" 2>/dev/null ;
102+
wait ;
103+
fi
104+
92105
check_command checkmake ;
93106

94107
# USAGE:
@@ -121,19 +134,21 @@ process_checkmake_output() {
121134
local emsg="$2"
122135

123136
if ! output=$(checkmake "${file}" 2>&1); then
124-
printf "%s\n" "::error::checkmake failed: ${output}" >&2
125-
return 1
126-
fi
137+
printf "%s\n" "::error::checkmake failed!"
127138

128-
printf "%s\n" "${output}" | \
129-
sed -e 's/ /:/g' | \
130-
tr -s ':' | \
131-
cut -d: -f 3-5 | \
132-
grep -F "${file}" | \
133-
sed -E -e 's/^[[:space:]]+//g' | \
134-
while IFS= read -r line; do
135-
printf "%s\n" "::warning file=${file},title=LINT::${line} ${emsg}" >&2
136-
done
139+
printf "%s\n" "${output}" | \
140+
sed -e 's/ /:/g' | \
141+
tr -s ':' | \
142+
cut -d: -f 3-5 | \
143+
grep -F "${file}" | \
144+
sed -E -e 's/^[[:space:]]+//g' | \
145+
while IFS= read -r line; do
146+
printf "%s\n" "::warning file=${file},title=LINT::${line}: ${emsg}" >&2
147+
done
148+
return 1
149+
else
150+
printf "%s\n" "::notice file=${file},title=LINT::OK - No lint errors." >&2
151+
fi ;
137152
}
138153

139154
process_checkmake_output "${FILE}" "${EMSG}"

tests/check_pip

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
################################################################################
6262
#
6363
# check_pip: Audit and validate Python requirements files.
64-
# This, best-effort, script audits and validates Python requirements files using tools like pip-audit and pip-licenses.
64+
# This, best-effort, script audits and validates Python requirements
65+
# files using tools like pip-audit and pip-licenses.
6566
# It accomplishes the following tasks:
6667
# 1. Sets up a safe execution environment with resource limits and UTF-8 encoding.
6768
# 2. Checks for the existence and executability of required commands.
@@ -258,8 +259,8 @@ function check_license_when_given_req() {
258259
printf "::debug::%s\n" "venv setup ... (${SUB_CODE})" ;
259260
# Install the given Python modules using pip
260261
for module in $@ ; do
261-
printf "::debug::%s\n" "Checking license from package '$module' ..." ;
262-
REQ_SPEC=$(grep -F "$module" <(cat <"${_TEST_ROOT_DIR}"/$req_file | sed -E -e '/^[[:space:]]*$/d' | sed -E -e '/^[#]+.*$/d') | grep -m1 -F "$module" )
262+
printf "::debug::%s\n" "Checking license from package '${module}' ..." ;
263+
REQ_SPEC=$(grep -F "${module}" <(cat <"${_TEST_ROOT_DIR}"/$req_file | sed -E -e '/^[[:space:]]*$/d' | sed -E -e '/^[#]+.*$/d') | grep -m1 -F "$module" )
263264
ERR_MSG="pip install '$module' failed for $req_file." ;
264265
if [[ ("${SUB_CODE}" -eq 0) ]] && python3 -m pip install $PIP_COMMON_FLAGS $PIP_ENV_FLAGS "${REQ_SPEC};" 2>/dev/null ;
265266
then

0 commit comments

Comments
 (0)