From 93beac7906042ebf95558351107e8fc01ef65b86 Mon Sep 17 00:00:00 2001 From: Nick Owens Date: Tue, 2 Feb 2016 14:48:20 -0800 Subject: [PATCH] eclass: add get_semver() to cros-workon eclass --- eclass/cros-workon.eclass | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/eclass/cros-workon.eclass b/eclass/cros-workon.eclass index ac6adbce28..e845e725df 100644 --- a/eclass/cros-workon.eclass +++ b/eclass/cros-workon.eclass @@ -166,4 +166,20 @@ cros-workon_pkg_info() { 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 +