Skip to content
Snippets Groups Projects
Commit 677a2a8d authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: minor cleanup in wmakePrintBuild

parent 808ff1aa
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
# Print the version used when building the project # Print the version used when building the project
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# persistent build tag
build="$WM_PROJECT_DIR/.build"
usage() { usage() {
exec 1>&2 exec 1>&2
...@@ -41,6 +44,7 @@ options: ...@@ -41,6 +44,7 @@ options:
-major report \$WM_PROJECT_VERSION only and exit -major report \$WM_PROJECT_VERSION only and exit
-update update \$WM_PROJECT_DIR/.build from the git information -update update \$WM_PROJECT_DIR/.build from the git information
-pkg TAG specify packager/release tag ('none' marks an empty packager) -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 -version VER specify an alternative version
Print the version used when building the project, in this order of precedence: Print the version used when building the project, in this order of precedence:
...@@ -53,7 +57,7 @@ USAGE ...@@ -53,7 +57,7 @@ USAGE
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
unset checkOnly update package version oldPackage oldVersion unset checkOnly update package version shortOpt
# parse options # parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
...@@ -80,6 +84,10 @@ do ...@@ -80,6 +84,10 @@ do
package=$(echo "${2:-none}" | sed -e 's/!//g') package=$(echo "${2:-none}" | sed -e 's/!//g')
shift 2 shift 2
;; ;;
-short)
shortOpt=true
shift
;;
-v | -version) -v | -version)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument" [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
version="$2" version="$2"
...@@ -93,17 +101,11 @@ done ...@@ -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 # retrieve old values from the $WM_PROJECT_DIR/.build cache, stored as
# version [packager] # version [packager]
# #
unset oldPackage oldVersion
getOldValues() getOldValues()
{ {
set -- $(tail -1 $build 2>/dev/null) set -- $(tail -1 $build 2>/dev/null)
...@@ -157,6 +159,11 @@ fi ...@@ -157,6 +159,11 @@ fi
# retrieve old values # retrieve old values
getOldValues getOldValues
if [ "$shortOpt" = true ]
then
unset package oldPackage
fi
# #
# update persistent build tag if possible # update persistent build tag if possible
# #
...@@ -171,6 +178,14 @@ then ...@@ -171,6 +178,14 @@ then
fi fi
fi fi
# cat<< DEBUG 1>&2
# Debug information
# version='$version'
# package='$package'
# oldVersion='$oldVersion'
# oldPackage='$oldPackage'
# DEBUG
# check git vs. persistent build tag # check git vs. persistent build tag
if [ -n "$checkOnly" ] if [ -n "$checkOnly" ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment