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

cleanup: fix for formula/cask name collision #5843

Merged
merged 1 commit into from
Mar 6, 2019
Merged

cleanup: fix for formula/cask name collision #5843

merged 1 commit into from
Mar 6, 2019

Conversation

chasestubblefield
Copy link
Contributor

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew tests with your changes locally?

When a formula and cask share the same name, a download can be incorrectly considered stale. This is the case for the name docker:

$ brew cleanup
...
$ brew cask fetch docker
==> Downloading external files for Cask docker
==> Downloading https://download.docker.com/mac/stable/31259/Docker.dmg
######################################################################## 100.0%
==> Verifying SHA-256 checksum for Cask 'docker'.
==> Success! Downloaded to -> /Users/chase/Library/Caches/Homebrew/downloads/be9b9366a4a96478a04d2711baad17a8d5dc1342a82facd388f211b741965149--Docker.dmg
$ brew cleanup -n
Would remove: /Users/chase/Library/Caches/Homebrew/Cask/docker--2.0.0.3-ce-mac81,31259.dmg (521.5MB)
==> This operation would free approximately 521.5MB of disk space.

This is because the download for the cask docker (/Users/chase/Library/Caches/Homebrew/Cask/docker--2.0.0.3-ce-mac81,31259.dmg) is considered a stale download for the formula docker.

The fix is to call either stale_formula? or stale_cask? on the download based on the containing directory, but not both. Also, a check on the containing directory in stale_cask? is no longer necessary.

When a formula and cask share the same name, a download can be
incorrectly considered stale. Only check for if a download is a stale
formula or stale cask, but not both.
@MikeMcQuaid
Copy link
Member

Thanks so much for your great first contribution (I hope to see more from you)! Without people like you submitting PRs we couldn't run this project. You rock, @Chasetopher !

@MikeMcQuaid MikeMcQuaid merged commit be6862d into Homebrew:master Mar 6, 2019
@lock lock bot added the outdated PR was locked due to age label Apr 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Apr 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants