Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use _log_ instead of echo for logging messages #64

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions scripts/container-only/wkdev-sdk-show-welcome-message
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ run_test() {
shift 2


echo ""
echo "-> ${description}:"
_log_ ""
_log_ "-> ${description}:"
"${command}" "${@}"
}

Expand All @@ -50,28 +50,28 @@ run() {

pushd "${WKDEV_SDK}" &>/dev/null

echo ""
echo ' _ ______ _______ _______ ______ _ '
echo '|\ /|| \ /\( __ \ ( ____ \|\ /| ( ____ \( __ \ | \ /\'
echo '| ) ( || \ / /| ( \ )| ( \/| ) ( | | ( \/| ( \ )| \ / /'
echo '| | _ | || (_/ / | | ) || (__ | | | | _____ | (_____ | | ) || (_/ / '
echo '| |( )| || _ ( | | | || __) ( ( ) )(_____)(_____ )| | | || _ ( '
echo '| || || || ( \ \ | | ) || ( \ \_/ / ) || | ) || ( \ \ '
echo '| () () || / \ \| (__/ )| (____/\ \ / /\____) || (__/ )| / \ \'
echo '(_______)|_/ \/(______/ (_______/ \_/ \_______)(______/ |_/ \/'
echo ""
echo ""
echo "Git repository 'wkdev-sdk' ($(ansi::bold) $(git branch --show-current) @ $(git rev-parse HEAD) $(ansi::normal))"
echo " 🠲 Last commit: $(ansi::bold)$(git log -1 --format=%cd)$(ansi::normal)"
echo ""
echo "NOTE:"
echo " - Be sure to try $(ansi::bold)\`wkdev-test-host-integration\`$(ansi::normal) to verify your container setup behaves as expected."
echo ""
echo " - The home directory $(ansi::bold)\${HOME}$(ansi::normal)=${HOME} within the container is $(ansi::underline)$(ansi::bold)not the same$(ansi::normal)$(ansi::noUnderline) as your host home directory."
echo " You can find your regular host home directory in the container under $(ansi::bold)\${HOST_HOME}$(ansi::normal)=${HOST_HOME}."
echo ""
echo " - Instructions on how to build / debug / profile WebKit can be found in the SDK documentation, either"
echo " locally in $(ansi::underline)\${WKDEV_SDK}/docs$(ansi::noUnderline) or online $(ansi::underline)https://github.com/Igalia/wkdev-sdk/tree/main/docs$(ansi::noUnderline)".
_log_ ""
_log_ ' _ ______ _______ _______ ______ _ '
_log_ '|\ /|| \ /\( __ \ ( ____ \|\ /| ( ____ \( __ \ | \ /\'
_log_ '| ) ( || \ / /| ( \ )| ( \/| ) ( | | ( \/| ( \ )| \ / /'
_log_ '| | _ | || (_/ / | | ) || (__ | | | | _____ | (_____ | | ) || (_/ / '
_log_ '| |( )| || _ ( | | | || __) ( ( ) )(_____)(_____ )| | | || _ ( '
_log_ '| || || || ( \ \ | | ) || ( \ \_/ / ) || | ) || ( \ \ '
_log_ '| () () || / \ \| (__/ )| (____/\ \ / /\____) || (__/ )| / \ \'
_log_ '(_______)|_/ \/(______/ (_______/ \_/ \_______)(______/ |_/ \/'
_log_ ""
_log_ ""
_log_ "Git repository 'wkdev-sdk' ($(ansi::bold) $(git branch --show-current) @ $(git rev-parse HEAD) $(ansi::normal))"
_log_ " 🠲 Last commit: $(ansi::bold)$(git log -1 --format=%cd)$(ansi::normal)"
_log_ ""
_log_ "NOTE:"
_log_ " - Be sure to try $(ansi::bold)\`wkdev-test-host-integration\`$(ansi::normal) to verify your container setup behaves as expected."
_log_ ""
_log_ " - The home directory $(ansi::bold)\${HOME}$(ansi::normal)=${HOME} within the container is $(ansi::underline)$(ansi::bold)not the same$(ansi::normal)$(ansi::noUnderline) as your host home directory."
_log_ " You can find your regular host home directory in the container under $(ansi::bold)\${HOST_HOME}$(ansi::normal)=${HOST_HOME}."
_log_ ""
_log_ " - Instructions on how to build / debug / profile WebKit can be found in the SDK documentation, either"
_log_ " locally in $(ansi::underline)\${WKDEV_SDK}/docs$(ansi::noUnderline) or online $(ansi::underline)https://github.com/Igalia/wkdev-sdk/tree/main/docs$(ansi::noUnderline)".

popd &>/dev/null
}
Expand Down
32 changes: 17 additions & 15 deletions scripts/container-only/wkdev-setup-devhelp
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ run() {
local port="$(argsparse_is_option_set 'wpe' && echo 'WPE' || echo 'GTK')"
local docs_dir="${webkit_directory}/WebKitBuild/${port}/${build_type}/Documentation"

echo ""
_log_ ""

if [ ! -d "${webkit_directory}/WebKit.xcworkspace" ]; then
echo "Passed directory does not appear to be a WebKit source directory: ${webkit_directory}"
_log_ "Passed directory does not appear to be a WebKit source directory: ${webkit_directory}"
exit 1
fi

if [ ! -d "${docs_dir}" ]; then
echo "WebKit ${build_type} has not been built with documentation."
_log_ "WebKit ${build_type} has not been built with documentation."
exit 1
fi

Expand All @@ -65,18 +65,20 @@ run() {

mkdir -p "${books_dir}"

echo "Linking documentation:"
printf " Source:\t %s\n" "${docs_dir}"
printf " Destination:\t %s\n" "${books_dir}"
printf " Books:\t"
for dir in "${docs_dir}"/*; do
echo -n " $(basename "${dir}")"
ln --symbolic --force "${dir}" "${books_dir}/$(basename "${dir}")"
done
echo ""

echo ""
echo "Simply run 'devhelp' to access the documentation."
_log_ "$(
nikolaszimmermann marked this conversation as resolved.
Show resolved Hide resolved
echo "Linking documentation:"
printf " Source:\t %s\n" "${docs_dir}"
printf " Destination:\t %s\n" "${books_dir}"
printf " Books:\t"
for dir in "${docs_dir}"/*; do
echo -n " $(basename "${dir}")"
ln --symbolic --force "${dir}" "${books_dir}/$(basename "${dir}")"
done
echo ""
)"

_log_ ""
_log_ "Simply run 'devhelp' to access the documentation."
}

run "${@}"
30 changes: 15 additions & 15 deletions scripts/container-only/wkdev-setup-sccache
Original file line number Diff line number Diff line change
Expand Up @@ -36,35 +36,35 @@ request_token() {
# Igalians should have access to this information. We can scrape the token
# from our mailinglist archive.

echo ""
echo "Logging in using Igalia credentials to get the sccache token."
_log_ ""
_log_ "Logging in using Igalia credentials to get the sccache token."
read -rp 'Username: ' username
read -rsp 'Password: ' password
echo ""
_log_ ""

response=$(curl --silent --fail --user "${username}:${password}" https://archive.igalia.com/mail/team-webkit/2023/01/msg00005.html)

if [ -z "${response}" ]; then
echo "Failed to authenticate."
_log_ "Failed to authenticate."
exit 1
fi

local regex='The new token is: (\S+)'
if [[ ! "$response" =~ $regex ]]; then
echo "Failed to retrieve token."
_log_ "Failed to retrieve token."
exit 1
fi

__requested_token="${BASH_REMATCH[1]}"
}

print_how_to_use() {
echo ""
echo "In order to use sccache, you need to set the following environment variables:"
echo ""
echo " export WEBKIT_USE_SCCACHE=1"
echo " export NUMBER_OF_PROCESSORS=45 # How many jobs to queue at once."
echo ""
_log_ ""
_log_ "In order to use sccache, you need to set the following environment variables:"
_log_ ""
_log_ " export WEBKIT_USE_SCCACHE=1"
_log_ " export NUMBER_OF_PROCESSORS=45 # How many jobs to queue at once."
_log_ ""
}

run() {
Expand All @@ -76,8 +76,8 @@ run() {
local sccache_config="${XDG_CONFIG_HOME:-${HOME}/.config}/sccache/config"

if [ -f "${sccache_config}" ] && ! argsparse_is_option_set "force"; then
echo ""
echo "Already configured, you can overwrite with --force. (${sccache_config})"
_log_ ""
_log_ "Already configured, you can overwrite with --force. (${sccache_config})"
print_how_to_use
exit 1
fi
Expand All @@ -89,8 +89,8 @@ run() {

mkdir -p "$(dirname "${sccache_config}")"

echo ""
echo "Creating ${sccache_config}..."
_log_ ""
_log_ "Creating ${sccache_config}..."
cat <<EOF >"${sccache_config}"
[dist]
scheduler_url = "${url}"
Expand Down
32 changes: 16 additions & 16 deletions scripts/container-only/wkdev-setup-vscode
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ argsparse_use_option "no-extensions" "Don't install extensions."

install_vscode() {

echo ""
echo "Installing Visual Studio Code..."
echo ""
_log_ ""
_log_ "Installing Visual Studio Code..."
_log_ ""

if which code > /dev/null; then
echo "Visual Studio Code is already installed."
_log_ "Visual Studio Code is already installed."
return
fi

Expand All @@ -36,19 +36,19 @@ install_vscode() {
fi

if ! curl --silent --fail --location "${download_url}" -o /tmp/code.deb; then
echo "Failed to download Visual Studio Code."
_log_ "Failed to download Visual Studio Code."
exit 1
fi

if ! sudo apt install /tmp/code.deb; then
echo "Failed to install Visual Studio Code."
_log_ "Failed to install Visual Studio Code."
rm /tmp/code.deb
exit 1
fi

rm /tmp/code.deb
echo ""
echo "Visual Studio Code has been installed."
_log_ ""
_log_ "Visual Studio Code has been installed."
}

install_extension() {
Expand All @@ -62,7 +62,7 @@ install_extension() {
readarray installed_extensions < <(code --list-extensions)

if [[ "${installed_extensions[*]}" =~ "${extension_name}" ]]; then
echo "VSCode extension already installed: ${extension_name}"
_log_ "VSCode extension already installed: ${extension_name}"
return
fi

Expand All @@ -72,23 +72,23 @@ install_extension() {
return
fi
else
echo "Installing VSCode extension: ${extension_name} (${description})..."
_log_ "Installing VSCode extension: ${extension_name} (${description})..."
fi

if ! code --install-extension "${extension_name}" &>/dev/null; then
echo "Failed to install VSCode extension: ${extension_name}"
_log_ "Failed to install VSCode extension: ${extension_name}"
exit 1
fi

echo "Installed"
echo ""
_log_ "Installed"
_log_ ""
}

install_extensions() {

echo ""
echo "Installing extensions..."
echo ""
_log_ ""
_log_ "Installing extensions..."
_log_ ""
install_extension ms-vscode.cmake-tools "CMake support"
install_extension llvm-vs-code-extensions.vscode-clangd "C/C++ support"
install_extension vadimcn.vscode-lldb "C/C++ debugging" true
Expand Down
6 changes: 3 additions & 3 deletions scripts/container-only/wkdev-test-host-integration
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ run_test() {

read -p "Press any key to continue.."

echo ""
echo "-> ${description}:"
_log_ ""
_log_ "-> ${description}:"
"${command}" "${@}"
}

Expand All @@ -51,7 +51,7 @@ run() {

process_command_line_arguments "${@}"

echo "-> Install required packages:"
_log_ "-> Install required packages:"
sudo apt-get install --assume-yes epiphany-browser gtk-4-examples glmark2 glmark2-drm glmark2-wayland libnotify-bin mesa-utils x11-apps

run_test "Ping allowed in rootless container: (expected to work)" \
Expand Down
Loading