Skip to content

Commit

Permalink
Merge pull request #1 from swisstxt/getgittag
Browse files Browse the repository at this point in the history
Added an option to get the most recent tag of a git tree
  • Loading branch information
sontags authored Nov 21, 2016
2 parents 23fc407 + d1aeeb6 commit 7975a43
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions buildhelper
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Main () {
in getarch ) GetArch
;; getosrelease ) GetOsRelease
;; getgitrev ) GetGitRev $Opt
;; getgittag ) GetGitTag $Opt
;; getspec ) GetSpec $Opt
;; pushrpm ) PushRpm $Opt
;; help ) Help 0
Expand Down Expand Up @@ -49,6 +50,23 @@ GetGitRev () {
fi
}

#============================================================================================#
GetGitTag () {
if [ "$1" = "$DefaultOptString" ]; then
echo "$Prog: error. getgittag command requires an argument" ; Help 42
fi

DIR=$1

if [ -d ${DIR} ]; then
(cd ${DIR}; git describe --abbrev=0 --tags)
exit $?;
else
echo "No such directory: $1"
exit 1;
fi
}

#============================================================================================#
GetOsRelease () {
lsb_release -rs | cut -f1 -d.
Expand Down Expand Up @@ -100,6 +118,7 @@ Help () {
getarch : get architecture of current system
getosrelease : get os release of current system
getgitrev [DIR] : gets the git revision of given directory
getgittag [DIR] : gets the most recent git tag of given directory
getspec [PKGNAME] : finds the required spec file in SPECS subfolder for PKGNAME
pushrpm [BASEURL] : pushes all *.rpm files found in current dir
to [BASEURL][OS_RELEASE]/[RPMNAME]
Expand Down

0 comments on commit 7975a43

Please sign in to comment.