From: Kefu Chai <k.chai@proxmox.com>
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 [thread overview]
Message-ID: <20260331071041.1199091-3-k.chai@proxmox.com> (raw)
In-Reply-To: <20260331071041.1199091-1-k.chai@proxmox.com>
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 <k.chai@proxmox.com>
---
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
next prev parent reply other threads:[~2026-03-31 7:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 7:10 [PATCH v2 proxmox-acme 0/3] update acme.sh DNS API to upstream 3.1.2 tag Kefu Chai
2026-03-31 7:10 ` [PATCH v2 proxmox-acme 1/3] " Kefu Chai
2026-03-31 7:10 ` Kefu Chai [this message]
2026-03-31 7:10 ` [PATCH v2 proxmox-acme 3/3] buildsys: run tests as part of dpkg-buildpackage Kefu Chai
2026-03-31 16:16 ` Thomas Lamprecht
2026-04-01 4:31 ` Kefu Chai
2026-03-31 16:48 ` applied: [PATCH v2 proxmox-acme 0/3] update acme.sh DNS API to upstream 3.1.2 tag Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260331071041.1199091-3-k.chai@proxmox.com \
--to=k.chai@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox