All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Thomas Huth <thuth@redhat.com>
Subject: [Qemu-devel] [PULL 20/69] Polish the version strings containing the package version
Date: Tue, 13 Mar 2018 23:46:30 +0100	[thread overview]
Message-ID: <20180313224719.4954-21-pbonzini@redhat.com> (raw)
In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com>

From: Thomas Huth <thuth@redhat.com>

Since commit 67a1de0d195a there is no space anymore between the
version number and the parentheses when running configure with
--with-pkgversion=foo :

 $ qemu-system-s390x --version
 QEMU emulator version 2.11.50(foo)

But the space is included when building without that option
when building from a git checkout:

 $ qemu-system-s390x --version
 QEMU emulator version 2.11.50 (v2.11.0-1494-gbec9c64-dirty)

The same confusion exists with the "query-version" QMP command.
Let's fix this by introducing a proper QEMU_FULL_VERSION definition
that includes the space and parentheses, while the QEMU_PKGVERSION
should just cleanly contain the package version string itself.
Note that this also changes the behavior of the "query-version" QMP
command (the space and parentheses are not included there anymore),
but that's supposed to be OK since the strings there are not meant
to be parsed by other tools.

Fixes: 67a1de0d195a6185c39b436159c9ffc7720bf979
Buglink: https://bugs.launchpad.net/qemu/+bug/1673373
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1518692807-25859-1-git-send-email-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Makefile              | 20 +++++++++++---------
 bsd-user/main.c       |  2 +-
 configure             |  2 +-
 linux-user/main.c     |  2 +-
 qemu-img.c            |  2 +-
 qemu-io.c             |  2 +-
 qemu-nbd.c            |  2 +-
 qga/main.c            |  2 +-
 scsi/qemu-pr-helper.c |  2 +-
 ui/cocoa.m            |  2 +-
 vl.c                  |  2 +-
 11 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/Makefile b/Makefile
index 5d9ef3b8fd..416a81c7ca 100644
--- a/Makefile
+++ b/Makefile
@@ -434,21 +434,23 @@ all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules
 qemu-version.h: FORCE
 	$(call quiet-command, \
 		(cd $(SRC_PATH); \
-		printf '#define QEMU_PKGVERSION '; \
 		if test -n "$(PKGVERSION)"; then \
-			printf '"$(PKGVERSION)"\n'; \
+			pkgvers="$(PKGVERSION)"; \
 		else \
 			if test -d .git; then \
-				printf '" ('; \
-				git describe --match 'v*' 2>/dev/null | tr -d '\n'; \
+				pkgvers=$$(git describe --match 'v*' 2>/dev/null | tr -d '\n');\
 				if ! git diff-index --quiet HEAD &>/dev/null; then \
-					printf -- '-dirty'; \
+					pkgvers="$${pkgvers}-dirty"; \
 				fi; \
-				printf ')"\n'; \
-			else \
-				printf '""\n'; \
 			fi; \
-		fi) > $@.tmp)
+		fi; \
+		printf "#define QEMU_PKGVERSION \"$${pkgvers}\"\n"; \
+		if test -n "$${pkgvers}"; then \
+			printf '#define QEMU_FULL_VERSION QEMU_VERSION " (" QEMU_PKGVERSION ")"\n'; \
+		else \
+			printf '#define QEMU_FULL_VERSION QEMU_VERSION\n'; \
+		fi; \
+		) > $@.tmp)
 	$(call quiet-command, if ! cmp -s $@ $@.tmp; then \
 	  mv $@.tmp $@; \
 	 else \
diff --git a/bsd-user/main.c b/bsd-user/main.c
index efef5ff8c5..05aa5594a9 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -649,7 +649,7 @@ void cpu_loop(CPUSPARCState *env)
 
 static void usage(void)
 {
-    printf("qemu-" TARGET_NAME " version " QEMU_VERSION QEMU_PKGVERSION
+    printf("qemu-" TARGET_NAME " version " QEMU_FULL_VERSION
            "\n" QEMU_COPYRIGHT "\n"
            "usage: qemu-" TARGET_NAME " [options] program [arguments...]\n"
            "BSD CPU emulator (compiled for %s emulation)\n"
diff --git a/configure b/configure
index f74e1f3b7c..26d56eb5bb 100755
--- a/configure
+++ b/configure
@@ -1163,7 +1163,7 @@ for opt do
   ;;
   --disable-blobs) blobs="no"
   ;;
-  --with-pkgversion=*) pkgversion=" ($optarg)"
+  --with-pkgversion=*) pkgversion="$optarg"
   ;;
   --with-coroutine=*) coroutine="$optarg"
   ;;
diff --git a/linux-user/main.c b/linux-user/main.c
index 7bc9bc79b0..abbd14e208 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -4163,7 +4163,7 @@ static void handle_arg_strace(const char *arg)
 
 static void handle_arg_version(const char *arg)
 {
-    printf("qemu-" TARGET_NAME " version " QEMU_VERSION QEMU_PKGVERSION
+    printf("qemu-" TARGET_NAME " version " QEMU_FULL_VERSION
            "\n" QEMU_COPYRIGHT "\n");
     exit(EXIT_SUCCESS);
 }
diff --git a/qemu-img.c b/qemu-img.c
index 088d89043e..855fa52514 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -46,7 +46,7 @@
 #include "crypto/init.h"
 #include "trace/control.h"
 
-#define QEMU_IMG_VERSION "qemu-img version " QEMU_VERSION QEMU_PKGVERSION \
+#define QEMU_IMG_VERSION "qemu-img version " QEMU_FULL_VERSION \
                           "\n" QEMU_COPYRIGHT "\n"
 
 typedef struct img_cmd_t {
diff --git a/qemu-io.c b/qemu-io.c
index 160fb2a89f..e692c555e0 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -558,7 +558,7 @@ int main(int argc, char **argv)
             trace_file = trace_opt_parse(optarg);
             break;
         case 'V':
-            printf("%s version " QEMU_VERSION QEMU_PKGVERSION "\n"
+            printf("%s version " QEMU_FULL_VERSION "\n"
                    QEMU_COPYRIGHT "\n", progname);
             exit(0);
         case 'h':
diff --git a/qemu-nbd.c b/qemu-nbd.c
index ed5d9b5062..0af0560ad1 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -130,7 +130,7 @@ QEMU_HELP_BOTTOM "\n"
 static void version(const char *name)
 {
     printf(
-"%s " QEMU_VERSION QEMU_PKGVERSION "\n"
+"%s " QEMU_FULL_VERSION "\n"
 "Written by Anthony Liguori.\n"
 "\n"
 QEMU_COPYRIGHT "\n"
diff --git a/qga/main.c b/qga/main.c
index f9c83050c5..837a75a46a 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -218,7 +218,7 @@ static void usage(const char *cmd)
 {
     printf(
 "Usage: %s [-m <method> -p <path>] [<options>]\n"
-"QEMU Guest Agent " QEMU_VERSION QEMU_PKGVERSION "\n"
+"QEMU Guest Agent " QEMU_FULL_VERSION "\n"
 QEMU_COPYRIGHT "\n"
 "\n"
 "  -m, --method      transport method: one of unix-listen, virtio-serial,\n"
diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c
index 9fe615c73c..3facbba170 100644
--- a/scsi/qemu-pr-helper.c
+++ b/scsi/qemu-pr-helper.c
@@ -102,7 +102,7 @@ QEMU_HELP_BOTTOM "\n"
 static void version(const char *name)
 {
     printf(
-"%s " QEMU_VERSION QEMU_PKGVERSION "\n"
+"%s " QEMU_FULL_VERSION "\n"
 "Written by Paolo Bonzini.\n"
 "\n"
 QEMU_COPYRIGHT "\n"
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 18de0bb3ea..110b393e4e 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1330,7 +1330,7 @@ QemuCocoaView *cocoaView;
     /* Create the version string*/
     NSString *version_string;
     version_string = [[NSString alloc] initWithFormat:
-    @"QEMU emulator version %s%s", QEMU_VERSION, QEMU_PKGVERSION];
+    @"QEMU emulator version %s", QEMU_FULL_VERSION];
     [version_label setStringValue: version_string];
     [superView addSubview: version_label];
 
diff --git a/vl.c b/vl.c
index 26662eb9e7..e81152417a 100644
--- a/vl.c
+++ b/vl.c
@@ -1948,7 +1948,7 @@ static void main_loop(void)
 
 static void version(void)
 {
-    printf("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION "\n"
+    printf("QEMU emulator version " QEMU_FULL_VERSION "\n"
            QEMU_COPYRIGHT "\n");
 }
 
-- 
2.14.3

  parent reply	other threads:[~2018-03-13 22:47 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-13 22:46 [Qemu-devel] [PULL 00/69] Misc patches for QEMU soft freeze Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 01/69] qom: introduce object_class_get_list_sorted Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 02/69] net: allow using any PCI NICs in -net or -nic Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 03/69] q35: change default NIC to e1000e Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 04/69] scsi-disk.c: consider bl->max_transfer in INQUIRY emulation Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 05/69] qemu-doc: update deprecation section to use -nic and -netdev hubport Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 06/69] qemu-doc: Add the paragraph about the -no-frame deprecation again Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 07/69] build-sys: make help could have 'modules' target Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 08/69] hw: Do not include "sysemu/block-backend.h" if it is not necessary Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 09/69] checkpatch: Exempt long URLs Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 10/69] vl: export machine_init_done Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 11/69] chardev: fix handling of EAGAIN for TCP chardev Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 12/69] chardev: update net listener gcontext Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 13/69] chardev: allow telnet gsource to switch gcontext Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 14/69] chardev: introduce chr_machine_done hook Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 15/69] chardev: use chardev's gcontext for async connect Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 16/69] chardev: tcp: postpone async connection setup Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 17/69] chardev: tcp: let TLS run on chardev context Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 18/69] scsi: support NDOB (no data-out buffer) for WRITE SAME commands Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 19/69] hw/i386: make IOMMUs configurable via default-configs/ Paolo Bonzini
2018-03-13 22:46 ` Paolo Bonzini [this message]
2018-03-13 22:46 ` [Qemu-devel] [PULL 21/69] hw/mips/jazz: Fix implicit creation of "-drive if=scsi" devices Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 22/69] rcutorture: remove synchronize_rcu from readers Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 23/69] docs: document atomic_load_acquire and atomic_store_release Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 24/69] rcu: make memory barriers more explicit Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 25/69] membarrier: introduce qemu/sys_membarrier.h Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 26/69] membarrier: add --enable-membarrier Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 27/69] hw/isa: Move parallel_hds_isa_init() to hw/char/parallel-isa.c Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 28/69] hw/dma/i8257: Rename DMA_init() to i8257_dma_init() Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 29/69] hw/input/i8042: Extract declarations from i386/pc.h into input/i8042.h Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 30/69] MAINTAINERS: Fix the PC87312 include path Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 31/69] hw/isa/pc87312: Rename the device type as TYPE_PC87312_SUPERIO Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 32/69] hw/isa/pc87312: Use uint16_t for the ISA I/O base address Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 33/69] hw/isa/pc87312: Use 'unsigned int' for the irq value Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 34/69] hw/isa/superio: Add a Super I/O template based on the PC87312 device Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 35/69] hw/isa/pc87312: Inherit from the abstract TYPE_ISA_SUPERIO Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 36/69] hw/isa/superio: Factor out the parallel code from pc87312.c Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 37/69] hw/isa/superio: Factor out the serial " Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 38/69] hw/isa/superio: Factor out the floppy disc controller " Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 39/69] hw/isa/superio: Add a keyboard/mouse controller (8042) Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 40/69] hw/isa/superio: Factor out the IDE code from pc87312.c Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 41/69] hw/mips/malta: Code movement Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 42/69] hw/isa/superio: Factor out the FDC37M817 Super I/O from mips_malta.c Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 43/69] hw/mips/mips_fulong2e: Factor out vt82c686b_southbridge_init() Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 44/69] hw/isa/vt82c686: Rename vt82c686b_init() -> vt82c686b_isa_init() Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 45/69] hw/isa/vt82c686: Add the TYPE_VT82C686B_SUPERIO Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 46/69] MAINTAINERS: Add entries for the VT82C686B Super I/O Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 47/69] MAINTAINERS: Split the Alpha TCG/machine section Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 48/69] hw/isa/superio: Add the SMC FDC37C669 Super I/O Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 49/69] hw/alpha/dp264: Add the ISA DMA controller Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 50/69] hw/alpha/dp264: Use the TYPE_SMC37C669_SUPERIO Paolo Bonzini
2018-06-01 18:51   ` Emilio G. Cota
2018-06-01 19:49     ` Richard Henderson
2018-06-13 16:21     ` Paolo Bonzini
2018-06-13 16:35       ` Philippe Mathieu-Daudé
2018-06-13 17:17         ` Philippe Mathieu-Daudé
2018-06-14 12:21           ` Philippe Mathieu-Daudé
2018-03-13 22:47 ` [Qemu-devel] [PULL 51/69] hw/i386/pc: Factor out the superio code Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 52/69] cpu-exec: fix exception_index handling Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 53/69] replay: fix processing async events Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 54/69] replay: fixed replay_enable_events Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 55/69] replay: fix save/load vm for non-empty queue Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 56/69] replay: added replay log format description Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 57/69] replay: save prior value of the host clock Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 58/69] replay/replay.c: bump REPLAY_VERSION again Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 59/69] replay/replay-internal.c: track holding of replay_lock Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 60/69] replay: make locking visible outside replay code Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 61/69] replay: don't destroy mutex at exit Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 62/69] replay: push replay_mutex_lock up the call tree Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 63/69] replay: check return values of fwrite Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 64/69] replay: avoid recursive call of checkpoints Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 65/69] scripts/replay-dump.py: replay log dumper Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 66/69] replay: don't process async events when warping the clock Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 67/69] replay: save vmstate of the asynchronous events Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 68/69] replay: update documentation Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 69/69] tcg: fix cpu_io_recompile Paolo Bonzini
2018-03-14  0:15 ` [Qemu-devel] [PULL 00/69] Misc patches for QEMU soft freeze no-reply
2018-03-14  3:35   ` Peter Xu
2018-03-14 10:12     ` Paolo Bonzini
2018-03-14 11:30       ` Eric Blake
2018-03-14 11:36         ` Peter Xu
2018-03-14 11:53         ` Paolo Bonzini
2018-03-16 12:58 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180313224719.4954-21-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.