SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-01-2010, 12:32 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Removing a Plugin and its dependencies

I recently had an issue that was caused by a misbehaving plugin. More specifically, a misbehaving plugin dependency. I noticed there is no way from the plugin manager to uninstall a plugin AND all of its (unneeded) dependencies so I started thinking about writing a plugin to do this. Looking at the PluginAPI I don't see any methods that tell me what dependencies a plugin has or if an installed plugin is a dependency of another installed plugin.

Did I miss something? If not I plan on making a feature request to Sage. (I really don't want to write an XML parser.)

Tom
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.

Last edited by tmiranda; 12-01-2010 at 12:37 PM.
Reply With Quote
  #2  
Old 12-01-2010, 12:50 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
My 2 cents make the request to sagetv anyhow this should be a default feature when uninstalling a plugin.
Reply With Quote
  #3  
Old 12-01-2010, 12:51 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by tmiranda View Post
I recently had an issue that was caused by a misbehaving plugin. More specifically, a misbehaving plugin dependency. I noticed there is no way from the plugin manager to uninstall a plugin AND all of its (unneeded) dependencies so I started thinking about writing a plugin to do this. Looking at the PluginAPI I don't see any methods that tell me what dependencies a plugin has or if an installed plugin is a dependency of another installed plugin.

Did I miss something? If not I plan on making a feature request to Sage. (I really don't want to write an XML parser.)

Tom
Well, the good news, is that you won't have to write an xml parser, since java has one built in (jaxp)... unless you meant, write a tool to parse the plugin dependencies xml??

I brought this up some time ago as well.. i can remember if it was a private email or forum posting, but I didn't see anything at time to get a recursive list of dependencies.

It would be handy to simply select something like BMT and and then click completely uninstall and it would inform you of all the plugins that would have to be removed to completely remove bmt and it's dependencies. Unfortunately there is nothing in the PluginAPI about dependencies
Reply With Quote
  #4  
Old 12-01-2010, 01:02 PM
vividweb vividweb is offline
Sage Aficionado
 
Join Date: Aug 2006
Location: Calgary AB
Posts: 401
After having to try and fix some plugins, the ability to remove a plugin and its dependancies should be available.
__________________

Sage Server: i5-2500K 8 GB DDR, 6000gb HDD, 4xHD-PVR < 4xBell 6141, Win7 x64
Client 1: HD-200, Panasonic 42PX75
Client 2: HD-300, Samsung LCD
Client 3: HD-300, Samsung PN50C550
Client 4: MS Surface Pro
Reply With Quote
  #5  
Old 12-01-2010, 01:15 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by stuckless View Post
Unfortunately there is nothing in the PluginAPI about dependencies
Sure there is. GetPluginDependencies(plugin) gives you the PluginIDs of all plugins on which the given plugin depends. I've used this to implement a number of dependency-checking extension methods in my PluginAPI wrapper class. In principle this is all the information you would need to iterate over installed plugins to find the ones on which no other plugins depend.

The real trick is deciding whether it's OK to uninstall them. Suppose the user installs plugin A, which pulls in B as a dependency. Suppose also that B provides some useful feature of its own that the user then comes to rely on. In that case, automatically removing B when A is uninstalled would not necessarily be what the user wants. It's even possible that the user manually installed B first, and then A, and wants to keep B when A is removed. There's no way to distinguish these cases just by examining dependencies. So the only time it would really be safe to remove B is if B is a pure library plugin that exposes no user-level behavior at all (in which case it does no harm to leave B installed).
__________________
-- Greg
Reply With Quote
  #6  
Old 12-01-2010, 01:43 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by GKusnick View Post
Sure there is. GetPluginDependencies(plugin) gives you the PluginIDs of all plugins on which the given plugin depends. I've used this to implement a number of dependency-checking extension methods in my PluginAPI wrapper class. In principle this is all the information you would need to iterate over installed plugins to find the ones on which no other plugins depend.

The real trick is deciding whether it's OK to uninstall them. Suppose the user installs plugin A, which pulls in B as a dependency. Suppose also that B provides some useful feature of its own that the user then comes to rely on. In that case, automatically removing B when A is uninstalled would not necessarily be what the user wants. It's even possible that the user manually installed B first, and then A, and wants to keep B when A is removed. There's no way to distinguish these cases just by examining dependencies. So the only time it would really be safe to remove B is if B is a pure library plugin that exposes no user-level behavior at all (in which case it does no harm to leave B installed).
Looks like I missed that API... Thanks.

I agree that you'd have to be careful, which I why I would propose that any plugin that would do this this... should actually present the user with the complete list of plugins that would be removed before the remove is actually done... ie, like most package managers under linux.

Ideally the "uninstall" would have 2 buttons.. "uninstall" and "completely remove". The latter would prompt you with a dialog showing a complete list of plugins that need to be removed, giving you a chance to continue, or abort.

Just for the record... i don't intend on writing this... but it is good to know, as Greg pointed out, that the APIs are there, in case someone else wants to do it.
Reply With Quote
  #7  
Old 12-01-2010, 01:46 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Greg, now I remember why GetPluginDependencies doesn't work... because it doesn't return a list of plugin ids, but rather a list of descriptions...

Quote:
Returns an array of Strings which specifies the dependencies of this plugin. These strings will be descriptive and indicate the type of dependency (i.e. STV, Plugin, OS or Desktop) and the specifics of that dependency.
I thought I must have been losing my mind, because i knew I had this conversation with Narflex before aobut how handy it would be get let a list of plugin dependencies... His comment, if I recall, is that you can potentially scrape the output of GetPluginDependencies... which I wasn't prepared to do.
Reply With Quote
  #8  
Old 12-01-2010, 01:59 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by stuckless View Post
Greg, now I remember why GetPluginDependencies doesn't work... because it doesn't return a list of plugin ids, but rather a list of descriptions...

I thought I must have been losing my mind, because i knew I had this conversation with Narflex before aobut how handy it would be get let a list of plugin dependencies... His comment, if I recall, is that you can potentially scrape the output of GetPluginDependencies... which I wasn't prepared to do.
Yes, you're right; I'd forgotten that part. But looking back at my code I have in fact done that conversion to a list of PluginIDs. So the information is there and in a usable form (if you use my API wrappers).
__________________
-- Greg
Reply With Quote
  #9  
Old 12-01-2010, 02:29 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Thanks for the pointers. I didn't realize I could use the String[] from GetPluginDependencies to find the Plugin Object, now I see how to do that.

I'm going to look into this a little more because I think it's a worthwhile plugin to have available. It's probably something that should really be done in the Sage Core.

Tom
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #10  
Old 12-03-2010, 07:34 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by stuckless View Post
I agree that you'd have to be careful, which I why I would propose that any plugin that would do this this... should actually present the user with the complete list of plugins that would be removed before the remove is actually done... ie, like most package managers under linux.

Ideally the "uninstall" would have 2 buttons.. "uninstall" and "completely remove". The latter would prompt you with a dialog showing a complete list of plugins that need to be removed, giving you a chance to continue, or abort.
I've started working on this and this is the direction I'm going. When you select "completely remove" you see a list of all the dependencies with an indicator showing if it will be uninstalled or won't (because it's a dependency for another plugin.) For each dependency that will be uninstalled you can manually override the uninstall.

I'm just starting on this and suspect it will not get done real soon because Slugger and I are getting ready to release SJQv4.
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #11  
Old 12-03-2010, 08:11 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by tmiranda View Post
I've started working on this and this is the direction I'm going. When you select "completely remove" you see a list of all the dependencies with an indicator showing if it will be uninstalled or won't (because it's a dependency for another plugin.) For each dependency that will be uninstalled you can manually override the uninstall.

I'm just starting on this and suspect it will not get done real soon because Slugger and I are getting ready to release SJQv4.
I think it will be a great plugin. Good luck.
Reply With Quote
  #12  
Old 12-03-2010, 12:12 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
It's still in the deisgn phase. Lots of things to think about: dependencies of dependencies, circular depencies, order of plugin removal, failure recovery, etc. I think it will be fun.
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #13  
Old 12-03-2010, 12:30 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by tmiranda View Post
...circular depencies...
I'm pretty sure circular dependencies are detected and flagged as errors by the plugin submission script. So there shouldn't be any circular dependencies in the repository or on normal end-user installations.

On the other hand it's probably possible to abuse SageTVPluginsDev.xml to create circular dependencies locally on your dev machine.
__________________
-- Greg
Reply With Quote
  #14  
Old 12-03-2010, 12:51 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by GKusnick View Post
I'm pretty sure circular dependencies are detected and flagged as errors by the plugin submission script. So there shouldn't be any circular dependencies in the repository or on normal end-user installations.

On the other hand it's probably possible to abuse SageTVPluginsDev.xml to create circular dependencies locally on your dev machine.
I don't think they are detected by the plugin system. But if you do one like on a local dev (i did once by mistake) you will get hung when trying to install. Just the tainted circle of death
Reply With Quote
  #15  
Old 12-05-2010, 04:10 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by GKusnick View Post
I'm pretty sure circular dependencies are detected and flagged as errors by the plugin submission script. So there shouldn't be any circular dependencies in the repository or on normal end-user installations.

On the other hand it's probably possible to abuse SageTVPluginsDev.xml to create circular dependencies locally on your dev machine.
I've verified that both of these statements are true.
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #16  
Old 12-19-2010, 04:03 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
So here it is: http://forums.sagetv.com/forums/showthread.php?t=53047

I had to brush off my recursive programming skills for this so if you find bugs please let me me know.
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional dependencies in a manifest? tmiranda SageTV Studio 0 09-04-2010 05:32 PM
STVi Dependencies jaminben SageTV Studio 5 07-23-2010 05:35 PM
Plugin Dependencies: A blessing and a curse! Slugger SageTV Studio 11 05-27-2010 12:46 PM
When a plug-in states it has dependencies, are they installed automatically? CanadianEh SageTV v7 Customizations 2 05-22-2010 09:42 AM


All times are GMT -6. The time now is 02:00 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.