Modules determine their own compatibility with the library

A module is built against the system-installed libdpm-core.so and is
responsible for being correct against it. Where it needs to act on the
version it is running under, dpm_core_version() reports that and the
module decides for itself.

dpm_module_core_min() is removed. It was a declaration handed to the
library to enforce on the module's behalf, and enforcement of that kind
belongs nowhere in a library that routes and hosts. The contract is now
three reserved symbols and load validation is two steps: the reserved
symbols resolve, and the version and description probes return
well-formed values.

compare_versions had no remaining caller and is removed; parse_version
stays for the well-formedness probe. The core_too_new fixture went with
the handshake it existed to exercise.
This commit is contained in:
2026-08-15 04:21:58 -04:00
parent 97b39cac6c
commit 17acad2b02
17 changed files with 101 additions and 185 deletions

View File

@@ -30,11 +30,6 @@ extern "C" const char* dpm_module_description(void)
return "Fixture with a malformed version.";
}
extern "C" const char* dpm_module_core_min(void)
{
return "0.1.0";
}
extern "C" int dpm_module_execute(void* ctx, const char* command,
int argc, char** argv)
{

View File

@@ -1,47 +0,0 @@
/**
* @file core_too_new.cpp
* @brief Broken fixture: demands a libdpm-core newer than any that exists
*
* Contract-complete, but dpm_module_core_min() reports 99.0.0.
* libdpm-core must refuse it at validation step 2 with a message
* naming the remedy (update libdpm-core).
*
* Part of the Dark Horse Linux Package Manager (DPM)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
extern "C" const char* dpm_module_version(void)
{
return "1.0.0";
}
extern "C" const char* dpm_module_description(void)
{
return "Fixture demanding a future libdpm-core.";
}
extern "C" const char* dpm_module_core_min(void)
{
return "99.0.0";
}
extern "C" int dpm_module_execute(void* ctx, const char* command,
int argc, char** argv)
{
(void)ctx;
(void)command;
(void)argc;
(void)argv;
return 0;
}

View File

@@ -34,11 +34,6 @@ extern "C" const char* dpm_module_description(void)
return "Known-good stub module.";
}
extern "C" const char* dpm_module_core_min(void)
{
return "0.1.0";
}
/* Answers "ping" with 42 so a dispatch round trip is observable, and
0 for anything else. */
extern "C" int dpm_module_execute(void* ctx, const char* command,

View File

@@ -2,9 +2,8 @@
* @file missing_symbols.cpp
* @brief Broken fixture: exports only part of the module contract
*
* Missing dpm_module_execute, dpm_module_core_min, and
* dpm_module_manifest. libdpm-core must refuse it at step 1 and
* name the missing symbols.
* Exports the version and description probes and nothing else.
* libdpm-core.so refuses it at step 1 and names dpm_module_execute.
*
* Part of the Dark Horse Linux Package Manager (DPM)
*