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

If only the major number is specified for a release build consider downloading the latest bug fix release #668

Open
whimboo opened this issue Apr 2, 2024 · 2 comments · May be fixed by #675

Comments

@whimboo
Copy link
Contributor

whimboo commented Apr 2, 2024

Trying to download a Firefox build by only specifying the major version currently fails:

$ mozdownload -v 108
File "/Users/henrik/.pyenv/versions/3.10.11/lib/python3.10/site-packages/mozdownload/scraper.py", line 150, in _retry_check_404
    self._retry(func, **retry_kwargs)
  File "/Users/henrik/.pyenv/versions/3.10.11/lib/python3.10/site-packages/mozdownload/scraper.py", line 141, in _retry
    return redo.retry(func, **retry_kwargs)
  File "/Users/henrik/.pyenv/versions/3.10.11/lib/python3.10/site-packages/redo/__init__.py", line 170, in retry
    return action(*args, **kwargs)
  File "/Users/henrik/.pyenv/versions/3.10.11/lib/python3.10/site-packages/mozdownload/scraper.py", line 168, in _get_binary
    parser = self._create_directory_parser(self.path)
  File "/Users/henrik/.pyenv/versions/3.10.11/lib/python3.10/site-packages/mozdownload/scraper.py", line 158, in _create_directory_parser
    return DirectoryParser(url,
  File "/Users/henrik/.pyenv/versions/3.10.11/lib/python3.10/site-packages/mozdownload/parser.py", line 48, in __init__
    r.raise_for_status()
  File "/Users/henrik/.pyenv/versions/3.10.11/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://archive.mozilla.org/pub/firefox/releases/108/mac/en-US/

In such a case when no minor and bugfix version is included we should fallback to the latest bug fix release of this major release which in this case is 108.0.2.

@ghost
Copy link

ghost commented Apr 17, 2024

Hi,
I'm have just recently started to contribute to open source projects, and would love to take this up.
From what I can understand from the description above, is that we will need to construct a URL that points to the latest bug fix release for the given major version, but where can we have that information from?

@whimboo
Copy link
Contributor Author

whimboo commented Apr 18, 2024

Welcome @ghost and great to see that you have interest in contributing to the mozdownload project!

So this issue is all around the Firefox releases including candidate builds. For both we have the ReleaseScraper and the ReleaseCandidateScraper. Both are not really different but the latter contains a bit more logic, so that I would suggest to start with the former.

The central code around retrieving available versions of an application is in query_versions(). I would suggest that you take a look at this method because here we need to make updates.

Something that I would suggest is to not blindly return the version anymore in line 713, but really check if the version is present. Therefore we already have the parser code below. If the version like 108.* is found we can sort as in line 721 and return the latest entry.

To run tests and checks I would propose that you create a virtual environment and run python setup.py develop to install the package with symlinks. That way you can easily make changes to the code and directly execute.

Let me know if something is not clear and you need more help. Thanks again in advance!

piri-p added a commit to piri-p/mozdownload that referenced this issue Apr 30, 2024
@piri-p piri-p linked a pull request Apr 30, 2024 that will close this issue
piri-p added a commit to piri-p/mozdownload that referenced this issue May 7, 2024
piri-p added a commit to piri-p/mozdownload that referenced this issue May 7, 2024
piri-p added a commit to piri-p/mozdownload that referenced this issue May 8, 2024
piri-p added a commit to piri-p/mozdownload that referenced this issue May 8, 2024
piri-p added a commit to piri-p/mozdownload that referenced this issue May 8, 2024
piri-p added a commit to piri-p/mozdownload that referenced this issue May 8, 2024
piri-p added a commit to piri-p/mozdownload that referenced this issue May 8, 2024
piri-p added a commit to piri-p/mozdownload that referenced this issue May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant