[yast-devel] MetaPackage status
Greetings all, I've just finished re-writing the MetaPackage handler for installation of software from webpages. Martin has kindly agreed to help package it as next week I am away on holiday Monday-Friday. The UI has only minor cosmetic changes and: - Introduction of a welcome screen displaying overall details of the metapackage, using the new name/summary/description elements Adrian requested. - Introduction of Simple/Advanced modes. - Addition of warning dialogue before installation to attempt to ensure users review the changes. - More detailed status reporting. See http://benjiweber.co.uk/OCI/screenshots/ for a tour. This version of the MetaPackage handler is almost a complete re-write. It is now using the new schema that is the outcome of various discussions over the past few weeks. See http://en.opensuse.org/Standards/One_Click_Install The only feature that I have not been able to test as working is the Pattern installation, see my other mail about that. I have also tried to make it easier to extend & maintain, and work around some of the limitations of YaST to allow - Separation of UI & logic. - Easy XML handling. - Privilege Escalation mid process. - Communication of detailed status. The design I have decided upon eventually is possibly best illustrated by a diagram: http://benjiweber.co.uk/OCI/OCI-design.png I have used perl-xml-xpath as this seems to allow XML to be handled fairly easily from within YCP. One can simply select any data out of the XML document which is itself handled by Perl. This also avoids requiring lots of custom Perl or YCP. I have utilised the existing yast2-xml support for marshalling/unmarshalling YCP datatypes to and from XML to transfer state between limited-user and root instances of YaST. The invocation of the root instance is performed using xdg-su so it will work on either KDE or GNOME. The basic workflow is: 1) User opens metapackage 2) User reviews changes that will be made, and commits/makes changes/aborts. 3) Installation is performed as root 4) Status is displayed to user. Which expands to: 1) User clicks a ymu link on a webpage, or clicks on a ymp file. 2) OneClickInstallUI is invoked with the metapackage uri as a parameter, this downloads the xml file if necessary and asks OneClickInstall module to load it. 3) OneClickInstall module parses the XML, picks out the relevant data based on what product & language the user is using. This is stored in its own internal format. 4) User interacts with the OneClickInstallUI user interface, this adjusts values in OneClickInstall depending on what the user selects. 5) OneClickInstall state is persisted to temporary file. 6) Root instance of OneClickInstallWorker is invoked. 7) OneClickInstall state is recovered from temporary file. 8) Installation is performed, results are stored in OneClickInstallWorkerResponse module. 9) OneClickInstallWorkerResponse state is persisted back to the temporary file. 10) OneClickInstallWorkerResponse running as the user restores its state from the temporary file. 10) OneClickInstallUI running as the user displays the status by querying the response. A summary of each file and its purpose: OneClickInstallUI.ycp : Wizard User Interface. This is pretty much only the User Interface, it interacts with the other components to do things. OneClickInstallUrlHandler.ycp : Simple additional stage that allows for the additional level of indirection of the YMUs, this is required to allow embedding of just the URL itself in a webpage. OneClickInstallWorker.ycp : Performs the actual installation. This contains just the installation logic. OneClickInstall.ycp : Responsible for most of the logic. Can load an XML document in the metapackage format, select the appropriate data from it and store it in its own internal format. Provides an interface for the User interface and install worker to obtain the information they require. Provides ToXML and FromXML methods for transfering state between the limited user instance and the root instance. OneClickInstallWorkerResponse.ycp : Responsible for storing installation status & error messages. Provides ToXML and FromXML methods for transferring state between the limited user instance and the root instance. YPX.pm : Thin wrapper around the Perl::XML::XPath, allows querying of data out of an XML document without requiring lots of ugly YCP or Perl code. ==Installation== The installation instructions are relatively similar to the existing handler, so hopefully the existing spec can be adjusted. There is a new dependency on Perl-XML-XPath, instead of Perl-XML-Simple. So this will need to be packaged. Using the perl xpath library actually makes consuming XML from within YCP itself quite simple, instead of ugly solutions, or needing to use lots of perl. Until this is packaged you can install the XPath library by running cpan as root and typing: "install XML::XPath" If you are using 10.2 rather than factory (I have not tested this on factory yet) you will need to install xdg-su which you can get from http://benjiweber.co.uk/OCI/xdg-utils-1.0.1-45.noarch.rpm Grab http://benjiweber.co.uk/OCI/deploy.tar.gz and copy the contents of the modules directory to /usr/share/YaST2/modules, copy the contents of the clients directory to /usr/share/YaST2/clients. You can test whether it is working by running "/sbin/YaST2 OneClickInstallUI http://benjiweber.co.uk/OCI/test-tuxsaver.ymp" in a terminal. N.B. Mimetypes & Programme names have both changed so the associations will need to be re-created, once this is done you can test the link at http://benjiweber.co.uk/OCI/test.html =KDE/Konqueror= Replace all instances of ~/.kde/share/ in these instructions with `kde-config --prefix`/share/ for systemwide installation. Copy the two files from http://benjiweber.co.uk/OCI/mimelnk to ~/.kde/share/mimelnk/text Copy the two files from http://benjiweber.co.uk/OCI/applnk to ~/.kde/share/applnk/.hidden Add the following sections to ~/.kde/share/config/profilerc -- [text/x-suse-ymp - 1] AllowAsDefault=true Application=kde-yast2-ymp.desktop GenericServiceType=Application Preference=1 ServiceType=text/x-suse-ymp [text/x-suse-ymu - 1] AllowAsDefault=true Application=kde-yast2-ymp.desktop GenericServiceType=Application Preference=1 ServiceType=text/x-suse-ymu -- Add the following lines to ~/.kde/share/config/konquerorc in the [Notification Messages] section: -- askEmbedOrSavetext/x-suse-ymp=no askEmbedOrSavetext/x-suse-ymu=no askSavetext/x-suse-ymp=no askSavetext/x-suse-ymu=no -- Kill all instances of konqueror and restart it. =Firefox= We have to use a wrapper script for firefox as it doesn't support associating things with a command + parameters. Save the following as /sbin/OneClickInstallUrlHandler , and make it executable. -- #!/bin/bash /sbin/YaST2 OneClickInstallUrlHandler $@ -- Add the following to mimeTypes.rdf (~/.mozilla/firefox/..profilename../mimeTypes.rdf if you're installing just for your user). Just below the opening element. -- <RDF:Description RDF:about="urn:mimetype:externalApplication:text/x-suse-ymu" NC:path="/sbin/OneClickInstallUrlHandler" NC:prettyName="OneClickInstallUrlHandler" /> <RDF:Description RDF:about="urn:mimetype:text/x-suse-ymu" NC:value="text/x-suse-ymu" NC:editable="true" NC:description="" > <NC:handlerProp RDF:resource="urn:mimetype:handler:text/x-suse-ymu"/> </RDF:Description> <RDF:Description RDF:about="urn:mimetype:handler:text/x-suse-ymu" NC:alwaysAsk="false" NC:saveToDisk="false" NC:useSystemDefault="false" NC:handleInternal="false"> <NC:externalApplication RDF:resource="urn:mimetype:externalApplication:text/x-suse-ymu"/> </RDF:Description> -- A sample complete mimeTypes.rdf follows -- <?xml version="1.0"?> <RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#" xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <RDF:Description RDF:about="urn:mimetype:externalApplication:text/x-suse-ymu" NC:path="/sbin/OneClickInstallUrlHandler" NC:prettyName="OneClickInstallUrlHandler" /> <RDF:Description RDF:about="urn:mimetype:text/x-suse-ymu" NC:value="text/x-suse-ymu" NC:editable="true" NC:description="" > <NC:handlerProp RDF:resource="urn:mimetype:handler:text/x-suse-ymu"/> </RDF:Description> <RDF:Description RDF:about="urn:mimetype:handler:text/x-suse-ymu" NC:alwaysAsk="false" NC:saveToDisk="false" NC:useSystemDefault="false" NC:handleInternal="false"> <NC:externalApplication RDF:resource="urn:mimetype:externalApplication:text/x-suse-ymu"/> </RDF:Description> <RDF:Description RDF:about="urn:mimetypes"> <NC:MIME-types RDF:resource="urn:mimetypes:root"/> </RDF:Description> </RDF:RDF> -- _ Benjamin Weber -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (1)
-
Benji Weber