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

Add semantic version output flag to updater #377

Merged
merged 5 commits into from Oct 10, 2019

Conversation

@winder
Copy link
Member

winder commented Oct 8, 2019

Summary

updater ver check -c stable outputs a machine readable number that can conveniently be used in scripts, like 4294967323. It would be nice to have a human readable form as well, so this adds a --semantic flag for printing the semantic version.

Test Plan

Added some unit tests and ran the command.

$ updater ver check -c stable
Checking for files matching: 'channel/stable/node_stable_linux-amd64' in bucket algorand-releases
4294967323
$ updater ver check -c stable -s
Checking for files matching: 'channel/stable/node_stable_linux-amd64' in bucket algorand-releases
1.0.27
@winder winder requested a review from algobolson Oct 8, 2019
@winder winder changed the title Will/updater Add semantic version output flag to updater Oct 8, 2019
winder added 2 commits Oct 8, 2019

modVal := uint64(1 << 16)

patch = val % modVal

This comment has been minimized.

Copy link
@tsachiherman

tsachiherman Oct 8, 2019

Contributor

nit: division (or modulo ) is a dangerous operation. it could lead to theoretical division by zero.
if you were to change it to
patch = val & 65536
you'd eliminate that one.

This comment has been minimized.

Copy link
@winder

winder Oct 9, 2019

Author Member

Good idea, but wouldn't it need to be patch = val & 65535? Or val & (modVal - 1)

And do you prefer using the actual constant or the shifted bit?

This comment has been minimized.

Copy link
@algobolson

algobolson Oct 9, 2019

Collaborator

I like val & 0xffff because I've handled bit patterns enough that I can just see each 0xf as 1111 bits and know I have a good mask.

This comment has been minimized.

Copy link
@tsachiherman

tsachiherman Oct 9, 2019

Contributor

yes. I like @algobolson proposal to use 0xffff.
If you want to merge it as is ( since it's already approved ), you can go ahead and do that.
If you'd like to use bit masks, I would be happy to approve it again.

Copy link
Contributor

tsachiherman left a comment

LGTM

Copy link
Contributor

tsachiherman left a comment

LGTM

@winder winder merged commit c33ee57 into algorand:master Oct 10, 2019
2 checks passed
2 checks passed
Travis CI - Pull Request Build Passed
Details
license/cla Contributor License Agreement is signed.
Details
@winder winder deleted the winder:will/updater branch Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.