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

fix bug on update_package.py #1162

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion scripts/utils/update_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ def get_latest_version(org, project, version):
print(f"GitHub API response not ok: {response.status_code}")
return None
latest_version = response.json()["tag_name"]
return latest_version
if latest_version.startswith('v'):
Copy link
Member

Choose a reason for hiding this comment

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

@naacbin introduced the support for packages whose version is preceded by v in #1067, but it seems the v was only taken into account when matching the url in the file and not to get the latest version, so it seems like the fix has never worked.

What is really getting me confused is that I see upx being correctly updated by our bot in acec181 before #1067, how is this possible? 🕵️‍♀️

return latest_version.replace('v','',1)
Copy link
Member

Choose a reason for hiding this comment

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

A bit more elegant 😉

Suggested change
return latest_version.replace('v','',1)
return latest_version[1:]

else:
return latest_version


# Get url response's content hash (SHA256)
Expand Down Expand Up @@ -104,6 +107,7 @@ def update_github_url(package):

latest_version = None
for url, org, project, version in matches:
# version excludes `v` from the capturing group in the regex therefore latest_version_match mustn't include `v` if the version starts with `v`
Copy link
Member

Choose a reason for hiding this comment

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

Can you move this comment (maybe with a bit rewording needed) just before the line if latest_version.startswith('v'):? Here it is difficult to understand what it is refering to 😕

latest_version_match = get_latest_version(org, project, version)
# No newer version available
if (not latest_version_match) or (latest_version_match == version):
Expand Down
Loading