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

Make remaining curl respect HOMEBREW_CURLRC #4900

Merged
merged 2 commits into from
Sep 14, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion Library/Homebrew/cmd/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,13 @@ EOS
QUIET_ARGS=()
fi

if [[ -z "$HOMEBREW_CURLRC" ]]
then
CURL_DISABLE_CURLRC_ARGS=(-q)
else
CURL_DISABLE_CURLRC_ARGS=()
fi

# only allow one instance of brew update
lock update

Expand Down Expand Up @@ -481,7 +488,9 @@ EOS
GITHUB_API_ENDPOINT="commits/$UPSTREAM_BRANCH_DIR"
fi

UPSTREAM_SHA_HTTP_CODE="$("$HOMEBREW_CURL" --silent --max-time 3 \
UPSTREAM_SHA_HTTP_CODE="$("$HOMEBREW_CURL" \
"${CURL_DISABLE_CURLRC_ARGS[@]}" \
--silent --max-time 3 \
--location --output /dev/null --write-out "%{http_code}" \
--dump-header "$DIR/.git/GITHUB_HEADERS" \
--user-agent "$HOMEBREW_USER_AGENT_CURL" \
Expand Down
15 changes: 10 additions & 5 deletions Library/Homebrew/utils/analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ def os_prefix_ci
def report(type, metadata = {})
return if ENV["HOMEBREW_NO_ANALYTICS"] || ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"]

args = %W[
args = []

# do not load .curlrc unless requested (must be the first argument)
args << "-q" unless ENV["HOMEBREW_CURLRC"]

args += %W[
--max-time 3
--user-agent #{HOMEBREW_USER_AGENT_CURL}
--data v=1
Expand All @@ -49,14 +54,14 @@ def report(type, metadata = {})
# https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
if ENV["HOMEBREW_ANALYTICS_DEBUG"]
url = "https://www.google-analytics.com/debug/collect"
puts "#{ENV["HOMEBREW_CURL"]} #{url} #{args.join(" ")}"
puts Utils.popen_read ENV["HOMEBREW_CURL"], url, *args
puts "#{ENV["HOMEBREW_CURL"]} #{args.join(" ")} #{url}"
puts Utils.popen_read ENV["HOMEBREW_CURL"], *args, url
else
pid = fork do
exec ENV["HOMEBREW_CURL"],
"https://www.google-analytics.com/collect",
*args,
"--silent", "--output", "/dev/null",
*args
"https://www.google-analytics.com/collect"
end
Process.detach pid
end
Expand Down