From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C918EC433E0 for ; Sat, 1 Aug 2020 17:32:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 94FC82072A for ; Sat, 1 Aug 2020 17:32:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20150623.gappssmtp.com header.i=@networkplumber-org.20150623.gappssmtp.com header.b="ygZfiLXJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726545AbgHARcj (ORCPT ); Sat, 1 Aug 2020 13:32:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725883AbgHARcj (ORCPT ); Sat, 1 Aug 2020 13:32:39 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13111C06174A for ; Sat, 1 Aug 2020 10:32:39 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id f5so373595pgg.10 for ; Sat, 01 Aug 2020 10:32:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RXgiF4EJ+OiNWAXkjSU1K6tSaCx/jSwmV+/cTeAKX+Q=; b=ygZfiLXJtJASSb5m3Zo6YWoR13C4zLuakA2hpnh4t2W2g2za6Vbi/wL97jOqYR5XPB KvWENK/MkVLGuPcjLluI5FYRVMCHfz+m/te+LEpd4zMnskVNA4A7koQsGf8sKuPsUIma UKF09D0PQ2F5HoH5a4EH6IVhDpeDM5nVKJDxffI/oAjf7dJ2J7xdJ4G7NbKrV3QcAGFQ 7m9i1fxcWWycQZ20T+I8FNRCaghtzJqq9C46BY7ES58wPdnfPZM72u5lAJKXf7eKORrV KnPFdpf7pyAa9D0I2vru72WHLKjdAE+YxZC0xJQlAc8KEVSP+7b6dadbQ6WkmkfyJ71Q 2QxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RXgiF4EJ+OiNWAXkjSU1K6tSaCx/jSwmV+/cTeAKX+Q=; b=cGpz5CAoPy42ynVJNpOMyggKKSa6ZXAEVBAFKH6W1HfD85s6BW+vV8JfIAADC/caIY 34RmtKY8XGgQjnfjHOdczp0fyMJ7CyIiMc7RFs81+9j6TPNJmnLCTttMcgJ3udCHQGb0 koD8eHUExwVMllOL6mOCbmBO5m5nXjNkjb+bqsMBwZLZAsIFey/11DZbWS1foevbXmyH jxHS2d5c6CEHqpTHZHUKwgEU2Rt0+PMjriqpSUXiPXUvNW90fo95vKEujtDd63zsuEVD WHVCUQLjSLDRVslrhCg2CGaZ3YHs0gkucIpnwRHfEaj72PlAhUrpOy8Hw02crnTkzK1o 5kOg== X-Gm-Message-State: AOAM5305HJqBSkVEHBQlB58mgcoIEP/i+kWBjSELm/XwXQ+h6F4Jg+qk RfAXRRQoma3kjfi0YZywysj2zpgL7xOqcg== X-Google-Smtp-Source: ABdhPJxdKifUZhnjsw8nmsYO2RKBC3rRraGV2NlBGO4klGjebDWrZCZQAY+nEi7mNT2mUoNz7fwupw== X-Received: by 2002:a65:524b:: with SMTP id q11mr5454086pgp.372.1596303157709; Sat, 01 Aug 2020 10:32:37 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id m24sm9897702pff.45.2020.08.01.10.32.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Aug 2020 10:32:36 -0700 (PDT) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [RFC] replace SNAPSHOT with auto-generated version Date: Sat, 1 Aug 2020 10:32:35 -0700 Message-Id: <20200801173235.22434-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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(-) diff --git a/.gitignore b/.gitignore index e5234a3dc948..8c553394453a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ Config static-syms.h config.* +include/Version.h *.o *.a *.so diff --git a/Makefile b/Makefile index 25d05fac952a..61056cf6d7b2 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/bridge/bridge.c b/bridge/bridge.c index a50d9d59b4c5..db2984ad7d88 100644 --- a/bridge/bridge.c +++ b/bridge/bridge.c @@ -12,7 +12,7 @@ #include #include -#include "SNAPSHOT.h" +#include "Version.h" #include "utils.h" #include "br_common.h" #include "namespace.h" diff --git a/devlink/devlink.c b/devlink/devlink.c index 7f83fb746fd6..b558137caa0e 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -34,7 +34,7 @@ #include #include -#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': diff --git a/genl/genl.c b/genl/genl.c index aba3c13afd34..cf30c7af20f6 100644 --- a/genl/genl.c +++ b/genl/genl.c @@ -22,7 +22,7 @@ #include #include #include /* 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/ip/ip.c b/ip/ip.c index 4249df0377f9..ac7caa1b0171 100644 --- a/ip/ip.c +++ b/ip/ip.c @@ -18,7 +18,7 @@ #include #include -#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; diff --git a/ip/rtmon.c b/ip/rtmon.c index bccddedddd17..d42bbd30c0fb 100644 --- a/ip/rtmon.c +++ b/ip/rtmon.c @@ -19,7 +19,7 @@ #include #include -#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--; diff --git a/misc/ifstat.c b/misc/ifstat.c index 03327af83ae8..abbd10cb9866 100644 --- a/misc/ifstat.c +++ b/misc/ifstat.c @@ -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 '?': diff --git a/misc/nstat.c b/misc/nstat.c index 88f52eaf8c8c..189a2d74602e 100644 --- a/misc/nstat.c +++ b/misc/nstat.c @@ -29,7 +29,7 @@ #include #include -#include +#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 '?': diff --git a/misc/rtacct.c b/misc/rtacct.c index c4bb5bc3888c..ec475b9b5bd7 100644 --- a/misc/rtacct.c +++ b/misc/rtacct.c @@ -30,7 +30,7 @@ #include "rt_names.h" -#include +#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 diff --git a/misc/ss.c b/misc/ss.c index 5aa10e4a715f..08521672a154 100644 --- 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++; diff --git a/rdma/rdma.c b/rdma/rdma.c index 22050555735d..0e7251fe26ef 100644 --- a/rdma/rdma.c +++ b/rdma/rdma.c @@ -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 b72657ec2e60..31c9030d1ed1 100644 --- a/tc/tc.c +++ b/tc/tc.c @@ -24,7 +24,7 @@ #include #include -#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; -- 2.27.0