Bug 363958

Summary: yast2-packager needs to require yast2-*-pkg and handling of missing pkg widget
Product: [openSUSE] openSUSE 11.0 Reporter: Michal Svec <msvec>
Component: YaST2Assignee: Stefan Hundhammer <shundhammer>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P5 - None CC: casualprogrammer, mmeeks
Version: Alpha 2   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard: maint:released:11.2:28219
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Not so silent ;-) failure to load pkg plugin

Description Michal Svec 2008-02-22 10:32:10 UTC
To prevent broken yast2-packager experience it seems we need several things:

  - yast2-packager needs to require yast2_pkg (virtual capability) to ensure
    it could run at least some way, it would be provided by all yast2-*-pkg

  - yast2-qt-pkg needs to require yast2-qt and ncurses the same way, to ensure
    at least some level of consistency

  - yast2-packager needs to check for the widget of the same UI it's running
    in and warn the user if it's not available (*), to prevent situation with
    running yast2-qt and having only yast2-ncurses-pkg installed

(*) Ideally, it should be able to install the widget at runtime and possibly
continue to run.
Comment 1 Katarina Machalkova 2008-02-22 14:36:12 UTC
1) is a good point, I'm going to add it to ncurses-pkg right away.
2) is already done in nc-pkg (Requires: yast2-ncurses >= 2.16.15), but can't see it in qt-pkg
3) is not that trivial:

I've fixed yast2-ncurses to throw UI Exception (and display evil red error box) if the below ReplaceWidget in inst_packages.ycp client fails:

UI::ReplaceWidget(`rep,
                   mode == nil ?
                   `PackageSelector(`id(`packages ), "") ...

It should fail, as `PackageSelector widget is not created if we don't have the appropriate plugin (YUI::widgetFactory()->createPackageSelector() returns NULL)

Now it is up to ycp client to handle the failure and do not call UI::RunPkgSelection, if we don't have PackageSelector widget, possibly offer user to install suitable *-pkg package.
Comment 2 Katarina Machalkova 2008-02-22 14:38:50 UTC
.. and for the latter, we could possibly extend each UI's GetDisplayInfo function to return a string (either of yast2-ncurses-pkg|yast2-qt-pkg|yast2-gtk-pkg) to inform YCP client which package with pkg-selector plugin it needs.
Comment 3 Ladislav Slezák 2008-02-25 12:02:11 UTC
To comment #1 3): The package selector is a special widget and there already is UI::HasSpecialWidget() function, it should be also used for checking whether the package selector is available. What do you think?
Comment 4 Katarina Machalkova 2008-02-25 12:20:47 UTC
UI::HasSpecialWidget() is query-only function, it does not really create the widgets, it only questions particular UI whether it has capability to create certain widget. So you would not really find out whether `PackageSelector can be created or not.
Moreover, `PackageSelector is not an optional (special) widget ;-) and imho it should not become one, because every UI should support it and implement it.
Comment 5 Stefan Hundhammer 2008-02-25 12:59:59 UTC
The package selector is a mandatory widget. The pattern selector and the simple patch selector, however, are optional widgets.

Anyway, we will probably need a meta-provides like

    yast2_ui_pkg

(similar to yast2_ui which yast2-qt, yast2-ncurses, and yast2-gtk provide)
and make yast2-qt-pkg, yast2-ncurses-pkg, and yast2-gtk (and if/when the package part is split off from yast2-gtk yast2-gtk-pkg instead) provide that symbol and yast2-packager require it.
Comment 6 Stefan Hundhammer 2008-02-25 13:46:06 UTC
yast2-qt-pkg      now provides yast2_ui_pkg
yast2-ncurses-pkg now provides yast2_ui_pkg
yast2-packager    now requires yast2_ui_pkg

yast2-qt-pkg      now requires yast2-qt

yast2-ncurses-pkg already required yast2-ncurses


submitted packages
- yast2-qt-pkg
- yast2-ncurses-pkg
- yast2-packager


TO DO (-> mmeeks):

yast2-gtk should provide yast2_ui_pkg
(until we'll get yast2-gtk-pkg, at which point yast2-gtk-pkg should provide yast2_ui_pkg)
Comment 7 Michael Meeks 2008-02-25 15:06:14 UTC
Please don't feel that gtk+ is somehow different from qt/ncurses :-) do feel free to commit the (I assume fairly trivial) .spec file fix to yast2-gtk at the same time.
Comment 8 Stefan Hundhammer 2008-02-25 15:26:12 UTC
OK. Done and submitted (yast2-gtk-2.16.5).
Comment 9 Stanislav Visnovsky 2008-02-25 15:30:13 UTC
The fix just ensures there is at least one working package manager widget. But YaST will still fail silently if user is not running the particular working UI. Or am I missing something?
Comment 10 Stefan Hundhammer 2008-02-25 15:42:09 UTC
(In reply to comment #9 from Stanislav Visnovsky)
> The fix just ensures there is at least one working package manager widget. 

Right. But that's more than we had before.

> But YaST will still fail silently if user is not running the particular 
> working UI.

It fails, but it shouldn't fail silently. You should get a YUIException that will result in an error dialog (http://svn.opensuse.org/svn/yast/trunk/ycp-ui-bindings/src/YCPErrorDialog.cc). If that doesn't work, this is another bug that needs to be fixed.


Comment 11 Katarina Machalkova 2008-02-25 15:53:56 UTC
Created attachment 196958 [details]
Not so silent ;-) failure to load pkg plugin

Does this look any better?
Comment 12 Stefan Hundhammer 2008-02-25 16:06:47 UTC
Duh. It did exit(1) if there was no plug-in.
Comment 13 Stefan Hundhammer 2008-02-25 16:09:38 UTC
Now throwing a proper exception that displays an error pop-up.
Comment 14 Cyril Hrubis 2008-02-29 14:56:15 UTC
*** Bug 364849 has been marked as a duplicate of this bug. ***
Comment 15 Swamp Workflow Management 2009-10-30 09:36:09 UTC
Update released for: yast2-gtk
Products:
openSUSE 11.2 (debug, i586, x86_64)