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 98c76bd
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 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: echo | sudo tee /var/log/install.log

- 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: echo | sudo tee /var/log/install.log

- 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
16 changes: 15 additions & 1 deletion Library/Homebrew/cmd/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,6 @@ EOS
export HOMEBREW_UPDATE_AFTER"${TAP_VAR}"="${CURRENT_REVISION}"
else
merge_or_rebase "${DIR}" "${TAP_VAR}" "${UPSTREAM_BRANCH}"
[[ -n "${HOMEBREW_VERBOSE}" ]] && echo
fi
done

Expand All @@ -799,6 +798,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 +850,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 +864,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
2 changes: 1 addition & 1 deletion package/scripts/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ git config --global --add safe.directory "${homebrew_directory}"
git reset --hard
git checkout --force master
git branch | grep -v '\*' | xargs -n 1 git branch --delete --force
git config --global --unset safe.directory
git config --global --unset safe.directory "${homebrew_directory}"

# move to /usr/local if on x86_64
if [[ $(uname -m) == "x86_64" ]]
Expand Down

0 comments on commit 98c76bd

Please sign in to comment.