Merge pull request #6532 from MikeMcQuaid/faster-auto-update

Improve speed of HOMEBREW_AUTO_UPDATE_SECS
This commit is contained in:
Mike McQuaid 2019-10-03 15:44:04 +01:00 committed by GitHub
commit b7596adb4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 11 deletions

View File

@ -466,6 +466,20 @@ update-preinstall() {
then then
export HOMEBREW_AUTO_UPDATING="1" export HOMEBREW_AUTO_UPDATING="1"
# Skip auto-update if the cask/core tap has been updated in the
# last $HOMEBREW_AUTO_UPDATE_SECS.
if [[ "$HOMEBREW_COMMAND" = "cask" ]]
then
tap_fetch_head="$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-cask/.git/FETCH_HEAD"
else
tap_fetch_head="$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core/.git/FETCH_HEAD"
fi
if [[ -f "$tap_fetch_head" &&
-n "$(find "$tap_fetch_head" -type f -mtime -"${HOMEBREW_AUTO_UPDATE_SECS}"s 2>/dev/null)" ]]
then
return
fi
if [[ -z "$HOMEBREW_VERBOSE" ]] if [[ -z "$HOMEBREW_VERBOSE" ]]
then then
update-preinstall-timer & update-preinstall-timer &

View File

@ -337,7 +337,7 @@ EOS
if [[ -z "$HOMEBREW_AUTO_UPDATE_SECS" ]] if [[ -z "$HOMEBREW_AUTO_UPDATE_SECS" ]]
then then
HOMEBREW_AUTO_UPDATE_SECS="60" HOMEBREW_AUTO_UPDATE_SECS="300"
fi fi
# check permissions # check permissions
@ -451,12 +451,6 @@ EOS
# origin branch name is, and use that. If not set, fall back to "master". # origin branch name is, and use that. If not set, fall back to "master".
# the refspec ensures that the default upstream branch gets updated # the refspec ensures that the default upstream branch gets updated
( (
if [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]]
then
# Skip taps checked/fetched recently
[[ -n "$(find "$DIR/.git/FETCH_HEAD" -type f -mtime -"${HOMEBREW_AUTO_UPDATE_SECS}"s 2>/dev/null)" ]] && exit
fi
UPSTREAM_REPOSITORY_URL="$(git config remote.origin.url)" UPSTREAM_REPOSITORY_URL="$(git config remote.origin.url)"
if [[ "$UPSTREAM_REPOSITORY_URL" = "https://github.com/"* ]] if [[ "$UPSTREAM_REPOSITORY_URL" = "https://github.com/"* ]]
then then

View File

@ -134,7 +134,7 @@ Note that environment variables must have a value set to be detected. For exampl
* `HOMEBREW_AUTO_UPDATE_SECS`: * `HOMEBREW_AUTO_UPDATE_SECS`:
If set, Homebrew will only check for autoupdates once per this seconds interval. If set, Homebrew will only check for autoupdates once per this seconds interval.
*Default:* `60`. *Default:* `300`.
* `HOMEBREW_AWS_ACCESS_KEY_ID`, `HOMEBREW_AWS_SECRET_ACCESS_KEY`: * `HOMEBREW_AWS_ACCESS_KEY_ID`, `HOMEBREW_AWS_SECRET_ACCESS_KEY`:
When using the `S3` download strategy, Homebrew will look in When using the `S3` download strategy, Homebrew will look in

View File

@ -1068,7 +1068,7 @@ Note that environment variables must have a value set to be detected. For exampl
* `HOMEBREW_AUTO_UPDATE_SECS`: * `HOMEBREW_AUTO_UPDATE_SECS`:
If set, Homebrew will only check for autoupdates once per this seconds interval. If set, Homebrew will only check for autoupdates once per this seconds interval.
*Default:* `60`. *Default:* `300`.
* `HOMEBREW_AWS_ACCESS_KEY_ID`, `HOMEBREW_AWS_SECRET_ACCESS_KEY`: * `HOMEBREW_AWS_ACCESS_KEY_ID`, `HOMEBREW_AWS_SECRET_ACCESS_KEY`:
When using the `S3` download strategy, Homebrew will look in When using the `S3` download strategy, Homebrew will look in

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BREW\-CASK" "1" "September 2019" "Homebrew" "brew-cask" .TH "BREW\-CASK" "1" "October 2019" "Homebrew" "brew-cask"
. .
.SH "NAME" .SH "NAME"
\fBbrew\-cask\fR \- a friendly binary installer for macOS \fBbrew\-cask\fR \- a friendly binary installer for macOS

View File

@ -1329,7 +1329,7 @@ If set, instructs Homebrew to prefix all download URLs, including those for bott
If set, Homebrew will only check for autoupdates once per this seconds interval\. If set, Homebrew will only check for autoupdates once per this seconds interval\.
. .
.IP .IP
\fIDefault:\fR \fB60\fR\. \fIDefault:\fR \fB300\fR\.
. .
.TP .TP
\fBHOMEBREW_AWS_ACCESS_KEY_ID\fR, \fBHOMEBREW_AWS_SECRET_ACCESS_KEY\fR \fBHOMEBREW_AWS_ACCESS_KEY_ID\fR, \fBHOMEBREW_AWS_SECRET_ACCESS_KEY\fR