You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "zhfeng (via GitHub)" <gi...@apache.org> on 2023/08/10 07:54:45 UTC

[GitHub] [camel-quarkus] zhfeng opened a new pull request, #5166: Fix compareVersion in sanity-checks.groovy #5165

zhfeng opened a new pull request, #5166:
URL: https://github.com/apache/camel-quarkus/pull/5166

   Fix #5165 
   <!-- Uncomment and fill this section if your PR is not trivial
   [ ] An issue should be filed for the change unless this is a trivial change (fixing a typo or similar). One issue should ideally be fixed by not more than one commit and the other way round, each commit should fix just one issue, without pulling in other changes.
   [ ] Each commit in the pull request should have a meaningful and properly spelled subject line and body. Copying the title of the associated issue is typically enough. Please include the issue number in the commit message prefixed by #.
   [ ] The pull request description should explain what the pull request does, how, and why. If the info is available in the associated issue or some other external document, a link is enough.
   [ ] Phrases like Fix #<issueNumber> or Fixes #<issueNumber> will auto-close the named issue upon merging the pull request. Using them is typically a good idea.
   [ ] Please run mvn process-resources -Pformat (and amend the changes if necessary) before sending the pull request.
   [ ] Contributor guide is your good friend: https://camel.apache.org/camel-quarkus/latest/contributor-guide.html
   -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] ppalaga commented on a diff in pull request #5166: Fix compareVersion in sanity-checks.groovy #5165

Posted by "ppalaga (via GitHub)" <gi...@apache.org>.
ppalaga commented on code in PR #5166:
URL: https://github.com/apache/camel-quarkus/pull/5166#discussion_r1289882075


##########
tooling/scripts/sanity-checks.groovy:
##########
@@ -68,10 +68,11 @@ int compareVersion(String a, String b) {
     List verB = b.tokenize('.')
 
     def commonIndices = Math.min(verA.size(), verB.size())
+    def versionRegex = ~/\-.*/
 
     for (int i = 0; i < commonIndices; ++i) {
        def numA = verA[i].toInteger()
-       def numB = verB[i].toInteger()
+       def numB = (verB[i] - versionRegex).toInteger()

Review Comment:
   I am bit lost what is this doing. The minus operator removes the matching part from the string, right?
   I this way we are effectively disregard the `-RC` qualifiers, right? 
   That's definitely OK for this current versions check, but I wonder whether it would not be safer for future copy-and-paste visitors, to move the suffix stripping before the compareVersion() method. After all we strip `-SNAPSHOT` from project.version before passing it to compareVersion() too. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zhfeng commented on a diff in pull request #5166: Fix compareVersion in sanity-checks.groovy #5165

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on code in PR #5166:
URL: https://github.com/apache/camel-quarkus/pull/5166#discussion_r1290809424


##########
tooling/scripts/sanity-checks.groovy:
##########
@@ -68,10 +68,11 @@ int compareVersion(String a, String b) {
     List verB = b.tokenize('.')
 
     def commonIndices = Math.min(verA.size(), verB.size())
+    def versionRegex = ~/\-.*/
 
     for (int i = 0; i < commonIndices; ++i) {
        def numA = verA[i].toInteger()
-       def numB = verB[i].toInteger()
+       def numB = (verB[i] - versionRegex).toInteger()

Review Comment:
   Only `currentVersion` contains `-RC`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] ppalaga merged pull request #5166: Fix compareVersion in sanity-checks.groovy #5165

Posted by "ppalaga (via GitHub)" <gi...@apache.org>.
ppalaga merged PR #5166:
URL: https://github.com/apache/camel-quarkus/pull/5166


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zhfeng commented on a diff in pull request #5166: Fix compareVersion in sanity-checks.groovy #5165

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on code in PR #5166:
URL: https://github.com/apache/camel-quarkus/pull/5166#discussion_r1290812468


##########
tooling/scripts/sanity-checks.groovy:
##########
@@ -68,10 +68,11 @@ int compareVersion(String a, String b) {
     List verB = b.tokenize('.')
 
     def commonIndices = Math.min(verA.size(), verB.size())
+    def versionRegex = ~/\-.*/
 
     for (int i = 0; i < commonIndices; ++i) {
        def numA = verA[i].toInteger()
-       def numB = verB[i].toInteger()
+       def numB = (verB[i] - versionRegex).toInteger()

Review Comment:
   Yeah, it intends to strip `-RC`. So Maybe it could move before `compareVersion()` like
   ```java
   final String currentVersion = project.version - '~/\-.*/'
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zhfeng commented on a diff in pull request #5166: Fix compareVersion in sanity-checks.groovy #5165

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on code in PR #5166:
URL: https://github.com/apache/camel-quarkus/pull/5166#discussion_r1292973027


##########
tooling/scripts/sanity-checks.groovy:
##########
@@ -68,10 +68,11 @@ int compareVersion(String a, String b) {
     List verB = b.tokenize('.')
 
     def commonIndices = Math.min(verA.size(), verB.size())
+    def versionRegex = ~/\-.*/
 
     for (int i = 0; i < commonIndices; ++i) {
        def numA = verA[i].toInteger()
-       def numB = verB[i].toInteger()
+       def numB = (verB[i] - versionRegex).toInteger()

Review Comment:
   OK, I fix it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zhfeng commented on a diff in pull request #5166: Fix compareVersion in sanity-checks.groovy #5165

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on code in PR #5166:
URL: https://github.com/apache/camel-quarkus/pull/5166#discussion_r1290812468


##########
tooling/scripts/sanity-checks.groovy:
##########
@@ -68,10 +68,11 @@ int compareVersion(String a, String b) {
     List verB = b.tokenize('.')
 
     def commonIndices = Math.min(verA.size(), verB.size())
+    def versionRegex = ~/\-.*/
 
     for (int i = 0; i < commonIndices; ++i) {
        def numA = verA[i].toInteger()
-       def numB = verB[i].toInteger()
+       def numB = (verB[i] - versionRegex).toInteger()

Review Comment:
   Yeah, it intends to strip `-RC`. So Maybe it could move before `compareVersion()` like
   ```java
   def versionRegex = ~/\-.*/
   final String currentVersion = project.version - versionRegex
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] ppalaga commented on a diff in pull request #5166: Fix compareVersion in sanity-checks.groovy #5165

Posted by "ppalaga (via GitHub)" <gi...@apache.org>.
ppalaga commented on code in PR #5166:
URL: https://github.com/apache/camel-quarkus/pull/5166#discussion_r1290022861


##########
tooling/scripts/sanity-checks.groovy:
##########
@@ -68,10 +68,11 @@ int compareVersion(String a, String b) {
     List verB = b.tokenize('.')
 
     def commonIndices = Math.min(verA.size(), verB.size())
+    def versionRegex = ~/\-.*/
 
     for (int i = 0; i < commonIndices; ++i) {
        def numA = verA[i].toInteger()
-       def numB = verB[i].toInteger()
+       def numB = (verB[i] - versionRegex).toInteger()

Review Comment:
   But wait, which version actually contains the -RC qualifier? Is it the current version or some of the since versions? Both of those sounds a bit strange.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] ppalaga commented on a diff in pull request #5166: Fix compareVersion in sanity-checks.groovy #5165

Posted by "ppalaga (via GitHub)" <gi...@apache.org>.
ppalaga commented on code in PR #5166:
URL: https://github.com/apache/camel-quarkus/pull/5166#discussion_r1291508991


##########
tooling/scripts/sanity-checks.groovy:
##########
@@ -68,10 +68,11 @@ int compareVersion(String a, String b) {
     List verB = b.tokenize('.')
 
     def commonIndices = Math.min(verA.size(), verB.size())
+    def versionRegex = ~/\-.*/
 
     for (int i = 0; i < commonIndices; ++i) {
        def numA = verA[i].toInteger()
-       def numB = verB[i].toInteger()
+       def numB = (verB[i] - versionRegex).toInteger()

Review Comment:
   Yeah, I think that would be safer for any future reuse of `compareVersion()`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] ppalaga commented on pull request #5166: Fix compareVersion in sanity-checks.groovy #5165

Posted by "ppalaga (via GitHub)" <gi...@apache.org>.
ppalaga commented on PR #5166:
URL: https://github.com/apache/camel-quarkus/pull/5166#issuecomment-1678725649

   Thanks for taking care, @zhfeng 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org