]> git.proxmox.com Git - mirror_qemu.git/commitdiff
build-sys: define QEMU_VERSION_{MAJOR, MINOR, MICRO}
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 12 Sep 2016 09:18:56 +0000 (13:18 +0400)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 19 Sep 2016 15:32:21 +0000 (17:32 +0200)
There are better chances to find what went wrong at build time than a
later assert in qmp_query_version

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20160912091913.15831-2-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
qmp.c
scripts/create_config

diff --git a/qmp.c b/qmp.c
index dea8f81345b5623175c0f954b0ba15ddd270e333..6733463fa23288f3b4e0640ace49c54e5a0b43ff 100644 (file)
--- a/qmp.c
+++ b/qmp.c
@@ -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;
index 1dd6a354f530d9b2cd526818f67961bd3d60dcbc..e6929dd61efb62d5ede5b98021d7d4eed6d7850d 100755 (executable)
@@ -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%=*}