Author: jsmeix
Date: Thu Mar 11 18:00:36 2010
New Revision: 61278
URL: http://svn.opensuse.org/viewcvs/yast?rev=61278&view=rev
Log:
- printer_auto.ycp and printer_proposal.ycp cleanup, see
https://bugzilla.novell.com/show_bug.cgi?id=582680#c33
Currently this is untested work in progress!
When finished this will become version 2.19.6
Modified:
trunk/printer/VERSION
trunk/printer/package/yast2-printer.changes
trunk/printer/src/Printer.ycp
trunk/printer/src/printer_auto.ycp
trunk/printer/src/printer_proposal.ycp
Modified: trunk/printer/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/VERSION?rev=61278&r1=61277&r2=61278&view=diff
==============================================================================
--- trunk/printer/VERSION (original)
+++ trunk/printer/VERSION Thu Mar 11 18:00:36 2010
@@ -1 +1 @@
-2.19.5
+2.19.6
Modified: trunk/printer/package/yast2-printer.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/package/yast2-printer.changes?rev=61278&r1=61277&r2=61278&view=diff
==============================================================================
--- trunk/printer/package/yast2-printer.changes (original)
+++ trunk/printer/package/yast2-printer.changes Thu Mar 11 18:00:36 2010
@@ -1,4 +1,12 @@
-------------------------------------------------------------------
+Thu Mar 11 17:55:54 CET 2010 - jsmeix@suse.de
+
+- printer_auto.ycp and printer_proposal.ycp cleanup, see
+ https://bugzilla.novell.com/show_bug.cgi?id=582680#c33
+ Curently this is untested work in progress!
+ When finished this will become version 2.19.6
+
+-------------------------------------------------------------------
Wed Mar 3 12:18:38 CET 2010 - jsmeix@suse.de
- Fixed tools/autodetect_print_queues by testing for the
Modified: trunk/printer/src/Printer.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/Printer.ycp?rev=61278&r1=61277&r2=61278&view=diff
==============================================================================
--- trunk/printer/src/Printer.ycp (original)
+++ trunk/printer/src/Printer.ycp Thu Mar 11 18:00:36 2010
@@ -51,6 +51,18 @@
global boolean modified = false;
/**
+ * Set by AutoYaST by calling in printer_auto.ycp the "SetModified" function.
+ * Preset to false which is the right default for AutoYast.
+ */
+global boolean printer_auto_modified = false;
+
+/**
+ * Filled in by AutoYaST by calling in printer_auto.ycp the "Import" function.
+ * Preset to the empty map which is the right default for AutoYast.
+ */
+global map autoyast_printer_settings_import = $[];
+
+/**
*/
global boolean proposal_valid = false;
@@ -2249,47 +2261,6 @@
return true;
}
-/**
- * Get all printer settings from the first parameter
- * (For use by autoinstallation.)
- * @param settings The YCP structure to be imported.
- * @return boolean True on success
- */
-global boolean Import (map settings) {
- Printerlib::WriteClientSettings(settings["cups_remote_server"]:$[]);
- Printerlib::WriteCupsSettings(settings["server_settings"]:$[]);
- return true;
-}
-
-/**
- * Dump the printer settings to a single map
- * (For use by autoinstallation.)
- * @return map Dumped settings (later acceptable by Import ())
- */
-global map Export () {
- Printerlib::DetermineClientOnly();
- AutodetectQueues();
- list <map> p_queues = filter(map queue, queues, { return (queue["config"]:""=="local"); });
- map exp = $[
-// "queues" : p_queues,
-// "filters" : Printerlib::ExportFilters( p_queues ),
- "server_settings" : (map)SCR::Read(.cups.server),
- "cups_remote_server" : (map)SCR::Read(.cups.client)
- ];
-//y2internal("export %1", exp);
- return exp;
-}
-
-/**
- * Return packages needed to be installed and removed during
- * Autoinstallation to insure module has all needed software
- * installed.
- * @return map with 2 lists.
- */
-global map AutoPackages() {
- // TODO FIXME: your code here...
- return $[ "install":[], "remove":[] ];
-}
-
/* EOF */
}
+
Modified: trunk/printer/src/printer_auto.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/printer_auto.ycp?rev=61278&r1=61277&r2=61278&view=diff
==============================================================================
--- trunk/printer/src/printer_auto.ycp (original)
+++ trunk/printer/src/printer_auto.ycp Thu Mar 11 18:00:36 2010
@@ -22,7 +22,8 @@
* File: clients/printer_auto.ycp
* Package: Configuration of printer
* Summary: Client for autoinstallation
- * Authors: Johannes Meixner
+ * Authors: Michal Zugec
+ * Johannes Meixner
*
* $Id: printer_auto.ycp 27914 2006-02-13 14:32:08Z locilka $
*
@@ -32,6 +33,21 @@
*/
/**
+ * It is perfectly correct and sufficient that the
+ * AutoYaST printer profile contains only the content
+ * of /etc/cups/client.conf and /etc/cups/cupsd.conf
+ * because:
+ * The current AutoYaST printer documentation
+ * in Suse/Novell Bugzilla attachment #269970 in
+ * https://bugzilla.novell.com/show_bug.cgi?id=464364#c22
+ * describes why there cannot be support for
+ * local print queues for USB printers
+ * which is a reason that there is only support
+ * for printing with CUPS via network,
+ * and
+ * https://bugzilla.novell.com/show_bug.cgi?id=464364#c25
+ * describes that AutoYaST support regarding whether or not
+ * the cupsd should run belongs to the runlevel module.
* @param function to execute
* @param map/list of printer settings
* @return map edited settings, Summary or boolean on success depending on called function
@@ -47,6 +63,8 @@
y2milestone("Printer auto started");
import "Printer";
+import "Printerlib";
+import "Progress";
include "printer/wizards.ycp";
any ret = nil;
@@ -59,52 +77,104 @@
if(size(WFM::Args()) > 1 && is(WFM::Args(1), map))
param = (map) WFM::Args(1);
}
-y2debug("func=%1", func);
-y2debug("param=%1", param);
+y2milestone("Printer auto func='%1'", func);
+y2milestone("Printer auto param='%1'", param);
-/* Create a summary*/
-if(func == "Summary") {
- ret = Printer::QueueItems( true, true )[0]:[];
-}
-/* Reset configuration */
-else if (func == "Reset") {
- Printer::Import($[]);
- ret = $[];
-}
-// TODO: use global value to set Printer::dirty
-else if (func == "GetModified") {
- ret = true;
- }
-/* Change configuration (run AutoSequence) */
-else if (func == "Change") {
- ret = PrinterAutoSequence();
-}
-/* Import configuration */
-else if (func == "Import") {
- ret = Printer::Import(param);
-}
-/* Return actual state */
-else if (func == "Export") {
- ret = Printer::Export();
-}
-/* Return needed packages */
-else if (func == "Packages") {
- ret = Printer::AutoPackages();
-}
-/* Read current state */
-else if (func == "Read") {
- import "Progress";
- boolean progress_orig = Progress::set (false);
- ret = Printer::Read();
- Progress::set (progress_orig);
-}
-/* Write givven settings */
-else if (func == "Write") {
- import "Progress";
- boolean progress_orig = Progress::set (false);
- Printer::write_only = true;
- ret = Printer::Write();
- Progress::set (progress_orig);
+/* Create a summary string */
+if (func == "Summary")
+{ ret = _("AutoYaST printer client settings.");
+}
+/* Reset configuration to an empty map */
+else if (func == "Reset")
+{ ret = $[];
+}
+/* Called appropriately by the AutoYaST framework */
+else if (func == "SetModified")
+{ Printer::printer_auto_modified = true;
+ ret = true;
+}
+/* Provide to AutoYaST what it did set before (or the default "false") */
+else if (func == "GetModified")
+{ ret = Printer::printer_auto_modified;
+}
+/* Change configuration (run the wizards AutoSequence dialogs) */
+else if (func == "Change")
+{ // Call Printer::Read() here (compare the 'func == "Read"' case below)
+ // to make sure that when the full printer module dialogs are launched
+ // it asks the user to install the packages cups-client and cups:
+ boolean progress_orig = Progress::set( false );
+ Printer::Read();
+ Progress::set( progress_orig );
+ // PrinterAutoSequence in wizards.ycp runs only the MainSequence
+ // which are all the usual dialogs (starting with the "Overview")
+ // but without running before ReadDialog (which calls only Printer::Read)
+ // and running afterwards WriteDialog (which calls only Printer::Write)
+ // which is the reason that Printer::Read is called explicitely above.
+ ret = PrinterAutoSequence();
+}
+/*
+ * Import the AutoYaST related printer settings map from AutoYaST
+ * and store it to be used later when the Write function is called.
+ */
+else if (func == "Import")
+{ Printer::autoyast_printer_settings_import = param;
+ ret = true;
+}
+/*
+ * Read AutoYaST related printer configuration from this system's config files
+ * and export them to AutoYaST as a single map which contains
+ * the cupsd.conf entries in a "server_settings" sub-map and
+ * the client.conf entries in a "cups_remote_server" sub-map
+ * so that it can be imported later on another system from AutoYaST
+ * when AutoYaST on the other system calls the above Import function.
+ */
+else if (func == "Export")
+{ ret = $[ "server_settings" : (map)SCR::Read(.cups.server),
+ "cups_remote_server" : (map)SCR::Read(.cups.client)
+ ];
+}
+/*
+ * Return packages needed to be installed and removed during
+ * Autoinstallation to insure it has all needed software installed.
+ * @return map with 2 lists of strings $["install":[],"remove":[]]
+ */
+else if (func == "Packages")
+{ list< string > to_be_installed_packages = [];
+ if( Printerlib::TestAndInstallPackage( "cups-client", "installed" ) )
+ { to_be_installed_packages = add( to_be_installed_packages, "cups-client" );
+ }
+ if( Printerlib::TestAndInstallPackage( "cups", "installed" ) )
+ { to_be_installed_packages = add( to_be_installed_packages, "cups" );
+ }
+ ret = $[ "install":to_be_installed_packages,
+ "remove":[]
+ ];
+}
+/* Dummy to provide a Read function for the AutoYaST framework */
+else if (func == "Read")
+{ // Do not call Printer::Read() here to
+ // avoid that the AutoYaST printer client asks the user
+ // to install the packages cups-client and cups, see
+ // https://bugzilla.novell.com/show_bug.cgi?id=445719#c13
+ y2milestone("Not calling Printer::Read() to avoid that printer_auto asks to install cups-client and cups.");
+ ret = true;
+}
+/*
+ * Write the AutoYaST related printer settings to the system
+ * according to the Printer::autoyast_printer_settings_import map
+ * which was stored by a previous call of the Import function by AutoYaST.
+ * The map contains the cupsd.conf entries in a "server_settings" sub-map
+ * and the client.conf entries in a "cups_remote_server" sub-map.
+ * The cupsd.conf and client.conf entries are written by calling
+ * Printerlib::WriteClientSettings to write /etc/cups/client.conf and
+ * Printerlib::WriteCupsSettings to write /etc/cups/cupsd.conf
+ * where empty sub-maps would result empty system config files.
+ */
+else if (func == "Write")
+{ y2milestone("Writing to system '%1'", Printer::autoyast_printer_settings_import);
+ Printerlib::WriteClientSettings( Printer::autoyast_printer_settings_import["cups_remote_server"]:$[] );
+ Printerlib::WriteCupsSettings( Printer::autoyast_printer_settings_import["server_settings"]:$[] );
+ return true;
}
/* Unknown function */
else {
@@ -112,7 +182,7 @@
ret = false;
}
-y2debug("ret=%1", ret);
+y2milestone("Printer auto ret='%1'", ret);
y2milestone("Printer auto finished");
y2milestone("----------------------------------------");
Modified: trunk/printer/src/printer_proposal.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/printer_proposal.ycp?rev=61278&r1=61277&r2=61278&view=diff
==============================================================================
--- trunk/printer/src/printer_proposal.ycp (original)
+++ trunk/printer/src/printer_proposal.ycp Thu Mar 11 18:00:36 2010
@@ -51,7 +51,7 @@
map param = (map) WFM::Args(1);
map ret = $[];
-/* create a textual proposal */
+/* create a textual proposal and write it instantly to the system */
if( func == "MakeProposal" )
{ list<string> proposal = [];
string warning = nil;
@@ -63,13 +63,9 @@
// avoid that the hardware proposal asks the user
// to install the packages cups-client and cups, see
// https://bugzilla.novell.com/show_bug.cgi?id=445719#c13
- //boolean progress_orig = Progress::set( false );
- //Printer::Read();
- //Progress::set( progress_orig );
y2milestone("Not calling Printer::Read() to avoid that the proposal asks to install cups-client and cups.");
}
// Propose configuration for each local printer:
- // TODO: replace by cups-autoconfig
// Check if the packages cups-client and cups are installed
// and skip the automated queue setup if one of them is missing, see
// https://bugzilla.novell.com/show_bug.cgi?id=445719#c13
@@ -271,20 +267,21 @@
"warning" : warning,
];
}
-/* run the module */
+/* run the full printer module dialogs */
else if(func == "AskUser")
{ // Call Printer::Read() here (compare "MakeProposal" above)
- // to make sure that when the full printer module is launched
+ // to make sure that when the full printer module dialogs are launched
// it asks the user to install the packages cups-client and cups:
boolean progress_orig = Progress::set( false );
Printer::Read();
Progress::set( progress_orig );
- // TODO FIXME: Printer::Export exists but there is nothing implemented
- map stored = Printer::Export();
+ // In printer.ycp the .propose argument calls PrinterAutoSequence and
+ // PrinterAutoSequence in wizards.ycp runs only the MainSequence
+ // which are all the usual dialogs (starting with the "Overview")
+ // but without running before ReadDialog (which calls only Printer::Read)
+ // and running afterwards WriteDialog (which calls only Printer::Write)
+ // which is the reason that Printer::Read is called explicitely above.
symbol seq = (symbol) WFM::CallFunction("printer", [.propose]);
- // TODO FIXME: Printer::Import exists but there is nothing implemented
- if(seq != `next) Printer::Import(stored);
- y2debug("stored=%1",stored);
y2debug("seq=%1",seq);
ret = $[ "workflow_sequence" : seq ];
}
@@ -303,7 +300,6 @@
// it does actually nothing except to exit verbosely, see
// http://en.opensuse.org/YaST/Development/Printer_Enhancement#Basic_Implementa...:
// for background information.
- //Printer::Write();
y2milestone("No need to call Printer::Write() because it does nothing.");
}
/* unknown function */
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org