Improve logs for building extensions from source

This commit is contained in:
Shivam Mathur 2021-03-11 09:07:00 +05:30
parent e831babc61
commit f5f14c3aa3
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -319,23 +319,24 @@ add_extension_from_github() {
repo=$3 repo=$3
release=$4 release=$4
prefix=$5 prefix=$5
slug="$extension-$org/$repo@$release"
IFS=' ' read -r -a libs <<< "$(parse_args "$extension" LIBS)" IFS=' ' read -r -a libs <<< "$(parse_args "$extension" LIBS)"
IFS=' ' read -r -a opts <<< "$(parse_args "$extension" CONFIGURE_OPTS)" IFS=' ' read -r -a opts <<< "$(parse_args "$extension" CONFIGURE_OPTS)"
IFS=' ' read -r -a prefix_opts <<< "$(parse_args "$extension" CONFIGURE_PREFIX_OPTS)" IFS=' ' read -r -a prefix_opts <<< "$(parse_args "$extension" CONFIGURE_PREFIX_OPTS)"
IFS=' ' read -r -a suffix_opts <<< "$(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)" IFS=' ' read -r -a suffix_opts <<< "$(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
( (
add_devtools phpize add_devtools phpize >/dev/null
delete_extension "$extension" delete_extension "$extension"
git clone -n https://github.com/"$org"/"$repo" /tmp/"$repo-$release" || exit 1 git clone -q -n https://github.com/"$org"/"$repo" /tmp/"$repo-$release"
cd /tmp/"$repo-$release" || exit 1 cd /tmp/"$repo-$release" || exit 1
git checkout "$release" || exit 1 git checkout -q "$release" && git submodule -q update --init --recursive
git submodule update --init --recursive || exit 1
add_libs "${libs[@]}" add_libs "${libs[@]}"
phpize phpize && sudo "${prefix_opts[@]}" ./configure "${suffix_opts[@]}" "${opts[@]}"
sudo "${prefix_opts[@]}" ./configure "${suffix_opts[@]}" "${opts[@]}" sudo make -j"$(nproc 2>/dev/null || sysctl -n hw.ncpu)" && sudo make install
sudo make -j"$(nproc 2>/dev/null || sysctl -n hw.ncpu)"
sudo make install
enable_extension "$extension" "$prefix" enable_extension "$extension" "$prefix"
) >/dev/null 2>&1 ) | sudo tee "/tmp/$extension@$release.log" >/dev/null
add_extension_log "$extension-$org/$repo@$release" "Installed and enabled" add_extension_log "$slug" "Installed and enabled"
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$slug" "Click to get the logs of compiling $extension"
cat "/tmp/$extension@$release.log"
echo "::endgroup::"
} }