mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-23 07:21:14 +02:00
eclass: add get_semver() to cros-workon eclass
This commit is contained in:
parent
5f98a5296b
commit
09ffbde166
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user