eclass: add get_semver() to cros-workon eclass

This commit is contained in:
Nick Owens 2016-02-02 14:48:20 -08:00
parent 5f98a5296b
commit 09ffbde166

View File

@ -166,4 +166,20 @@ cros-workon_pkg_info() {
echo "CROS_WORKON_PROJECT=(\"${CROS_WORKON_PROJECT}\")" echo "CROS_WORKON_PROJECT=(\"${CROS_WORKON_PROJECT}\")"
} }
# get the semver of the git repo that is being built
get_semver() {
# get git tag/sha
local v
v=$(git describe --long --dirty) || die
# strip a leading v from the tag
v=${v#v}
# replace first - with +, to attach git sha/dirty as semver metadata
v=${v/-/+}
echo ${v}
}
EXPORT_FUNCTIONS src_unpack pkg_info EXPORT_FUNCTIONS src_unpack pkg_info