From patchwork Sun Sep 25 21:08:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lev Stipakov X-Patchwork-Id: 2795 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director7.mail.ord1d.rsapps.net ([172.27.255.9]) by backend30.mail.ord1d.rsapps.net with LMTP id VlWWOE9QMWPAYgAAIUCqbw (envelope-from ) for ; Mon, 26 Sep 2022 03:10:07 -0400 Received: from proxy11.mail.iad3a.rsapps.net ([172.27.255.9]) by director7.mail.ord1d.rsapps.net with LMTP id EO/cN09QMWMpTgAAovjBpQ (envelope-from ) for ; Mon, 26 Sep 2022 03:10:07 -0400 Received: from smtp38.gate.iad3a ([172.27.255.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy11.mail.iad3a.rsapps.net with LMTPS id WKldMk9QMWPzfQAAxCvdqw (envelope-from ) for ; Mon, 26 Sep 2022 03:10:07 -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: smtp38.gate.iad3a.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: 3fab9f2a-3d6a-11ed-bfa9-525400000c92-1-1 Received: from [216.105.38.7] ([216.105.38.7:47778] helo=lists.sourceforge.net) by smtp38.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 6A/49-25769-E4051336; Mon, 26 Sep 2022 03:10:07 -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 1ociEy-0004Fd-WF; Mon, 26 Sep 2022 07:09:21 +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 1ociEm-0004EY-A6 for openvpn-devel@lists.sourceforge.net; Mon, 26 Sep 2022 07:09:08 +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:References: In-Reply-To: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:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=0vxI67wd9CYUzjdDW6uIjVuF3pFlf97p7Nei5D4HT2o=; b=m3FXWaO4Iyyx0q7kEQrWQ4iIhe W+xUcR7fhFvIBnVSxXYLajPIjX1TDqw5y6nY4J4V75dURLKEdweUsRvrVbntwQ4O4ZLlpC3aiupl4 P2nceyF8z9kBR7SQITHMbP5HJxJuq0hr6hxEPRFElRILZ02wVEokeLzEaD21SoGuC46w=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: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:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=0vxI67wd9CYUzjdDW6uIjVuF3pFlf97p7Nei5D4HT2o=; b=Rhh5NnGo9jXs9YpaZCFKDnSDb/ 1DH7HPhONx+KfMZghjfHaQTMoHXIxe2tEybzpAsw35iL1IrHepxclCd9nE5YXfrAaVSTFdk2RAnkw /JEbf5/PcVvorKoZVhHFqflYNySwj8r7k877G02afe0yvDeu6TUvfNc4Uzy+XkvcR+PU=; Received: from mail-lf1-f49.google.com ([209.85.167.49]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1ociEk-0037Cs-DF for openvpn-devel@lists.sourceforge.net; Mon, 26 Sep 2022 07:09:07 +0000 Received: by mail-lf1-f49.google.com with SMTP id z25so9403083lfr.2 for ; Mon, 26 Sep 2022 00:09:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=0vxI67wd9CYUzjdDW6uIjVuF3pFlf97p7Nei5D4HT2o=; b=QSW5vy4Ik4489IulSc+9ukWdgze6e452SxpbEVfqLW8baEf4NQDYFFWFLvoPVoK7FE Dcs+Vq+Ht9PKyDYOt+OSyr9C3E1WCgQ3nMqUsJilSn8w4geLfKrP9sgTaxElukB+LEO6 6QM1k+Dp3YF6mqdLz3v3tHymU26uff536jaW0JUwGInSD9rJ8HPQKR9gMjoTw10DiahH sE+LbOEuhA4Fm/6m/bF3MV7BCWRYHSIv2wI+yUcYiOcMYaKP7h4fPYxYmqspXDZTxvfT kSuAe4Wqgsr3YUQv32/5xbl3lYzTQgpc+Sn6PWiNpjc1Xn6oifSGLTh7iroP5sZmPQbX 3ydg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=0vxI67wd9CYUzjdDW6uIjVuF3pFlf97p7Nei5D4HT2o=; b=DZotrRXoFAwT+UI/KsimJ+LAgbj2JXQyyAwVKiljXtqwc3KhlSVTibC8drxC0KEKlN Fm+GXxAcO7UHO2kQCqOvXwEZT7jtt0DJR9GPsgZuf+qQCFaz9Hwxrej5Fcr3b9kloSLd b2kSge2OB37MR1qOXDaJua2KHQ14CWeUtGmFzQLmwXWKPYLLWkF/fzFnu0/jXeUyxYOL iSL9OEpZSRQj2rdSU37MFIrX/YnBXmiX1mCFHNMg3XGa55H0zDb4O8j/EFvgMOqyBM2W q+0ypZkJYETSo3ccjG+4JeFMpNvOWxKyB/EYxW/59GzTVt+YRSKxMdcD2/A2t1wY2xDm OP+g== X-Gm-Message-State: ACrzQf12p1pLjV6oRjyghSHWtzRjr/OcogVJE8366I8zIttDN6z1c9Wt 5h3dTSw77ROcDp2fFo6qgECYJbhwX3w= X-Google-Smtp-Source: AMsMyM6m+t8v1/EAfE6jBiHBffgJwCxxo3Sr7BoWeCFhQ05MnVXC6p41DZqZn6i3kBdQs1Zr+Xl66g== X-Received: by 2002:a05:6512:b1e:b0:4a1:ba8c:7ea7 with SMTP id w30-20020a0565120b1e00b004a1ba8c7ea7mr2573492lfu.608.1664176139437; Mon, 26 Sep 2022 00:08:59 -0700 (PDT) Received: from LAPTOP-4L3N7KFS.localdomain (81-175-157-115.bb.dnainternet.fi. [81.175.157.115]) by smtp.gmail.com with ESMTPSA id o8-20020a056512050800b004a05767bc07sm1175874lfb.28.2022.09.26.00.08.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 00:08:59 -0700 (PDT) From: Lev Stipakov To: openvpn-devel@lists.sourceforge.net Date: Mon, 26 Sep 2022 10:08:43 +0300 Message-Id: <20220926070843.717-1-lstipakov@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220923085740.525-1-lstipakov@gmail.com> References: <20220923085740.525-1-lstipakov@gmail.com> MIME-Version: 1.0 X-Spam-Report: Spam detection software, running on the system "util-spamd-2.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 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [lstipakov[at]gmail.com] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.167.49 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.167.49 listed in list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-Headers-End: 1ociEk-0037Cs-DF Subject: [Openvpn-devel] [PATCH v5 release/2.5] 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 Acked-by: Gert Doering --- v5: - replace "detached" with "none" ("none" if not on a branch, "unknown" if cannot be determined) v4: - replace backslash with slash - instead of git:msvc-version-release\2.5/b5df0fadf0fdad98 we display git:msvc-version-release/2.5/b5df0fadf0fdad98 v3: - properly handle branchnames like release/2.5 and detached HEAD state - property handle "not in git repo" case v2: - fix copyright year 2002 -> 2022 - change "not-a-git-repo" to "unknown" build/msvc/msvc-generate/Makefile.mak | 33 +++++++++++- build/msvc/msvc-generate/git-version.py | 50 +++++++++++++++++++ .../msvc/msvc-generate/msvc-generate.vcxproj | 2 +- config-msvc.h | 2 + 4 files changed, 84 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..b6037e1e --- /dev/null +++ b/build/msvc/msvc-generate/git-version.py @@ -0,0 +1,50 @@ +# +# 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) 2022-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] + if not commit_id: + raise + l = os.popen("git rev-parse --symbolic-full-name HEAD").read().split("/")[2:] + if not l: + l = ["none\n"] + branch = "/" .join(l)[:-1] + return branch, commit_id + +def main(): + try: + branch, commit_id = get_branch_commit_id() + except: + branch, commit_id = "unknown", "unknown" + + 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 e7479c86..47c5ba07 100644 --- a/config-msvc.h +++ b/config-msvc.h @@ -177,3 +177,5 @@ typedef uint16_t in_port_t; #define HAVE_INET_NTOP #define HAVE_INET_PTON #endif + +#define HAVE_CONFIG_VERSION_H 1