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

Install script: fix query latest release from GitHub on missing curl #839

Merged
merged 6 commits into from
Feb 15, 2023

Conversation

perazz
Copy link
Contributor

@perazz perazz commented Feb 9, 2023

Improve the command to query the latest release version from Github by trying curl then wget; with fallback to the last known version release if none of the two commands is available

The updated install.sh script queries the latest fpm release version from github directly, instead of having its version hardcoded
@perazz perazz mentioned this pull request Feb 9, 2023
@perazz perazz marked this pull request as ready for review February 9, 2023 16:16
@perazz
Copy link
Contributor Author

perazz commented Feb 15, 2023

@fortran-lang/admins please assign any reviewers if you wish to close this PR, thanks.

install.sh Outdated
Comment on lines 25 to 35
if command -v curl > /dev/null 2>&1; then
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' | # Pluck JSON value
sed -E 's/^v//' # Remove heading "v" if present
elif command -v wget > /dev/null 2>&1; then
wget -q -O- "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' | # Pluck JSON value
sed -E 's/^v//' # Remove heading "v" if present
else
Copy link
Member

Choose a reason for hiding this comment

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

You can reuse the logic later in the script where we define the FETCH variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks better now - made it a function

@awvwgk awvwgk requested a review from a team February 15, 2023 18:46
Copy link
Member

@awvwgk awvwgk left a comment

Choose a reason for hiding this comment

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

Looks good to me now.

@awvwgk awvwgk merged commit 5efb9e0 into fortran-lang:main Feb 15, 2023
@perazz perazz deleted the query_latest_release_from_github branch February 17, 2023 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants