Skip to contentSkip to conversation

iproute2 DDMMYY versioning - why?

RFC New Or Gerlitz 3 participants 6 messages Jul 28, 2020 – Aug 1, 2020

Subsystems (3)
lore
Share & tools
lore

Or Gerlitz

author
#0 lore raw

Stephen,

Taking into account that iproute releases are aligned with the kernel ones -- is there any real reason for the confusing DDMMYY double versioning?

I see that even the git tags go after the kernel releases..

Or.

# git remote -v
origin  git://git.kernel.org/pub/scm/network/iproute2/iproute2.git (fetch)
origin  git://git.kernel.org/pub/scm/network/iproute2/iproute2.git (push)
$ git log -p include/SNAPSHOT.h

commit 1bfa3b3f66ef48bdabe0eb2a7c14e69f481dfa25 (tag: v5.7.0)

Author: Stephen Hemminger <[email protected]>
Date:   Tue Jun 2 20:35:00 2020 -0700
    v5.7.0
include/SNAPSHOT.h +1 -1
index 0d10a9c2..0d211784 100644
@@ -1 +1 @@
-static const char SNAPSHOT[] = "200330";
+static const char SNAPSHOT[] = "200602";

commit 29981db0e051cd4c53920c89dddcf3d883343a0f (tag: v5.6.0)

Author: Stephen Hemminger <[email protected]>
Date:   Mon Mar 30 08:06:08 2020 -0700
    v5.6.0
include/SNAPSHOT.h +1 -1
index c0fa1bb4..0d10a9c2 100644
@@ -1 +1 @@
-static const char SNAPSHOT[] = "200127";
+static const char SNAPSHOT[] = "200330";

commit d4df55404aec707bd55c9264c666ddb1bb05d7f1 (tag: v5.5.0)

Author: Stephen Hemminger <[email protected]>
Date:   Mon Jan 27 05:53:09 2020 -0800
    v5.5.0
include/SNAPSHOT.h +1 -1
index b98ad502..c0fa1bb4 100644
@@ -1 +1 @@
-static const char SNAPSHOT[] = "191125";
+static const char SNAPSHOT[] = "200127";

etc

maintainer
#1 lore raw
Quoted 7 lines · On Tue, 28 Jul 2020 16:05:50 +0300 Or Gerlitz wrote:

Stephen,

Taking into account that iproute releases are aligned with the kernel ones -- is there any real reason for the confusing DDMMYY double versioning?

I see that even the git tags go after the kernel releases..

+1

#2 lore raw
In reply to Or Gerlitz
Quoted 10 lines · On Tue, 28 Jul 2020 16:05:50 +0300 Or Gerlitz <[email protected]> wrote:

Stephen,

Taking into account that iproute releases are aligned with the kernel ones -- is there any real reason for the confusing DDMMYY double versioning?

I see that even the git tags go after the kernel releases..

Or.

It is only an historical leftover, because 15 yrs ago that is how Alexy did it

author
#3 lore raw
Quoted 1 line · Stephen Hemminger

It is only an historical leftover, because 15 yrs ago that is how Alexy did it

So how about putting behind the burden created by this historical leftover and moving to use the kernel releases as the emitted version?

Or.

#4 lore raw
Quoted 7 lines · On Fri, 31 Jul 2020 16:23:06 +0300 Or Gerlitz <[email protected]> wrote:
Quoted 1 line · Stephen Hemminger

It is only an historical leftover, because 15 yrs ago that is how Alexy did it

So how about putting behind the burden created by this historical leftover and moving to use the kernel releases as the emitted version?

The only downside to kernel versioning is the distros will think "can't use v5.10 because our kernel is still v4.3" and then want LTS versions of iproute2 which would create significant resource efforts.

Open to changing to kernel versions, it would be trivial to do. The tagging and releases are by kernel version.
The SNAPSHOT.h is autogenerated by a script, that can be changed.

#5 lore raw

RFC 1/1 replace SNAPSHOT with auto-generated version

In reply to Or Gerlitz

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.

---
One additional tweak needed will be to put Version.h in the tarball for building outside of git.

 .gitignore        |  1 +
 Makefile          | 10 +++++-----
 bridge/bridge.c   |  2 +-
 devlink/devlink.c |  4 ++--
 genl/genl.c       |  4 ++--
 ip/ip.c           |  4 ++--
 ip/rtmon.c        |  4 ++--
 misc/ifstat.c     |  4 ++--
 misc/nstat.c      |  4 ++--
 misc/rtacct.c     |  4 ++--
 misc/ss.c         |  4 ++--
 rdma/rdma.c       |  6 +++---
 tc/tc.c           |  4 ++--
 13 files changed, 28 insertions(+), 27 deletions(-)
.gitignore +1 -0
index e5234a3dc948..8c553394453a 100644
@@ -2,6 +2,7 @@
 Config
 static-syms.h
 config.*
+include/Version.h
 *.o
 *.a
 *.so
Makefile +5 -5
index 25d05fac952a..61056cf6d7b2 100644
@@ -60,7 +60,7 @@ SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma man
 LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
 LDLIBS += $(LIBNETLINK)
 
-all: config.mk
+all: config.mk include/Version.h
 	@set -e; \
 	for i in $(SUBDIRS); \
 	do echo; echo $$i; $(MAKE) $(MFLAGS) -C $$i; done
@@ -93,9 +93,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
+include/Version.h:
+	echo "static const char Version[] = \""`git describe --tags --long`"\";" \
+		> include/Version.h
 
 clean:
 	@for i in $(SUBDIRS) testsuite; \
@@ -104,7 +104,7 @@ clean:
 clobber:
 	touch config.mk
 	$(MAKE) $(MFLAGS) clean
-	rm -f config.mk cscope.*
+	rm -f config.mk cscope.* include/Version.h
 
 distclean: clobber
 
bridge/bridge.c +1 -1
index a50d9d59b4c5..db2984ad7d88 100644
@@ -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"
devlink/devlink.c +2 -2
index 7f83fb746fd6..b558137caa0e 100644
@@ -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':
genl/genl.c +2 -2
index aba3c13afd34..cf30c7af20f6 100644
@@ -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();
ip/ip.c +2 -2
index 4249df0377f9..ac7caa1b0171 100644
@@ -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;
ip/rtmon.c +2 -2
index bccddedddd17..d42bbd30c0fb 100644
@@ -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--;
misc/ifstat.c +2 -2
index 03327af83ae8..abbd10cb9866 100644
@@ -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 '?':
misc/nstat.c +2 -2
index 88f52eaf8c8c..189a2d74602e 100644
@@ -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 '?':
misc/rtacct.c +2 -2
index c4bb5bc3888c..ec475b9b5bd7 100644
@@ -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
misc/ss.c +2 -2
index 5aa10e4a715f..08521672a154 100644
@@ -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++;
rdma/rdma.c +3 -3
index 22050555735d..0e7251fe26ef 100644
@@ -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;
tc/tc.c +2 -2
index b72657ec2e60..31c9030d1ed1 100644
@@ -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;
Signature · 1 line
2.27.0