Merge pull request #9545 from maxim-belkin/vendor-tools/fail-for-old-glibc

cmd/vendor-install.sh: fail on systems with old Glibc

Closes: Homebrew/brew#8658
This commit is contained in:
Maxim Belkin 2020-12-16 03:06:59 -06:00 committed by GitHub
commit a9eb00fe3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,6 +32,25 @@ then
esac
fi
check_ldd_version() {
local ldd_version
local ldd_version_major
local ldd_version_minor
if [[ $(/usr/bin/ldd --version) =~ \ [0-9]\.[0-9]+ ]]
then
ldd_version=${BASH_REMATCH[0]// /}
ldd_version_major=${ldd_version%.*}
ldd_version_minor=${ldd_version#*.}
if (( ldd_version_major < 2 || ldd_version_minor < 13 ))
then
odie "Vendored tools require system Glibc 2.13 or later."
fi
else
odie "Failed to detect system Glibc version."
fi
}
# Execute the specified command, and suppress stderr unless HOMEBREW_STDERR is set.
quiet_stderr() {
if [[ -z "$HOMEBREW_STDERR" ]]; then
@ -220,6 +239,7 @@ homebrew-vendor-install() {
[[ -z "$VENDOR_NAME" ]] && odie "This command requires a vendor target!"
[[ -n "$HOMEBREW_DEBUG" ]] && set -x
[[ -n "$HOMEBREW_LINUX" ]] && check_ldd_version
url_var="${VENDOR_NAME}_URL"
url2_var="${VENDOR_NAME}_URL2"