Bug 25222 - Add ability to let plugins live in individual subdirectories
Summary: Add ability to let plugins live in individual subdirectories
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Plugin architecture (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Kyle M Hall (khall)
QA Contact: Tomás Cohen Arazi (tcohen)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-20 18:20 UTC by Kyle M Hall (khall)
Modified: 2022-04-12 11:57 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 25222: Add ability to let plugins live in individual subdirectories (2.75 KB, patch)
2020-04-20 18:24 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 25222: Add ability to let plugins live in individual subdirectories (2.79 KB, patch)
2020-04-20 21:37 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 25222: Add ability to let plugins live in individual subdirectories (2.84 KB, patch)
2020-04-21 15:42 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 25222: (QA follow-up) Make Koha create the subdirectory (3.07 KB, patch)
2020-04-22 16:47 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 25222: (QA follow-up) Update @INC when calling Koha::Plugins::new (1.35 KB, patch)
2020-04-22 16:47 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall (khall) 2020-04-20 18:20:06 UTC
From Tomas: "We really need to put each plugin in its own subdirectory (to identify them individually) and have a metadata file we can refer to."

This would make things much more manageable. Right now, plugins get all mixed together in the plugins directory. For example, installing the kitchen sink plugin results in Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm being created in the plugins directory. Installing CoverFlow will create CoverFlow.pm in the same directory as KitchenSink.pm.

There is no reason that plugins cannot be created to install in a subdirectory directly in the kpz file. In that case, the plugins directory would contain something like kitchen-sink/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm, while CoverFlow would live in coverflow/Koha/Plugin/Com/ByWaterSolutions/CoverFlow.pm.
Comment 1 Kyle M Hall (khall) 2020-04-20 18:24:11 UTC
Created attachment 103311 [details] [review]
Bug 25222: Add ability to let plugins live in individual subdirectories

From Tomas: "We really need to put each plugin in its own subdirectory
(to identify them individually) and have a metadata file we can refer
to."

This would make things much more manageable. Right now, plugins get all
mixed together in the plugins directory. For example, installing the
kitchen sink plugin results in
Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm being created in the
plugins directory. Installing CoverFlow will create CoverFlow.pm in the
same directory as KitchenSink.pm.

There is no reason that plugins cannot be created to install in a
subdirectory directly in the kpz file. In that case, the plugins
directory would contain something like
kitchen-sink/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm, while
CoverFlow would live in
coverflow/Koha/Plugin/Com/ByWaterSolutions/CoverFlow.pm.

Test Plan:
1) Apply this patch
2) Restart all the things!
3) Download the Kitchen Sink plugin
4) Rename it from kzp to zip
5) Unzip the plugin
6) Create a new directory kitchen-sink
7) move the Koha directory from the plugin into kitchen-sink
8) Zip the new kitchen-sink directory, include that directory in the zip file
9) Change the file suffix from zip to kpz
10) Install the plugin in Koha
11) The plugin should load!
Comment 2 Arthur Suzuki 2020-04-20 21:37:33 UTC
Created attachment 103317 [details] [review]
Bug 25222: Add ability to let plugins live in individual subdirectories

From Tomas: "We really need to put each plugin in its own subdirectory
(to identify them individually) and have a metadata file we can refer
to."

This would make things much more manageable. Right now, plugins get all
mixed together in the plugins directory. For example, installing the
kitchen sink plugin results in
Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm being created in the
plugins directory. Installing CoverFlow will create CoverFlow.pm in the
same directory as KitchenSink.pm.

There is no reason that plugins cannot be created to install in a
subdirectory directly in the kpz file. In that case, the plugins
directory would contain something like
kitchen-sink/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm, while
CoverFlow would live in
coverflow/Koha/Plugin/Com/ByWaterSolutions/CoverFlow.pm.

Test Plan:
1) Apply this patch
2) Restart all the things!
3) Download the Kitchen Sink plugin
4) Rename it from kzp to zip
5) Unzip the plugin
6) Create a new directory kitchen-sink
7) move the Koha directory from the plugin into kitchen-sink
8) Zip the new kitchen-sink directory, include that directory in the zip file
9) Change the file suffix from zip to kpz
10) Install the plugin in Koha
11) The plugin should load!

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 3 Josef Moravec 2020-04-21 15:42:18 UTC
Created attachment 103389 [details] [review]
Bug 25222: Add ability to let plugins live in individual subdirectories

From Tomas: "We really need to put each plugin in its own subdirectory
(to identify them individually) and have a metadata file we can refer
to."

This would make things much more manageable. Right now, plugins get all
mixed together in the plugins directory. For example, installing the
kitchen sink plugin results in
Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm being created in the
plugins directory. Installing CoverFlow will create CoverFlow.pm in the
same directory as KitchenSink.pm.

There is no reason that plugins cannot be created to install in a
subdirectory directly in the kpz file. In that case, the plugins
directory would contain something like
kitchen-sink/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm, while
CoverFlow would live in
coverflow/Koha/Plugin/Com/ByWaterSolutions/CoverFlow.pm.

Test Plan:
1) Apply this patch
2) Restart all the things!
3) Download the Kitchen Sink plugin
4) Rename it from kzp to zip
5) Unzip the plugin
6) Create a new directory kitchen-sink
7) move the Koha directory from the plugin into kitchen-sink
8) Zip the new kitchen-sink directory, include that directory in the zip file
9) Change the file suffix from zip to kpz
10) Install the plugin in Koha
11) The plugin should load!

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 4 Martin Renvoize (ashimema) 2020-04-22 12:38:53 UTC
Hmm.. this looks like it adds a new dependency but doesn't specify that in the cpanfile

File::Find::Rule
Comment 5 Martin Renvoize (ashimema) 2020-04-22 12:48:47 UTC
Had a quick chat with Kyle regarding alternatives:

>I'm not sure about the approach in bug 25222 - Add ability to let plugins live in individual subdirectories
> should we require that plugin devs package like this under a top level dir..
> or should we actually handle the separation at install time perhaps and create a directory for each plugin there?
> I can see things ending up very inconsistent with a mix of the two styles otherwise.

We agreed that if it's not a mammoth task it would be cleaner to continue to package plugins the way we currently are, and instead split them up at install time.  As such, we're going to have a go at that and I'll hold off pushing this until we've reached a conclusion.
Comment 6 Kyle M Hall (khall) 2020-04-22 16:47:28 UTC
Created attachment 103495 [details] [review]
Bug 25222: (QA follow-up) Make Koha create the subdirectory
Comment 7 Kyle M Hall (khall) 2020-04-22 16:47:40 UTC
Created attachment 103496 [details] [review]
Bug 25222: (QA follow-up) Update @INC when calling Koha::Plugins::new
Comment 8 Martin Renvoize (ashimema) 2020-04-29 13:41:59 UTC
Setting back to signed off.. I've asked Tomas to give the follow-ups a quick once over to check there's nothing I've missed in Kyles work.

Thanks for your effort guys, this will be a nice improvement.
Comment 9 Julian Maurice 2020-07-03 10:12:55 UTC
Not sure how this worked before, but uninstalling a plugin with the patch applied leaves a lot of files in <pluginsdir>. Can it be fixed ?
Comment 10 David Cook 2020-07-06 01:05:17 UTC
(In reply to Julian Maurice from comment #9)
> Not sure how this worked before, but uninstalling a plugin with the patch
> applied leaves a lot of files in <pluginsdir>. Can it be fixed ?

I think uninstallation is already broken anyway? Bug 25604
Comment 11 Katrin Fischer 2020-08-16 21:47:33 UTC
Tomas, you are QA contact here - could you verify that uninstalling works correctly?
Comment 12 Katrin Fischer 2020-08-22 22:47:09 UTC
Please check comment#9 and comment#10 - something appears not to be right with uninstalling plugins.
Comment 13 Martin Renvoize (ashimema) 2022-04-11 08:17:30 UTC
Is this dead in the water?
Comment 14 Kyle M Hall (khall) 2022-04-11 10:46:39 UTC
(In reply to Martin Renvoize from comment #13)
> Is this dead in the water?

I'm not opposed to continuing work on it if someone can tell me what needs done.
Comment 15 David Cook 2022-04-12 00:00:45 UTC
I don't have anything to ad from a QA perspective... but I'm intrigued by this one!

In Discourse, the named plugins go into /var/www/discourse/plugins, so you wind up with something like /var/www/discourse/plugins/discourse-jwt/plugin.rb (https://github.com/discourse/discourse-jwt). I found it super convenient.
Comment 16 Kyle M Hall (khall) 2022-04-12 11:57:31 UTC
(In reply to David Cook from comment #15)
> I don't have anything to ad from a QA perspective... but I'm intrigued by
> this one!
> 
> In Discourse, the named plugins go into /var/www/discourse/plugins, so you
> wind up with something like
> /var/www/discourse/plugins/discourse-jwt/plugin.rb
> (https://github.com/discourse/discourse-jwt). I found it super convenient.

Yeah, that's basically the gist of what we are trying do to here as well!