Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Beam Positoning Monitor - Software
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
Beam Positoning Monitor - Software
Commits
0924b5e1
Commit
0924b5e1
authored
9 years ago
by
Lucas Russo
Browse files
Options
Downloads
Patches
Plain Diff
version.sh: add script to extract version number from header files
parent
db19c2ed
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
version.sh
+30
-0
30 additions, 0 deletions
version.sh
with
30 additions
and
0 deletions
version.sh
0 → 100755
+
30
−
0
View file @
0924b5e1
#!/usr/bin/env sh
#
# This script extracts the version from the project header file
#
# This script is based on CZMQ version.sh script located at:
# https://github.com/zeromq/czmq/blob/master/version.sh
project
=
$1
appendix
=
"_classes"
if
[
!
-f
include/
$project$appendix
.h
]
;
then
echo
"version.sh: error: could not open file include/
$project$appendix
.h"
1>&2
exit
1
fi
MAJOR
=
`
egrep
'^#define .*_VERSION_MAJOR +[0-9]+$'
include/
$project$appendix
.h
`
MINOR
=
`
egrep
'^#define .*_VERSION_MINOR +[0-9]+$'
include/
$project$appendix
.h
`
PATCH
=
`
egrep
'^#define .*_VERSION_PATCH +[0-9]+$'
include/
$project$appendix
.h
`
if
[
-z
"
$MAJOR
"
-o
-z
"
$MINOR
"
-o
-z
"
$PATCH
"
]
;
then
echo
"version.sh: error: could not extract version from include/
$project$appendix
.h"
1>&2
exit
1
fi
MAJOR
=
`
echo
$MAJOR
|
awk
'{ print $3 }'
`
MINOR
=
`
echo
$MINOR
|
awk
'{ print $3 }'
`
PATCH
=
`
echo
$PATCH
|
awk
'{ print $3 }'
`
echo
$MAJOR
.
$MINOR
.
$PATCH
|
tr
-d
'\n'
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment