[Spice-devel] [PATCH 1/3] build-sys: more version related fixups
Frediano Ziglio
freddy77 at gmail.com
Sat Apr 17 10:00:56 UTC 2021
Il giorno sab 17 apr 2021 alle ore 09:52 Roman Bogorodskiy
<bogorodskiy at gmail.com> ha scritto:
>
> - Drop "-dirty" suffix before processing version info
> - Don't fail on versions without 'minor' specified (e.g. v0.15)
This is due to my fault, I didn't realize that version tags must
contain the micro version,
even if 0. Fixed (removed v0.15, added v0.15.0)
>
> Signed-off-by: Roman Bogorodskiy <bogorodskiy at gmail.com>
> ---
> server/meson.build | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/server/meson.build b/server/meson.build
> index 4a670635..4fadb6e4 100644
> --- a/server/meson.build
> +++ b/server/meson.build
> @@ -8,10 +8,15 @@ if meson.project_version().startswith('UNKNOWN')
> minor = '0'
> micro = '1'
> else
> - version_info = meson.project_version().split('.')
> + version_str = meson.project_version()
> + # drop "-dirty" suffix
This is not actually entirely true, to code below removes everything
after the dash, if you have changes the version
can be something like 0.1.2.3-abcd-dirty where 3 is the number of
commits after the release, acbd is the last commit
hash and -dirty means additional changes.
> + if version_str.contains('-')
> + version_str = version_str.split('-')[0]
> + endif
Even easier:
version_str = version_str.split('-')[0]
(no need for the if)
> + version_info = version_str.split('.')
> major = '@0@'.format(version_info[0])
> minor = '@0@'.format(version_info[1])
> - micro = version_info[2].to_int()
> + micro = version_info.get(2, '0').to_int()
Not necessary (actually wrong), version tags should have the micro version.
> if version_info.length() >= 4
> micro += 1
> endif
Frediano
More information about the Spice-devel
mailing list