]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
replace SNAPSHOT with auto-generated version string
authorStephen Hemminger <stephen@networkplumber.org>
Sat, 1 Aug 2020 17:26:41 +0000 (10:26 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 3 Aug 2020 17:02:47 +0000 (10:02 -0700)
Replace the iproute2 snapshot with a version string which is
autogenerated as part of the build process using git describe.

This will also allow seeing if the version of the command
is built from the same sources is as upstream.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
14 files changed:
Makefile
bridge/bridge.c
devlink/devlink.c
genl/genl.c
include/SNAPSHOT.h [deleted file]
include/version.h [new file with mode: 0644]
ip/ip.c
ip/rtmon.c
misc/ifstat.c
misc/nstat.c
misc/rtacct.c
misc/ss.c
rdma/rdma.c
tc/tc.c

index 25d05fac952a15ef7d6217ff9def8795b7b02c23..cadda235863df39f829b4109f48486bb5356a72e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -65,6 +65,8 @@ all: config.mk
        for i in $(SUBDIRS); \
        do echo; echo $$i; $(MAKE) $(MFLAGS) -C $$i; done
 
+.PHONY: clean clobber distclean check cscope version
+
 help:
        @echo "Make Targets:"
        @echo " all                 - build binaries"
@@ -73,7 +75,7 @@ help:
        @echo " install             - install binaries on local machine"
        @echo " check               - run tests"
        @echo " cscope              - build cscope database"
-       @echo " snapshot            - generate version number header"
+       @echo " version             - update version"
        @echo ""
        @echo "Make Arguments:"
        @echo " V=[0|1]             - set build verbosity level"
@@ -93,9 +95,9 @@ install: all
        install -m 0644 bash-completion/devlink $(DESTDIR)$(BASH_COMPDIR)
        install -m 0644 include/bpf_elf.h $(DESTDIR)$(HDRDIR)
 
-snapshot:
-       echo "static const char SNAPSHOT[] = \""`date +%y%m%d`"\";" \
-               > include/SNAPSHOT.h
+version:
+       echo "static const char version[] = \""`git describe --tags --long`"\";" \
+               > include/version.h
 
 clean:
        @for i in $(SUBDIRS) testsuite; \
index a50d9d59b4c5a452bf2356f0419e4eee847c0946..453d689732bd5d1715f95d2b919fc3365cb7e9d8 100644 (file)
@@ -12,7 +12,7 @@
 #include <string.h>
 #include <errno.h>
 
-#include "SNAPSHOT.h"
+#include "version.h"
 #include "utils.h"
 #include "br_common.h"
 #include "namespace.h"
index 7f83fb746fd694c56dc46f7ad5d20789e5c47356..0982faef7d88eef07e1d2ff79035a492d62d7662 100644 (file)
@@ -34,7 +34,7 @@
 #include <sys/socket.h>
 #include <sys/types.h>
 
-#include "SNAPSHOT.h"
+#include "version.h"
 #include "list.h"
 #include "mnlg.h"
 #include "json_print.h"
@@ -7606,7 +7606,7 @@ int main(int argc, char **argv)
 
                switch (opt) {
                case 'V':
-                       printf("devlink utility, iproute2-ss%s\n", SNAPSHOT);
+                       printf("devlink utility, iproute2-%s\n", version);
                        ret = EXIT_SUCCESS;
                        goto dl_free;
                case 'f':
index aba3c13afd3496a8c583c7888c370a7b3072e1b2..6557e6bc6ce6562665ea2d9b903c4ea58ecef7ec 100644 (file)
@@ -22,7 +22,7 @@
 #include <errno.h>
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h> /* until we put our own header */
-#include "SNAPSHOT.h"
+#include "version.h"
 #include "utils.h"
 #include "genl_utils.h"
 
@@ -118,7 +118,7 @@ int main(int argc, char **argv)
                } else if (matches(argv[1], "-raw") == 0) {
                        ++show_raw;
                } else if (matches(argv[1], "-Version") == 0) {
-                       printf("genl utility, iproute2-ss%s\n", SNAPSHOT);
+                       printf("genl utility, iproute2-%s\n", version);
                        exit(0);
                } else if (matches(argv[1], "-help") == 0) {
                        usage();
diff --git a/include/SNAPSHOT.h b/include/SNAPSHOT.h
deleted file mode 100644 (file)
index 0d21178..0000000
+++ /dev/null
@@ -1 +0,0 @@
-static const char SNAPSHOT[] = "200602";
diff --git a/include/version.h b/include/version.h
new file mode 100644 (file)
index 0000000..7b7bde3
--- /dev/null
@@ -0,0 +1 @@
+static const char version[] = "v5.7.0-77-gb687d1067169";
diff --git a/ip/ip.c b/ip/ip.c
index 4249df0377f9e20a0cb329d750ac81d4ef337e6a..ac44502353702b522ae8394b7cb67deab0192c3e 100644 (file)
--- a/ip/ip.c
+++ b/ip/ip.c
@@ -18,7 +18,7 @@
 #include <string.h>
 #include <errno.h>
 
-#include "SNAPSHOT.h"
+#include "version.h"
 #include "utils.h"
 #include "ip_common.h"
 #include "namespace.h"
@@ -255,7 +255,7 @@ int main(int argc, char **argv)
                        ++timestamp;
                        ++timestamp_short;
                } else if (matches(opt, "-Version") == 0) {
-                       printf("ip utility, iproute2-ss%s\n", SNAPSHOT);
+                       printf("ip utility, iproute2-%s\n", version);
                        exit(0);
                } else if (matches(opt, "-force") == 0) {
                        ++force;
index bccddedddd17dd68932a42d011ba2d28895432f3..01c19c80a30a60c20b69b4380c9fc4ebd8ef8d87 100644 (file)
@@ -19,7 +19,7 @@
 #include <netinet/in.h>
 #include <string.h>
 
-#include "SNAPSHOT.h"
+#include "version.h"
 
 #include "utils.h"
 #include "libnetlink.h"
@@ -107,7 +107,7 @@ main(int argc, char **argv)
                } else if (strcmp(argv[1], "-0") == 0) {
                        family = AF_PACKET;
                } else if (matches(argv[1], "-Version") == 0) {
-                       printf("rtmon utility, iproute2-ss%s\n", SNAPSHOT);
+                       printf("rtmon utility, iproute2-%s\n", version);
                        exit(0);
                } else if (matches(argv[1], "file") == 0) {
                        argc--;
index 03327af83ae8e6619545d5610962ad605d12b7f8..c05183d79a13aedaf17812aad46085b8dcd257a1 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "libnetlink.h"
 #include "json_writer.h"
-#include "SNAPSHOT.h"
+#include "version.h"
 #include "utils.h"
 
 int dump_zeros;
@@ -869,7 +869,7 @@ int main(int argc, char *argv[])
                        break;
                case 'v':
                case 'V':
-                       printf("ifstat utility, iproute2-ss%s\n", SNAPSHOT);
+                       printf("ifstat utility, iproute2-%s\n", version);
                        exit(0);
                case 'h':
                case '?':
index 88f52eaf8c8c266bc61f3b6ee5302c26951fd59e..6fdd316cce849d48e14d2f8c44e9a538ee193ef9 100644 (file)
@@ -29,7 +29,7 @@
 #include <getopt.h>
 
 #include <json_writer.h>
-#include <SNAPSHOT.h>
+#include "version.h"
 #include "utils.h"
 
 int dump_zeros;
@@ -621,7 +621,7 @@ int main(int argc, char *argv[])
                        break;
                case 'v':
                case 'V':
-                       printf("nstat utility, iproute2-ss%s\n", SNAPSHOT);
+                       printf("nstat utility, iproute2-%s\n", version);
                        exit(0);
                case 'h':
                case '?':
index c4bb5bc3888cb46325c9490a183da344a94351ed..47b27e3fd88d901ea6ccd2116348da8d9c8256a1 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "rt_names.h"
 
-#include <SNAPSHOT.h>
+#include "version.h"
 
 int reset_history;
 int ignore_history;
@@ -463,7 +463,7 @@ int main(int argc, char *argv[])
                        break;
                case 'v':
                case 'V':
-                       printf("rtacct utility, iproute2-ss%s\n", SNAPSHOT);
+                       printf("rtacct utility, iproute2-%s\n", version);
                        exit(0);
                case 'M':
                        /* Some secret undocumented option, nobody
index 5aa10e4a715fd3995c54ac435a660df20b09227e..35066bf641970c8c0254804f15ff072df899ae1c 100644 (file)
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -35,7 +35,7 @@
 #include "ll_map.h"
 #include "libnetlink.h"
 #include "namespace.h"
-#include "SNAPSHOT.h"
+#include "version.h"
 #include "rt_names.h"
 #include "cg_map.h"
 
@@ -5411,7 +5411,7 @@ int main(int argc, char *argv[])
                        break;
                case 'v':
                case 'V':
-                       printf("ss utility, iproute2-ss%s\n", SNAPSHOT);
+                       printf("ss utility, iproute2-%s\n", version);
                        exit(0);
                case 'z':
                        show_sock_ctx++;
index 22050555735dea309738e5f0bfebcae8200cd6c2..d1957465afa2818de67986b9cb85a9b8af5895b3 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #include "rdma.h"
-#include "SNAPSHOT.h"
+#include "version.h"
 #include "color.h"
 
 static void help(char *name)
@@ -131,8 +131,8 @@ int main(int argc, char **argv)
                                  long_options, NULL)) >= 0) {
                switch (opt) {
                case 'V':
-                       printf("%s utility, iproute2-ss%s\n",
-                              filename, SNAPSHOT);
+                       printf("%s utility, iproute2-%s\n",
+                              filename, version);
                        return EXIT_SUCCESS;
                case 'p':
                        pretty = 1;
diff --git a/tc/tc.c b/tc/tc.c
index b72657ec2e60c8430d850c187b0ef6dcc6d7a268..5d57054b45fbcabae538fb4ceab2ccdfa3139849 100644 (file)
--- a/tc/tc.c
+++ b/tc/tc.c
@@ -24,7 +24,7 @@
 #include <string.h>
 #include <errno.h>
 
-#include "SNAPSHOT.h"
+#include "version.h"
 #include "utils.h"
 #include "tc_util.h"
 #include "tc_common.h"
@@ -299,7 +299,7 @@ int main(int argc, char **argv)
                } else if (matches(argv[1], "-graph") == 0) {
                        show_graph = 1;
                } else if (matches(argv[1], "-Version") == 0) {
-                       printf("tc utility, iproute2-ss%s\n", SNAPSHOT);
+                       printf("tc utility, iproute2-%s\n", version);
                        return 0;
                } else if (matches(argv[1], "-iec") == 0) {
                        ++use_iec;