Author: jsuchome
Date: Wed Dec 5 13:18:17 2007
New Revision: 42709
URL: http://svn.opensuse.org/viewcvs/yast?rev=42709&view=rev
Log:
- added command line support (F302395)
- fixed generating configuration path name (#346152)
- 2.16.6
Modified:
trunk/product-creator/VERSION
trunk/product-creator/package/yast2-product-creator.changes
trunk/product-creator/src/Kiwi.ycp
trunk/product-creator/src/ProductCreator.ycp
trunk/product-creator/src/commandline.ycp
trunk/product-creator/src/dialogs.ycp
trunk/product-creator/src/kiwi_dialogs.ycp
trunk/product-creator/src/product-creator.ycp
Modified: trunk/product-creator/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/VERSION?rev=42709&r1=42708&r2=42709&view=diff
==============================================================================
--- trunk/product-creator/VERSION (original)
+++ trunk/product-creator/VERSION Wed Dec 5 13:18:17 2007
@@ -1 +1 @@
-2.16.5
+2.16.6
Modified: trunk/product-creator/package/yast2-product-creator.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/package/yast2-product-creator.changes?rev=42709&r1=42708&r2=42709&view=diff
==============================================================================
--- trunk/product-creator/package/yast2-product-creator.changes (original)
+++ trunk/product-creator/package/yast2-product-creator.changes Wed Dec 5 13:18:17 2007
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Wed Dec 5 09:57:45 CET 2007 - jsuchome@suse.cz
+
+- added command line support (F302395)
+- fixed generating configuration path name (#346152)
+- 2.16.6
+
+-------------------------------------------------------------------
Mon Dec 3 15:12:11 CET 2007 - jsuchome@suse.cz
- perl-XML-LibXML required for ag_kiwi
Modified: trunk/product-creator/src/Kiwi.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/Kiwi.ycp?rev=42709&r1=42708&r2=42709&view=diff
==============================================================================
--- trunk/product-creator/src/Kiwi.ycp (original)
+++ trunk/product-creator/src/Kiwi.ycp Wed Dec 5 13:18:17 2007
@@ -716,7 +716,7 @@
if (!FileUtils::Exists (images_dir))
SCR::Execute (.target.mkdir, images_dir);
SCR::Execute (.target.bash, sformat ("cp -ar %1 %2/", config_dir, images_dir));
- return (images_dir + KiwiConfig["name"]:"");
+ return (images_dir + "/" + KiwiConfig["name"]:"");
}
/**
Modified: trunk/product-creator/src/ProductCreator.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/ProductCreator.ycp?rev=42709&r1=42708&r2=42709&view=diff
==============================================================================
--- trunk/product-creator/src/ProductCreator.ycp (original)
+++ trunk/product-creator/src/ProductCreator.ycp Wed Dec 5 13:18:17 2007
@@ -164,8 +164,13 @@
symbol autoyastPackages ()
{
string base_selection = "";
- //Pkg::TargetFinish ();
- Popup::ShowFeedback(_("Reading data from Package Database..."), _("Please wait..."));
+ // busy message
+ string feedback = _("Reading data from Package Database...");
+ if (Mode::commandline())
+ CommandLine::PrintVerbose (feedback);
+ else
+ // popup
+ Popup::ShowFeedback (feedback, _("Please wait..."));
Pkg::TargetFinish ();
string tmp = (string)SCR::Read( .target.tmpdir );
Modified: trunk/product-creator/src/commandline.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/commandline.ycp?rev=42709&r1=42708&r2=42709&view=diff
==============================================================================
--- trunk/product-creator/src/commandline.ycp (original)
+++ trunk/product-creator/src/commandline.ycp Wed Dec 5 13:18:17 2007
@@ -9,10 +9,12 @@
{
import "CommandLine";
+ import "FileUtils";
import "Progress";
import "ProductCreator";
- textdomain "product-creator";
+ import "RichText";
+ textdomain "product-creator";
void ProcessConfigFileOption(map params)
{
@@ -32,6 +34,135 @@
}
}
+ /**
+ * Go through the command line parameters map, verify the validity
+ * and fill appropriate gloal values
+ * @param params map with command line parameters
+ * @param action for what action are the parameters intended (create/edit)
+ */
+ boolean ProcessParameters (map params, string action)
+ {
+ string name = params["name"]:"";
+ if (name == "")
+ {
+ // command line error message
+ Report::Error (_("Configuration name is missing."));
+ return false;
+ }
+ map Config = $[
+ "name" : name
+ ];
+
+ if (action != "create" && !haskey (ProductCreator::Configs, name))
+ {
+ // command line error message, %1 is a name
+ Report::Error (sformat (_("There is no configuration %1."), name));
+ return false;
+ }
+ if (action == "edit" || action == "show")
+ {
+ ProductCreator::LoadConfig (name);
+ Config = ProductCreator::Config;
+ }
+ if (action == "show")
+ return true;
+
+ // first, handle required parameters
+ if (params["output_dir"]:"" != "")
+ {
+ Config["iso-directory"] = params["output_dir"]:"";
+ }
+ else if (action == "create")
+ {
+ // command line error message
+ Report::Error (_("Path to output directory is missing."));
+ return false;
+ }
+
+ list<string> repos = splitstring (params["repositories"]:"", ",");
+ if (repos != [])
+ Config["sources"] = repos;
+ else if (action == "create")
+ {
+ // command line error message
+ Report::Error (_("List of package repositories is empty."));
+ return false;
+ }
+
+ if (params["profile"]:"" != "")
+ Config["profile"] = params["profile"]:"";
+ else if (action == "create")
+ {
+ // command line error message
+ Report::Error (_("Path to AutoYaST profile is missing."));
+ return false;
+ }
+ if (haskey (params, "copy_profile"))
+ Config["copy_profile"] = true;
+
+ // there is no manual way for selecting packages:
+ if (action == "create" || params["profile"]:"" != "")
+ {
+ Config["pkgtype"] = "autoyast";
+ ProductCreator::profile_parsed = false;
+ }
+
+ if (params["iso_name"]:"" != "")
+ Config["isofile"] = params["iso_name"]:"";
+ else if (action == "create")
+ Config["isofile"] = name + ".iso";
+
+ if (haskey (params, "create_iso"))
+ Config["result"] = "iso";
+ else if (action == "create")
+ Config["result"] = "tree";
+
+ if (haskey (params, "savespace"))
+ Config["savespace"] = true;
+
+ if (params["gpg_key"]:"" != "")
+ {
+ Config["gpg_key"] = params["gpg_key"]:"";
+ }
+
+ // no selections
+ if (action == "create")
+ Config["type"] = `patterns;
+
+ if (params["isolinux_path"]:"" != "")
+ {
+ string file = params["isolinux_path"]:"";
+ if (!FileUtils::Exists (file))
+ {
+ // command line error message
+ Report::Error (sformat (_("File %1 does not exist."), file));
+ return false;
+ }
+ if (SCR::Read(.target.size, file)> 0)
+ {
+ string cont = (string)SCR::Read (.target.string, file);
+ if (cont != nil)
+ Config["bootconfig"] = cont;
+ }
+ }
+
+ ProductCreator::Config = Config;
+
+ // read default isolinux (Config needs to be saved already to
+ // ProductCreator::Config, it is used by Readisolinux)
+ if (params["isolinux_path"]:"" == "" && action == "create")
+ {
+ ProductCreator::Config["bootconfig"] =
+ ProductCreator::Readisolinux();
+ }
+
+ // save the new configuration into global map, parse autoyast profile
+ ProductCreator::CommitConfig ();
+ }
+
+ /**
+ * Command line handler for List action: list available configurations
+ */
boolean ListHandler(map params)
{
ProcessConfigFileOption(params);
@@ -42,9 +173,12 @@
}
);
- return true;
+ return false; // = do not try to write
}
+ /**
+ * Command line handler for Create ISO action
+ */
boolean CreateIsoHandler(map params)
{
y2milestone("CreateIsoHandler parameters: %1", params);
@@ -60,6 +194,7 @@
if (!ProductCreator::LoadConfig(name))
{
+ // command line error message
CommandLine::Print(sformat(_("Cannot load configuration %1."), name));
return false;
}
@@ -80,6 +215,7 @@
// verify the destination
if (VerifyDialog() != `next)
{
+ // command line error message
CommandLine::Print("Cannot verify the destination");
return false;
}
@@ -94,11 +230,13 @@
integer image_size = (integer)SCR::Read(.target.size, iso_name);
if (SCR::Read(.target.size, iso_name) < 0)
{
+ // command line error message (%1 is path)
CommandLine::Print(sformat(_("Cannot create ISO image %1."), iso_name));
return false;
}
else
{
+ // command line info message
CommandLine::Print(sformat(_("ISO image %1 has been written."), iso_name));
}
@@ -106,10 +244,127 @@
}
else
{
- CommandLine::Print(_("Error: Configuration name cannot be empty."));
+ // command line error message
+ Report::Error (_("Configuration name cannot be empty."));
return false;
}
return true;
}
+
+ /**
+ * Command line handler for Create Config action: create new product
+ * configuration
+ */
+ boolean CreateConfigHandler (map params)
+ {
+ y2milestone ("CreateConfigHandler parameters: %1", params);
+ ProcessConfigFileOption(params);
+
+ return ProcessParameters (params, "create");
+ }
+
+ /**
+ * Command line handler for Delete Config action
+ */
+ boolean DeleteConfigHandler (map params)
+ {
+ y2milestone ("DeleteConfigHandler parameters: %1", params);
+ string name = params["name"]:"";
+
+ if (name == "")
+ {
+ // command line error message
+ Report::Error (_("Configuration name is missing."));
+ return false;
+ }
+ ProductCreator::Configs = filter(string k, map v, ProductCreator::Configs, ``(k!=name));
+ return true;
+ }
+
+ /**
+ * Command line handler for Edit Config action
+ */
+ boolean EditConfigHandler (map params)
+ {
+ y2milestone ("EditConfigHandler parameters: %1", params);
+ ProcessConfigFileOption(params);
+
+ return ProcessParameters (params, "edit");
+ }
+
+ /**
+ * Command line handler for Show Config action
+ */
+ boolean ShowConfigHandler (map params)
+ {
+ y2milestone ("EditConfigHandler parameters: %1", params);
+ ProcessConfigFileOption(params);
+ if (!ProcessParameters (params, "show"))
+ return false;
+
+ // summary caption
+ CommandLine::Print (_("Package Source"));
+ foreach(string s, ProductCreator::Config["sources"]:[], ``{
+ CommandLine::Print ("* " + s);
+ });
+
+
+ /*
+ // summary line (%1 is number)
+ CommandLine::Print (sformat(_("Selected %1 packages"),
+ size (ProductCreator::Config["packages"]:[])));
+ // currently does not have sense: packages from patterns would need
+ // to be counted as well
+ */
+ if (ProductCreator::Config["profile"]:"" != "")
+ {
+ // summary line (%1 is file path)
+ CommandLine::Print (sformat(_("Using AutoYaST profile %1"),
+ ProductCreator::Config["profile"]:""));
+ }
+
+
+ if (ProductCreator::Config["result"]:"tree" == "iso")
+ {
+ // summary line (%1/%2 is file path)
+ CommandLine::Print (sformat(_("Creating ISO image %1/%2"),
+ ProductCreator::Config["iso-directory"]:"",
+ ProductCreator::Config["isofile"]:"") );
+ }
+ else
+ {
+ // summary line (%1/%2 is file path)
+ CommandLine::Print (sformat(_("Creating directory tree in %1/%2"),
+ ProductCreator::Config["iso-directory"]:"",
+ ProductCreator::Config["name"]:"") );
+ }
+
+ string gpgkey = ProductCreator::Config["gpg_key"]:"";
+
+ if (gpgkey != "")
+ {
+ list<map> privatekeys = GPG::PrivateKeys();
+ string uid = "";
+ foreach(map key, privatekeys,
+ {
+ if (key["id"]:"" == gpgkey)
+ {
+ uid = mergestring(key["uid"]:[], ", ");
+ }
+ }
+ );
+ if (uid != "")
+ uid = sformat(" (%1)", uid);
+
+ // summary text - %1 is GPG key ID (e.g. ABCDEF01), %2 is GPG key user ID (or empty if not defined)
+ CommandLine::Print (sformat(_("Digitally sign the medium with GPG key %1%2"), gpgkey, uid));
+ }
+ else
+ {
+ // summary text
+ CommandLine::Print (_("The medium will not be digitally signed"));
+ }
+ return false;
+ }
}
Modified: trunk/product-creator/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/dialogs.ycp?rev=42709&r1=42708&r2=42709&view=diff
==============================================================================
--- trunk/product-creator/src/dialogs.ycp (original)
+++ trunk/product-creator/src/dialogs.ycp Wed Dec 5 13:18:17 2007
@@ -99,7 +99,6 @@
string caption = _("CD Creator Configuration");
- string source = ProductCreator::Config["source"]:"";
string name = ProductCreator::Config["name"]:"";
string pkgtype = ProductCreator::Config["pkgtype"]:"package-manager";
@@ -268,7 +267,6 @@
string publisher = ProductCreator::Config["publisher"]:"";
string preparer = ProductCreator::Config["preparer"]:"";
string result = ProductCreator::Config["result"]:"iso";
- string db = ProductCreator::Config["database"]:"original";
string isofile_path = ProductCreator::Config["isofile"]:"";
boolean savespace = ProductCreator::Config["savespace"]:false;
@@ -1349,10 +1347,24 @@
// summary caption
summary = Summary::AddHeader(summary,_("Output Directory"));
- // summary line
- summary = Summary::AddLine(summary,sformat(_("Creating directory tree in <b> %1/%2 </b>"),
+ if (ProductCreator::Config["result"]:"tree" == "iso")
+ {
+ summary = Summary::AddLine (summary,
+ // summary line (%1/%2 is file path)
+ sformat (_("Creating ISO image %1/%2"),
+ ProductCreator::Config["iso-directory"]:"",
+ ProductCreator::Config["isofile"]:"")
+ );
+ }
+ else
+ {
+ summary = Summary::AddLine (summary,
+ // summary line (%1/%2 is file path)
+ sformat(_("Creating directory tree in <b> %1/%2 </b>"),
ProductCreator::Config["iso-directory"]:"",
- ProductCreator::Config["name"]:"") );
+ ProductCreator::Config["name"]:"")
+ );
+ }
// header in the summary dialog
Modified: trunk/product-creator/src/kiwi_dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/kiwi_dialogs.ycp?rev=42709&r1=42708&r2=42709&view=diff
==============================================================================
--- trunk/product-creator/src/kiwi_dialogs.ycp (original)
+++ trunk/product-creator/src/kiwi_dialogs.ycp Wed Dec 5 13:18:17 2007
@@ -799,9 +799,10 @@
map read_config = Kiwi::ReadConfigXML (kiwi_configuration);
if (!KiwiConfig["_imported"]:false)
{
- KiwiConfig = (map) union (
- // "type" had different meaning in ProductCreator::Config...
- remove (KiwiConfig, "type"), read_config);
+ // "type" had different meaning in ProductCreator::Config...
+ if (haskey (KiwiConfig, "type"))
+ KiwiConfig = remove (KiwiConfig, "type");
+ KiwiConfig = (map) union (KiwiConfig, read_config);
// for new configuration, do not read all from the template
y2milestone ("product-creator based configuration...");
foreach (string key, ["addons", "packages", "sources"], {
Modified: trunk/product-creator/src/product-creator.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/product-creator.ycp?rev=42709&r1=42708&r2=42709&view=diff
==============================================================================
--- trunk/product-creator/src/product-creator.ycp (original)
+++ trunk/product-creator/src/product-creator.ycp Wed Dec 5 13:18:17 2007
@@ -34,16 +34,36 @@
"initialize" : ProductCreator::Read,
"finish" : ProductCreator::Write,
"actions" : $[
- "list" :$[
+ "list" : $[
"handler" : ListHandler,
- // translators: command line help text for summary action
+ // translators: command line help text for list action
"help" : _("Print existing configurations")
],
- "create-iso" :$[
+ "create-iso" : $[
"handler" : CreateIsoHandler,
- // translators: command line help text for summary action
+ // translators: command line help text for create-iso action
"help" : _("Create installation ISO image")
- ]
+ ],
+ "create" : $[
+ "handler" : CreateConfigHandler,
+ // translators: command line help text for create-config action
+ "help" : _("Create new product configuration")
+ ],
+ "delete" : $[
+ "handler" : DeleteConfigHandler,
+ // translators: command line help text for delete-config action
+ "help" : _("Delete existing configuration")
+ ],
+ "edit" : $[
+ "handler" : EditConfigHandler,
+ // translators: command line help text for delete-config action
+ "help" : _("Edit existing configuration")
+ ],
+ "show" : $[
+ "handler" : ShowConfigHandler,
+ // translators: command line help text for show action
+ "help" : _("Show the summary of selected configuration")
+ ],
],
"options" : $[
"name" : $[
@@ -52,7 +72,7 @@
"type" : "string"
],
"passphrase" : $[
- // translators: command line help text for the 'passhrase' option
+ // translators: command line help text for the 'passphrase' option
"help" : _("GPG passhrase required for signing the source."),
"type" : "string"
],
@@ -66,11 +86,64 @@
"help" : sformat(_("Path to the configuration file (default is %1"),
ProductCreator::ConfigFile),
"type" : "string"
- ]
+ ],
+ "output_dir" : $[
+ // command line help text for 'output_dir' option
+ "help" : _("Path to the output directory"),
+ "type" : "string"
+ ],
+ // TODO provide also for create-iso...?
+ "create_iso" : $[
+ // command line help text for 'create_iso' option
+ "help" : _("Output should be ISO image instead of directory tree"),
+ ],
+ "iso_name" : $[
+ // command line help text for 'iso_name' option
+ "help" : _("Name of the output ISO image"),
+ "type" : "string",
+ ],
+ "savespace" : $[
+ // command line help text for 'savespace' option
+ "help" : _("Copy only needed files to save space"),
+ ],
+ "profile" : $[
+ // command line help text for 'profile' option
+ "help" : _("Path to AutoYaST profile"),
+ "type" : "string"
+ ],
+ "copy_profile" : $[
+ // command line help text for 'copy_profile' option
+ "help" : _("Copy AutoYaST profile to CD image"),
+ ],
+ "isolinux_path" : $[
+ // command line help text for 'isolinux_path' option
+ "help" : _("Path to isolinux.cfg file"),
+ "type" : "string"
+ ],
+ "gpg_key" : $[
+ // command line help text for 'gpg_key' option
+ "help" : _("GPG key ID used to sign a product"),
+ "type" : "string",
+ ],
+ "repositories" : $[
+ // command line help text for 'repositories' option
+ "help" : _("List of package repositories (separated by commas)"),
+ "type" : "string"
+ ],
],
"mappings" : $[
"list" : ["configfile"],
"create-iso" : ["name", "passphrase", "passphrase_file", "configfile"],
+ "create" : ["name", "configfile", "output_dir", "create_iso",
+ "iso_name", "savespace", "profile", "copy_profile", "isolinux_path",
+ "gpg_key", "repositories",
+ ],
+ "edit" : ["name", "configfile", "output_dir", "create_iso",
+ "iso_name", "savespace", "profile", "copy_profile", "isolinux_path",
+ "gpg_key", "repositories",
+ ],
+ "delete" : ["name"],
+ "show" : ["name"],
]
];
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org