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

Livecheck: Avoid duplicate URLs #12563

Merged
merged 1 commit into from Dec 16, 2021

Conversation

samford
Copy link
Member

@samford samford commented Dec 14, 2021

  • 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 typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Some formulae/casks contain duplicate checkable URLs or contain URLs that become duplicates after #preprocess_url is used. With the former, a formula's stable and head URLs can be the same if they both use the Git repository. With the latter, a formula's homepage and stable URLs are different but #preprocess_url can return the same Git repository URL for each (which can also be a duplicate of the head URL).

The fabric-completion formula is a worst case scenario, as it contains both of these conditions but the repository has no tags. By default, livecheck would needlessly check the repository three times (i.e., no versions are found so livecheck tries the next URL, which happens to be the same URL). [That said, I added a skip livecheck block in the past when I noticed this issue.]

This PR avoids duplicate URLs in #checkable_urls and keeps track of checked URLs in #latest_version to avoid a duplicate caused by #preprocess_url. This should effectively resolve the issue of checking the same URL more than once for a given formula/cask. Checking the same URL only once across all the formulae/casks in a given livecheck run will be handled in a later PR (though I've done most of the groundwork already in previous PRs).

Some formulae/casks contain duplicate checkable URLs or contain
URLs that become duplicates after `#preprocess_url` is used. With
the former, a formula's `stable` and `head` URLs can be the same if
they both use the Git repository. With the latter, a formula's
`homepage` and `stable` URLs are different but `#preprocess_url` can
return the same Git repository URL for each (which can also be
a duplicate of the `head` URL).

The `fabric-completion` formula is a worst case scenario, as it
contains both of these conditions but the repository has no tags.
By default, livecheck would needlessly check the repository three
times (i.e., no versions are found so livecheck tries the next URL,
which happens to be the same URL).

This commit avoids duplicate URLs in `#checkable_urls` and keeps
track of checked URLs in `#latest_version` to avoid a duplicate
caused by `#preprocess_url`. This should effectively resolve the
issue of checking the same URL more than once for a given
formula/cask. Checking the same URL only once across all the
formulae/casks in a given livecheck run will be handled in a later
commit (though I've done most of the groundwork already in previous
PRs).
@BrewTestBot
Copy link
Member

Review period will end on 2021-12-15 at 15:32:21 UTC.

@BrewTestBot BrewTestBot added the waiting for feedback Merging is blocked until sufficient time has passed for review label Dec 14, 2021
@BrewTestBot BrewTestBot removed the waiting for feedback Merging is blocked until sufficient time has passed for review label Dec 15, 2021
@BrewTestBot
Copy link
Member

Review period ended.

@samford samford merged commit 29329fe into Homebrew:master Dec 16, 2021
@samford samford deleted the livecheck/avoid-duplicate-urls branch December 16, 2021 14:46
@github-actions github-actions bot added the outdated PR was locked due to age label Jan 16, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 16, 2022
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.

None yet

3 participants