提交 3688d8c7 编写于 作者: M Marc-André Lureau 提交者: Markus Armbruster

build-sys: define QEMU_VERSION_{MAJOR, MINOR, MICRO}

There are better chances to find what went wrong at build time than a
later assert in qmp_query_version
Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20160912091913.15831-2-marcandre.lureau@redhat.com>
Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
上级 e3571ae3
......@@ -51,21 +51,11 @@ NameInfo *qmp_query_name(Error **errp)
VersionInfo *qmp_query_version(Error **errp)
{
VersionInfo *info = g_new0(VersionInfo, 1);
const char *version = QEMU_VERSION;
const char *tmp;
int err;
info->qemu = g_new0(VersionTriple, 1);
err = qemu_strtoll(version, &tmp, 10, &info->qemu->major);
assert(err == 0);
tmp++;
err = qemu_strtoll(tmp, &tmp, 10, &info->qemu->minor);
assert(err == 0);
tmp++;
err = qemu_strtoll(tmp, &tmp, 10, &info->qemu->micro);
assert(err == 0);
info->qemu->major = QEMU_VERSION_MAJOR;
info->qemu->minor = QEMU_VERSION_MINOR;
info->qemu->micro = QEMU_VERSION_MICRO;
info->package = g_strdup(QEMU_PKGVERSION);
return info;
......
......@@ -7,7 +7,13 @@ while read line; do
case $line in
VERSION=*) # configuration
version=${line#*=}
major=$(echo "$version" | cut -d. -f1)
minor=$(echo "$version" | cut -d. -f2)
micro=$(echo "$version" | cut -d. -f3)
echo "#define QEMU_VERSION \"$version\""
echo "#define QEMU_VERSION_MAJOR $major"
echo "#define QEMU_VERSION_MINOR $minor"
echo "#define QEMU_VERSION_MICRO $micro"
;;
qemu_*dir=*) # qemu-specific directory configuration
name=${line%=*}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册