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 migration: add strategies #8255

Merged
merged 1 commit into from
Aug 27, 2020
Merged

livecheck migration: add strategies #8255

merged 1 commit into from
Aug 27, 2020

Conversation

nandahkrishna
Copy link
Member

@nandahkrishna nandahkrishna commented Aug 8, 2020

  • 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?

This PR adds livecheck's strategies to Homebrew/brew. The original PR #8180 was split up to make code review easier, and the changes here will have to be merged before that PR can be merged.

Changes yet to work on:

  • Tests, have some very simple tests ready, will add them here soon.
  • Making the strategy regexes more understandable.

Sorry, something went wrong.

@nandahkrishna
Copy link
Member Author

nandahkrishna commented Aug 10, 2020

Well CI is failing, for page_matches in page_match_spec with this error:

SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate)

It all works fine locally, not sure why there's a problem. Even tried changing the url to something else, doesn't seem to help. It seems like the test for find_versions passes though, which is strange because it calls page_matches. Am I missing something?

Edit: I removed that particular test and it seems to pass now.

Copy link
Member

@samford samford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are just a couple things that I wanted to comment on for the moment. I'll take a pass at the tests after I've finished updating the strategies and those changes are integrated here.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bunch of comments but I don't consider many of them blocking considering this code has been tested and has a decent amount of new tests too.

Copy link
Member

@samford samford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hoping to have a PR up within the next day or two for the aforementioned work to make the strategies more clear (turning regexes into multiline constants with comments, adding explanatory comments in general, etc.). I've finished the technical changes (relating to code clarity) and I just need to finish adding explanatory comments.

The forthcoming PR should address most of the feedback here in the process, so I'll request Mike's review on that PR once it's up.

@nandahkrishna
Copy link
Member Author

nandahkrishna commented Aug 26, 2020

With the latest push, changes from Homebrew/homebrew-livecheck#1329 have been integrated here. There are hardly any differences except the absence here of a private_method for strategies since I won't be able to test it otherwise.

I've also removed the test for DEV_VERSION_ALLOWLIST which is obsolete.

Other than that, just need to add tests if required I think (maybe for the find_versions methods that haven't been tested yet as they're network-heavy). Do review when you are able to @MikeMcQuaid @samford, thanks.

Copy link
Member

@samford samford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a couple suggestions related to changes that I made to the Apache and Git strategies' #match? methods after reviewing the strategy tests here. These changes are in homebrew-livecheck and simply need to be integrated here.

There's one issue in the Gnu strategy where some code didn't get copied over correctly and that needs to be brought in line with the relevant code in homebrew-livecheck.


Regarding the tests, I added some suggested URLs that are a little closer to real URLs for each strategy. As documented in the explanatory comments in the strategies, there are often multiple URL formats that we want to test but I didn't go so far as to add alternative URLs to the tests yet. It's technically possible to handle some of it here but our time is limited and this is something that I plan to address in a PR sometime after GSoC is over, so I'm not overly concerned about getting it done in this PR.

I'll defer to Mike as to whether we should add tests for all the #find_versions methods. If we do go this route, then we would just replace the test URLs with real URLs, so there wouldn't be any need to integrate my suggested URL changes. With that in mind, I would hold off on those particular changes until Mike reviews this.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this would have more tests but it's looking good enough to me now that I'm happy to see it merged whenever @samford is happy with it. I'd err on merging on the earlier side given that we can continue to make updates once it's in Homebrew/brew and we're coming towards the end of GSoC.

@reitermarkus
Copy link
Member

Please also mark all modules and classes with @api private or @api public explicitly.

@samford
Copy link
Member

samford commented Aug 27, 2020

Ideally this would have more tests but it's looking good enough to me now that I'm happy to see it merged whenever @samford is happy with it. I'd err on merging on the earlier side given that we can continue to make updates once it's in Homebrew/brew and we're coming towards the end of GSoC.

I agree. The only remaining areas that need to be addressed at this point are:

  • Markus's documentation request (marking modules and classes as @api private or @api public)
  • What should we do about the PageMatch#find_versions test (which fails on CI with an SSL error)? This is the only #find_versions test currently, so it may be easiest to drop it and deal with all those tests later, if that makes sense.

Once these are resolved, I'm good with this being merged.

@MikeMcQuaid
Copy link
Member

  • What should we do about the PageMatch#find_versions test (which fails on CI with an SSL error)? This is the only #find_versions test currently, so it may be easiest to drop it and deal with all those tests later, if that makes sense.

Agreed 👍🏻

@nandahkrishna
Copy link
Member Author

The test has been dropped for now but I'm doing some research on what the problem could be. The documentation request has also been completed as follows:

  • The Strategy module is private as it isn't going to be used by any Tap
  • The individual strategies are public because they can be modified (priorities overridden for example) or used in a Tap's own strategy.

Partially verified

This commit is signed with the committer’s verified signature.
nandahkrishna’s contribution has been verified via GPG key.
We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com>
Co-authored-by: Thierry Moisan <thierry.moisan@gmail.com>
Co-authored-by: Dawid Dziurla <dawidd0811@gmail.com>
Co-authored-by: Maxim Belkin <maxim.belkin@gmail.com>
Co-authored-by: Issy Long <me@issyl0.co.uk>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Co-authored-by: Seeker <meaningseeking@protonmail.com>
Copy link
Member

@samford samford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't comment on the @api private and @api public additions but outside of that this looks good to me. Anything else that we've discussed here but haven't addressed (e.g., the Strategy#strategies situation) can simply be handled after GSoC.

@MikeMcQuaid MikeMcQuaid merged commit ff8d30d into Homebrew:master Aug 27, 2020
@MikeMcQuaid
Copy link
Member

Merging, thanks @nandahkrishna and @samford!

@nandahkrishna nandahkrishna deleted the migrate-livecheck-strategy branch August 27, 2020 15:16
@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Dec 14, 2020
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Dec 14, 2020
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

5 participants