From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: [B.A.T.M.A.N.] [PATCH] batctl: Replace version info instead of appending them
Date: Tue, 5 Jul 2011 10:54:59 +0200 [thread overview]
Message-ID: <1309856099-10122-1-git-send-email-sven@narfation.org> (raw)
In-Reply-To: <1309855371-9389-1-git-send-email-sven@narfation.org>
The version number of batctl can get revision numbers added. This is useful to
give hints about the revision of a distribution package and the used patchset
or the commit which was used to build it. The prepended source number or branch
name doesn't add any additional information which would help to identify
problems and can therefore be omitted.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
Makefile | 9 ++++++---
main.c | 2 +-
main.h | 6 +++---
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index eee5a63..85efc30 100755
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,6 @@ MANPAGE = man/batctl.8
# batctl flags and options
CFLAGS += -pedantic -Wall -W -std=gnu99 -fno-strict-aliasing -MD
-CPPFLAGS += -DREVISION_VERSION=$(REVISION_VERSION)
LDLIBS += -lm
# disable verbose output
@@ -52,8 +51,12 @@ SBINDIR = $(PREFIX)/sbin
MANDIR = $(PREFIX)/share/man
# try to generate revision
-REVISION = $(shell if [ -d .git ]; then echo $$(git describe --always --dirty 2> /dev/null || echo "[unknown]"); fi)
-REVISION_VERSION =\"\ $(REVISION)\"
+REVISION= $(shell if [ -d .git ]; then \
+ echo $$(git describe --always --dirty --match "v*" |sed 's/^v//' 2> /dev/null || echo "[unknown]"); \
+ fi)
+ifneq ($(REVISION),)
+CPPFLAGS += -DSOURCE_VERSION=\"$(REVISION)\"
+endif
# default target
all: $(BINARY_NAME)
diff --git a/main.c b/main.c
index eb67737..e0cccbd 100644
--- a/main.c
+++ b/main.c
@@ -95,7 +95,7 @@ int main(int argc, char **argv)
goto err;
if (strcmp(argv[1], "-v") == 0) {
- printf("batctl %s%s\n", SOURCE_VERSION, (strlen(REVISION_VERSION) > 3 ? REVISION_VERSION : ""));
+ printf("batctl %s\n", SOURCE_VERSION);
exit(EXIT_SUCCESS);
}
diff --git a/main.h b/main.h
index a9102b1..dd6428b 100644
--- a/main.h
+++ b/main.h
@@ -19,9 +19,9 @@
*
*/
-
-
-#define SOURCE_VERSION "next"
+#ifndef SOURCE_VERSION
+#define SOURCE_VERSION "2011.2.0"
+#endif
#define SOCKET_PATH_FMT "%s/batman_adv/%s/socket"
--
1.7.5.4
next prev parent reply other threads:[~2011-07-05 8:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-05 8:42 [B.A.T.M.A.N.] [PATCH] batman-adv: Replace version info instead of appending them Sven Eckelmann
2011-07-05 8:54 ` Sven Eckelmann [this message]
2011-07-05 11:20 ` [B.A.T.M.A.N.] [PATCH] batctl: " Marek Lindner
2011-07-05 11:18 ` [B.A.T.M.A.N.] [PATCH] batman-adv: " Marek Lindner
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=1309856099-10122-1-git-send-email-sven@narfation.org \
--to=sven@narfation.org \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox