Skip to content

BIGTOP-3046: correct script to find lasted mvn version#369

Closed
deart2k wants to merge 2 commits intoapache:masterfrom
deart2k:master
Closed

BIGTOP-3046: correct script to find lasted mvn version#369
deart2k wants to merge 2 commits intoapache:masterfrom
deart2k:master

Conversation

@deart2k
Copy link
Contributor

@deart2k deart2k commented Jun 25, 2018

No description provided.

@evans-ye
Copy link
Contributor

@deart2k May I know what's your concern here?

@deart2k
Copy link
Contributor Author

deart2k commented Jun 25, 2018

The current variant of the script returns not correct value, if try to run this script:
curl --stderr /dev/null 'https://www.apache.org/dist/maven/maven-3/?F=0&V=1' | grep -o '<li>.*href="3.5.[0-9]*/"' | grep -o '3.5.[0-9]*'
it's return two line:
3.5.3
3.5.4

@acmnu
Copy link
Contributor

acmnu commented Jun 25, 2018

Strange that original patch for Ant was right, but for some reason it was changed for Maven

@JunHe77
Copy link
Contributor

JunHe77 commented Jun 26, 2018

Thanks for reporting this issue, @deart2k !
The previous implementation assumes that only one minor version is listed in the url, say, only one 3.5.x. But it is obviously not true, as there are 3.5.3 and 3.5.4 on the link now. 😀

Your patch LGTM, while I think there might be a little to add: it may not true to assume the last <li> is the latest version. So an extra cmd can be added to make sure the output is ordered by version, like following:
curl --stderr /dev/null 'https://www.apache.org/dist/maven/maven-3/?F=0&V=1' | grep -o '<li>.*href="3.5.[0-9]*/"' | grep -o '3.5.[0-9]*' | sort -V --field-separator=- | tail -1 | tr -d '\n'

What do you think?

And could you pls create a JIRA to link with this PR so we can track this, just like https://issues.apache.org/jira/browse/BIGTOP-3031.

Thank you very much.

@acmnu
Copy link
Contributor

acmnu commented Jun 26, 2018

@JunHe77, list is already sorted on server side (V=1 in GET parameters). I have no idea is this sorting equal to sort -V, but authors of auto_index module called that "version sorting".

http://httpd.apache.org/docs/2.2/mod/mod_autoindex.html#page-header

@deart2k deart2k changed the title BIGTOP-3031: correct script to find lasted mvn version BIGTOP-3046: correct script to find lasted mvn version Jun 26, 2018
@deart2k
Copy link
Contributor Author

deart2k commented Jun 26, 2018

@JunHe77
Copy link
Contributor

JunHe77 commented Jun 27, 2018

@acmnu , I see. So the sort cmd is not needed.
@deart2k , great! Thank you for your efforts and contribution.
LGTM, +1.

@asfgit asfgit closed this in 9b9304a Jun 28, 2018
panelion pushed a commit to panelion/bigtop that referenced this pull request Jan 15, 2019
This closes apache#369

Signed-off-by: Jun He <junhe@apache.org>
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.

4 participants