From patchwork Fri Nov 11 12:12:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Lichtenheld X-Patchwork-Id: 2848 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director14.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id nmeGHUg8bmM/LgAAIUCqbw (envelope-from ) for ; Fri, 11 Nov 2022 07:12:56 -0500 Received: from proxy11.mail.ord1d.rsapps.net ([172.30.191.6]) by director14.mail.ord1d.rsapps.net with LMTP id +LLiHEg8bmNjGgAAeJ7fFg (envelope-from ) for ; Fri, 11 Nov 2022 07:12:56 -0500 Received: from smtp13.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy11.mail.ord1d.rsapps.net with LMTPS id SMasHEg8bmNeMwAAgKDEHA (envelope-from ) for ; Fri, 11 Nov 2022 07:12:56 -0500 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: smtp13.gate.ord1d.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; dmarc=none (p=nil; dis=none) header.from=lichtenheld.com X-Suspicious-Flag: YES X-Classification-ID: 2c4e8d2e-61ba-11ed-a808-525400b197d9-1-1 Received: from [216.105.38.7] ([216.105.38.7:58088] helo=lists.sourceforge.net) by smtp13.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 32/C8-12378-74C3E636; Fri, 11 Nov 2022 07:12:55 -0500 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1otStT-0001Ia-DD; Fri, 11 Nov 2022 12:12:23 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1otStS-0001IU-9k for openvpn-devel@lists.sourceforge.net; Fri, 11 Nov 2022 12:12:22 +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=eUaB+7Qu3pGjfAI5uL4hX3IyglHicHzsG5kM5V+AQi0=; b=f50y4P0SZsf/w4KoIcF4u0WVBX MJ4VCoioK4ov5gf5DkHQriIRyOuS4ctnfKPhqz6GBoFhcyLk+tpOjf8dehvQOYmLRojqE2eWn1rBr DYHbLfS8c6A14XX2p+zpif/IbCcpXjPGVo949mZ9EhLvCaJLroYggYmcgJCH+9J80HNE=; 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=eUaB+7Qu3pGjfAI5uL4hX3IyglHicHzsG5kM5V+AQi0=; b=EnNvj3+vwXFCbbfjTT+q95OtLS Sq/zBqQrUvFdqFgb1ssWTdBqtapP/EhpoQjqSdJEGz18IC4VxqJOt2UXTEEZtEAqfj1TefraARd7n wDG1xzwS5p1mpO24bDhOjFuf82DSx8j+GSBfm4NfqvwX3k72Ltiav4ze4JUXkVH+DZcw=; Received: from mout-p-201.mailbox.org ([80.241.56.171]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1otStR-004KVC-24 for openvpn-devel@lists.sourceforge.net; Fri, 11 Nov 2022 12:12:22 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4N7yHw6M5wz9sTy; Fri, 11 Nov 2022 13:12:12 +0100 (CET) From: Frank Lichtenheld To: openvpn-devel@lists.sourceforge.net Date: Fri, 11 Nov 2022 13:12:12 +0100 Message-Id: <20221111121212.25167-1-frank@lichtenheld.com> In-Reply-To: <20221111111619.21415-1-frank@lichtenheld.com> References: <20221111111619.21415-1-frank@lichtenheld.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: There is no way to detect whether this information is outdated in nmake itself. So leave it up to the Python script to decide. While here, change some leading whitespace to tabs as expected in Makefile. Content analysis details: (-0.7 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [80.241.56.171 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-Headers-End: 1otStR-004KVC-24 Subject: [Openvpn-devel] [PATCH v2] msvc: always call git-version.py 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 There is no way to detect whether this information is outdated in nmake itself. So leave it up to the Python script to decide. While here, change some leading whitespace to tabs as expected in Makefile. Signed-off-by: Frank Lichtenheld Signed-off-by: Lev Stipakov Acked-by: Lev Stipakov --- build/msvc/msvc-generate/Makefile.mak | 9 ++++++--- build/msvc/msvc-generate/git-version.py | 21 ++++++++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) v2: incorporate changes to git-version.py by Lev diff --git a/build/msvc/msvc-generate/Makefile.mak b/build/msvc/msvc-generate/Makefile.mak index ae8b0842..1c1c4bab 100644 --- a/build/msvc/msvc-generate/Makefile.mak +++ b/build/msvc/msvc-generate/Makefile.mak @@ -51,10 +51,13 @@ $(OUTPUT_PLUGIN): $(INPUT_PLUGIN) $(OUTPUT_PLUGIN_CONFIG) cscript //nologo msvc-generate.js --config="$(OUTPUT_PLUGIN_CONFIG)" --input="$(INPUT_PLUGIN)" --output="$(OUTPUT_PLUGIN)" $(OUTPUT_MAN): $(INPUT_MAN) - -FOR /F %i IN ('where rst2html.py') DO python %i "$(INPUT_MAN)" "$(OUTPUT_MAN)" + -FOR /F %i IN ('where rst2html.py') DO python %i "$(INPUT_MAN)" "$(OUTPUT_MAN)" -$(OUTPUT_MSVC_GIT_CONFIG): - python git-version.py $(SOLUTIONDIR) +# Force regeneration because we can't detect whether it is outdated +$(OUTPUT_MSVC_GIT_CONFIG): FORCE + python git-version.py $(SOLUTIONDIR) + +FORCE: clean: -del "$(OUTPUT_MSVC_VER)" diff --git a/build/msvc/msvc-generate/git-version.py b/build/msvc/msvc-generate/git-version.py index b6037e1e..814dc86a 100644 --- a/build/msvc/msvc-generate/git-version.py +++ b/build/msvc/msvc-generate/git-version.py @@ -41,10 +41,25 @@ def main(): except: branch, commit_id = "unknown", "unknown" + prev_content = "" + 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") + try: + with open(name, "r") as f: + prev_content = f.read() + except: + # file doesn't exist + pass + + content = "#define CONFIGURE_GIT_REVISION \"%s/%s\"\n" % (branch, commit_id) + content += "#define CONFIGURE_GIT_FLAGS \"\"\n" + + if prev_content != content: + print("Writing %s" % name) + with open(name, "w") as f: + f.write(content) + else: + print("Content of %s hasn't changed" % name) if __name__ == "__main__": main()