-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mykola Lysenko <[email protected]>
- Loading branch information
1 parent
106bf6a
commit 7cc9fb8
Showing
2 changed files
with
431 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# shellcheck shell=bash | ||
|
||
# $1 - start or end | ||
# $2 - fold identifier, no spaces | ||
# $3 - fold section description | ||
foldable() { | ||
local YELLOW='\033[1;33m' | ||
local NOCOLOR='\033[0m' | ||
if [ $1 = "start" ]; then | ||
line="::group::$2" | ||
if [ ! -z "${3:-}" ]; then | ||
line="$line - ${YELLOW}$3${NOCOLOR}" | ||
fi | ||
else | ||
line="::endgroup::" | ||
fi | ||
echo -e "$line" | ||
} | ||
|
||
__print() { | ||
local TITLE="" | ||
if [[ -n $2 ]]; then | ||
TITLE=" title=$2" | ||
fi | ||
echo "::$1${TITLE}::$3" | ||
} | ||
|
||
# $1 - title | ||
# $2 - message | ||
print_error() { | ||
__print error $1 $2 | ||
} | ||
|
||
# $1 - title | ||
# $2 - message | ||
print_notice() { | ||
__print notice $1 $2 | ||
} | ||
|
||
# No arguments | ||
llvm_default_version() { | ||
echo "16" | ||
} | ||
|
||
# No arguments | ||
llvm_latest_version() { | ||
echo "17" | ||
} | ||
|
||
# $1 - toolchain name | ||
llvm_version() { | ||
local toolchain="$1" | ||
local toolchain_name="$(echo $toolchain | cut -d '-' -f 1)" | ||
local toolchain_version="$(echo $toolchain | cut -d '-' -f 2)" | ||
|
||
if [ "$toolchain_name" == "llvm" ]; then | ||
echo "$toolchain_version" | ||
return 0 | ||
else | ||
llvm_default_version | ||
return 1 | ||
fi | ||
} | ||
|
||
# No arguments | ||
kernel_build_make_jobs() { | ||
# returns the number of processes to use when building kernel/selftests/samples | ||
# default to 4*nproc if MAX_MAKE_JOBS is not defined | ||
smp=$((4*$(nproc))) | ||
MAX_MAKE_JOBS=${MAX_MAKE_JOBS:-$smp} | ||
echo $(( smp > MAX_MAKE_JOBS ? MAX_MAKE_JOBS : smp )) | ||
} |
Oops, something went wrong.