From patchwork Mon Jan 13 08:33:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13936859 Received: from fhigh-b7-smtp.messagingengine.com (fhigh-b7-smtp.messagingengine.com [202.12.124.158]) (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 30549231A50 for ; Mon, 13 Jan 2025 08:34:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.158 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736757243; cv=none; b=RB6qYrOXKKztkweAXP54JSvewwUs7z4lLRMMJuCWogNndCWxBy4gy5GXWFS21LA0a/lV2rwo8QlKIGP/a7hfUbACGUktfQgRoSUpPo0yxb/+dLcQzJONhGElPSZjpqslRA51/Gb5Lb5AH67DbD2NBEhYibv4IMi+r3ALXZ2YP7k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736757243; c=relaxed/simple; bh=o2iWhaRDbf4mZTtvqjXbtUYxc5edAYKfxsFRwJR5zAU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=riHcjKGhJ6EuKKV+quLKBc1gezm3/3K2pQI6D/o8b2wVrbkapPE/dKe0WM8b2w7/1rnWHgAX6gbNZGPFsg903iuzd7NoRrPX/uTYWf8uLkF5Z6uPnpkK1qfPtIQhrwr8kdVctYU0LHyn9/FjSUEaQUNpTZOAat84Mm1Fy/BfZio= 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=s86uoz+i; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Q2gIlwC3; arc=none smtp.client-ip=202.12.124.158 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="s86uoz+i"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Q2gIlwC3" Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id 245E1254018C; Mon, 13 Jan 2025 03:34:01 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Mon, 13 Jan 2025 03:34:01 -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=fm2; t=1736757240; x=1736843640; bh=GHRJtpRx/lqITinIvR5+zJ7UEPtBKThxQtPc3SuCxLE=; b= s86uoz+iHQNrqSwUpuMbZOHa81543TG+C+CH/xFcp2BlbCJfqrz/w6wtdbhKywAj h925Ul7d5Ho3XgqWLCvYTy+SCvf2v9IsmSCMt+peb37Q8RnP1Cx9bYvoZzE0gslz cn+60JP/4w5JxLIeoTnKI9tznt0PJMoT+vFSJgLI4GEUDBm/aejYnYNB8F9qYqWt f7gzdXmWRPFd92YsLE9F6Z8eNGt3o1qabrEmJk7ksUMoDcVTflNKu0iAINl29Lsx Uo63pv6PNrRHHfX6MWGK0gvbvN5rR6fXJv/Nt0ZoVS1nXU7frdk69762ngkl9eSQ vbRoBwmMLyLmiT/MnVAYPg== 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=fm2; t=1736757240; x= 1736843640; bh=GHRJtpRx/lqITinIvR5+zJ7UEPtBKThxQtPc3SuCxLE=; b=Q 2gIlwC3I+NqK7wTWLnx4w56yAdS6X86kWzO0K1iSuN095zHr/FfMY1abn78/A9FG JtZOf6J9QgFHvoegfSZkyGyONBBYWLLZCWz/YVnOxtVtZHC9T0yaub7ngSczwuN+ mPC/fWjSAelZsHTKrRra3pffdJpG2pj+k2gz/GrdsCY7hfrOAPly54v8+2im1fOX /aU2QUlBKBoBUFC/1clZHd/FJ+x5E94h/hBNnw+H/beJFMygdk2VegAauwsdECJq YggPtlJ2jvNQDcNfLGWgg5vW5ok06DT6DW+cYDpbAeMCjG3IL5VsVDxYf5XJNQUL gnKOeU8r17Zn+mEUNtLUA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehfedguddulecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthekredtredt jeenucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrd himheqnecuggftrfgrthhtvghrnhepfefhueegleehfeejkedtffehvdfhvdetfefgtddu ffduveevteegueeutdekhfegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepfedpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohepvghstghhfigrrhhtiiesghgvnhhtohhordhorh hgpdhrtghpthhtohepvghvrghnrdhmrghrthhinhesghhmrghilhdrtghomhdprhgtphht thhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 13 Jan 2025 03:34:00 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id f8b8c8d8 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 13 Jan 2025 08:33:57 +0000 (UTC) From: Patrick Steinhardt Date: Mon, 13 Jan 2025 09:33:34 +0100 Subject: [PATCH 1/9] GIT-VERSION-GEN: simplify computing the dirty marker Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250113-b4-pks-meson-additions-v1-1-97f6a93f691d@pks.im> References: <20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im> In-Reply-To: <20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im> To: git@vger.kernel.org Cc: Evan Martin , Eli Schwartz X-Mailer: b4 0.14.2 The GIT-VERSION-GEN script computes the version that Git is being built from. When building from a commit with an unclean worktree it knows to append "-dirty" to that version to indicate that there were custom changes applied and that it isn't the exact same as that commit. The dirtiness check is done manually via git-diff-index(1), which is somewhat puzzling though: we already use git-describe(1) to compute the version, which also knows to compute dirtiness via the "--dirty" flag. But digging back in history explains why: the "-dirty" suffix was added in 31e0b2ca81 (GIT 1.5.4.3, 2008-02-23), and git-describe(1) didn't yet have support for "--dirty" back then. Refactor the script to use git-describe(1). Despite being simpler, it also results in a small speedup: Benchmark 1: git describe --dirty --match "v[0-9]*" Time (mean ± σ): 12.5 ms ± 0.3 ms [User: 6.3 ms, System: 8.8 ms] Range (min … max): 12.0 ms … 13.5 ms 200 runs Benchmark 2: git describe --match "v[0-9]*" HEAD && git update-index -q --refresh && git diff-index --name-only HEAD -- Time (mean ± σ): 17.9 ms ± 1.1 ms [User: 8.8 ms, System: 14.4 ms] Range (min … max): 17.0 ms … 30.6 ms 148 runs Summary git describe --dirty --match "v[0-9]*" ran 1.43 ± 0.09 times faster than git describe --match "v[0-9]*" && git update-index -q --refresh && git diff-index --name-only HEAD -- While the speedup doesn't really matter on Unix-based systems, where filesystem operations are typically fast, they do matter on Windows where the commands take a couple hundred milliseconds. A quick and dirty check on that system shows a speedup from ~800ms to ~400ms. Signed-off-by: Patrick Steinhardt --- GIT-VERSION-GEN | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index f2af817feaeb384dee0ffd197f02a31cf2d31f87..754b8ca9eedaa2f7e3b61c83c1cc763538394fe6 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -39,13 +39,9 @@ then test -d "${GIT_DIR:-.git}" || test -f "$SOURCE_DIR"/.git; } && - VN=$(git -C "$SOURCE_DIR" describe --match "v[0-9]*" HEAD 2>/dev/null) && + VN=$(git -C "$SOURCE_DIR" describe --match --dirty "v[0-9]*" 2>/dev/null) && case "$VN" in *$LF*) (exit 1) ;; - v[0-9]*) - git -C "$SOURCE_DIR" update-index -q --refresh - test -z "$(git -C "$SOURCE_DIR" diff-index --name-only HEAD --)" || - VN="$VN-dirty" ;; esac then VN=$(echo "$VN" | sed -e 's/-/./g'); From patchwork Mon Jan 13 08:33:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13936860 Received: from fhigh-b7-smtp.messagingengine.com (fhigh-b7-smtp.messagingengine.com [202.12.124.158]) (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 8F74023312B for ; Mon, 13 Jan 2025 08:34:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.158 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736757244; cv=none; b=Xp7TxwFEVnDb83eTlcU21cCpAyCuqvtOEGbfuBR8x9go9iI4gCLHAWCy/luraPaM2EDQwYAJ4CXHDFOgzbC1JFyviFlqI/QVXL+fA9xBuk3058rC/BoAtrTKospVlq/164Yz0TntyqlT/Kwvww7q8skolS9avZ9yAbHPCqiDfac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736757244; c=relaxed/simple; bh=tZ9c3Ihxsz/uqtX0vJc73Magx9vZJeYlJGXD6o7uy5E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SKbR5ek07T/cQgjWRU53vBRCW1Cj5EvEOqzmEL3KEAgV2m+Au01URCoVz1Kq5M3n8v+awawoWaAWOkWkWLe4noWy3IEyDuu+Q6L7R6uZ3yhQmf5r7I75E600+ZQZbKz9WVYiW6pkI6VpYyV5B+8tRiwwQ6duA14aQDKqWotjSHQ= 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=qe0xiblG; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=lvrwm0JA; arc=none smtp.client-ip=202.12.124.158 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="qe0xiblG"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="lvrwm0JA" Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id 61DD7254018E; Mon, 13 Jan 2025 03:34:01 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Mon, 13 Jan 2025 03:34:01 -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=fm2; t=1736757241; x=1736843641; bh=BF5f7yyPmFalPFQl2+sHm0F7xvJc+32riwuroaNcLTg=; b= qe0xiblG5/owqP8pBjy6wYZ4E1XIAHD0Pmf+337oe9304InndtIks9XnBph7esXG Opq9cqJBRDiR6RX4wH1zGVIgWSL/suFaSDaqOACunKpRnJSmBTXn3t4ErRKy2/Ej IXj73MRFrvm494DVAUf+yZHuzIc5hEsaXrg1jTRBkLRHwxDi2/95Z5/ta0SbPZPJ 4T1zKLXLzVHal1GluzhybMwQJxF8aOS525EKpeHdVYMmDiS0zOnUh9sXoL+1yEtw EN3j64KMBTDhjK690uEODMXPVSW/J5B0i4uu0HlJ+2ZsysZ2CcYpeE5n780+UKpx wZQ8Jbvu4IjbZI636Wuwtg== 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=fm2; t=1736757241; x= 1736843641; bh=BF5f7yyPmFalPFQl2+sHm0F7xvJc+32riwuroaNcLTg=; b=l vrwm0JACG4ym13wZ7YS1IRKl0E4ODvz3bm28ewqqcG3uXsmRxaisKOivDT/PbhQJ Lvb8kxG0R1EL8vYbIMqBVvZ2DGMwi4+V7azeO6atuvqesIiy1ukgIrrMIM1FmXUc O0ymN970/IlEJJRBrah6RkrD3Q5JraCYUy4pDTQvjzHrZZ7nihXj96MFNapvHP5/ 53U3914vGHYBg1UMA7nKmvGygTdf45RwqEF7CZwD1JBxrVoBYJrbgZnvQuyLCY8L lr7wbyzO4/OPgffD3TmplDcUVB0NGoiWBAR2kzbjLTjUb9YeNuZWBC8CkHoINnGX h0nKqfjmbgJttEJ1JwFHA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehfedguddulecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrd himheqnecuggftrfgrthhtvghrnhepffeuiedujedvkeehuedvkeefffeivdeuleetkedu heejteekgedvudfgtdfgieelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepfedpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohepvghvrghnrdhmrghrthhinhesghhmrghilhdrtg homhdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthht ohepvghstghhfigrrhhtiiesghgvnhhtohhordhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 13 Jan 2025 03:34:00 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 16b02d41 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 13 Jan 2025 08:33:58 +0000 (UTC) From: Patrick Steinhardt Date: Mon, 13 Jan 2025 09:33:35 +0100 Subject: [PATCH 2/9] GIT-VERSION-GEN: move default version into a separate file Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250113-b4-pks-meson-additions-v1-2-97f6a93f691d@pks.im> References: <20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im> In-Reply-To: <20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im> To: git@vger.kernel.org Cc: Evan Martin , Eli Schwartz X-Mailer: b4 0.14.2 The Git version for Meson is currently wired up manually. It can thus grow (and alread has grown) stale quite easily, as having multiple sources of truth is never a good idea. This issue is mostly of cosmetic nature as we don't use the project version anywhere, and instead use the GIT-VERSION-GEN script to propagate the correct version into our build. But it is somewhat puzzling when `meson setup` announces to build an old Git release. There are a couple of alternatives for how to solve this: - We can keep the version undefined, but this makes Meson output "undefined" for the version, as well. - We can adapt GIT-VERSION-GEN so that it knows to print a version to stdout with a specific invocation and then use `run_command()`. At the point of configuring the project we haven't yet figured out host details though, and thus we didn't yet set up the shell environment. While not an issue for Unix-based systems, this would be an issue in Windows, where the shell typically gets provided via Git for Windows and thus requires some special setup. - We can pull the default version out of GIT-VERSION-GEN and move it into its own file. This likely requires some adjustments for scripts that bump the version, but allows Meson to read the version from that file trivially. The last option is a proper solution and quite trivial to implement, and adapting scripts should be a one-time event. Refactor GIT-VERSION-GEN accordingly. This refactoring also prepares for a planned consolidation of all build scripts into a separate folder. This should reduce clutter and make it easier to find all scripts part of the build process. Signed-off-by: Patrick Steinhardt --- GIT-VERSION | 1 + GIT-VERSION-GEN | 4 ++-- meson.build | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/GIT-VERSION b/GIT-VERSION new file mode 100644 index 0000000000000000000000000000000000000000..ed39430ff189488182bc6d651bdb88a531498baa --- /dev/null +++ b/GIT-VERSION @@ -0,0 +1 @@ +v2.48.0 diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 754b8ca9eedaa2f7e3b61c83c1cc763538394fe6..95d7d41d233450774a6580c0de332e7b8f69eb4e 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,5 @@ #!/bin/sh -DEF_VER=v2.48.0 - LF=' ' @@ -21,6 +19,8 @@ then exit 1 fi +DEF_VER=$(cat "$SOURCE_DIR"/GIT-VERSION) + # Protect us from reading Git version information outside of the Git directory # in case it is not a repository itself, but embedded in an unrelated # repository. diff --git a/meson.build b/meson.build index 7361eb2eaad422e7a6c6ed95d275615836c21cdb..87755537d2aff84a9d8e86f0f5b025ef8dd23292 100644 --- a/meson.build +++ b/meson.build @@ -170,7 +170,7 @@ project('git', 'c', meson_version: '>=0.61.0', - version: 'v2.47.GIT', + version: files('GIT-VERSION'), ) fs = import('fs') From patchwork Mon Jan 13 08:33:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13936861 Received: from fout-b8-smtp.messagingengine.com (fout-b8-smtp.messagingengine.com [202.12.124.151]) (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 965B5232363 for ; Mon, 13 Jan 2025 08:34:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.151 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736757245; cv=none; b=NXqbCoDzZRnEoHftZDubKBCLMtybLrHHn8MZ8KVulNZvczPEfScDU0sv40mzVufHFtnDZAuxP/uXH9o3fp1ZX1K/oi0ShVsPUCBdG2lCtKz1Ar9kbn8VlEvZN2z9y3MMNT4hjq5shke0Slv6QIYBEflHeDTScG8Nr+W9x4vi25c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736757245; c=relaxed/simple; bh=/lFcYwQwwr/JWz6QndIhMdmKvTZ1FxpKRHcpvIjNeAg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mEfM6f6UoKKwxsBixmPvLIzefZEKc/vBLIqyZhumPL7xnASz5h1FtgUmVBI1fxJVpnTucSx8QX0GSDd5E3DHekTl2MQ3GA7peSyy5MWr6Ys7v121eeSFwIJT/FHAF4vWefeeVVviJ109RKyRywgIgc6w4opePYu0x8oaQMtGFUQ= 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=ktHKT9Lg; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=A/WGzYaZ; arc=none smtp.client-ip=202.12.124.151 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="ktHKT9Lg"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="A/WGzYaZ" Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.stl.internal (Postfix) with ESMTP id 840C21140137; Mon, 13 Jan 2025 03:34:02 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Mon, 13 Jan 2025 03:34:02 -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=fm2; t=1736757242; x=1736843642; bh=XFWOj80HCvIhoQUsy7UtRYe4iObon1cXrYB9d6YpteA=; b= ktHKT9Lg/bBb8vBGYBXoHyp/gMIQeg7b2nC3KsJSWpX7aXwTySnl4OxhazU/Z/ae Aqdn36EX+ByTiNyEjGRgUiWGxAOHX2f8YKPRqzoTGVv9SZ6rAorHMB/iZgYovtyO xZN4OJk8ANl2maH8ZZac23ri0vqeUxvQWOQWFtVonlsqhEBY6M0KgqPOpf356dq0 DBk1VAh9aGgSnMudca9iPAZYFmJ7RsTbEckcFOvrg1zBc9lzRiMdJgPFtjMeOtDL 6kIIa6RnaPBS6uDazflHy+u0Q9+uJmZzvphq1sbLAfuaGHFf5CQ14Z2EIsHUaJBX 8gTsI+SAtF9ThtaVSkD3yQ== 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=fm2; t=1736757242; x= 1736843642; bh=XFWOj80HCvIhoQUsy7UtRYe4iObon1cXrYB9d6YpteA=; b=A /WGzYaZhR3qzMoWyiI8HAbv21Y/XxhqUQx4uVJyO2OQawmoPTfoTD2KHOaxgJvn+ 4WagsAoAU+kFEdm4WFFoAC39ZlRSs8a8cyx8SW7Rg41seepaZUcbLu5w6X0XZFrK Meui520eL57586xev3Wuz9jQUAyBhRJVE9aHLsT7J0NM0MDxhvZDZi4DjhzP9XYs i/OJ5QCbDfWPc4rQO4Vjjka0jpatsYxleJzTWilLXxxEEBEnk+wE4Rmky8uaUvQE Qhz2BgdHFCuIoQ+rLbBi8TCsJk9e3ANLcjTWBjTQEyI3Qjl6Uu4Nm+ijzt7Urr+l 76/ZjmG5EzAr0zvQmcdWw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehfedguddulecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrd himheqnecuggftrfgrthhtvghrnhepffeuiedujedvkeehuedvkeefffeivdeuleetkedu heejteekgedvudfgtdfgieelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepfedpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohepvghvrghnrdhmrghrthhinhesghhmrghilhdrtg homhdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthht ohepvghstghhfigrrhhtiiesghgvnhhtohhordhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 13 Jan 2025 03:34:01 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id cf57043b (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 13 Jan 2025 08:33:59 +0000 (UTC) From: Patrick Steinhardt Date: Mon, 13 Jan 2025 09:33:36 +0100 Subject: [PATCH 3/9] meson: fix dependencies for generated headers Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250113-b4-pks-meson-additions-v1-3-97f6a93f691d@pks.im> References: <20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im> In-Reply-To: <20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im> To: git@vger.kernel.org Cc: Evan Martin , Eli Schwartz X-Mailer: b4 0.14.2 We generate a couple of headers from our documentation. These headers are added to the libgit sources, but two of them aren't used by the library, but instead by our builtins. This can cause parallel builds to fail because the builtin object may be compiled before the header was generated. Fix the issue by adding both "config-list.h" and "hook-list.h" to the list of builtin sources. While "command-list.h" is generated similarly, it is used by "help.c" and thus part of the libgit sources indeed. Reported-by: Evan Martin Signed-off-by: Patrick Steinhardt --- meson.build | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/meson.build b/meson.build index 87755537d2aff84a9d8e86f0f5b025ef8dd23292..e278ff207a7714fbb6b6cf8e1ec1fcca37360bd0 100644 --- a/meson.build +++ b/meson.build @@ -480,6 +480,13 @@ libgit_sources = [ 'xdiff/xutils.c', ] +libgit_sources += custom_target( + input: 'command-list.txt', + output: 'command-list.h', + command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'], + env: script_environment, +) + builtin_sources = [ 'builtin/add.c', 'builtin/am.c', @@ -607,14 +614,7 @@ builtin_sources = [ 'builtin/write-tree.c', ] -libgit_sources += custom_target( - input: 'command-list.txt', - output: 'command-list.h', - command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'], - env: script_environment, -) - -libgit_sources += custom_target( +builtin_sources += custom_target( output: 'config-list.h', command: [ shell, @@ -625,7 +625,7 @@ libgit_sources += custom_target( env: script_environment, ) -libgit_sources += custom_target( +builtin_sources += custom_target( input: 'Documentation/githooks.txt', output: 'hook-list.h', command: [ From patchwork Mon Jan 13 08:33:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13936862 Received: from fhigh-b7-smtp.messagingengine.com (fhigh-b7-smtp.messagingengine.com [202.12.124.158]) (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 B4CA4233D69 for ; Mon, 13 Jan 2025 08:34:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.158 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736757246; cv=none; b=tUctrYzwlLASloUo8Vbx8UPks9t+6rF+/TZu0YQxPplVeXdRvCv0RKexRCT+bJrD2LoxQwVKPDudiXAiBeKc+795pszrHVUZE2rQzgj5oPTSkcCBpqWelbNJes+zdbt6RTaHWeBPBdKbHWUic7GHIDkUo0oMNMXNJM2FxPdiGAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736757246; c=relaxed/simple; bh=W+VFHoOUO+RRe7F8s14UIdnp/zEkTVdHI8vOShzRrSA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mL8FXm23kCWFJHKYd9MGIgm30f7Uh9UXH0fp5FX9a5DCyc1MVVGtEFUDGXve/OL7tyNcsUDKLXJKEviAcS2tmihR6Qusq6EyW4XhQQF/StUIe4iYBawDcwJH7AgE1nVng2K5gwYTr9bq8iDfDH35MTr6Q8rc5gsktpyla6vzR9M= 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=MnK65Ipi; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=iXOZm/N2; arc=none smtp.client-ip=202.12.124.158 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="MnK65Ipi"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="iXOZm/N2" Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id BD48C2540191; Mon, 13 Jan 2025 03:34:02 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Mon, 13 Jan 2025 03:34:02 -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=fm2; t=1736757242; x=1736843642; bh=DEApv3Aa6ippS6UuHrYggXWOuZURAB4yzCQZcLDomeA=; b= MnK65IpiEWeaoR9l/tOmEo+D3jF0sa6cYifrjky5RS+23vieOu8JHlRfV8Cb/ogd x/4NZatmhvHOqKcSpReWcRx4SAj5z4y9Gj09r5vUzcOtBTl1HDTZEZZ5VfiKBkg/ R5mBj9p0zLqptj+xpCtT+MTTHuL6TviJnjAaAjE7MU4F+KAAhGWIDzad8ellIG9r tmUAZXiGoVdwTQYQNi67X1ksETFjh83xL3h2t+kLPP4FzgdI4mTYLw2lQwOx9vcX mI+my4+2rJjnlxfUA2SlyGUeWE9nYkxo1tZNQoMwdpMs/DkwZdIakRnssQnzft9j AKg/kqXo+HvqR1Bl3umjPQ== 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=fm2; t=1736757242; x= 1736843642; bh=DEApv3Aa6ippS6UuHrYggXWOuZURAB4yzCQZcLDomeA=; b=i XOZm/N2iYHmQchF+khabTL3P+gyIH4354ms1MfemJMsODL7PDzJCwdAlyXaixSwq ntXllFFReWetIvlKGHXb7YX65nI0soPjnFwQk4m05SvWtlszCX8Pr1Qt0JZx6A8W fMZMPjLdDr5KGJ611xdqPdAWsOTp2m2MKeYOKSprmWgKFShZwSCShbpNWZBwHwp6 pgUIfxPglXpwsvkgoxhqYAdKdTlwvvh88qVbnM04sgtrMuw6fQ2YkCOPzfQSOwCh yVgrHAp2bVkeK/rmB2C5uF09XgDEg5Rp9wbamqJI03i7HpiMCIkLc5sOCPDOPTCa cEp+ncBaGabp8QR8bNWDQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehfedguddulecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrd himheqnecuggftrfgrthhtvghrnhepffeuiedujedvkeehuedvkeefffeivdeuleetkedu heejteekgedvudfgtdfgieelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepfedpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohepvghvrghnrdhmrghrthhinhesghhmrghilhdrtg homhdprhgtphhtthhopegvshgthhifrghrthiisehgvghnthhoohdrohhrghdprhgtphht thhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 13 Jan 2025 03:34:01 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id c8fde734 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 13 Jan 2025 08:34:00 +0000 (UTC) From: Patrick Steinhardt Date: Mon, 13 Jan 2025 09:33:37 +0100 Subject: [PATCH 4/9] meson: wire up development environments Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250113-b4-pks-meson-additions-v1-4-97f6a93f691d@pks.im> References: <20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im> In-Reply-To: <20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im> To: git@vger.kernel.org Cc: Evan Martin , Eli Schwartz X-Mailer: b4 0.14.2 The Meson build system is able to wire up development environments. The intent is to make build artifacts of the project available. This is typically used to export e.g. paths to linkable libraries, which isn't all that interesting in our context given that we don't have an official library interface. But what we can use this mechanism for is to expose the built Git executables as well as the build directory. This allows users to play around with the built Git version in the devenv, and allows them to execute our test scripts directly with the built distribution. Wire up this feature, which can then be used via `meson devenv` in the build directory. Signed-off-by: Patrick Steinhardt --- meson.build | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/meson.build b/meson.build index e278ff207a7714fbb6b6cf8e1ec1fcca37360bd0..0b559215e4f105ac87bd580d755f88c32b7b36ca 100644 --- a/meson.build +++ b/meson.build @@ -1932,6 +1932,14 @@ configure_file( configuration: build_options_config, ) +# Development environments can be used via `meson devenv -C `. This +# allows you to execute test scripts directly with the built Git version and +# puts the built version of Git in your PATH. +devenv = environment() +devenv.set('GIT_BUILD_DIR', meson.current_build_dir()) +devenv.prepend('PATH', meson.current_build_dir() / 'bin-wrappers') +meson.add_devenv(devenv) + summary({ 'curl': curl.found(), 'expat': expat.found(), From patchwork Mon Jan 13 08:33:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13936864 Received: from fout-b8-smtp.messagingengine.com (fout-b8-smtp.messagingengine.com [202.12.124.151]) (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 E3CDC233D9F for ; Mon, 13 Jan 2025 08:34:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.151 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736757246; cv=none; b=duUzlO3Rfn+jOHdtDg0vXLEMsqvHsPY6Pv8WxM0ejsl0id8yA5F53TElgfgMbQYQLuAbTqWdPnYqD1oQtlTTb6GLsG7xvtJWi7JG6aZ3KkUYN81F2ppNQ8UJnu5O2f82cHw7uo6sgOSGZ8qbOYFoSGLct4l7ELggGAYXIjVhj7w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736757246; c=relaxed/simple; bh=3YeJFig2P33DViIlP75fmV0deVT8jf7CEZJ/2REuAqE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kvAEidzWWWuTykSZFWMKG/J6URbzfdI4dEaOEothskh0lpnkwu456aJaXWV9+sEhgJue00YcwVblI8mFTX9aC5qrC0ilcxSfbGeSEZwroGiG/eFXMxvQnbmOGpmr6S0/Jy1y+WMzkDm0n+Vqx5f+Zn+0PHUeLf6C9DudzhuEeb0= 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=H/K4t595; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=XvucEmyW; arc=none smtp.client-ip=202.12.124.151 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="H/K4t595"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="XvucEmyW" Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfout.stl.internal (Postfix) with ESMTP id 19EE51140146; Mon, 13 Jan 2025 03:34:04 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Mon, 13 Jan 2025 03:34:04 -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=fm2; t=1736757243; x=1736843643; bh=wxH4C9UoPNS3Ntoc5IWVDbLhRGUV6ASH7dfCEJzBncs=; b= H/K4t595iljLCJelGgWOdEALnVYOZim+NHTEXE+/6o8yaAOr2PKjHlPDJY8Ws8YC GACghJ1IXoRNlMtszptJgWoGTbRt8SM9l+JzUpYDSFRMWfzAtGS9ZQCQC8+OVgQq vM9hLTQjokZ5ig7oT/n5wCdB1brP0ObeQUNeWC6ORBJdbOCBgzz6lMUBnRF4mT0e hw73s4g6yMh8AVp0q9RJY8474k9ig0QdT9AfvY4fAbDX8akAONFQk/dF5xTnycKt /Jskk/au+NY62QEZCnYzIWWXQO+j1HvhMoPUBZJhnSB7ah0Dy/4VKt5iTyWkvN4+ /zHDEhK9QeJ84WAwitXOYQ== 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=fm2; t=1736757243; x= 1736843643; bh=wxH4C9UoPNS3Ntoc5IWVDbLhRGUV6ASH7dfCEJzBncs=; b=X vucEmyWxTVkjvH9oaBn0sO5EkdDV7rHxyasHRr2GwZzLhEkr+LH+Qd3EDldJeCeO rFcYDo91br7Tg0JyvRQDm9UvDmgnZRnyehrtoWsFxIUQMvj8BMFs2izPgovnOp3R /oEF8/hzl3uwbCU8CuUMrEONahCNmvRPZ++AGjY13OScL/NQQCKda6NrdWvBpc6h CaoJufXzc0E3wgUwbT4A2+Gn1VWHNj5FWOfGp78Ive9hbgwi3tjiFavD7Jp1X/fX 7LzHumwUjfRXBcWEEmqpGq7ZsUqYX+dreoZk/HFtJoSb6sebhagGy3jFV8fGM97z rp/j1f7J1LCzsWLyq22Ww== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehfedguddulecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrd himheqnecuggftrfgrthhtvghrnhepffeuiedujedvkeehuedvkeefffeivdeuleetkedu heejteekgedvudfgtdfgieelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepfedpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrgh dprhgtphhtthhopegvvhgrnhdrmhgrrhhtihhnsehgmhgrihhlrdgtohhmpdhrtghpthht ohepvghstghhfigrrhhtiiesghgvnhhtohhordhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 13 Jan 2025 03:34:02 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 8736ad66 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 13 Jan 2025 08:34:01 +0000 (UTC) From: Patrick Steinhardt Date: Mon, 13 Jan 2025 09:33:38 +0100 Subject: [PATCH 5/9] meson: wire up generation of distribution archive Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250113-b4-pks-meson-additions-v1-5-97f6a93f691d@pks.im> References: <20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im> In-Reply-To: <20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im> To: git@vger.kernel.org Cc: Evan Martin , Eli Schwartz X-Mailer: b4 0.14.2 Meson knows to generate distribution archives via `meson dist`. Despite generating the archive itself, this target also knows to compile and execute tests from that archive, which helps to ensure that the result is an adequate drop-in replacement for the versioned project. While this already works as-is, one omission is that we don't propagate the commit that this is built from into the resulting archive. This can be fixed though by adding a distribution script that propagates the version into the "version" file, which GIT-VERSION-GEN knows to read if present. Use GIT-VERSION-GEN itself to populate that file. There are two smallish gotchas: - The script is executed in the build directory, not in the directory where we generate the archive. The target directory is propagated via the "MESON_DIST_ROOT" environment variable, but because we don't use a shell to execute GIT-VERSION-GEN we cannot populate the envvar into its arguments. We thus adapt GIT-VERSION-GEN to handle this for us. - We use the "GIT-VERSION-FILE.in" template to generate the version, which contains a "GIT_VERSION=" prefix that we need to strip after reading the "version" file. We could avoid this extra logic if we used a template that only had the `@GIT_VERSION@` placeholder, but it would require us to add one more template file. Signed-off-by: Patrick Steinhardt --- GIT-VERSION-GEN | 7 ++++++- meson.build | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 95d7d41d233450774a6580c0de332e7b8f69eb4e..1f0fb4098da392511f02a34cdcc84f3889771001 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -19,6 +19,11 @@ then exit 1 fi +if test -n "$OUTPUT" && test -n "$MESON_DIST_ROOT" +then + OUTPUT="$MESON_DIST_ROOT/$OUTPUT" +fi + DEF_VER=$(cat "$SOURCE_DIR"/GIT-VERSION) # Protect us from reading Git version information outside of the Git directory @@ -33,7 +38,7 @@ then # then try git-describe, then default. if test -f "$SOURCE_DIR"/version then - VN=$(cat "$SOURCE_DIR"/version) || VN="$DEF_VER" + VN=$(cat "$SOURCE_DIR"/version) && VN=${VN#GIT_VERSION=} || VN="$DEF_VER" elif { test -d "$SOURCE_DIR/.git" || test -d "${GIT_DIR:-.git}" || diff --git a/meson.build b/meson.build index 0b559215e4f105ac87bd580d755f88c32b7b36ca..771bdded484a0c0e8638e7c6555e3f4e09e64025 100644 --- a/meson.build +++ b/meson.build @@ -1940,6 +1940,18 @@ devenv.set('GIT_BUILD_DIR', meson.current_build_dir()) devenv.prepend('PATH', meson.current_build_dir() / 'bin-wrappers') meson.add_devenv(devenv) +# Generate the 'version' file in the distribution tarball. This is used via +# `meson dist -C ` to populate the source archive with the Git +# version that the archive is being generated from. GIT-VERSION-GEN knows to +# pick up this file. +meson.add_dist_script( + shell, + meson.current_source_dir() / 'GIT-VERSION-GEN', + meson.current_source_dir(), + meson.current_source_dir() / 'GIT-VERSION-FILE.in', + 'version', +) + summary({ 'curl': curl.found(), 'expat': expat.found(), From patchwork Mon Jan 13 08:33:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13936863 Received: from fhigh-b7-smtp.messagingengine.com (fhigh-b7-smtp.messagingengine.com [202.12.124.158]) (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 119FB2343A1 for ; Mon, 13 Jan 2025 08:34:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.158 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736757246; cv=none; b=XlxanFU7h7dBebhPznXxPQgG2+ejJzbSQ7jy/X22ARsK+JbwL47fo1czOKKSl4zj63pmdUzKVOd7iaOn6I5tThNmAWOwmxY7hH50HkUlg8Oa9qjC/T/io1ykAtyeY5yjsiI23zA9BjB0+DuLgYHAMmm16rxEvzc1eCCS018S9HY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736757246; c=relaxed/simple; bh=PtpNxVcpEdRpAfiEu1BNRjy4Luz6xdm90zoH+u2SvVI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UOO5S7C+P6YbzHj4/ewm/IuW8rymzU9/zako5S0q1wxMtQisK1v3bMEJhEsB2N37fgRoLA31SQTmWosawWUn7+Y/2h2TujC6oS1rrJB0aWW2tseZ6hYRCJaYntes/gHVZkFHFFS1rtXNTGREv2naeU2vfleiA5QFkwSsrCWx9U8= 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=PuPfyiT0; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=FU2TjleM; arc=none smtp.client-ip=202.12.124.158 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="PuPfyiT0"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="FU2TjleM" Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.stl.internal (Postfix) with ESMTP id 36B12254018C; Mon, 13 Jan 2025 03:34:04 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Mon, 13 Jan 2025 03:34:04 -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=fm2; t=1736757244; x=1736843644; bh=H32mhsTgL/5r5cg5hwF0U3hC8O4vO02/2SkOsjMCpgo=; b= PuPfyiT0jYyFXiCqipYNYw9WasTbLrId36xy2BeNWv8BSJcWr1IXS866Tke0wu5q zJqxwpfwad3B4p61IfmYLLJJEAr/SiMyy9/eEYQ6/4QtHhXlIw+5+NERl0/coKO5 v6/Rr5P2DiFSajuw7hEpdqRY1eEldJN/tuexzIPtAg7JbnBO0JGCsWHzaTKD4Xpm cM/uEVbXl+h2XME4CdY9cgStOHG0HxOr92+OBw3poXq56ZV+lG2pFyN9msq/SfV4 PYUUoacLoDkGFyjsWDu3LCiPaAWQ0TtUKVkwNGeMilm7eTldetjzblxC/xSO7xUu 21DrwNr5DKrXftbi0XMeqg== 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=fm2; t=1736757244; x= 1736843644; bh=H32mhsTgL/5r5cg5hwF0U3hC8O4vO02/2SkOsjMCpgo=; b=F U2TjleMERibKutVHljx142LmVDEAksCegiIXNlX7ExcbokbJjBXGiMJrOrMr3tIy ff3C2KIEnE7MWlxycMz8wnpi615dMsrEzBwsUnMyqaH1sxo3Tr1YyhdSSL2LOXxJ p0HNCLC72kppGOQvm4CiWSBp7MFpUFoN2xZlpsIcnWgnlXEaaMC5n79//U6jgzmd JRQHaK4rM+yi9/zu5frzXzUYqJYOjSpjWqK5P6ZciY5nMxLmAJNIJ+6Do+crb3tm ODuIMh7PjE2gXOOARtS0R5SB7YqmHEyzWf/DATxcpoBKFgoe3hN/Q8uvHKry5Ae3 7UYSrDryivISW4kTwcthA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehfedguddulecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrd himheqnecuggftrfgrthhtvghrnhepffeuiedujedvkeehuedvkeefffeivdeuleetkedu heejteekgedvudfgtdfgieelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepfedpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrgh dprhgtphhtthhopegvvhgrnhdrmhgrrhhtihhnsehgmhgrihhlrdgtohhmpdhrtghpthht ohepvghstghhfigrrhhtiiesghgvnhhtohhordhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 13 Jan 2025 03:34:03 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id f1375057 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 13 Jan 2025 08:34:02 +0000 (UTC) From: Patrick Steinhardt Date: Mon, 13 Jan 2025 09:33:39 +0100 Subject: [PATCH 6/9] meson: wire up fuzzers Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250113-b4-pks-meson-additions-v1-6-97f6a93f691d@pks.im> References: <20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im> In-Reply-To: <20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im> To: git@vger.kernel.org Cc: Evan Martin , Eli Schwartz X-Mailer: b4 0.14.2 Meson does not yet know to build our fuzzers. Introduce a new build option "fuzzers" and wire up the fuzzers in case it is enabled. Adapt our CI jobs so that they build the fuzzers by default. Signed-off-by: Patrick Steinhardt --- ci/run-build-and-tests.sh | 3 ++- meson.build | 4 ++++ meson_options.txt | 2 ++ oss-fuzz/meson.build | 20 ++++++++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh index 76667a1277720d74e09e8da227b5e0832003e0e2..6c828c3b755153dab179f73346e7124bda49c90e 100755 --- a/ci/run-build-and-tests.sh +++ b/ci/run-build-and-tests.sh @@ -53,7 +53,8 @@ case "$jobname" in *-meson) group "Configure" meson setup build . \ --warnlevel 2 --werror \ - --wrap-mode nofallback + --wrap-mode nofallback \ + -Dfuzzers=true group "Build" meson compile -C build -- if test -n "$run_tests" then diff --git a/meson.build b/meson.build index 771bdded484a0c0e8638e7c6555e3f4e09e64025..5e1373f6a52a91beb527d00d8fd5c55d377c718b 100644 --- a/meson.build +++ b/meson.build @@ -1899,6 +1899,10 @@ if get_option('tests') subdir('t') endif +if get_option('fuzzers') + subdir('oss-fuzz') +endif + subdir('bin-wrappers') if get_option('docs') != [] subdir('Documentation') diff --git a/meson_options.txt b/meson_options.txt index 89b01bad042b533b23e0e2b4b780ce152ee688c8..34ba679cf931b67a794a9bb7e765bfb22106381e 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -95,3 +95,5 @@ option('tests', type: 'boolean', value: true, description: 'Enable building tests. This requires Perl, but is separate from the "perl" option such that you can build tests without Perl features enabled.') option('test_output_directory', type: 'string', description: 'Path to the directory used to store test outputs') +option('fuzzers', type: 'boolean', value: false, + description: 'Enable building fuzzers.') diff --git a/oss-fuzz/meson.build b/oss-fuzz/meson.build new file mode 100644 index 0000000000000000000000000000000000000000..ed79665501655eae4948623c07114fab23a55393 --- /dev/null +++ b/oss-fuzz/meson.build @@ -0,0 +1,20 @@ +fuzz_programs = [ + 'fuzz-commit-graph.c', + 'fuzz-config.c', + 'fuzz-credential-from-url-gently.c', + 'fuzz-date.c', + 'fuzz-pack-headers.c', + 'fuzz-pack-idx.c', + 'fuzz-parse-attr-line.c', + 'fuzz-url-decode-mem.c', +] + +foreach fuzz_program : fuzz_programs + executable(fs.stem(fuzz_program), + sources: [ + 'dummy-cmd-main.c', + fuzz_program, + ], + dependencies: [libgit, common_main], + ) +endforeach From patchwork Mon Jan 13 08:33:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13936865 Received: from fout-b8-smtp.messagingengine.com (fout-b8-smtp.messagingengine.com [202.12.124.151]) (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 3AE5E2343A5 for ; Mon, 13 Jan 2025 08:34:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.151 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736757247; cv=none; b=iMn+0TK/WXfmvcyRfO+nekN4Lb2rB8nJ3zZeeZ3cNXuaGioEXoJlJowZp7/xKsBrAcZF87y3blI9l7W/sIce4ZwaGk3v1WvqPd/Z5a6YmZ7NXsLAy8NeWFr+h5wnsPio6PjBWmMRkpWU1MD5yWKJ/YeVc49eGKzypsOnhKLCqA4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736757247; c=relaxed/simple; bh=kB5zdHoXu3t+oPAvdoE5S81nT4nrfyXveLXDLoyZDHo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JDrh6w4exBel2nJ/YvjM0U/JUtHwaUOKsiBfewK/RMTdGWmYfGSJoN4buZ9TsNSPwRe4CUZx2P5DAXmrBBaEz0GNQzxQe+jx2EAFqL9a5s/gmitUNJtM/ilwVvgpt1aFUESBli6ko/cyPv63EebFLmouz0rF67A4lf+z74H1HkY= 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=mbS6Lioo; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=TDeMFcK1; arc=none smtp.client-ip=202.12.124.151 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="mbS6Lioo"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="TDeMFcK1" Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfout.stl.internal (Postfix) with ESMTP id 6B78C1140139; Mon, 13 Jan 2025 03:34:05 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Mon, 13 Jan 2025 03:34:05 -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=fm2; t=1736757245; x=1736843645; bh=s9ekD9NLDs0JPpLlp3fJoVFsnFdaez9db1rIcUI7xXQ=; b= mbS6LiooqWCnPInCpKRJTLDLGmIoFls2pCjiudggf1/FKJLTwUsAHGJrW9ruqoUY MhWwcKDwf7mSOlnddVgAztOSNN3rwCoJJf8k+AxfLC/c5M9VYBi2Rpc6BQEbs3Xo vUGpREXutmjJZ0tv34chvqvB1Xcc1SR9JDdmYMRbAyVw6716f6LrBnQ8eZDA213n oojazJxla10c/t4BZoeb7BCUGrG7eYPeesN/CQpOyCABlgWTJN25OgwjnzYB7bgZ 1iWS6nI43RTrKrHy5++otcL++2joftU+Jl34ZMVde7IdO6caSC1qLDzdWof+MRg3 TbsAolg6v986TpLCyki7Mg== 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=fm2; t=1736757245; x= 1736843645; bh=s9ekD9NLDs0JPpLlp3fJoVFsnFdaez9db1rIcUI7xXQ=; b=T DeMFcK1gMjiCFaTtBOl4HItdoYi5e5PXcLZKJgDBno5wNlUG0dwGQqqbsaTMcnEl 71RAAJW+RlRFeYp7NJ4GPrGK0qo0CrXXtjOO+9IGEgYt7VF9C85SuQsKtG8vAQb9 xReypmMcZNpKvQp7JoVD3choCHSAEApb6INcAuMpFBMlFlxzv2SggjiHSk1Vz7Bw CFjfE0jxI8EzZTlukSEU21sHlI+hE0LlYnPIo9MErgHfBQ5x17qjJvw5LaRr5rut VvEPK1AxIdjCHPOQPQ0ft2gMqzyCPEt/7TDkI6jjU9j2Ajs7ftS0v73M40nRfS0s lmKrt9zvv8PUJ6YH5Hy4A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehfedguddulecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrd himheqnecuggftrfgrthhtvghrnhepffeuiedujedvkeehuedvkeefffeivdeuleetkedu heejteekgedvudfgtdfgieelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepfedpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohepvghstghhfigrrhhtiiesghgvnhhtohhordhorh hgpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthho pegvvhgrnhdrmhgrrhhtihhnsehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 13 Jan 2025 03:34:04 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 36c40c61 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 13 Jan 2025 08:34:03 +0000 (UTC) From: Patrick Steinhardt Date: Mon, 13 Jan 2025 09:33:40 +0100 Subject: [PATCH 7/9] meson: make the CSPRNG backend configurable Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250113-b4-pks-meson-additions-v1-7-97f6a93f691d@pks.im> References: <20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im> In-Reply-To: <20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im> To: git@vger.kernel.org Cc: Evan Martin , Eli Schwartz X-Mailer: b4 0.14.2 The CSPRNG backend is not configurable in Meson and isn't quite discoverable, either. Make it configurable and add the actual backend used to the summary. Signed-off-by: Patrick Steinhardt --- meson.build | 26 +++++++++++++++++++------- meson_options.txt | 2 ++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index 5e1373f6a52a91beb527d00d8fd5c55d377c718b..cb352ce6fd50616e3281a776104692c5b2bfa5b2 100644 --- a/meson.build +++ b/meson.build @@ -1325,6 +1325,7 @@ if not meson.is_cross_build() and fs.exists('/dev/tty') libgit_c_args += '-DHAVE_DEV_TTY' endif +csprng_backend = get_option('csprng_backend') https_backend = get_option('https_backend') sha1_backend = get_option('sha1_backend') sha1_unsafe_backend = get_option('sha1_unsafe_backend') @@ -1336,7 +1337,7 @@ if https_backend == 'auto' and security_framework.found() https_backend = 'CommonCrypto' endif -openssl_required = 'openssl' in [https_backend, sha1_backend, sha1_unsafe_backend, sha256_backend] +openssl_required = 'openssl' in [csprng_backend, https_backend, sha1_backend, sha1_unsafe_backend, sha256_backend] openssl = dependency('openssl', required: openssl_required, default_options: ['default_library=static']) if https_backend == 'auto' and openssl.found() https_backend = 'openssl' @@ -1421,18 +1422,28 @@ else error('Unhandled SHA256 backend ' + sha256_backend) endif -if compiler.has_header_symbol('stdlib.h', 'arc4random_buf') +if csprng_backend in ['auto', 'arc4random'] and compiler.has_header_symbol('stdlib.h', 'arc4random_buf', required: csprng_backend == 'arc4random') libgit_c_args += '-DHAVE_ARC4RANDOM' -elif compiler.has_header_symbol('bsd/stdlib.h', 'arc4random_buf') + csprng_backend = 'arc4random' +elif csprng_backend in ['auto', 'arc4random_bsd'] and compiler.has_header_symbol('bsd/stdlib.h', 'arc4random_buf', required: csprng_backend == 'arc4random_bsd') libgit_c_args += '-DHAVE_ARC4RANDOM_BSD' -elif compiler.has_function('getrandom', prefix: '#include ') + csprng_backend = 'arc4random_bsd' +elif csprng_backend in ['auto', 'getrandom'] and compiler.has_function('getrandom', prefix: '#include ', required: csprng_backend == 'getrandom') libgit_c_args += '-DHAVE_GETRANDOM' -elif compiler.has_function('getentropy', prefix: '#include ') + csprng_backend = 'getrandom' +elif csprng_backend in ['auto', 'getentropy'] and compiler.has_function('getentropy', prefix: '#include ', required: csprng_backend == 'getentropy') libgit_c_args += '-DHAVE_GETENTROPY' -elif compiler.has_function('RtlGenRandom', prefix: '#include \n#include ') + csprng_backend = 'getentropy' +elif csprng_backend in ['auto', 'rtlgenrandom'] and compiler.has_function('RtlGenRandom', prefix: '#include \n#include ', required: csprng_backend == 'rtlgenrandom') libgit_c_args += '-DHAVE_RTLGENRANDOM' -elif openssl.found() + csprng_backend = 'rtlgenrandom' +elif csprng_backend in ['auto', 'openssl'] and openssl.found() libgit_c_args += '-DHAVE_OPENSSL_CSPRNG' + csprng_backend = 'openssl' +elif csprng_backend in ['auto', 'urandom'] + csprng_backend = 'urandom' +else + error('Unsupported CSPRNG backend: ' + csprng_backend) endif if get_option('runtime_prefix') @@ -1969,6 +1980,7 @@ summary({ }, section: 'Auto-detected features') summary({ + 'csprng': csprng_backend, 'https': https_backend, 'sha1': sha1_backend, 'sha1_unsafe': sha1_unsafe_backend, diff --git a/meson_options.txt b/meson_options.txt index 34ba679cf931b67a794a9bb7e765bfb22106381e..5429022f30621105cd6974e4260cca60e5f24324 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -47,6 +47,8 @@ option('regex', type: 'feature', value: 'auto', description: 'Use the system-provided regex library instead of the bundled one.') # Backends. +option('csprng_backend', type: 'combo', value: 'auto', choices: ['auto', 'arc4random', 'arc4random_bsd', 'getrandom', 'getentropy', 'rtlgenrandom', 'openssl', 'urandom'], + description: 'The backend to use for generating cryptographically-secure pseudo-random numbers.') option('https_backend', type: 'combo', value: 'auto', choices: ['auto', 'openssl', 'CommonCrypto', 'none'], description: 'The HTTPS backend to use when connecting to remotes.') option('sha1_backend', type: 'combo', choices: ['openssl', 'block', 'sha1dc', 'CommonCrypto'], value: 'sha1dc', From patchwork Mon Jan 13 08:33:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13936866 Received: from fhigh-b7-smtp.messagingengine.com (fhigh-b7-smtp.messagingengine.com [202.12.124.158]) (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 E5D5B23497C for ; Mon, 13 Jan 2025 08:34:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.158 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736757249; cv=none; b=uGWqkCRx0P5wx34uRW6bev+eu/V0yGZyjKhgdQIEkf4f6C3WVNgq1X0yXXcIe8NUv2FiESKO/oNrghL+tpfKoMAttXGgcwXSqBfjeYcN8pOToCahsaKN7xY4e4I2NWhfQQX4uBC+nWB3qpIUgnE73bxiQKjOt2ols2PDKSa2og4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736757249; c=relaxed/simple; bh=FpA5vIeMOCqneOSeKl7Sw3yx7qPfUvN7JosfY4NzR0I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jNZY+7qY3/4QRncXH/1d2oV5ZDSDO7iezLQ2Q3caWRcxfeKnldYyp2i8Q9kLaX9tRYTH468kPcI4P2wLDp67KTDP0jITTu6srQFeRl6vK4IHOmGR5SJYdZdDNbHX7fIAbP8NIaWcDq0+EzYqHgwX+PismeK3JD+pNJxu0uNgL0k= 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=Y9rPeBLC; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=no6Dyxkv; arc=none smtp.client-ip=202.12.124.158 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="Y9rPeBLC"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="no6Dyxkv" Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfhigh.stl.internal (Postfix) with ESMTP id DC9AC2540184; Mon, 13 Jan 2025 03:34:06 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Mon, 13 Jan 2025 03:34:06 -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=fm2; t=1736757246; x=1736843646; bh=IBtC9pDEGZxGQWr7Kx9n6MowFYngOWCAcp5GLHX+acY=; b= Y9rPeBLC0un7XtPms5CEJTINmbbt5tzOHtPvxTP8mm2xQ4r1ylfmA7nTI65NdnzR LmmDTemX1Mzyn61lwKtycc96LJxGANgL/pQWT4SdZ6sZAM4T/uP5f5lhUyrjuqhZ euk3uZsZVGed6jMufFN+G/Cc3vMo1Xshr/Uj7V+lcTdmZ4UhqOEP8nD7qIrwnDoD 5IS849bxY0fsE+0y+kClhKpP+Qggjiv1EK92wXR+dfWnDvjN1EBBqPNX1yVFI/dJ GG7ms72swXNNwNM6FGGjZldxY5sGtsqjYVDPGWy4DoA/OFNkDatcPBeBN2NnNhII dza3D9BVps0pxIftuxOmHA== 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=fm2; t=1736757246; x= 1736843646; bh=IBtC9pDEGZxGQWr7Kx9n6MowFYngOWCAcp5GLHX+acY=; b=n o6DyxkvXXAgh6O+wF4mXxvbH9md5xOUMht/sNzZABL9KTLwlAGX3I6VcDMQPEHtm oCr7mazrK9v/zMd+9eUVVXo0SeBvttUbgcWndsZknGjDE3bEJr9q6FC2l66lJ1df EqUnVXv0iH3D0CxK0qvoqBQo+acnIHqA/H8MCVVLICO9c/qXSa61hvMFJ1JxsFYv ouRQxDyjD4jEvrwyjzUSrEm4m2CjiPaC4VEe3aY7qpi9K0I5HSP+XG823cIYYK3I zkBHh/oiixO34fsjYSikS6UPD7128lF9VtaU7tIRHJUOwMqgUEX0Qs0q+Xf5uaB1 /hgDOySAPVuDQG8V1eBEQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehfedguddulecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrd himheqnecuggftrfgrthhtvghrnhepffeuiedujedvkeehuedvkeefffeivdeuleetkedu heejteekgedvudfgtdfgieelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepfedpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohepvghvrghnrdhmrghrthhinhesghhmrghilhdrtg homhdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthht ohepvghstghhfigrrhhtiiesghgvnhhtohhordhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 13 Jan 2025 03:34:05 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 00970054 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 13 Jan 2025 08:34:04 +0000 (UTC) From: Patrick Steinhardt Date: Mon, 13 Jan 2025 09:33:41 +0100 Subject: [PATCH 8/9] meson: fix compilation with Visual Studio Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250113-b4-pks-meson-additions-v1-8-97f6a93f691d@pks.im> References: <20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im> In-Reply-To: <20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im> To: git@vger.kernel.org Cc: Evan Martin , Eli Schwartz X-Mailer: b4 0.14.2 The Visual Studio compiler defaults to C89 unless explicitly asked to use a different version of the C standard. We don't specify any C standard at all though in our Meson build, and consequently compiling Git fails: ...\git\git-compat-util.h(14): fatal error C1189: #error: "Required C99 support is in a test phase. Please see git-compat-util.h for more details." Fix the issue by specifying the project's C standard. Funny enough, specifying C99 does not work because apparently, `__STDC_VERSION__` is not getting defined in that version at all. Instead, we have to specify C11 as the project's C standard, which is also done in our CMake build instructions. We don't want to generally enforce C11 though, as our requiremets only state that a C99 compiler is required. In fact, we don't even require plain C99, but rather the GNU variant thereof. Meson allows us to handle this case rather easily by specifying "gnu99,c11", which will cause it to fall back to C11 in case GNU C99 is unsupported. This feature has only been introduced with Meson 1.3.0 though, and we support 0.61.0 and newer. In case we use such an oldish version though we fall back to requiring GNU99 unconditionally. This means that Windows essentially requires Meson 1.3.0 and newer when using Visual Studio, but I doubt that this is ever going to be a real problem. Signed-off-by: Patrick Steinhardt Tested-by: M Hickford --- meson.build | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/meson.build b/meson.build index cb352ce6fd50616e3281a776104692c5b2bfa5b2..831da1d43cafe85a8c9ac872e141476adbc08188 100644 --- a/meson.build +++ b/meson.build @@ -171,6 +171,14 @@ project('git', 'c', meson_version: '>=0.61.0', version: files('GIT-VERSION'), + default_options: [ + # Git requires C99 with GNU extensions, which of course isn't supported by + # MSVC. Funny enough, C99 doesn't work with MSVC either, as it has only + # learned to define __STDC_VERSION__ with C11 and later. We thus require + # GNU C99 and fall back to C11. Meson only learned to handle the fallback + # with version 1.3.0, so on older versions we use GNU C99 unconditionally. + 'c_std=' + (meson.version().version_compare('>=1.3.0') ? 'gnu99,c11' : 'gnu99'), + ] ) fs = import('fs') From patchwork Mon Jan 13 08:33:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13936874 Received: from fhigh-b7-smtp.messagingengine.com (fhigh-b7-smtp.messagingengine.com [202.12.124.158]) (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 1CE77237A38 for ; Mon, 13 Jan 2025 08:34:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.158 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736757251; cv=none; b=AvjLpoPiO/9DiRt9RQiAez9/IROKjMfWZKwppPZ8fZt05aZXIg/4GV+BQpsZNG6/LUHHBiW7oE/1O5I02x7+9I5/a4mFexbKkCdPzm+CI1VHrbwvm+cKq91W8Tl0mVI3epztXMOSUfu5cgYgd9ydtx0+uhsKd6WXpSIRRge98mw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736757251; c=relaxed/simple; bh=pXZDLhfIsFDW4HiVgYHFY60hbxELcc7n7gejKucS+yA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=e9F3dJ8a/hduLqcGlA5E0XrIIaL4CyWdhGqfq4wUqs3+jFJrwIGEmuVd8ghckQsc61Mw67S3Yp6JN4/c/KlPkvhqt1pVn0JJEV3jdJyn0Y5/cOFapZgsXG5TOTkalwev1VCYHTEziUQtnzGeWEtNFK4aaaQ2EW+BCU8COgeYSZA= 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=metGph78; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Oyc1h8HO; arc=none smtp.client-ip=202.12.124.158 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="metGph78"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Oyc1h8HO" Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id 3DDAA2540191; Mon, 13 Jan 2025 03:34:08 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Mon, 13 Jan 2025 03:34:08 -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=fm2; t=1736757248; x=1736843648; bh=GASN2Fh+DLEt2B1IRqXmBDtWc3S5ohSffczj+TY7KKA=; b= metGph78Uqb5LQS12D6LW1w+q1pIKTF7cHGisXytIiGshoZ233mc//7OjR61ZcHJ 0jR6gJE4QkthAa38lKwRZlchiUQGhprIpffh654ArEb+UtGjqpOZX4qCWlzdQwHi kt+8mgKN8YwOBmanB6wMapwyzJebX1ogmmfs/SufR81EXFcOMCakjM9fsvO7TPnL LVwHDi4yTW94ZswGU3gsh28h73sc4gO8OqbEOhPj2UdIVRT6Po16qbn3e9aTO8rl MuHc046JnSOyYE+T8LgxJMBA0rV3OWGxNDx+h2j1c5qFw0rTUEeSnEsknqut1FeQ YRwD5x/znlCOOzJ1WXqzTw== 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=fm2; t=1736757248; x= 1736843648; bh=GASN2Fh+DLEt2B1IRqXmBDtWc3S5ohSffczj+TY7KKA=; b=O yc1h8HOSzw9OSyhDzpOiD+zXipxVeXKzA1yutkT4NGcGWgqXt1HUk8JLRoNirtrI FAPYiWrRc6saxfNtoTsU6oehI7/e9V9OFXv40p5l4miGD2verTeqmQE7lei6/BWA yVZPAEP/2wJY1SSj+RitTcapziM08SAOR/nOVu3gxH06sowTGec0/sCAlDMqlowq aMWf7Iv7VKtHu7dxTn6EVxqG8MbN9SH0qJ4fCgGv7mzArI6W8EuudZ0oXGVZIq1A iCyjN03qok9QFyZ3tK9+CflIilTrEV932v7KOGsef+Z8QlgT6AqSHZHjnOj2OGci msQrrSdg3/U0VU0bnMwbA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehfedguddulecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrd himheqnecuggftrfgrthhtvghrnhepveelgfdttddtvddtudeileevhfekueehvddtgeei tdelkeffieffleejvdfgueeinecuffhomhgrihhnpehgihhthhhusgdrtghomhdpphihth hhohhnrdhorhhgpdhhrgiggidrshgvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepfedpmh houggvpehsmhhtphhouhhtpdhrtghpthhtohepvghstghhfigrrhhtiiesghgvnhhtohho rdhorhhgpdhrtghpthhtohepvghvrghnrdhmrghrthhinhesghhmrghilhdrtghomhdprh gtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 13 Jan 2025 03:34:07 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id bd05dec8 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 13 Jan 2025 08:34:05 +0000 (UTC) From: Patrick Steinhardt Date: Mon, 13 Jan 2025 09:33:42 +0100 Subject: [PATCH 9/9] ci: wire up Visual Studio build with Meson Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250113-b4-pks-meson-additions-v1-9-97f6a93f691d@pks.im> References: <20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im> In-Reply-To: <20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im> To: git@vger.kernel.org Cc: Evan Martin , Eli Schwartz X-Mailer: b4 0.14.2 Add a new job to GitHub Actions and GitLab CI that builds and tests Meson-based builds with Visual Studio. A couple notes: - While the build job is mandatory, the test job is marked as "manual" on GitLab so that it doesn't run by default. We already have a bunch of Windows-based jobs, and the computational overhead that these cause is simply out of proportion to run the test suite twice. The same isn't true for GitHub as I could not find a way to make a subset of jobs manually triggered. - We disable Perl. This is because we pick up Perl from Git for Windows, which outputs different paths ("/c/" instead of "C:\") than what we expect in our tests. - We don't use the Git for Windows SDK. Instead, the build only depends on Visual Studio, Meson and Git for Windows. All the other dependencies like curl, pcre2 and zlib get pulled in and compiled automatically by Meson and thus do not have to be provided by the system. - We open-code "ci/run-test-slice.sh". This is because we only have direct access to PowerShell, so we manually implement the logic. There is an upstream pull request for the Meson build system [1] to implement test slicing in Meson directly. - We don't process test artifacts for failed CI jobs. This is done to keep down prerequisites to a minimum. All tests are passing. [1]: https://github.com/mesonbuild/meson/pull/14092 Signed-off-by: Patrick Steinhardt --- .github/workflows/main.yml | 52 ++++++++++++++++++++++++++++++++++++++++++++++ .gitlab-ci.yml | 38 +++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 900be9957a23fcaa64e1aefd0c8638c5f84b7997..7f55f8b3a91d6caf95934af308a2bd35a19a62f1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -248,6 +248,58 @@ jobs: with: name: failed-tests-windows-vs-${{ matrix.nr }} path: ${{env.FAILED_TEST_ARTIFACTS}} + + windows-meson-build: + name: win+Meson build + needs: ci-config + if: needs.ci-config.outputs.enabled == 'yes' + runs-on: windows-latest + concurrency: + group: windows-meson-build-${{ github.ref }} + cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - name: Set up dependencies + shell: pwsh + run: pip install meson ninja + - name: Setup + shell: pwsh + run: meson setup build -Dperl=disabled + - name: Compile + shell: pwsh + run: meson compile -C build + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: windows-meson-artifacts + path: build + windows-meson-test: + name: win+Meson test + runs-on: windows-latest + needs: [ci-config, windows-meson-build] + strategy: + fail-fast: false + matrix: + nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + concurrency: + group: windows-meson-test-${{ matrix.nr }}-${{ github.ref }} + cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - name: Set up dependencies + shell: pwsh + run: pip install meson ninja + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: windows-meson-artifacts + path: build + - name: Test + shell: pwsh + run: meson test -C build --list | Select-Object -Skip 1 | Select-String .* | Group-Object -Property { $_.LineNumber % 10 } | Where-Object Name -EQ ${{ matrix.nr }} | ForEach-Object { meson test -C build --no-rebuild --print-errorlogs $_.Group } + regular: name: ${{matrix.vector.jobname}} (${{matrix.vector.pool}}) needs: ci-config diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9254e01583306e67dc12b6b9e0015183e1108655..4976e18a0503298f38230f5ba7348675baf48664 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -149,6 +149,44 @@ test:mingw64: - git-sdk/usr/bin/bash.exe -l -c 'ci/print-test-failures.sh' parallel: 10 +.msvc-meson: + tags: + - saas-windows-medium-amd64 + before_script: + - choco install -y git meson ninja openssl + - Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 + - refreshenv + # The certificate store for Python on Windows is broken and fails to fetch + # certificates, see https://bugs.python.org/issue36011. This seems to + # mostly be an issue with how the GitLab image is set up as it is a + # non-issue on GitHub Actions. Work around the issue by importing + # cetrificates manually. + - Invoke-WebRequest https://curl.haxx.se/ca/cacert.pem -OutFile cacert.pem + - openssl pkcs12 -export -nokeys -in cacert.pem -out certs.pfx -passout "pass:" + - Import-PfxCertificate -CertStoreLocation Cert:\LocalMachine\Root -FilePath certs.pfx + +build:msvc-meson: + extends: .msvc-meson + stage: build + script: + - meson setup build -Dperl=disabled + - meson compile -C build + artifacts: + paths: + - build + +test:msvc-meson: + extends: .msvc-meson + stage: test + when: manual + timeout: 6h + needs: + - job: "build:msvc-meson" + artifacts: true + script: + - meson test -C build --list | Select-Object -Skip 1 | Select-String .* | Group-Object -Property { $_.LineNumber % $Env:CI_NODE_TOTAL + 1 } | Where-Object Name -EQ $Env:CI_NODE_INDEX | ForEach-Object { meson test -C build --no-rebuild --print-errorlogs $_.Group } + parallel: 10 + test:fuzz-smoke-tests: image: ubuntu:latest stage: test