mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Merge pull request #13795 from Rylan12/api-update-improvements
Improve `brew update` with `HOMEBREW_INSTALL_FROM_API`
This commit is contained in:
commit
e689cc07d9
@ -33,7 +33,7 @@ module Homebrew
|
||||
if cached_formula_json_file.exist? && !cached_formula_json_file.empty?
|
||||
curl_args.prepend("--time-cond", cached_formula_json_file)
|
||||
end
|
||||
curl_download(*curl_args, to: HOMEBREW_CACHE_API/"#{formula_api_path}.json", max_time: 5)
|
||||
curl_download(*curl_args, to: cached_formula_json_file, max_time: 5)
|
||||
|
||||
json_formulae = JSON.parse(cached_formula_json_file.read)
|
||||
|
||||
|
@ -547,7 +547,7 @@ EOS
|
||||
for DIR in "${HOMEBREW_REPOSITORY}" "${HOMEBREW_LIBRARY}"/Taps/*/*
|
||||
do
|
||||
if [[ -n "${HOMEBREW_INSTALL_FROM_API}" ]] &&
|
||||
[[ -n "${HOMEBREW_UPDATE_AUTO}" ]] &&
|
||||
[[ -z "${HOMEBREW_DEVELOPER}" || -n "${HOMEBREW_UPDATE_AUTO}" ]] &&
|
||||
[[ "${DIR}" == "${HOMEBREW_CORE_REPOSITORY}" ]]
|
||||
then
|
||||
continue
|
||||
@ -705,6 +705,7 @@ EOS
|
||||
for DIR in "${HOMEBREW_REPOSITORY}" "${HOMEBREW_LIBRARY}"/Taps/*/*
|
||||
do
|
||||
if [[ -n "${HOMEBREW_INSTALL_FROM_API}" ]] &&
|
||||
[[ -z "${HOMEBREW_DEVELOPER}" || -n "${HOMEBREW_UPDATE_AUTO}" ]] &&
|
||||
[[ "${DIR}" == "${HOMEBREW_CORE_REPOSITORY}" ||
|
||||
"${DIR}" == "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask" ]]
|
||||
then
|
||||
@ -748,11 +749,11 @@ EOS
|
||||
if [[ -n "${HOMEBREW_INSTALL_FROM_API}" ]]
|
||||
then
|
||||
mkdir -p "${HOMEBREW_CACHE}/api"
|
||||
# TODO: use --header If-Modified-Since
|
||||
curl \
|
||||
"${CURL_DISABLE_CURLRC_ARGS[@]}" \
|
||||
--fail --compressed --silent --max-time 5 \
|
||||
--location --remote-time --output "${HOMEBREW_CACHE}/api/formula.json" \
|
||||
--time-cond "${HOMEBREW_CACHE}/api/formula.json" \
|
||||
--user-agent "${HOMEBREW_USER_AGENT_CURL}" \
|
||||
"https://formulae.brew.sh/api/formula.json"
|
||||
# TODO: we probably want to print an error if this fails.
|
||||
|
Loading…
x
Reference in New Issue
Block a user