From 677a2a8d1178b8fa2d69fc70e1b9e8ca6b9ecd24 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Tue, 15 Feb 2011 17:09:51 +0100
Subject: [PATCH] STYLE: minor cleanup in wmakePrintBuild

---
 wmake/wmakePrintBuild | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/wmake/wmakePrintBuild b/wmake/wmakePrintBuild
index 71ff327fe37..5461601d4f0 100755
--- a/wmake/wmakePrintBuild
+++ b/wmake/wmakePrintBuild
@@ -29,6 +29,9 @@
 #     Print the version used when building the project
 #
 #------------------------------------------------------------------------------
+# persistent build tag
+build="$WM_PROJECT_DIR/.build"
+
 usage() {
     exec 1>&2
 
@@ -41,6 +44,7 @@ options:
   -major          report \$WM_PROJECT_VERSION only and exit
   -update         update \$WM_PROJECT_DIR/.build from the git information
   -pkg TAG        specify packager/release tag ('none' marks an empty packager)
+  -short          report short version information (ie, without pkg tag)
   -version VER    specify an alternative version
 
 Print the version used when building the project, in this order of precedence:
@@ -53,7 +57,7 @@ USAGE
 }
 #------------------------------------------------------------------------------
 
-unset checkOnly update package version oldPackage oldVersion
+unset checkOnly update package version shortOpt
 
 # parse options
 while [ "$#" -gt 0 ]
@@ -80,6 +84,10 @@ do
         package=$(echo "${2:-none}" | sed -e 's/!//g')
         shift 2
         ;;
+    -short)
+        shortOpt=true
+        shift
+        ;;
     -v | -version)
         [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
         version="$2"
@@ -93,17 +101,11 @@ done
 
 #------------------------------------------------------------------------------
 
-#
-# persistent build tag
-#
-build="$WM_PROJECT_DIR/.build"
-
-unset oldVersion oldPackage
-
 #
 # retrieve old values from the $WM_PROJECT_DIR/.build cache, stored as
 #     version [packager]
 #
+unset oldPackage oldVersion
 getOldValues()
 {
     set -- $(tail -1 $build 2>/dev/null)
@@ -157,6 +159,11 @@ fi
 # retrieve old values
 getOldValues
 
+if [ "$shortOpt" = true ]
+then
+    unset package oldPackage
+fi
+
 #
 # update persistent build tag if possible
 #
@@ -171,6 +178,14 @@ then
     fi
 fi
 
+# cat<< DEBUG 1>&2
+# Debug information
+#     version='$version'
+#     package='$package'
+#     oldVersion='$oldVersion'
+#     oldPackage='$oldPackage'
+# DEBUG
+
 
 # check git vs. persistent build tag
 if [ -n "$checkOnly" ]
-- 
GitLab