khos2ow commented on a change in pull request #2433: Fix and enhance package 
script
URL: https://github.com/apache/cloudstack/pull/2433#discussion_r165451333
 
 

 ##########
 File path: packaging/package.sh
 ##########
 @@ -67,22 +79,38 @@ function packaging() {
             exit 2
         fi
     fi
+
     VERSION=$(cd ../; $MVN 
org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate 
-Dexpression=project.version | grep --color=none '^[0-9]\.')
+
+    if [ -n "$5" ]; then
+        DEFBRN="-D_brand -$5"
+        BRAND="${5}."
+    else
+        BASEVER=$(echo "$VERSION" | sed 's/-SNAPSHOT//g')
+        REALVER=$(echo "$BASEVER" | cut -d '-' -f 1)
+        BRAND=$(echo "$BASEVER" | cut -d '-' -f 2)
+
+        if [ "$REALVER" != "$BRAND" ]; then
+            DEFBRN="-D_brand -$BRAND"
+            BRAND="${BRAND}."
+        else
+            BRAND=""
+        fi
+    fi
+
 
 Review comment:
   - If you specifically mention `--brand NAME` as input flag, it will use this 
_NAME_ no matter what, otherwise it will try to extract any "branding" name 
from POM version (hence the else block).
   - If pass `$5` directly to `-D_rel` it will wipe the value of `-r, --release 
integer` that's why it will be appended to `-D_rel` and not replace it.
   - We still do need `-D_brand` for the cases in which POM version does have 
branding string in them. The folder in `/dist/RPM/...` will have a folder name 
as the full POM version but `_maventag` in spec wouldn't have it, so the 
packaging will fail.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to