From patchwork Thu Sep 22 02:59:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lev Stipakov X-Patchwork-Id: 2785 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director13.mail.ord1d.rsapps.net ([172.31.255.6]) by backend30.mail.ord1d.rsapps.net with LMTP id GN3jCHhcLGOKRAAAIUCqbw (envelope-from ) for ; Thu, 22 Sep 2022 09:00:40 -0400 Received: from proxy16.mail.iad3b.rsapps.net ([172.31.255.6]) by director13.mail.ord1d.rsapps.net with LMTP id SNIoCHhcLGP5DgAA91zNiA (envelope-from ) for ; Thu, 22 Sep 2022 09:00:40 -0400 Received: from smtp29.gate.iad3b ([172.31.255.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy16.mail.iad3b.rsapps.net with LMTPS id +FE4AHhcLGOeKQAAPj+4aA (envelope-from ) for ; Thu, 22 Sep 2022 09:00:40 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp29.gate.iad3b.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dkim=fail (signature verification failed) header.d=gmail.com; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Suspicious-Flag: YES X-Classification-ID: 8d0b8a60-3a76-11ed-9afb-525400534f55-1-1 Received: from [216.105.38.7] ([216.105.38.7:47264] helo=lists.sourceforge.net) by smtp29.gate.iad3b.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 5F/DE-24482-57C5C236; Thu, 22 Sep 2022 09:00:37 -0400 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1obLoE-0003CU-4D; Thu, 22 Sep 2022 13:00:06 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1obLoC-0003AI-U8 for openvpn-devel@lists.sourceforge.net; Thu, 22 Sep 2022 13:00:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=/DAJwTpF9gHCxYX0VBGXeIsH6YpUyCRpSVX+2XqAyHU=; b=LNeKbaXMCFZG+LSHuiBC8l4f9B EQh8KdVDuvMLjGFjqnTsBxrKAnD5EYm3zLzEFssR4XgKXt73kki56RwfwGenJVORDq2Rqt6cOvHo/ /mPcwn+qWd4GAtZvRNzmO7s0jFFn7/tNjybEZ9yLVi2OfKmGh7pRTQHVonxgQJqyvWS8=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=/DAJwTpF9gHCxYX0VBGXeIsH6YpUyCRpSVX+2XqAyHU=; b=m zwRwG3F3eDbs9w8tbYG6Id3L4e/rFTLQoJ+LZO3McIVpsBw2+7l2eE6hKtrckqAusY6bC9X0x9hyZ 5y1nggJ/RXnislzklZe2Vn0QwkNIeOU8BTe3sy+9SFFPPcqdVlrXNj8y4aG6JhCMtFZTZfStpoKrg /3bwsZXh5l6uQZEs=; Received: from mail-lj1-f174.google.com ([209.85.208.174]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1obLoA-00GYcb-V2 for openvpn-devel@lists.sourceforge.net; Thu, 22 Sep 2022 13:00:04 +0000 Received: by mail-lj1-f174.google.com with SMTP id s10so10892267ljp.5 for ; Thu, 22 Sep 2022 06:00:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=/DAJwTpF9gHCxYX0VBGXeIsH6YpUyCRpSVX+2XqAyHU=; b=hQZI0WoEHfy8oNk8r75x8aEkvY+tp+JLtGRcopsCMjo7w+TnitlCF3jBrlVx0Jh5E+ fy9EjpfbPNbffKW+S/HOwhoDTo9XQQYdt0ojDR4+NnP9r8c0Nbp6hwbw9VmnCLBkBtdI oMhke7kvjEA++p2Dey2Bns9Rt9Xz/4zPBqADI4StLHqM9NItGSKDjCAh0YsQJKr8U3bK y3FL6KdPgKEHgomAGQ8c3VwebfdGW34wFnP4dAihK6tZPGrtiRV32T9tFAkIHCBSIq0v 5AOKNBNm25bF9xZCyZewDzajNJV0sfekSWoNpGrN3FdEdDz0z/i3eBbDL+lVg7SOi7pE Pv+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=/DAJwTpF9gHCxYX0VBGXeIsH6YpUyCRpSVX+2XqAyHU=; b=M5ox3lRnDf6PbiZxSFI+jtL49FwkfiMWdOCYYFwhCB3jrcMxOWhol+wovQQef3I1Gp AxOrioxP6XQh+n1rYx5i7xhFH1IkUUniMy4wcsPU1PBRqHeFZOJEQFQsy6zE7CeC3ebW 7iVo776XufaqOVWVExGPiEzSe49dbJTow2VRVmVXxRgjeZwZ29a+pyy+q/lRD+sEQZEg lq7F4RWWgny5+Ybkj0NukJvtGsOtILJaOUkIWlNNoh5NltmzShara04UaOPllZgPEBqC pXXX08oFYs8RnV3cSRnoD66WswpTPI/bdhSycuffJWgSaGIBKCmh+/bdgXM9lAuqpaWD lXWA== X-Gm-Message-State: ACrzQf2yZNHzZk32hM+2dNFdkmeLgcpvLiN3biVJMf++H0GRXwv0dMlN 91VI9Z4CwthlixjbetliXwHak7xw/LK5sw== X-Google-Smtp-Source: AMsMyM4OSeJbzLCMNrh4cHx3H58NSH/aS7aJxxr6qREbxZ+KLe6YzGHGaEY5g8KKwszVt7F6Md2nXQ== X-Received: by 2002:a05:651c:1a25:b0:26c:1deb:4806 with SMTP id by37-20020a05651c1a2500b0026c1deb4806mr1063206ljb.49.1663851596046; Thu, 22 Sep 2022 05:59:56 -0700 (PDT) Received: from LAPTOP-4L3N7KFS.localdomain (89-166-53-18.co.dnainternet.fi. [89.166.53.18]) by smtp.gmail.com with ESMTPSA id i16-20020a2ea230000000b0026aba858fbfsm518570ljm.137.2022.09.22.05.59.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 05:59:55 -0700 (PDT) From: Lev Stipakov To: openvpn-devel@lists.sourceforge.net Date: Thu, 22 Sep 2022 15:59:37 +0300 Message-Id: <20220922125937.332-1-lstipakov@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Report: Spam detection software, running on the system "util-spamd-1.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Lev Stipakov Add a simple python script which generates header with branch name and commit hash #defines. While on it, fix filename in msvc-generate.vcxproj and add proper copyright header to Makefile.mak. Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [lstipakov[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.208.174 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.208.174 listed in wl.mailspike.net] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1obLoA-00GYcb-V2 Subject: [Openvpn-devel] [PATCH] msvc: add branch name and commit hash to version output X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lev Stipakov Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From: Lev Stipakov Add a simple python script which generates header with branch name and commit hash #defines. While on it, fix filename in msvc-generate.vcxproj and add proper copyright header to Makefile.mak. Signed-off-by: Lev Stipakov --- build/msvc/msvc-generate/Makefile.mak | 33 +++++++++++++- build/msvc/msvc-generate/git-version.py | 45 +++++++++++++++++++ .../msvc/msvc-generate/msvc-generate.vcxproj | 2 +- config-msvc.h | 2 + 4 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 build/msvc/msvc-generate/git-version.py diff --git a/build/msvc/msvc-generate/Makefile.mak b/build/msvc/msvc-generate/Makefile.mak index 1cb43102..ae8b0842 100644 --- a/build/msvc/msvc-generate/Makefile.mak +++ b/build/msvc/msvc-generate/Makefile.mak @@ -1,4 +1,27 @@ -# Copyright (C) 2008-2012 Alon Bar-Lev +# +# OpenVPN -- An application to securely tunnel IP networks +# over a single UDP port, with support for SSL/TLS-based +# session authentication and key exchange, +# packet encryption, packet authentication, and +# packet compression. +# +# Copyright (C) 2002-2022 OpenVPN Inc +# Copyright (C) 2008-2012 Alon Bar-Lev +# Copyright (C) 2022-2022 Lev Stipakov +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 +# as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# CONFIG=$(SOLUTIONDIR)/version.m4 @@ -14,7 +37,9 @@ OUTPUT_PLUGIN_CONFIG=version.m4 INPUT_MAN=$(SOLUTIONDIR)/doc/openvpn.8.rst OUTPUT_MAN=$(SOLUTIONDIR)/doc/openvpn.8.html -all: $(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN) +OUTPUT_MSVC_GIT_CONFIG=$(SOLUTIONDIR)/config-version.h + +all: $(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN) $(OUTPUT_MSVC_GIT_CONFIG) $(OUTPUT_MSVC_VER): $(INPUT_MSVC_VER) $(CONFIG) cscript //nologo msvc-generate.js --config="$(CONFIG)" --input="$(INPUT_MSVC_VER)" --output="$(OUTPUT_MSVC_VER)" @@ -28,8 +53,12 @@ $(OUTPUT_PLUGIN): $(INPUT_PLUGIN) $(OUTPUT_PLUGIN_CONFIG) $(OUTPUT_MAN): $(INPUT_MAN) -FOR /F %i IN ('where rst2html.py') DO python %i "$(INPUT_MAN)" "$(OUTPUT_MAN)" +$(OUTPUT_MSVC_GIT_CONFIG): + python git-version.py $(SOLUTIONDIR) + clean: -del "$(OUTPUT_MSVC_VER)" -del "$(OUTPUT_PLUGIN)" -del "$(OUTPUT_PLUGIN_CONFIG)" -del "$(OUTPUT_MAN)" + -del "$(OUTPUT_MSVC_GIT_CONFIG)" diff --git a/build/msvc/msvc-generate/git-version.py b/build/msvc/msvc-generate/git-version.py new file mode 100644 index 00000000..e1bf5bdb --- /dev/null +++ b/build/msvc/msvc-generate/git-version.py @@ -0,0 +1,45 @@ +# +# OpenVPN -- An application to securely tunnel IP networks +# over a single UDP port, with support for SSL/TLS-based +# session authentication and key exchange, +# packet encryption, packet authentication, and +# packet compression. +# +# Copyright (C) 2002-2022 OpenVPN Inc +# Copyright (C) 2022-2022 Lev Stipakov +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 +# as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +import os +import sys + +def get_branch_commit_id(): + commit_id = os.popen("git rev-parse --short=16 HEAD").read()[:-1] + branch = os.popen("git rev-parse --symbolic-full-name HEAD").read().split("/")[2][:-1] + return branch, commit_id + +def main(): + try: + branch, commit_id = get_branch_commit_id() + except: + branch, commit_id = "", "" + + name = os.path.join("%s" % (sys.argv[1] if len(sys.argv) > 1 else "."), "config-version.h") + with open(name, "w") as f: + f.write("#define CONFIGURE_GIT_REVISION \"%s/%s\"\n" % (branch, commit_id)) + f.write("#define CONFIGURE_GIT_FLAGS \"\"\n") + +if __name__ == "__main__": + main() diff --git a/build/msvc/msvc-generate/msvc-generate.vcxproj b/build/msvc/msvc-generate/msvc-generate.vcxproj index dda8b051..eae94709 100644 --- a/build/msvc/msvc-generate/msvc-generate.vcxproj +++ b/build/msvc/msvc-generate/msvc-generate.vcxproj @@ -150,7 +150,7 @@ - + diff --git a/config-msvc.h b/config-msvc.h index b621f3fb..a3c687ed 100644 --- a/config-msvc.h +++ b/config-msvc.h @@ -89,3 +89,5 @@ typedef uint16_t in_port_t; #endif #define ENABLE_DCO 1 + +#define HAVE_CONFIG_VERSION_H 1