From patchwork Fri Dec 20 12:22:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13916676 Received: from fhigh-a6-smtp.messagingengine.com (fhigh-a6-smtp.messagingengine.com [103.168.172.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2DF8204567 for ; Fri, 20 Dec 2024 12:23:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734697390; cv=none; b=q1CDHohsMkVT2p3z7JbZsk35+FR8+PlalqbAONd3d0QCJtrbcXHuDLwx7T0RkFmRLcmHBWHaEEwHakPyHad3oa4yXK82isjCLH9C0go3ugQ6D3oAXJTdCs5zEGWURcCWNWr7SI2Dt4cvwlVgOJYuCfaehm9TQXIxxNLQd0/S4Lc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734697390; c=relaxed/simple; bh=31bIg9TG/JR5p3GesVhqk5OWPcJIH/92Tm5wj268XYw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nhXs4qFDt0UzSAbAvGteXWuwHHhzRQpYZ/mjgdwrgyyEUGORa8le4jkFsPz/m76a9OgTq+rf4at6Tr9VNh6FnfBKxkZW3d7bUIFwEOLVeaqgtGrCWNiJCy/WkJQV0zql5e5LdYwx086kOuOETbqUSHoxysTSFNCs5pbdR5jXId0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=0GcHjgAM; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=hnDk1oq9; arc=none smtp.client-ip=103.168.172.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="0GcHjgAM"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="hnDk1oq9" Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfhigh.phl.internal (Postfix) with ESMTP id B596C11401ED; Fri, 20 Dec 2024 07:23:07 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Fri, 20 Dec 2024 07:23:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1734697387; x=1734783787; bh=BNtQCVhf6XM4IT5IA75ojY7FtTwIIEV7kGA1nQ0uvhg=; b= 0GcHjgAMKM/g6Z5Vz4jYqJQsZW9SyXFtmqWYXqn5WeyeURMazFUjVVXlewqeNthu 7etlu+2vUvAt5bRqWRYHmiaJbhMctUedUk/1OjGM5aI1quEJDszBxs7jyBhv7Zij pLds/cAa69ToTlHH+N56CmfUG9sXXhqawHdYt3pojZswwMCUBtUWtkQ6nfO0oITP 33/GOYN25E9uNxyWapWEuftafDLwzi1rfV+LB2MHeU/EIUc5ekXNKD6Yut6aeoYH +gUJ93/5469s+buZlFgcyHq6nLZ2PbhPH014zWzyXvrJpimHXGrPC7wTHc14xtdD aEAEZZAPHn/41PNWRQshhQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1734697387; x= 1734783787; bh=BNtQCVhf6XM4IT5IA75ojY7FtTwIIEV7kGA1nQ0uvhg=; b=h nDk1oq9rT/1wMnPJ4zl4AIg2hindsRgX/KmfHxTII70KV16ytkM5fie7J4W2FCSE 2G8uM49+ckveu855lEsT7QY/XmbKzHyGwbXAexH19i8gM3KxuV2/T6msWuM0IsNn Qw5csibhjmZ+CLmS4JzBKzp8PhKmpdiGy5rXByZ5kRgxdhBhYUF4aUDd91NAYTmE SzHOKmM6/RQXToQSiTq/9YPRuksAfaDp12ciELjzoHQl8HNLpd95UIcOafHK6Qci aI8oG7E2zROH9q9T0cr2Z7RT4H4QHXzFM5eH2VKDSXQSe8VUOzm1xMcjdTGjyjm+ BRGTRWTzX9RzfLR270d2g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddtvddgfeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepffeuieduje dvkeehuedvkeefffeivdeuleetkeduheejteekgedvudfgtdfgieelnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnh gspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepphgvfhhf sehpvghffhdrnhgvthdprhgtphhtthhopehsphgvtghtrhgrlhesghhoohhglhgvrdgtoh hmpdhrtghpthhtohepghhithhsthgvrhesphhosghogidrtghomhdprhgtphhtthhopehg ihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 20 Dec 2024 07:23:06 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 7734b51f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 20 Dec 2024 12:21:15 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 20 Dec 2024 13:22:45 +0100 Subject: [PATCH v2 1/5] GIT-VERSION-GEN: fix overriding version via environment Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241220-b4-pks-git-version-via-environment-v2-1-f1457a5e8c38@pks.im> References: <20241220-b4-pks-git-version-via-environment-v2-0-f1457a5e8c38@pks.im> In-Reply-To: <20241220-b4-pks-git-version-via-environment-v2-0-f1457a5e8c38@pks.im> To: git@vger.kernel.org Cc: Junio C Hamano , Kyle Lippincott , Jeff King X-Mailer: b4 0.14.2 GIT-VERSION-GEN tries to derive the version that Git is being built from via multiple different sources in the following order: 1. A file called "version" in the source tree's root directory, if it exists. 2. The current commit in case Git is built from a Git repository. 3. Otherwise, we use a fallback version stored in a variable which is bumped whenever a new Git version is getting tagged. It used to be possible to override the version by overriding the `GIT_VERSION` Makefile variable (e.g. `make GIT_VERSION=foo`). This worked somewhat by chance, only: `GIT-VERSION-GEN` would write the actual Git version into `GIT-VERSION-FILE`, not the overridden value, but when including the file into our Makefile we would not override the `GIT_VERSION` variable because it has already been set by the user. And because our Makefile used the variable to propagate the version to our build tools instead of using `GIT-VERSION-FILE` the resulting build artifacts used the overridden version. But that subtle mechanism broke with 4838deab65 (Makefile: refactor GIT-VERSION-GEN to be reusable, 2024-12-06) and subsequent commits because the version information is not propagated via the Makefile variable anymore, but instead via the files that `GIT-VERSION-GEN` started to write. And as the script never knew about the `GIT_VERSION` environment variable in the first place it uses one of the values listed above instead of the overridden value. Fix this issue by making `GIT-VERSION-GEN` handle the case where `GIT_VERSION` has been set via the environment. Signed-off-by: Patrick Steinhardt --- GIT-VERSION-GEN | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index de0e63bdfbac263884e2ea328cc2ef11ace7a238..27f9d6a81f77248c652649ae21d0ec51b8f2d247 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -29,7 +29,10 @@ export GIT_CEILING_DIRECTORIES # First see if there is a version file (included in release tarballs), # then try git-describe, then default. -if test -f "$SOURCE_DIR"/version +if test -n "$GIT_VERSION" +then + VN="$GIT_VERSION" +elif test -f "$SOURCE_DIR"/version then VN=$(cat "$SOURCE_DIR"/version) || VN="$DEF_VER" elif { @@ -51,7 +54,13 @@ else VN="$DEF_VER" fi -GIT_VERSION=$(expr "$VN" : v*'\(.*\)') +# Only strip leading `v` in case we have derived VN manually. Otherwise we +# retain whatever the user has set in their environment. +if test -z "$GIT_VERSION" +then + GIT_VERSION=$(expr "$VN" : v*'\(.*\)') +fi + GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null) GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as' 2>/dev/null) if test -z "$GIT_USER_AGENT" From patchwork Fri Dec 20 12:22:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13916677 Received: from fout-a3-smtp.messagingengine.com (fout-a3-smtp.messagingengine.com [103.168.172.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 203252046A4 for ; Fri, 20 Dec 2024 12:23:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.146 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734697391; cv=none; b=H1FDxdL3fX8GPQJpKyjlXO1seDsiq31qG5zpoNsr/F7QW/++Lqbq4yDqN6vTxSBi0cd1MgmqIc1Lzxww+MXby7XWtT50xWs906AOikehfOaltsd8f0y986hw02538vZUnlXu4V2uTKJff6jhKuXuKW0d4eBNCCQLPP6zNvSJxuw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734697391; c=relaxed/simple; bh=BmIHvYmtLQ0YrlXEuCeU+f3RO/IIX7ECgByEvqOK62E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IVE5brSFBUt9F5fuk90AzryovcALRI0I1raYtNWlJ+N6vgvZFaNajapZbXBbPenEjfJ2nFF9FefuVEg7Ik3PlmB+/QXN+ociGbMln27e0XRDoY8J1kg/3WL46KZweXA9K7KSMHIQaeA/xyI08yEuD2R7Lgty2JtjUnvmqYB7OAw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=kDGmhAUy; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=5IN12MwG; arc=none smtp.client-ip=103.168.172.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="kDGmhAUy"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="5IN12MwG" Received: from phl-compute-07.internal (phl-compute-07.phl.internal [10.202.2.47]) by mailfout.phl.internal (Postfix) with ESMTP id 113D31380227; Fri, 20 Dec 2024 07:23:09 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-07.internal (MEProxy); Fri, 20 Dec 2024 07:23:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1734697389; x=1734783789; bh=6MJKtxu/GEX1NH87n/nbPAJ6yqi1SBUVJ3SPf2KN9PU=; b= kDGmhAUy9ug3R5Hci5QbObT1AiVfXvEVbBvZcQ1e7ZInpEk2XptIRS74wLrM7Qqn 0AehRPjB7r/wl8fKkxuD5Nvj5sclaifFZNDw/JOMYP6Rln3FKez4rD30h65GQ8t5 aTAw7Ml53aMJNbcVmvJZJXrrXnL5PgyD2qYO9a0m/iChUF9L7H/IilvNjv/hzpHU 3SlwMMBtocyqy30+QX/HiQOwLat7pj2uVZmq6G++6wqLB3ZYrIYYEkKj2YORelpA zXrQZVhLDGSw/vYbuOqLMLKEQ7MfLnccdKl/2A05t2iFdyCAVEyA4kpYjsNELvOk +c7CMTJ3aKp7040XJp2D+A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1734697389; x= 1734783789; bh=6MJKtxu/GEX1NH87n/nbPAJ6yqi1SBUVJ3SPf2KN9PU=; b=5 IN12MwGPbz3HTDV2vTXFwAgfir7yEVc3VBfbmETa94NE5TsL/ZtiL5gTj5UoX1Rb hrGtxQRofu0P/qyxrm1nnDyVf0Lr/2P3dU2cAVBABbK4UHpLKg/Icv1CGuTWt61M KR+O9U3+y+FJqmiEwNGy/dt0JU3l+pag9FluOXwMovnHgqxmMR981tXSVwwT+cE1 h+TIekGo7QbnYY/64+OmlzsZaPDEFX+pY9sf3HbgYs5Pf9q8kT7IAVbu0mXetDuk Sthlj9iFTAN0Do1MzctNah4peQa3vSgXzPLMxZ2CuQgrqN7+PI2J+mFhlee8yjZ7 7CV1BtiNfBdgZLG1viDgA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddtvddgfeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepffeuieduje dvkeehuedvkeefffeivdeuleetkeduheejteekgedvudfgtdfgieelnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnh gspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepghhithes vhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehsphgvtghtrhgrlhesghhooh hglhgvrdgtohhmpdhrtghpthhtohepphgvfhhfsehpvghffhdrnhgvthdprhgtphhtthho pehgihhtshhtvghrsehpohgsohigrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 20 Dec 2024 07:23:07 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id a75e2e63 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 20 Dec 2024 12:21:16 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 20 Dec 2024 13:22:46 +0100 Subject: [PATCH v2 2/5] GIT-VERSION-GEN: fix overriding GIT_BUILT_FROM_COMMIT and GIT_DATE Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241220-b4-pks-git-version-via-environment-v2-2-f1457a5e8c38@pks.im> References: <20241220-b4-pks-git-version-via-environment-v2-0-f1457a5e8c38@pks.im> In-Reply-To: <20241220-b4-pks-git-version-via-environment-v2-0-f1457a5e8c38@pks.im> To: git@vger.kernel.org Cc: Junio C Hamano , Kyle Lippincott , Jeff King X-Mailer: b4 0.14.2 Same as with the preceding commit, neither GIT_BUILT_FROM_COMMIT nor GIT_DATE can be overridden via the environment. Especially the latter is of importance given that we set it in our own "Documentation/doc-diff" script. Make the values of both variables overridable. Signed-off-by: Patrick Steinhardt --- GIT-VERSION-GEN | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 27f9d6a81f77248c652649ae21d0ec51b8f2d247..4273d5284008e2787854928163e31802bf8a3d27 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -61,8 +61,16 @@ then GIT_VERSION=$(expr "$VN" : v*'\(.*\)') fi -GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null) -GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as' 2>/dev/null) +if test -z "$GIT_BUILT_FROM_COMMIT" +then + GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null) +fi + +if test -z "$GIT_DATE" +then + GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as' 2>/dev/null) +fi + if test -z "$GIT_USER_AGENT" then GIT_USER_AGENT="git/$GIT_VERSION" From patchwork Fri Dec 20 12:22:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13916678 Received: from fhigh-a6-smtp.messagingengine.com (fhigh-a6-smtp.messagingengine.com [103.168.172.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51AAF1C4612 for ; Fri, 20 Dec 2024 12:23:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734697393; cv=none; b=jPhrGhCF4xam9ImqiA0jU6OCUOQJWtMEQmAJlZMRmu1k8e+hzU7nQm4I+81hgLq06+7zrX0uJeyrcdBNd/VShdsPRY5qun3lD/EQEy/xQc+DwiKwHzCMWL23XgykJRfdqCCRGEa0Y9BHFhVzjg2aZ3w29pdfXnGua+V1kkDmlQw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734697393; c=relaxed/simple; bh=ic7+mXkqhVsJtimnn8bOCl684AgLWvhlgZyUXQ9BuRc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Zbp71t8WaUotb2L3PRgrTyUZTDhmviBshgXSioAiCXQvmpdHviVcMpWUoi1L/8JmNDBnR6nL5LKrpJOflnEnDRKTJCxyrRr6S4/6HxG50bz8NzyxxQFTuGk+BRDRDvigvMIIwyO5r9lxIIBFNKTjiBzKfUlCWQE3NxdvoV3cNQk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=0WQc2YWR; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=DCqgqoez; arc=none smtp.client-ip=103.168.172.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="0WQc2YWR"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="DCqgqoez" Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.phl.internal (Postfix) with ESMTP id 69121114006F; Fri, 20 Dec 2024 07:23:10 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Fri, 20 Dec 2024 07:23:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1734697390; x=1734783790; bh=LA3qmVc4cwd1EBDe7rRX9RyD63W5mqVP93pHUW4776Y=; b= 0WQc2YWRlYIy/IJ++ozuFWQstxpywFTywHHYslRcFrINFrSCMGS95OkknZGFE3hJ BfQdQlg64peCXPT2MLURKaMjxF+7CajEFMZHnbwZO/W5JG7t7oIEtF0HYNr8vih1 L8G5YAm7uZDF1D4s5VfdnbuG1auP14kuakA2xUYCPA6DCNkHGUCB3erMSuYJAmhJ GpQjJ74utYanFL8v8/lSj6lVcyFA1XTSCJOr1KdaZG6gjzEGzXXOJHvspv9o3Uuy x0/mSlN+9JtFP4oiLPbGCrI6GEdYXmNUfxYFiMkL5cdz030q2qp00+qFEkNRnNdp RvmsrnEiG8B7oNVzlh61pA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1734697390; x= 1734783790; bh=LA3qmVc4cwd1EBDe7rRX9RyD63W5mqVP93pHUW4776Y=; b=D Cqgqoez4vewRmQgeqmtBEJi0P492lYlt5h4NLoG2i0UNgKMC9taXq9e7N73GwvFx qGidQae5fIU60XGacCPVOzWquDVzvSV+E3hgtPWWrfx8AaRn9RkfBnb77msBIoI+ ORw+rQylqhHdxIbuD9/LxDzTuZOqrK00kzRGkITCfcHG5bbgQZB1g2LrHZeAXzvb 3e/IYEsenrgBKqPo4yGSwyNAMvtMIbFPfdnhpk9eN2k82SFkAVBtDldm1Dt1Bf26 POSYV+0ngvSEcJ2AaKU8wkT00Y+J/CLSTGZi/ZBQJnvtgFTi8UpjPVWdbdIQ11HN DQB/WvRZtPSurhDsfmLvw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddtvddgfeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepjefhgfette evtdfgveekkeelfeetgfelteejkeekvddvgfdufefhkeelgffhffetnecuffhomhgrihhn pehrsgdrihhnpdgtohhnfhdrihhnpdhrtgdrihhnnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthht ohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepghhithhsthgvrhesphhosg hogidrtghomhdprhgtphhtthhopehsphgvtghtrhgrlhesghhoohhglhgvrdgtohhmpdhr tghpthhtohepphgvfhhfsehpvghffhdrnhgvthdprhgtphhtthhopehgihhtsehvghgvrh drkhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 20 Dec 2024 07:23:09 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id e823b8e4 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 20 Dec 2024 12:21:17 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 20 Dec 2024 13:22:47 +0100 Subject: [PATCH v2 3/5] Makefile: drop unneeded indirection for GIT-VERSION-GEN outputs Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241220-b4-pks-git-version-via-environment-v2-3-f1457a5e8c38@pks.im> References: <20241220-b4-pks-git-version-via-environment-v2-0-f1457a5e8c38@pks.im> In-Reply-To: <20241220-b4-pks-git-version-via-environment-v2-0-f1457a5e8c38@pks.im> To: git@vger.kernel.org Cc: Junio C Hamano , Kyle Lippincott , Jeff King X-Mailer: b4 0.14.2 Some of the callsites of GIT-VERSION-GEN generate the target file with a "+" suffix first and then move the file into place when the new contents are different compared to the old contents. This allows us to avoid a needless rebuild by not updating timestamps of the target file when its contents will remain unchanged anyway. In fact though, this exact logic is already handled in GIT-VERSION-GEN, so doing this manually is pointless. This is a leftover from an earlier version of 4838deab65 (Makefile: refactor GIT-VERSION-GEN to be reusable, 2024-12-06), where the script didn't handle that logic for us. Drop the needless indirection. Signed-off-by: Patrick Steinhardt --- Documentation/Makefile | 6 ++---- Makefile | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Documentation/Makefile b/Documentation/Makefile index 3392e1ce7ebc540784912476847380d9c1775ac8..cee88dbda66265141b87d5e5c16bf86df22fa4ef 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -211,12 +211,10 @@ XMLTO_EXTRA += --skip-validation XMLTO_EXTRA += -x manpage.xsl asciidoctor-extensions.rb: asciidoctor-extensions.rb.in FORCE - $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+ - @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi + $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@ else asciidoc.conf: asciidoc.conf.in FORCE - $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+ - @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi + $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@ endif ASCIIDOC_DEPS += docinfo.html diff --git a/Makefile b/Makefile index 79739a13d2132204f56b1ef4ca879bd51c5164b4..695a9d9765daf864605002d572129bae7a8c4e40 100644 --- a/Makefile +++ b/Makefile @@ -2512,8 +2512,7 @@ pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \ -DPAGER_ENV='$(PAGER_ENV_CQ_SQ)' version-def.h: version-def.h.in GIT-VERSION-GEN GIT-VERSION-FILE GIT-USER-AGENT - $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@+ - @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi + $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@ version.sp version.s version.o: version-def.h @@ -2554,8 +2553,7 @@ $(SCRIPT_SH_GEN) $(SCRIPT_LIB) : % : %.sh generate-script.sh GIT-BUILD-OPTIONS G mv $@+ $@ git.rc: git.rc.in GIT-VERSION-GEN GIT-VERSION-FILE - $(QUIET_GEN)$(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@+ - @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi + $(QUIET_GEN)$(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@ git.res: git.rc GIT-PREFIX $(QUIET_RC)$(RC) -i $< -o $@ From patchwork Fri Dec 20 12:22:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13916679 Received: from fout-a3-smtp.messagingengine.com (fout-a3-smtp.messagingengine.com [103.168.172.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B98D72063F7 for ; Fri, 20 Dec 2024 12:23:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.146 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734697394; cv=none; b=koRezb1+s+eGLYBqPIibK20ivyIBWl3ko/Eq2TYP/ABTS8Fmbp4hr9yOHOahWqsVbGzQZLUplSuukj4se572yr3AWMQey/zFPESUmuN/AjlYgXFZbc1C2HKuXOKHY0I1hBduitEEB39jxya/KM0Wh29lpENbBvImXfiJyHS02+I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734697394; c=relaxed/simple; bh=qlcr1aexgNWPKNRgEroH12nFd6axCzrmVs2ziB6pU28=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BjSo/DzZFDCPsdZmf8fXjfyBwinFKc04CRwHoCrDbZ9eekF29EfmNvRi4n0cY5yg4B3PFyZIxv5IhQnaZU1ddnUKy1cZZyachPbd6YU5i0khBo0AlOjMJrXpQHfz1qwDdqtvpxZGklR02B2jxSJEcaqgsoKEwN5W+n6Oiweg6m4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=SSfwE5eU; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Wkx5Uxk7; arc=none smtp.client-ip=103.168.172.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="SSfwE5eU"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Wkx5Uxk7" Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.phl.internal (Postfix) with ESMTP id B2F051380232; Fri, 20 Dec 2024 07:23:11 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Fri, 20 Dec 2024 07:23:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1734697391; x=1734783791; bh=WziJjMIxdX/teIpw2Otk8BIHCq+qz2JUdoKl0gFTuaY=; b= SSfwE5eUEQyYNN5IPEQ3nyeScC9U317mLq/uelBlbQmgCiJQMS0YdAI/Ec4CRmNV 2AtT6PisiBWtTOYmkaErHCkhC4CxRCBqGYyslZ/I7XGa8A8nRHe6Po0SCvzxcsZA eZwWH3nx1SnOgQwjyk8GpCUOkO2K4rjGEBgN6YqTrJ8sgxq5Z1Tno4zfhksyjZ/6 rF16z5u4Y3LhvV7F80nIR+3+Hl8ANLCH9SReAQ8ctK/XQXR49Z9MxLkYwZOfypB6 6WOEvadiANT9iLetyJaIsynwihiZ7aczSI5J0H/qeVVl/731m53wIG2YF/XL51nC 844kneTkE4dw7Lunb729oQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1734697391; x= 1734783791; bh=WziJjMIxdX/teIpw2Otk8BIHCq+qz2JUdoKl0gFTuaY=; b=W kx5Uxk7JvSInpEnegVRfFkBsP/NEK49TVZH0TPIYmYcItG5CNmt/DI0SrcdeiH/Z pEOVEkFb3J7NaYnzJNuP7en25AiTByPlnXIn4h69549o90mFI69nb+uoEOlA0Yj1 yIwikObZ+Q9NsEpZUTwxNYduBPcRRPZGOVGRDzyOvrtkDeSlh8SyKZyCHebnZSzK REQIK/OFt0YeuUYF0PDgkWkiGoL5fSclCI69dtbgUN477jy/Ve4HZEHxQRyCkPA5 oAVpVp9xG2oK+sTT8QBZof4IEgItkHeCL5n+JhiSWDCgPiH4PHvrI45zlzU7XN60 IcWgjwhcKHFtRYIFHtY9w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddtvddgfeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepudelvedtje duleekueetkedvhfeuuddvkeeugeelieekveejtefgfeeivedttdehnecuffhomhgrihhn pehrsgdrihhnpdgtohhnfhdrihhnnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepgedpmhho uggvpehsmhhtphhouhhtpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdroh hrghdprhgtphhtthhopehpvghffhesphgvfhhfrdhnvghtpdhrtghpthhtohepshhpvggt thhrrghlsehgohhoghhlvgdrtghomhdprhgtphhtthhopehgihhtshhtvghrsehpohgsoh igrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 20 Dec 2024 07:23:10 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 3526b290 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 20 Dec 2024 12:21:18 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 20 Dec 2024 13:22:48 +0100 Subject: [PATCH v2 4/5] Makefile: respect build info declared in "config.mak" Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241220-b4-pks-git-version-via-environment-v2-4-f1457a5e8c38@pks.im> References: <20241220-b4-pks-git-version-via-environment-v2-0-f1457a5e8c38@pks.im> In-Reply-To: <20241220-b4-pks-git-version-via-environment-v2-0-f1457a5e8c38@pks.im> To: git@vger.kernel.org Cc: Junio C Hamano , Kyle Lippincott , Jeff King X-Mailer: b4 0.14.2 In preceding commits we fixed that build info set via e.g. `make GIT_VERSION=foo` didn't get propagated to GIT-VERSION-GEN. Similarly though, setting build info via "config.mak" does not work anymore either because the variables are only declared as Makefile variables and thus aren't accessible by the script. Fix the issue by exporting those variables via "shared.mak". This also allows us to deduplicate the export of GIT_USER_AGENT. Suggested-by: Jeff King Signed-off-by: Patrick Steinhardt --- Documentation/Makefile | 4 ++-- Makefile | 2 +- shared.mak | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Documentation/Makefile b/Documentation/Makefile index cee88dbda66265141b87d5e5c16bf86df22fa4ef..4c652dfa14f6af2c1374e2f83d3311b36dd297c4 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -211,10 +211,10 @@ XMLTO_EXTRA += --skip-validation XMLTO_EXTRA += -x manpage.xsl asciidoctor-extensions.rb: asciidoctor-extensions.rb.in FORCE - $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@ + $(QUIET_GEN)$(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@ else asciidoc.conf: asciidoc.conf.in FORCE - $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@ + $(QUIET_GEN)$(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@ endif ASCIIDOC_DEPS += docinfo.html diff --git a/Makefile b/Makefile index 695a9d9765daf864605002d572129bae7a8c4e40..788f6ee1721850e75f19fe2181f578ad2e783043 100644 --- a/Makefile +++ b/Makefile @@ -2512,7 +2512,7 @@ pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \ -DPAGER_ENV='$(PAGER_ENV_CQ_SQ)' version-def.h: version-def.h.in GIT-VERSION-GEN GIT-VERSION-FILE GIT-USER-AGENT - $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@ + $(QUIET_GEN)$(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@ version.sp version.s version.o: version-def.h diff --git a/shared.mak b/shared.mak index 29bebd30d8acbce9f50661cef48ecdbae1e41f5a..8cd132b5a03b85d4eabc3819eb3d1f64d39afa47 100644 --- a/shared.mak +++ b/shared.mak @@ -116,3 +116,10 @@ endef define libpath_template -L$(1) $(if $(filter-out -L,$(CC_LD_DYNPATH)),$(CC_LD_DYNPATH)$(1)) endef + +# Export build information so that variables defined in config.mak can be read +# by GIT-VERSION-GEN. +export GIT_BUILT_FROM_COMMIT +export GIT_DATE +export GIT_USER_AGENT +export GIT_VERSION From patchwork Fri Dec 20 12:22:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13916680 Received: from fhigh-a6-smtp.messagingengine.com (fhigh-a6-smtp.messagingengine.com [103.168.172.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8889C204693 for ; Fri, 20 Dec 2024 12:23:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734697395; cv=none; b=KCH6RRmiCoAC6e8sO5FRMQXbgnRHBLoUhYGI+7bDdELDDoqpwC15A4WWF9D5LXt7OCcCyeZZQPxGyvwhWmiRGEq349wP+7s+rKUkh/4qUwWNDSjVsMZMCGJwDEm/W3pq1Qpx7S5shXTWGu0KjoeG03yD/zA3hnU6nilLOGdir9k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734697395; c=relaxed/simple; bh=SWtKVYqEH2dlesWv740OBSC1m8E0dSpAGnv/p18GXq8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WGmpZgIMzP7JcvdcHpiofWCmRytEXaRIRbyglEFQXdfGErawyBNl7RaLRVfw53K5AiyAZ7W354Xa3s0FjWcEy46CMCPl34hKfENkGa66mvoYkLF/W38DU7h2IAOnUT8tG2+o2WqJJ0IiKNwQIFHp+DC80cq6W1CZ3N56J6ETzyU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=H4gMAhaF; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=U/4LxeYu; arc=none smtp.client-ip=103.168.172.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="H4gMAhaF"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="U/4LxeYu" Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.phl.internal (Postfix) with ESMTP id B7A5E11401FE; Fri, 20 Dec 2024 07:23:11 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Fri, 20 Dec 2024 07:23:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1734697391; x=1734783791; bh=Ahhl40NFQT1iU3EMsw4mAJe4U7EYMH0GfxAueUAzjj4=; b= H4gMAhaFVsgaDMXOdqxEnVKSVlHS9VjwO0Jdp89Tw0ePLvDeuPVDwnS5tkE3pttI 2kLaQb+nHeXpdivJMmqXoqWTA7cowLZ/Cch8gkf4hqHwXOSvDzQRQWOD3jKXg9LU BrpXkK65M6cw101aVpxeHpX93BNt/ljlVd68UQ7QiUO6dJdbTnYNSpifr0Qat/41 KMQjvji0ddbQOQKVOu7mzioBSq3AxLchv7GvrlIZGginwFPA+0NqVT9s5pqymzfy xrAwAr6YaCvmMKRTlAek2haayeY8+/Q3Ys8N3BfpBn8dcFDnxc5jgpBrRE9bYTAj dU/mm4Wt+7ynAh3BuYGoFA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1734697391; x= 1734783791; bh=Ahhl40NFQT1iU3EMsw4mAJe4U7EYMH0GfxAueUAzjj4=; b=U /4LxeYuDkiHgpHBPsEHQ3SX2ix91zo4Sp8y3GQc4IDIS0nek/TZtkFMpc32SlF5X YPqZF73iPs3n+JxyYNN7vA/GkZlft2+COYJ4daZHDIjWa5W26hg9XlJBs5Q2jzmz JhZt4ASeLFizGimtoMauyZarBtbA+IMSfc5VmrQ4w5X/Ybup3GdTucRFuP2am6wi hIOGrE9Latv5/8IbI2h1ybs/0kGWUYFot/dCAMLiMk6mORE8t+O6UA723ULQE+Wz SFBDIhn379I0UJR8lU6aFuSYQECXGX3ST1u4WjB9bNb97cJiPeLJ9prh6cdo6QgA h0+/pUYzlFwfXQylX/0AA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddtvddgfeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepfeeivedtue fhudfhfedujeetieefvdelkeelffdtgeekueegjeejgfekueffhfeunecuffhomhgrihhn pegtohhnfhdrihhnpdhrtgdrihhnnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepgedpmhho uggvpehsmhhtphhouhhtpdhrtghpthhtohepshhpvggtthhrrghlsehgohhoghhlvgdrtg homhdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthht ohepphgvfhhfsehpvghffhdrnhgvthdprhgtphhtthhopehgihhtshhtvghrsehpohgsoh igrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 20 Dec 2024 07:23:10 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 64358e6d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 20 Dec 2024 12:21:19 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 20 Dec 2024 13:22:49 +0100 Subject: [PATCH v2 5/5] meson: add options to override build information Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241220-b4-pks-git-version-via-environment-v2-5-f1457a5e8c38@pks.im> References: <20241220-b4-pks-git-version-via-environment-v2-0-f1457a5e8c38@pks.im> In-Reply-To: <20241220-b4-pks-git-version-via-environment-v2-0-f1457a5e8c38@pks.im> To: git@vger.kernel.org Cc: Junio C Hamano , Kyle Lippincott , Jeff King X-Mailer: b4 0.14.2 We inject various different kinds of build information into build artifacts, like the version string or the commit from which Git was built. Add options to let users explicitly override this information with Meson. Signed-off-by: Patrick Steinhardt --- Documentation/meson.build | 1 + meson.build | 13 +++++++++++++ meson_options.txt | 10 ++++++++++ 3 files changed, 24 insertions(+) diff --git a/Documentation/meson.build b/Documentation/meson.build index f2426ccaa30c29bd60b850eb0a9a4ab77c66a629..fca3eab1f1360a5fdeda89c1766ab8cdb3267b89 100644 --- a/Documentation/meson.build +++ b/Documentation/meson.build @@ -219,6 +219,7 @@ asciidoc_conf = custom_target( input: meson.current_source_dir() / 'asciidoc.conf.in', output: 'asciidoc.conf', depends: [git_version_file], + env: version_gen_environment, ) asciidoc_common_options = [ diff --git a/meson.build b/meson.build index 0dccebcdf16b07650d943e53643f0e09e2975cc9..be32d60e841a3055ed2bdf6fd449a48b66d94cd0 100644 --- a/meson.build +++ b/meson.build @@ -201,6 +201,16 @@ if get_option('sane_tool_path') != '' script_environment.prepend('PATH', get_option('sane_tool_path')) endif +# The environment used by GIT-VERSION-GEN. Note that we explicitly override +# environment variables that might be set by the user. This is by design so +# that we always use whatever Meson has configured instead of what is present +# in the environment. +version_gen_environment = script_environment +version_gen_environment.set('GIT_BUILT_FROM_COMMIT', get_option('built_from_commit')) +version_gen_environment.set('GIT_DATE', get_option('build_date')) +version_gen_environment.set('GIT_USER_AGENT', get_option('user_agent')) +version_gen_environment.set('GIT_VERSION', get_option('version')) + compiler = meson.get_compiler('c') libgit_sources = [ @@ -1485,6 +1495,7 @@ git_version_file = custom_target( ], input: meson.current_source_dir() / 'GIT-VERSION-FILE.in', output: 'GIT-VERSION-FILE', + env: version_gen_environment, build_always_stale: true, ) @@ -1501,6 +1512,7 @@ version_def_h = custom_target( # Depend on GIT-VERSION-FILE so that we don't always try to rebuild this # target for the same commit. depends: [git_version_file], + env: version_gen_environment, ) # Build a separate library for "version.c" so that we do not have to rebuild @@ -1544,6 +1556,7 @@ if host_machine.system() == 'windows' input: meson.current_source_dir() / 'git.rc.in', output: 'git.rc', depends: [git_version_file], + env: version_gen_environment, ) common_main_sources += import('windows').compile_resources(git_rc, diff --git a/meson_options.txt b/meson_options.txt index 32a72139bae870745d9131cc9086a4594826be91..8ead1349550807420bdb95e55298ea4f3f2ea9d0 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -16,6 +16,16 @@ option('runtime_prefix', type: 'boolean', value: false, option('sane_tool_path', type: 'string', value: '', description: 'A colon-separated list of paths to prepend to PATH if your tools in /usr/bin are broken.') +# Build information compiled into Git and other parts like documentation. +option('build_date', type: 'string', value: '', + description: 'Build date reported by our documentation.') +option('built_from_commit', type: 'string', value: '', + description: 'Commit that Git was built from reported by git-version(1).') +option('user_agent', type: 'string', value: '', + description: 'User agent reported to remote servers.') +option('version', type: 'string', value: '', + description: 'Version string reported by git-version(1) and other tools.') + # Features supported by Git. option('curl', type: 'feature', value: 'enabled', description: 'Build helpers used to access remotes with the HTTP transport.')