From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 32D881FF137 for ; Tue, 31 Mar 2026 09:10:37 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 895CA10791; Tue, 31 Mar 2026 09:10:57 +0200 (CEST) From: Kefu Chai To: pve-devel@lists.proxmox.com Subject: [PATCH v2 proxmox-acme 2/3] tests: verify all dnsapi plugins are listed in Makefile ACME_SOURCES Date: Tue, 31 Mar 2026 15:10:40 +0800 Message-ID: <20260331071041.1199091-3-k.chai@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260331071041.1199091-1-k.chai@proxmox.com> References: <20260331071041.1199091-1-k.chai@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1774940998662 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.245 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_SHORT 0.001 Use of a URL Shortener for very short URL POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 556DWKR2R6U7Y3M3IWHS3WVCIV3KHW24 X-Message-ID-Hash: 556DWKR2R6U7Y3M3IWHS3WVCIV3KHW24 X-MailFrom: k.chai@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add verify-acme-sources-in-makefile.pl which cross-checks the dnsapi/ scripts present in the acme.sh submodule against the ACME_SOURCES list in the Makefile. Plugins missing from ACME_SOURCES won't be installed, so this catches the class of error where a plugin is added to the schema but forgotten in the install list. ACME_SOURCES is passed via environment from the parent Makefile so Make expands the variable itself, avoiding fragile Makefile parsing in Perl. Signed-off-by: Kefu Chai --- src/Makefile | 2 +- src/test/Makefile | 5 +- src/test/verify-acme-sources-in-makefile.pl | 66 +++++++++++++++++++++ 3 files changed, 70 insertions(+), 3 deletions(-) create mode 100755 src/test/verify-acme-sources-in-makefile.pl diff --git a/src/Makefile b/src/Makefile index c948207..461597b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -190,7 +190,7 @@ install: .PHONY: test test: - $(MAKE) -C test test + $(MAKE) -C test test ACME_SOURCES="$(ACME_SOURCES)" .PHONY: clean clean: diff --git a/src/test/Makefile b/src/test/Makefile index 5768124..ad5256a 100644 --- a/src/test/Makefile +++ b/src/test/Makefile @@ -1,9 +1,10 @@ +ACME_SOURCES ?= .PHONY: test test-missing-functions -test: verify-dnsapi-plugins-in-schema.pl.t test-missing-functions +test: verify-dnsapi-plugins-in-schema.pl.t verify-acme-sources-in-makefile.pl.t test-missing-functions %.t: % - ./$< + ACME_SOURCES="$(ACME_SOURCES)" ./$< test-missing-functions: ./check-missing-functions | sort -u > missing-functions.actual diff --git a/src/test/verify-acme-sources-in-makefile.pl b/src/test/verify-acme-sources-in-makefile.pl new file mode 100755 index 0000000..7deb026 --- /dev/null +++ b/src/test/verify-acme-sources-in-makefile.pl @@ -0,0 +1,66 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use lib '../'; + +use PVE::Tools qw(dir_glob_foreach); + +my $dnsapi_path = '../acme.sh/dnsapi'; + +die "cannot find dnsapi path '$dnsapi_path'!\n" if !-d $dnsapi_path; + +my $acme_sources = $ENV{ACME_SOURCES} + or die "ACME_SOURCES environment variable not set\n"; + +my $makefile_plugins = {}; +while ($acme_sources =~ /dnsapi\/dns_(\S+)\.sh/g) { + $makefile_plugins->{$1} = 1; +} + +my $acmesh_plugins = []; +dir_glob_foreach( + $dnsapi_path, + qr/dns_(\S+)\.sh/, + sub { + my ($file, $provider) = @_; + push @$acmesh_plugins, $provider; + }, +); + +my $ok = 1; + +# check that all plugins in the submodule are listed in the Makefile for installation +my $missing_from_makefile = ''; +for my $provider (sort @$acmesh_plugins) { + if (!$makefile_plugins->{$provider}) { + $missing_from_makefile .= "\tdnsapi/dns_${provider}.sh \\\n"; + $ok = 0; + } +} + +if ($missing_from_makefile) { + print STDERR "\nplugins missing from Makefile ACME_SOURCES, add:\n"; + print STDERR $missing_from_makefile; +} + +# check that all plugins in the Makefile still exist in the submodule +my %acmesh_set = map { $_ => 1 } @$acmesh_plugins; +my $stale_in_makefile = ''; +for my $provider (sort keys %$makefile_plugins) { + if (!$acmesh_set{$provider}) { + $stale_in_makefile .= "\tdnsapi/dns_${provider}.sh\n"; + $ok = 0; + } +} + +if ($stale_in_makefile) { + print STDERR "\nplugins in Makefile but removed/renamed upstream, remove:\n"; + print STDERR $stale_in_makefile; +} + +die "\nERROR: Makefile ACME_SOURCES not in sync with available plugins!\n\n" if !$ok; + +print STDERR "OK: Makefile ACME_SOURCES in sync with available plugins.\n"; +exit(0); -- 2.47.3