[Bug 41651] New: Allow plugins to specify additional dependencies
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 Bug ID: 41651 Summary: Allow plugins to specify additional dependencies Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Plugin architecture Assignee: koha-bugs@lists.koha-community.org Reporter: tadeusz@sosnierz.com QA Contact: testopia@bugs.koha-community.org Koha plugins cannot currently declare any dependencies. Not meeting them will occcasionally fail upon installation (if the main plugin class tries to load them at compile time) or runtime (if one of the other packages does, or code cleverly checks if the dependency is met). Ideally we'd have a way of specifying if a Koha plugin depends on another Perl module, or another Koha plugin. A nice feature of this would be to able be able to declare optional dependencies, which may only be required for a subset of the Plugin's features (like in https://github.com/HKS3/koha-normalize-marc2db/blob/main/Koha/Plugin/HKS3/No...). Those shouldn't prevent installation, but should still warn loudly upon plugin installation, in a way that is hard/impossible to miss (e.g. have an intermitted screen on plugins-upload.pl, with an "are you sure"). Patch incoming. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 --- Comment #1 from HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> --- Created attachment 191567 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191567&action=edit Bug 41651: Allow plugins do specify dependencies, abort installation if unmet This approach uses a new $metadata key, to minimize the scope of changes needed. The downside of that is the fact that if the base plugin package requires those dependencies in compile-time already, the code (and thus metadata itself) will fail to load in an unhandled way. plugins-upload.pl can't know for sure whether it's really the plugin being installed that doesn't have its dependencies met, which is a limitation to how it currently works. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lisette@bywatersolutions.co | |m -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #191567|0 |1 is obsolete| | --- Comment #2 from HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> --- Created attachment 191651 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191651&action=edit Bug 41651: Allow plugins do specify dependencies, abort installation if unmet This unpacks uploaded plugin into a temporary directory where we check the prerequisites/conflicts in standard CPAN ways, and only continue with the installation if all the runtime requirements are met. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=24631 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #191651|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 --- Comment #3 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 192087 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=192087&action=edit Bug 41651: Allow plugins to specify dependencies, abort installation if unmet This unpacks uploaded plugin into a temporary directory where we check the prerequisites/conflicts in standard CPAN ways, and only continue with the installation if all the runtime requirements are met. Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 --- Comment #4 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 192088 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=192088&action=edit Bug 41651: (QA follow-up) Fix issues in plugin file copy We're focusing on reliability and security here, the improvements include: - Escape regex metacharacters in path using \Q...\E to prevent regex injection issues - Check copy() return value and collect errors, die if any copies fail to prevent silent partial installations - Make basename filter more specific to only skip cpanfile and META.json/META.yml, not files containing "META" anywhere -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 --- Comment #5 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 192089 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=192089&action=edit Bug 41651: (follow-up) Improve plugin dependency handling The original patch was a great start, but I saw some area's for improvement including listing all missing dependencies as apposed to just the first. - Add POD documentation for the new 'from' parameter in InstallPlugins() - Normalize staging directory path by removing trailing slashes to prevent double-slash issues in destination paths - Fix path concatenation to avoid double slashes (plugins_dir already ends without slash, destdir starts with slash after substitution) - Report all unmet dependencies at once instead of dying on the first one, providing better user feedback - Add 'last' to break out of metafiles loop once a file is found -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 --- Comment #6 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 192090 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=192090&action=edit Bug 41651: (follow-up) Add test coverage for dependency checking Tests for _check_dependencies(): - No dependency files present (passes silently) - cpanfile with satisfied dependencies (passes) - cpanfile with unmet dependencies (dies with message) - META.json with satisfied dependencies (passes) - META.yml with satisfied dependencies (passes) - META.json with unmet dependencies (dies) - Multiple unmet dependencies are all reported Tests for InstallPlugins() with 'from' parameter: - Files are copied from staging to plugins directory - cpanfile is NOT copied to plugins directory - META.json is NOT copied to plugins directory - META.yml is NOT copied to plugins directory - Trailing slash in path is handled correctly -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@openfifth.c | |o.uk Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tadeusz@sosnierz.com |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@gmail.com, | |julian.maurice@biblibre.com | |, | |kyle@bywatersolutions.com, | |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |41720 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41720 [Bug 41720] Plugin metadata should be outside the main class -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #192088|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #192089|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #192090|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 --- Comment #7 from HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> --- Created attachment 195936 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195936&action=edit Bug 41651: (QA follow-up) Fix issues in plugin file copy We're focusing on reliability and security here, the improvements include: - Escape regex metacharacters in path using \Q...\E to prevent regex injection issues - Check copy() return value and collect errors, die if any copies fail to prevent silent partial installations - Make basename filter more specific to only skip cpanfile and META.json/META.yml, not files containing "META" anywhere Signed-off-by: Tadeusz „tadzik” Sośnierz <tadeusz@sosnierz.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 --- Comment #8 from HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> --- Created attachment 195937 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195937&action=edit Bug 41651: (follow-up) Improve plugin dependency handling The original patch was a great start, but I saw some area's for improvement including listing all missing dependencies as apposed to just the first. - Add POD documentation for the new 'from' parameter in InstallPlugins() - Normalize staging directory path by removing trailing slashes to prevent double-slash issues in destination paths - Fix path concatenation to avoid double slashes (plugins_dir already ends without slash, destdir starts with slash after substitution) - Report all unmet dependencies at once instead of dying on the first one, providing better user feedback - Add 'last' to break out of metafiles loop once a file is found Signed-off-by: Tadeusz „tadzik” Sośnierz <tadeusz@sosnierz.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 --- Comment #9 from HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> --- Created attachment 195938 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195938&action=edit Bug 41651: (follow-up) Add test coverage for dependency checking Tests for _check_dependencies(): - No dependency files present (passes silently) - cpanfile with satisfied dependencies (passes) - cpanfile with unmet dependencies (dies with message) - META.json with satisfied dependencies (passes) - META.yml with satisfied dependencies (passes) - META.json with unmet dependencies (dies) - Multiple unmet dependencies are all reported Tests for InstallPlugins() with 'from' parameter: - Files are copied from staging to plugins directory - cpanfile is NOT copied to plugins directory - META.json is NOT copied to plugins directory - META.yml is NOT copied to plugins directory - Trailing slash in path is handled correctly Signed-off-by: Tadeusz „tadzik” Sośnierz <tadeusz@sosnierz.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Patch doesn't apply --- Comment #10 from Jonathan Druart <jonathan.druart@gmail.com> --- error: sha1 information is lacking or useless (Koha/Plugins.pm). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #192087|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195936|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195937|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195938|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 --- Comment #11 from HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> --- Created attachment 196201 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196201&action=edit Bug 41651: Allow plugins to specify dependencies, abort installation if unmet This unpacks uploaded plugin into a temporary directory where we check the prerequisites/conflicts in standard CPAN ways, and only continue with the installation if all the runtime requirements are met. Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 --- Comment #12 from HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> --- Created attachment 196202 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196202&action=edit Bug 41651: (QA follow-up) Fix issues in plugin file copy We're focusing on reliability and security here, the improvements include: - Escape regex metacharacters in path using \Q...\E to prevent regex injection issues - Check copy() return value and collect errors, die if any copies fail to prevent silent partial installations - Make basename filter more specific to only skip cpanfile and META.json/META.yml, not files containing "META" anywhere Signed-off-by: Tadeusz „tadzik” Sośnierz <tadeusz@sosnierz.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 --- Comment #13 from HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> --- Created attachment 196203 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196203&action=edit Bug 41651: (follow-up) Improve plugin dependency handling The original patch was a great start, but I saw some area's for improvement including listing all missing dependencies as apposed to just the first. - Add POD documentation for the new 'from' parameter in InstallPlugins() - Normalize staging directory path by removing trailing slashes to prevent double-slash issues in destination paths - Fix path concatenation to avoid double slashes (plugins_dir already ends without slash, destdir starts with slash after substitution) - Report all unmet dependencies at once instead of dying on the first one, providing better user feedback - Add 'last' to break out of metafiles loop once a file is found Signed-off-by: Tadeusz „tadzik” Sośnierz <tadeusz@sosnierz.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 --- Comment #14 from HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> --- Created attachment 196204 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196204&action=edit Bug 41651: (follow-up) Add test coverage for dependency checking Tests for _check_dependencies(): - No dependency files present (passes silently) - cpanfile with satisfied dependencies (passes) - cpanfile with unmet dependencies (dies with message) - META.json with satisfied dependencies (passes) - META.yml with satisfied dependencies (passes) - META.json with unmet dependencies (dies) - Multiple unmet dependencies are all reported Tests for InstallPlugins() with 'from' parameter: - Files are copied from staging to plugins directory - cpanfile is NOT copied to plugins directory - META.json is NOT copied to plugins directory - META.yml is NOT copied to plugins directory - Trailing slash in path is handled correctly Signed-off-by: Tadeusz „tadzik” Sośnierz <tadeusz@sosnierz.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Patch doesn't apply |Signed Off --- Comment #15 from HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> --- Rebased on main. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41651 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org