]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
352395 - Please provide SVN revision info in --version -v
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 29 Nov 2016 22:32:27 +0000 (22:32 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 29 Nov 2016 22:32:27 +0000 (22:32 +0000)
Finally committed ... :)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16164

Makefile.am
NEWS
auxprogs/Makefile.am
auxprogs/make_or_upd_vgversion_h [new file with mode: 0755]
coregrind/m_main.c

index c43b57045270794af679481ec6c559fc1af61acb..335d4d67b56e388ae26b585bdb7bb4f2745abc58 100644 (file)
@@ -62,7 +62,7 @@ vglib_DATA = default.supp
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = valgrind.pc
 
-BUILT_SOURCES  = default.supp valgrind.pc
+BUILT_SOURCES  = default.supp vgversion.h valgrind.pc
 CLEANFILES     = default.supp
 
 default.supp: $(DEFAULT_SUPP_FILES)
@@ -116,10 +116,13 @@ EXTRA_DIST = \
        valgrind.spec \
        autogen.sh
 
+dist-hook: vgversion.h
+       cp -p include/vgversion.h $(distdir)/include/vgversion.h
+
 dist_noinst_SCRIPTS = \
        vg-in-place
 
-all-local: default.supp
+all-local: default.supp vgversion.h
        mkdir -p $(inplacedir)
        rm -f $(inplacedir)/default.supp
        ln -s ../default.supp $(inplacedir)
@@ -129,3 +132,7 @@ clean-local:
 
 # Need config.h in the installed tree, since some files depend on it
 pkginclude_HEADERS = config.h
+
+# vgversion.h defines accurate versions to report with -v --version
+vgversion.h:
+       auxprogs/make_or_upd_vgversion_h
diff --git a/NEWS b/NEWS
index 9531e8d8c52bd483809ff0c5b39fa23e4c7c807e..a991bf91169e346651b40a7eacb1e975369b1bf2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -72,6 +72,7 @@ To see details of a given bug, visit
 where XXXXXX is the bug number as listed below.
 
 348616  Wine/valgrind: noted but unhandled ioctl 0x5390 [..] (DVD_READ_STRUCT)
+352395  Please provide SVN revision info in --version -v
 352767  Wine/valgrind: noted but unhandled ioctl 0x5307 [..] (CDROMSTOP)
 371412  Rename wrap_sys_shmat to sys_shmat like other wrappers
 371869  support '%' in symbol Z-encoding
@@ -81,7 +82,6 @@ where XXXXXX is the bug number as listed below.
 372600  process loops forever when fatal signals are arriving quickly
 373046  Stacks registered by core are never deregistered
 
-
 Release 3.12.0 (20 October 2016)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
index f5654c169210423851f5cd314509933040028761..c13f07a8e848daa82e25efc10c26f6fb213a7a4f 100644 (file)
@@ -6,6 +6,7 @@ dist_noinst_SCRIPTS = \
        gen-mdg \
        gsl16test \
        gsl19test \
+       make_or_upd_vgversion_h \
        nightly-build-summary \
        update-demangler \
        posixtestsuite-1.5.1-diff-results
diff --git a/auxprogs/make_or_upd_vgversion_h b/auxprogs/make_or_upd_vgversion_h
new file mode 100755 (executable)
index 0000000..2059f0e
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+extract_svn_version()
+{
+    if [ -d "$1"/.svn ]
+    then
+        svnversion -n "$1"
+    elif [ -d "$1"/.git/svn ]
+    then
+        cd "$1" || exit 1
+        git svn info . | grep '^Revision' | cut -d ' ' -f2 | tr -d '\n'
+    else
+        echo "unknown"
+    fi    
+}
+
+cat > include/vgversion.h.tmp <<EOF
+/* Do not edit: file generated by auxprogs/make_or_upd_vgversion_h.
+   This file defines VGSVN and VEXSVN, used to report SVN revision
+   when using command line options:  -v --version 
+*/
+#define VGSVN "$(extract_svn_version .)"
+#define VEXSVN "$(extract_svn_version VEX)"
+EOF
+
+if [ -f include/vgversion.h ]
+then
+    # There is already a vgversion.h.
+    # Update it only if we found a different and real svn version
+    if grep unknown include/vgversion.h.tmp ||
+       cmp -s include/vgversion.h include/vgversion.h.tmp
+    then
+        rm include/vgversion.h.tmp
+    else
+        mv include/vgversion.h.tmp include/vgversion.h
+    fi
+else
+    # There is no vgversion.h. Use the one just generated, whatever it is.
+    mv include/vgversion.h.tmp include/vgversion.h
+fi
index daa08d691ade8bd9950ad4534c4af087cae8fea6..66e9c4a8699de6b1e7838962b26410e7fa1b876e 100644 (file)
@@ -28,6 +28,7 @@
    The GNU General Public License is contained in the file COPYING.
 */
 
+#include "vgversion.h"
 #include "pub_core_basics.h"
 #include "pub_core_vki.h"
 #include "pub_core_vkiscnums.h"
@@ -378,6 +379,7 @@ static void early_process_cmd_line_options ( /*OUT*/Int* need_help,
 {
    UInt   i;
    HChar* str;
+   Int need_version = 0;
 
    vg_assert( VG_(args_for_valgrind) );
 
@@ -387,12 +389,13 @@ static void early_process_cmd_line_options ( /*OUT*/Int* need_help,
       str = * (HChar**) VG_(indexXA)( VG_(args_for_valgrind), i );
       vg_assert(str);
 
-      // Nb: the version string goes to stdout.
-      if VG_XACT_CLO(str, "--version", VG_(log_output_sink).fd, 1) {
-         VG_(log_output_sink).is_socket = False;
-         VG_(printf)("valgrind-" VERSION "\n");
-         VG_(exit)(0);
-      }
+      if VG_XACT_CLO(str, "--version", need_version, 1) {}
+      else if (VG_STREQ(str, "-v") ||
+               VG_STREQ(str, "--verbose"))
+         VG_(clo_verbosity)++;
+      else if (VG_STREQ(str, "-q") ||
+               VG_STREQ(str, "--quiet"))
+         VG_(clo_verbosity)--;
       else if VG_XACT_CLO(str, "--help", *need_help, *need_help+1) {}
       else if VG_XACT_CLO(str, "-h",     *need_help, *need_help+1) {}
 
@@ -421,6 +424,17 @@ static void early_process_cmd_line_options ( /*OUT*/Int* need_help,
                             VG_(clo_sim_hints)) {}
    }
 
+   if (need_version) {
+      // Nb: the version string goes to stdout.
+      VG_(log_output_sink).fd = 1;
+      VG_(log_output_sink).is_socket = False;
+      if (VG_(clo_verbosity) <= 1)
+         VG_(printf)("valgrind-" VERSION "\n");
+      else
+         VG_(printf)("valgrind-" VERSION "-" VGSVN "-vex-" VEXSVN "\n");
+      VG_(exit)(0);
+   }
+
    /* For convenience */
    VG_N_THREADS = VG_(clo_max_threads);
 }
@@ -557,6 +571,10 @@ void main_process_cmd_line_options ( /*OUT*/Bool* logging_to_fd,
       else if VG_STREQN(20, arg, "--command-line-only=") {}
       else if VG_STREQ(     arg, "--")                   {}
       else if VG_STREQ(     arg, "-d")                   {}
+      else if VG_STREQ(     arg, "-q")                   {}
+      else if VG_STREQ(     arg, "--quiet")              {}
+      else if VG_STREQ(     arg, "-v")                   {}
+      else if VG_STREQ(     arg, "--verbose")            {}
       else if VG_STREQN(17, arg, "--max-stackframe=")    {}
       else if VG_STREQN(17, arg, "--main-stacksize=")    {}
       else if VG_STREQN(14, arg, "--max-threads=")       {}
@@ -587,15 +605,8 @@ void main_process_cmd_line_options ( /*OUT*/Bool* logging_to_fd,
              " (or --vex-iropt-register-updates=allregs-at-each-insn)\n");
       }
 
-      // These options are new.
-      else if (VG_STREQ(arg, "-v") ||
-               VG_STREQ(arg, "--verbose"))
-         VG_(clo_verbosity)++;
-
-      else if (VG_STREQ(arg, "-q") ||
-               VG_STREQ(arg, "--quiet"))
-         VG_(clo_verbosity)--;
-
+      /* These options are new, not yet handled by
+         early_process_cmd_line_options. */
       else if VG_BOOL_CLO(arg, "--sigill-diagnostics", VG_(clo_sigill_diag))
          sigill_diag_set = True;