Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcQuaid committed Jul 27, 2023
1 parent e9ac1b8 commit cdf841b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/build-pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
HOMEBREW_NO_ANALYTICS_MESSAGE_OUTPUT: 1
steps:
- name: Remove existing API cache (to force update)
run: rm -rf ~/Library/Caches/Homebrew/api
run: rm -rvf ~/Library/Caches/Homebrew/api

- name: Set up Homebrew
id: set-up-homebrew
Expand Down Expand Up @@ -123,14 +123,28 @@ jobs:
fi
- name: Remove existing Homebrew installations
run: sudo rm -rf brew /usr/local/bin/brew /usr/local/.??* /usr/local/Homebrew /usr/local/Caskroom /usr/local/Cellar
run: sudo rm -rf brew /usr/local/bin/brew /usr/local/.??* /usr/local/Homebrew /usr/local/Caskroom /usr/local/Cellar /opt/homebrew /home/linuxbrew/.linuxbrew

- name: Zero existing installer logs
run: sudo echo > /var/log/install.log

Check failure on line 129 in .github/workflows/build-pkg.yml

View workflow job for this annotation

GitHub Actions / workflow_syntax

shellcheck reported issue in this script: SC2024:warning:1:11: sudo doesn't affect redirects. Use ..| sudo tee file

- name: Install Homebrew from installer package
run: sudo installer -verbose -pkg Homebrew-${{ steps.print-version.outputs.version }}.pkg -target /

- name: Install Homebrew (again) from installer package
- name: Output installer logs
if: ${{ always() }}
run: sudo cat /var/log/install.log

- name: Zero existing installer logs (again)
run: sudo echo > /var/log/install.log

Check failure on line 139 in .github/workflows/build-pkg.yml

View workflow job for this annotation

GitHub Actions / workflow_syntax

shellcheck reported issue in this script: SC2024:warning:1:11: sudo doesn't affect redirects. Use ..| sudo tee file

- name: Reinstall Homebrew from installer package
run: sudo installer -verbose -pkg Homebrew-${{ steps.print-version.outputs.version }}.pkg -target /

- name: Output installer logs (again)
if: ${{ always() }}
run: sudo cat /var/log/install.log

- name: Upload installer to GitHub Actions
uses: actions/upload-artifact@v3
with:
Expand Down
15 changes: 15 additions & 0 deletions Library/Homebrew/cmd/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,11 @@ EOS
INITIAL_JSON_BYTESIZE="$(wc -c "${cache_path}")"
fi

if [[ -n "${HOMEBREW_VERBOSE}" ]]
then
echo "Checking if we need to fetch ${filename}..."
fi

JSON_URLS=()
if [[ -n "${HOMEBREW_API_DOMAIN}" && "${HOMEBREW_API_DOMAIN}" != "${HOMEBREW_API_DEFAULT_DOMAIN}" ]]
then
Expand Down Expand Up @@ -846,6 +851,11 @@ EOS
rm -f "${api_cache}/formula_aliases.txt"
fi
HOMEBREW_UPDATED="1"

if [[ -n "${HOMEBREW_VERBOSE}" ]]
then
echo "Updated ${filename}."
fi
fi
else
echo "Failed to download ${json_url}!" >>"${update_failed_file}"
Expand All @@ -855,6 +865,11 @@ EOS

# Not a typo, these are the files we used to download that no longer need so should cleanup.
rm -f "${HOMEBREW_CACHE}/api/formula.json" "${HOMEBREW_CACHE}/api/cask.json"
else
if [[ -n "${HOMEBREW_VERBOSE}" ]]
then
echo "HOMEBREW_NO_INSTALL_FROM_API set: skipping API JSON downloads."
fi
fi

if [[ -f "${update_failed_file}" ]]
Expand Down

0 comments on commit cdf841b

Please sign in to comment.