]> sourceware.org Git - systemtap.git/commitdiff
Don't report non-git if we have an extra-version
authorJosh Stone <jistone@redhat.com>
Mon, 13 Aug 2012 22:45:23 +0000 (15:45 -0700)
committerJosh Stone <jistone@redhat.com>
Mon, 13 Aug 2012 22:45:23 +0000 (15:45 -0700)
When we're not building from git, but we do have --with-extra-version,
just let that suffice in our version strings.  But when we do have a git
repo, still print the fullest information possible.

* version.h: Define STAP_EXTENDED_VERSION with this scheme.
* session.cxx, stapdyn/stapdyn.cxx, staprun/common.c: Use it.

session.cxx
stapdyn/stapdyn.cxx
staprun/common.c
version.h [new file with mode: 0644]

index f6d4464fb6d99f7f05340dd8c2fdc2b2ae9287c5..98a77be2cb17da46d90636223a7516fd49ac0776 100644 (file)
@@ -20,6 +20,7 @@
 #include "util.h"
 #include "cmdline.h"
 #include "git_version.h"
+#include "version.h"
 
 #include <cerrno>
 #include <cstdlib>
@@ -397,12 +398,10 @@ systemtap_session::clone(const string& arch, const string& release)
 void
 systemtap_session::version ()
 {
-  clog << _F("Systemtap translator/driver (version %s/%s %s%s%s)\n"
+  clog << _F("Systemtap translator/driver (version %s/%s%s)\n"
              "Copyright (C) 2005-2012 Red Hat, Inc. and others\n"
              "This is free software; see the source for copying conditions.",
-             VERSION, dwfl_version(NULL), GIT_MESSAGE,
-             (STAP_EXTRA_VERSION[0]?", ":""),
-             (STAP_EXTRA_VERSION[0]?STAP_EXTRA_VERSION:"")) << endl;
+             VERSION, dwfl_version(NULL), STAP_EXTENDED_VERSION) << endl;
   clog << _("enabled features:")
 #ifdef HAVE_AVAHI
        << " AVAHI"
index f3b69e6b20bed1f8eb83b5cbf6c3e1c7bea1cd52..89371b76e2551cffa0b24026d8dc80307a4aa32d 100644 (file)
@@ -20,6 +20,7 @@ extern "C" {
 
 #include "config.h"
 #include "../git_version.h"
+#include "../version.h"
 
 #include "dynutil.h"
 
@@ -202,12 +203,10 @@ main(int argc, char * const argv[])
           break;
 
         case 'V':
-          fprintf(stderr, "Systemtap Dyninst loader/runner (version %s/%s %s%s%s)\n"
+          fprintf(stderr, "Systemtap Dyninst loader/runner (version %s/%s%s)\n"
                           "Copyright (C) 2012 Red Hat, Inc. and others\n"
                           "This is free software; see the source for copying conditions.\n",
-                  VERSION, DYNINST_FULL_VERSION, GIT_MESSAGE,
-                  (STAP_EXTRA_VERSION[0]?", ":""),
-                  (STAP_EXTRA_VERSION[0]?STAP_EXTRA_VERSION:""));
+                  VERSION, DYNINST_FULL_VERSION, STAP_EXTENDED_VERSION);
           return 0;
 
         default:
index f2fe88a39467f23672290d8b2b7411b06900a507..ba59c884843f3784d5e7e26409e45a68159de76c 100644 (file)
@@ -17,6 +17,7 @@
 #include <assert.h>
 #include <string.h>
 #include "../git_version.h"
+#include "../version.h"
 
 /* variables needed by parse_args() */
 int verbose;
@@ -200,12 +201,10 @@ void parse_args(int argc, char **argv)
                         }
                        break;
                case 'V':
-                        err(_("Systemtap module loader/runner (version %s %s%s%s)\n"
+                        err(_("Systemtap module loader/runner (version %s%s)\n"
                               "Copyright (C) 2005-2012 Red Hat, Inc. and others\n"
                               "This is free software; see the source for copying conditions.\n"),
-                            VERSION, GIT_MESSAGE, 
-                            (STAP_EXTRA_VERSION[0]?", ":""),
-                            (STAP_EXTRA_VERSION[0]?STAP_EXTRA_VERSION:""));
+                            VERSION, STAP_EXTENDED_VERSION);
                         _exit(1);
                         break;
                 case 'T':
diff --git a/version.h b/version.h
new file mode 100644 (file)
index 0000000..7db3b6e
--- /dev/null
+++ b/version.h
@@ -0,0 +1,16 @@
+#ifndef VERSION_H
+#define VERSION_H
+
+/* If we're building from a git repo, always include that commit information.
+ * Otherwise, only bother using the "non-git sources" if not configured with a
+ * nice --with-extra-version.
+ */
+#ifdef GIT_REPO
+#define STAP_EXTENDED_VERSION \
+  (STAP_EXTRA_VERSION[0] ? GIT_MESSAGE ", " STAP_EXTRA_VERSION : GIT_MESSAGE)
+#else
+#define STAP_EXTENDED_VERSION \
+  (STAP_EXTRA_VERSION[0] ? STAP_EXTRA_VERSION : GIT_MESSAGE)
+#endif
+
+#endif /* VERSION_H */
This page took 0.037746 seconds and 5 git commands to generate.