-
Notifications
You must be signed in to change notification settings - Fork 2k
update.sh: use version id for version comparison #1040
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
Conversation
This doesn't make a difference for the current set of supported versions, but I hope it prevents problems once we have multiple versions for both 7.x and 8.x. It made my work a bit simpler when supporting 5.x too. |
Thanks for the contribution! This definitely seems like a good idea. 👍 I'd rather have a version ID function so that the My rough idea would be something like |
@yosifkit Sounds good. I added a function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything else looks great to me. 👍
update.sh
Outdated
as_version_id() { | ||
local fullVersion="$1" | ||
# strip prelease suffix | ||
fullVersion="${fullVersion/[a-z]*/}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MIght be safer to use "${fullVersion%[a-z]*}"
so that it only matches the end?
update.sh
Outdated
# sodium is part of php core 7.2+ https://wiki.php.net/rfc/libsodium | ||
sed -ri '/sodium/d' "$version/$suite/$variant/Dockerfile" | ||
fi | ||
if [ "$variant" = 'fpm' -a "$majorVersion" = '7' -a "$minorVersion" -lt '3' ]; then | ||
if [ "$variant" = 'fpm' -a "$versionId" -lt '70300' ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed one 😉.
Use version id (single integer) for version comparisons. This is clearer and less error prone than combining conditions on major and minor. The convention used is the same as PHP_VERSION_ID, which is standard since PHP 5.2.7 and commonly used for simple version comparisons. See: https://www.php.net/manual/en/function.phpversion.php Co-authored-by: Tianon Gravi <admwiggin@gmail.com>
Use version id (single integer) for version comparisons. This is clearer
and less error prone than combining conditions on major and minor.
The convention used is the same as PHP_VERSION_ID, which is standard
since PHP 5.2.7 and commonly used for simple version comparisons.
See: https://www.php.net/manual/en/function.phpversion.php