mirror of
https://github.com/armbian/build.git
synced 2026-01-06 09:58:46 -08:00
fix: replace comm with grep to support uutils coreutils
Ubuntu 25.04+ replaced GNU coreutils with uutils coreutils, a Rust-based reimplementation of Unix core utilities. These are different projects with the same package name: - GNU coreutils 9.x (C) - Ubuntu ≤24.04 - uutils coreutils 0.x (Rust) - Ubuntu ≥25.04 The uutils comm doesn't recognize sort output as sorted, causing "comm: file is not in sorted order" errors. Replace comm patterns with: - grep -vxFf for set difference (lines in B but not in A) - sort | uniq -d for finding duplicates These alternatives don't depend on comm, ensuring compatibility with both GNU and uutils coreutils.
This commit is contained in:
@@ -49,7 +49,8 @@ MASTER_HEADER
|
||||
|
||||
[[ $HOOK_POINT_CALLS_COUNT -gt $HOOK_POINT_CALLS_UNIQUE_COUNT ]] && {
|
||||
# Some hook points were called multiple times, determine which.
|
||||
HOOK_POINTS_WITH_MULTIPLE_CALLS=$(comm -13 <(sort < "${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt" | uniq) <(sort < "${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt") | sort | uniq | xargs echo -n)
|
||||
# Find duplicates without comm (uutils coreutils compatible)
|
||||
HOOK_POINTS_WITH_MULTIPLE_CALLS=$(sort < "${EXTENSION_MANAGER_TMP_DIR}/hook_point_calls.txt" | uniq -d | xargs echo -n)
|
||||
|
||||
cat << MULTIPLE_CALLS_WARNING
|
||||
- *Important:* The following hook points where called multiple times during the documentation generation. This can be indicative of a bug in the build system. Please check the sources for the invocation of the following hooks: \`${HOOK_POINTS_WITH_MULTIPLE_CALLS}\`.
|
||||
|
||||
@@ -510,8 +510,8 @@ function enable_extension() {
|
||||
after_function_list="$(compgen -A function)"
|
||||
|
||||
# compare before and after, thus getting the functions defined by the extension.
|
||||
# comm is oldskool. we like it. go "man comm" to understand -13 below
|
||||
new_function_list="$(comm -13 <(echo "$before_function_list" | sort) <(echo "$after_function_list" | sort))"
|
||||
# Avoid comm for uutils coreutils compatibility
|
||||
new_function_list="$(grep -vxFf <(echo "$before_function_list") <(echo "$after_function_list") || true)"
|
||||
|
||||
# iterate over defined functions, store them in global associative array extension_function_info
|
||||
for newly_defined_function in ${new_function_list}; do
|
||||
|
||||
@@ -18,7 +18,8 @@ function do_capturing_defs() {
|
||||
|
||||
post_exec_vars="$(compgen -A variable)"
|
||||
|
||||
new_vars_list="$(comm -13 <(echo "$pre_exec_vars" | grep -E '[[:upper:]]+' | grep -v -e "^BASH_" | sort) <(echo "${post_exec_vars}" | grep -E '[[:upper:]]+' | grep -v -e "^BASH_" | sort))"
|
||||
# Avoid comm for uutils coreutils compatibility
|
||||
new_vars_list="$(grep -vxFf <(echo "$pre_exec_vars" | grep -E '[[:upper:]]+' | grep -v -e "^BASH_") <(echo "${post_exec_vars}" | grep -E '[[:upper:]]+' | grep -v -e "^BASH_") || true)"
|
||||
|
||||
for onevar in ${new_vars_list}; do
|
||||
all_vars_array+=("$(declare -p "${onevar}")")
|
||||
|
||||
Reference in New Issue
Block a user