Author: jsuchome
Date: Tue Dec 2 16:01:38 2008
New Revision: 53823
URL: http://svn.opensuse.org/viewcvs/yast?rev=53823&view=rev
Log:
- created UI for product dependency (fate#305172)
- write product dependency into input prod file
- ask for media type and flavor
- bs_productconvert produces 2 packages, take them both
- template has only product section
- 2.17.7
Modified:
trunk/add-on-creator/VERSION
trunk/add-on-creator/package/yast2-add-on-creator.changes
trunk/add-on-creator/src/AddOnCreator.ycp
trunk/add-on-creator/src/complex.ycp
trunk/add-on-creator/src/template.prod
Modified: trunk/add-on-creator/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/VERSION?rev=53823&r1=53822&r2=53823&view=diff
==============================================================================
--- trunk/add-on-creator/VERSION (original)
+++ trunk/add-on-creator/VERSION Tue Dec 2 16:01:38 2008
@@ -1 +1 @@
-2.17.6
+2.17.7
Modified: trunk/add-on-creator/package/yast2-add-on-creator.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/package/yast2-add-on-creator.changes?rev=53823&r1=53822&r2=53823&view=diff
==============================================================================
--- trunk/add-on-creator/package/yast2-add-on-creator.changes (original)
+++ trunk/add-on-creator/package/yast2-add-on-creator.changes Tue Dec 2 16:01:38 2008
@@ -1,4 +1,14 @@
-------------------------------------------------------------------
+Tue Dec 2 15:52:25 CET 2008 - jsuchome@suse.cz
+
+- created UI for product dependency (fate#305172)
+- write product dependency into input prod file
+- ask for media type and flavor
+- bs_productconvert produces 2 packages, take them both
+- template has only product section
+- 2.17.7
+
+-------------------------------------------------------------------
Mon Nov 24 14:35:01 CET 2008 - jsuchome@suse.cz
- really include the template in the package
Modified: trunk/add-on-creator/src/AddOnCreator.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/src/AddOnCreator.ycp?rev=53823&r1=53822&r2=53823&view=diff
==============================================================================
--- trunk/add-on-creator/src/AddOnCreator.ycp (original)
+++ trunk/add-on-creator/src/AddOnCreator.ycp Tue Dec 2 16:01:38 2008
@@ -250,115 +250,6 @@
// help text for content file 'UPDATEURLS' key
"help" : _("URL of the update source."),
],
-/*
- "DEFAULTBASE" : $[
- "key" : "DEFAULTBASE",
- // label of content file key
- "label" : _("Minimum architecture base supported"),
- // help text for content file 'DEFAULTBASE' key
- "help" : _("Minimum architecture base supported by this product. The default is the base architecture if no matching <b>ARCH.base</b> is found."),
- "mandatory" : true,
- "type" : "combo",
- "allowed_values" : allowed_archs,
- ],
- "PRODUCT" : $[
- "key" : "PRODUCT",
- // label of content file key
- "label" : _("Product name"),
- // help text for content file 'PRODUCT' key
- "help" : _("Name of the add-on product"),
- "mandatory" : true,
- ],
- "DISTPRODUCT" : $[
- "key" : "DISTPRODUCT",
- // label of content file key
- "label" : _("Distribution ID"),
- // help text for content file 'DISTPRODUCT' key
- "help" : _("Distribution ID (vendor specific). The value of the keyword must not contain spaces. Only letters, numbers, and the characters \".~_-\" are allowed."),
- "mandatory" : true,
- ],
- "DISTVERSION" : $[
- "key" : "DISTVERSION",
- // label of content file key
- "label" : _("Distribution version"),
- // help text for content file 'DISTVERSION' key
- "help" : _("Distribution version (vendor specific)."),
- "value" : "1",
- "mandatory" : true,
- ],
- "REQUIRES" : $[
- "key" : "REQUIRES",
- // label of content file key
- "label" : _("Resolvables that must be installed"),
- // help text for content file 'REQUIRES' key
- "help" : _("<p>Resolvables that must be installed on the system to meet the needs of this product.</p>
-<p>This is a space-separated list of names or <tt>kind:name</tt> pairs optionally followed by version constraints. Just a name denotes a dependency to a package, such as <tt>sles-release</tt> or <tt>sles-release-10</tt>. The kind can be package, pattern, or product, such as <tt>pattern:basesystem</tt>.</p>"),
- "mandatory" : true,
- ],
- "PREREQUIRES" : $[
- "key" : "PREREQUIRES",
- // labeliption of content file PREREQUIRES key
- "label" : _("Resolvables needed before installation"),
- // help text for content file 'PREREQUIRES' key
- "help" : _("Resolvables that must be installed on the system before the installation of this product. The syntax is the same as for <b>REQUIRES</b>."),
- ],
- "PROVIDES" : $[
- "key" : "PROVIDES",
- // label of content file PROVIDES key
- "label" : _("Resolvables provided"),
- // help text for content file 'PROVIDES' key
- "help" : _("Capabilities this product provides. They can be used to match <b>REQUIRES</b> from others. Every resolvable has a provides by default- its own name and edition. For example, package <i>bar-1.42-1</i> provides the capability <tt>bar = 1.42-1</tt>."),
- ],
- "CONFLICTS" : $[
- "key" : "CONFLICTS",
- // label of content file 'CONFLICTS' key
- "label" : _("Conflicting resolvables"),
- // help text for content file 'CONFLICTS' key
- "help" : _("This resolvable cannot be installed if the specified resolvable or one that provides the capability is installed."),
- ],
- "OBSOLETES" : $[
- "key" : "OBSOLETES",
- // label of content file 'OBSOLETES' key
- "label" : _("Resolvables made obsolete"),
- // help text for content file 'OBSOLETES' key
- "help" : _("When this resolvable is installed, it uninstalls any other resolvable with a name matching this keyword."),
- ],
- "RECOMMENDS" : $[
- "key" : "RECOMMENDS",
- // label of content file 'RECOMMENDS' key
- "label" : _("Recommended resolvables"),
- // help text for content file 'RECOMMENDS' key
- "help" : _("A weak version of <b>REQUIRES</b>. An attempt is made to fulfill <b>RECOMMENDS</b>, but they are silently ignored if no match is possible."),
- ],
- "SUGGESTS" : $[
- "key" : "SUGGESTS",
- // label of content file 'SUGGESTS' key
- "label" : _("Suggested resolvables"),
- // help text for content file 'SUGGESTS' key
- "help" : _("These are just hints for an application and not handled during dependency resolution."),
- ],
- "SUPPLEMENTS" : $[
- "key" : "SUPPLEMENTS",
- // label of content file 'SUPPLEMENTS' key
- "label" : _("Supplemented resolvables"),
- // help text for content file 'SUPPLEMENTS' key
- "help" : _("A reverse <b>RECOMMENDS</b>. This product is installed if the specified capability is provided by an installed resolvable. The dependency resolver installs it. Uninstalling it is silently accepted."),
- ],
- "ENHANCES" : $[
- "key" : "ENHANCES",
- // label of content file 'ENHANCES' key
- "label" : _("Enhanced resolvables"),
- // help text for content file 'ENHANCES' key
- "help" : _("A reverse <b>SUGGESTS</b>. This product can be installed if this capability is provided by an installed resolvable. It is just a hint for an application. For example, <i>SuSEplugger</i> can suggest packages for installation if specific hardware is found."),
- ],
- "FLAGS" : $[
- "key" : "FLAGS",
- // label of content file 'FLAGS' key
- "label" : _("Flags"),
- // help text for content file 'FLAGS' key
- "help" : _("Product-specific capabilities."),
- ],
- */
];
// skeletons for special keys in content file
@@ -371,16 +262,6 @@
"help" : _("UTF-8-encoded <b>LABEL</b>. <tt>lang</tt> has the same syntax as the <b>LINGUAS</b> values. For each language in <b>LINGUAS</b>, a matching <b>LABEL.lang</b> is expected."),
"helplabel" : "LABEL.lang",
],
- /*
- "ARCH" : $[
- // label of content file ARCH.base key
- "label" : _("Allowed architectures"),
- // help text for content file 'ARCH.base' key
- "help" : _("Space-separated list of allowed architectures for <tt>base</tt>."),
- "helplabel" : "ARCH.base",
- "mandatory" : true
- ],
- */
];
@@ -689,71 +570,54 @@
global map content_map = $[];
// info for product.xml
-global map product_info = $[
- "REQUIRES" : $[
- "key" : "REQUIRES",
+global map product_info_descr = $[
+ "requires" : $[
+ "key" : "requires",
// label of key
- "label" : _("Resolvables that must be installed"),
+ "label" : _("Products that must be installed"),
// help text for 'REQUIRES' key
- "help" : _("<p>Resolvables that must be installed on the system to meet the needs of this product.</p>
-<p>This is a space-separated list of names or <tt>kind:name</tt> pairs optionally followed by version constraints. Just a name denotes a dependency to a package, such as <tt>sles-release</tt> or <tt>sles-release-10</tt>. The kind can be package, pattern, or product, such as <tt>pattern:basesystem</tt>.</p>"),
- "mandatory" : true,
- ],
- "PREREQUIRES" : $[
- "key" : "PREREQUIRES",
- // labeliption of PREREQUIRES key
- "label" : _("Resolvables needed before installation"),
- // help text for 'PREREQUIRES' key
- "help" : _("Resolvables that must be installed on the system before the installation of this product. The syntax is the same as for <b>REQUIRES</b>."),
+ "help" : _("<p>Resolvables that must be installed on the system to meet the needs of this product.</p>"),
+ "type" : "dependency",
],
- "PROVIDES" : $[
- "key" : "PROVIDES",
+ "provides" : $[
+ "key" : "provides",
// label of PROVIDES key
- "label" : _("Resolvables provided"),
+ "label" : _("Provided products"),
// help text for 'PROVIDES' key
- "help" : _("Capabilities this product provides. They can be used to match <b>REQUIRES</b> from others. Every resolvable has a provides by default- its own name and edition. For example, package <i>bar-1.42-1</i> provides the capability <tt>bar = 1.42-1</tt>."),
+ "help" : _("Capabilities this product provides. They can be used to match <b>requires</b> from others."),
+ "type" : "dependency",
],
- "CONFLICTS" : $[
- "key" : "CONFLICTS",
+ "conflicts" : $[
+ "key" : "conflicts",
// label of 'CONFLICTS' key
- "label" : _("Conflicting resolvables"),
+ "label" : _("Conflicting products"),
// help text for 'CONFLICTS' key
"help" : _("This resolvable cannot be installed if the specified resolvable or one that provides the capability is installed."),
+ "type" : "dependency",
],
- "OBSOLETES" : $[
- "key" : "OBSOLETES",
+ "obsoletes" : $[
+ "key" : "obsoletes",
// label of 'OBSOLETES' key
- "label" : _("Resolvables made obsolete"),
+ "label" : _("Products made obsolete"),
// help text for 'OBSOLETES' key
"help" : _("When this resolvable is installed, it uninstalls any other resolvable with a name matching this keyword."),
+ "type" : "dependency",
],
- "RECOMMENDS" : $[
- "key" : "RECOMMENDS",
+ "recommends" : $[
+ "key" : "recommends",
// label of 'RECOMMENDS' key
- "label" : _("Recommended resolvables"),
+ "label" : _("Recommended products"),
// help text for 'RECOMMENDS' key
- "help" : _("A weak version of <b>REQUIRES</b>. An attempt is made to fulfill <b>RECOMMENDS</b>, but they are silently ignored if no match is possible."),
+ "help" : _("A weak version of <b>requires</b>. An attempt is made to fulfill <b>RECOMMENDS</b>, but they are silently ignored if no match is possible."),
+ "type" : "dependency",
],
- "SUGGESTS" : $[
- "key" : "SUGGESTS",
+ "suggests" : $[
+ "key" : "suggests",
// label of 'SUGGESTS' key
- "label" : _("Suggested resolvables"),
+ "label" : _("Suggested products"),
// help text for 'SUGGESTS' key
"help" : _("These are just hints for an application and not handled during dependency resolution."),
- ],
- "SUPPLEMENTS" : $[
- "key" : "SUPPLEMENTS",
- // label of 'SUPPLEMENTS' key
- "label" : _("Supplemented resolvables"),
- // help text for 'SUPPLEMENTS' key
- "help" : _("A reverse <b>RECOMMENDS</b>. This product is installed if the specified capability is provided by an installed resolvable. The dependency resolver installs it. Uninstalling it is silently accepted."),
- ],
- "ENHANCES" : $[
- "key" : "ENHANCES",
- // label of 'ENHANCES' key
- "label" : _("Enhanced resolvables"),
- // help text for 'ENHANCES' key
- "help" : _("A reverse <b>SUGGESTS</b>. This product can be installed if this capability is provided by an installed resolvable. It is just a hint for an application. For example, <i>SuSEplugger</i> can suggest packages for installation if specific hardware is found."),
+ "type" : "dependency",
],
"release" : $[
"key" : "release",
@@ -765,11 +629,16 @@
// table item label
"label" : _("The URL for release notes rpm"),
],
- "description" : $[
+ "description" : $[
"key" : "description",
// table item label
"label" : _("Product description"),
],
+ "patchlevel" : $[
+ "key" : "patchlevel",
+ // table item label
+ "label" : _("Patch level"),
+ ],
"summary" : $[
"key" : "summary",
// table item label
@@ -782,10 +651,32 @@
// help text for 'productline' key
"help" : _("A short name of the product which do not change between service packs and versions."),
],
+ "updaterepokey" : $[
+ "key" : "updaterepokey",
+ // table item label
+ "label" : _("Update repository key"),
+ ],
+ "media type" : $[
+ "key" : "media type",
+ // table item label
+ "label" : _("Type of media"),
+ // help text for media type
+ "help" : _("Type of media that will be used for target product. Possible values are: cd, ftp, dvd5, dvd9."),
+ ],
+ "flavor" : $[
+ "key" : "flavor",
+ // table item label
+ "label" : _("Product flavor"),
+ // help text for media type
+ "help" : _("Description of the flavor or variant of a product, e.g. DVD, FTP, Live"),
+ ],
];
+// save the structure of product_info, but not the values
+global map product_info = $[];
+
// the content of .prod file, as read using any_xml agent
-map product_xml = $[];
+global map product_xml = $[];
/**
@@ -916,12 +807,74 @@
"ContentKey" : content_key,
]
]);
-// ret = anyxml["products",0]:$[];
ret = (map) anyxml;
return ret;
}
/**
+ * Get the map describing product.xml and produce better readable YCP map
+ * @param xml map as read from xml file (from ReadProductXML)
+ * @param if the values in new ProductInfo map should be merged with current one
+ * (only changes are written when saving project, this means 'apply changes')
+ */
+global map GetProductInfo (map xml, boolean merge_with_current) {
+
+ // (because it is 'merge_with_current', product_info can
+ // be used as global variable, reflecting current state)
+ map retmap =
+ merge_with_current ? product_info : product_info_descr;
+ map prod_map = xml["product",0]:$[]; // maso, ze?
+
+ // only simple values are supported here, something nested
+ // deeper (e.g. linguas) will not work
+ foreach (string key, map desc, retmap, {
+ if (haskey (prod_map, key))
+ {
+ string val = prod_map[key,0,content_key]:"";
+ if (val != "")
+ {
+ if (merge_with_current)
+ {
+ // set the new value only when there is nothing
+ // present in product_info[key]:
+ // in case we are editing existing add-on product
+ // configuration, there can be some modifications
+ // saved, and they are preferred
+ if (retmap[key,"value"]:"" == "")
+ retmap[key,"value"] = val;
+ else
+ // manual modifications present -> generate
+ // this is used when product xml was read from rpm
+ generate_release_package = true;
+ }
+ else
+ retmap[key,"value"] = val;
+ }
+ }
+ });
+ // ok, let's try to read at least release notes url
+ foreach (map url, prod_map["urls",0,"url"]:[], {
+ if (url["name"]:"" == "releasenotes")
+ {
+ if (!merge_with_current || retmap["releasenotes","value"]:"" == "")
+ retmap["releasenotes","value"] = url[content_key]:"";
+ }
+ });
+ // read the product dependencies FIXME they are not here
+ // either in mediasets, or we must for rpm
+ // rpm -qp --requires `path to rpm` | grep product
+ foreach (map dep, prod_map["productdependency"]:[], {
+ string key = dep["relationship"]:"";
+ if (retmap[key,"value"]:[] == [])
+ retmap[key,"value"] = [];
+ retmap[key,"value"] = add (retmap[key,"value"]:[],
+ remove (dep, "relationship"));
+ });
+ y2milestone ("product_info: %1", retmap);
+ return retmap;
+}
+
+/**
* Take list of content-file data and update global content_map.
* If argument is empty, global 'content' list is used as an input.
*/
@@ -1074,6 +1027,9 @@
// read the template file
product_xml = ReadProductXML (
Directory::datadir + "/add-on-creator/template.prod");
+
+ // fill the inital values
+ product_info = product_info_descr;
return true;
}
@@ -1572,6 +1528,7 @@
if (substring (name, size (name) - 8) == "-release")
{
y2milestone ("release package found: %1, %2", name, f);
+ // FIXME beware, there may be flavor release package
release_package = f;
}
}
@@ -1586,7 +1543,6 @@
foreach (string key, map entry, content_descr, {
if (content_map[key]:"" != "")
entry["value"] = content_map[key]:"";
- // FIXME what default to put into BASEARCHS?
if (key == "BASEARCHS")
{
string archs = mergestring (arch_directories, " ");
@@ -1655,35 +1611,9 @@
y2milestone ("reading product info from %1", prod_file);
// read the prod file info and add it into the template
product_xml = ReadProductXML (prod_file);
- // translate product_xml map into product_info... huh
- map prod_map = product_xml["product",0]:$[];
- // only simple values are supported here, something nested
- // deeper (e.g. linguas) will not work
- foreach (string key, map desc, product_info, {
- if (haskey (prod_map, key))
- {
- string val = prod_map[key,0,content_key]:"";
- if (val != "")
- {
- // set the value from rpm only when there is nothing
- // present in product_info[key]:
- // in case we are editing existing add-on product
- // configuration, there can be some modifications
- // saved, and they are preferred
- if (product_info[key,"value"]:"" == "")
- product_info[key,"value"] = val;
- else
- // manual modifications present -> generate
- generate_release_package = true;
- }
- }
- });
- // ok, let's try to read at least release notes url
- foreach (map url, prod_map["urls",0,"url"]:[], {
- if (url["name"]:"" == "releasenotes")
- product_info["releasenotes","value"]= url[content_key]:"";
- });
- y2milestone ("product_info: %1", product_info);
+
+ // translate product_xml map into product_info
+ product_info = GetProductInfo (product_xml, true);
}
}
@@ -2227,21 +2157,26 @@
if (!FileUtils::Exists (base_path))
return false;
- // release package name and architecture
- string release_package = "";
- string arch = "";
+ // release packages names and architectures
+ map release_packages = $[];
// 1. update product_xml map using product_info and content,
// write the result into temporary .prod file
string name = content_map["NAME"]:"add-on";
- map submap= product_xml["productdefinition",0,"products",0,"product",0]:$[];
+ map submap = product_xml["product",0]:$[];
submap["id"] = name;
submap["name",0, content_key] = name;
submap["version",0, content_key] = content_map["VERSION"]:"1.0";
submap["vendor",0, content_key] = content_map["VENDOR"]:"";
+ if (product_info["summary","value"]:"" == "")
+ product_info["summary","value"] = name;
+
+ if (product_info["release","value"]:"" == "")
+ product_info["release","value"] = "0";
+
foreach (string key, ["release", "summary", "description"], {
submap[key,0,content_key]=product_info[key,"value"]:"";
});
@@ -2266,8 +2201,40 @@
]];
}
}
-
- product_xml["productdefinition",0,"products",0,"product"] = [ submap ];
+ // write the dependency stuff
+ list<map> dependency = [];
+ foreach (string key, map desc, product_info, {
+ if (desc["type"]:"" == "dependency")
+ {
+ foreach (map dep, (list<map>) desc["value"]:[], {
+ dependency = add (dependency, add (dep, "relationship", key));
+ });
+ }
+ });
+ list mediasets = [];
+ if (size (dependency) > 0)
+ {
+ mediasets = [ $[
+ "media" : [ $[
+ "productdependency" : dependency,
+ "type" : product_info["media type","value"]:"dvd",
+ "flavor" : product_info["flavor","value"]:"dvd",
+ "name" : name,
+ "product" : name
+ ]],
+ ]];
+ }
+
+ product_xml = $[
+ "productdefinition" : [ $[
+ "products" : [
+ $[
+ "product" : [ submap ]
+ ],
+ ],
+ "mediasets" : mediasets
+ ]],
+ ];
string prod_file_path = sformat ("%1/%2.product", tmpdir, name);
@@ -2283,7 +2250,6 @@
"KeyAttr" : [],
]
]);
-
string product_dir = tmpdir + "/" + name;
SCR::Execute (.target.mkdir, product_dir);
@@ -2295,6 +2261,14 @@
string cmd = sformat (
"rpmbuild -bb `find -L %1 -name %2-release.spec`", tmpdir, name);
+ if (out["exit"]:0 != 0)
+ {
+ y2error ("rpmbuild failed with %1", out["stderr"]:"");
+ SCR::Execute (.target.remove, prod_file_path);
+ SCR::Execute (.target.bash, sformat ("rm -rf '%1'", product_dir));
+ return false;
+ }
+
out = (map) SCR::Execute (.target.bash_output, cmd, $["LANG":"C"]);
if (out["exit"]:0 != 0)
{
@@ -2312,16 +2286,13 @@
y2milestone ("release package: %1", package);
out = (map) SCR::Execute (.target.bash_output,
sformat ("rpm -q -p %1 --qf \"%%{ARCH}\"", package));
- release_package = package;
- arch = out["stdout"]:"";
+ release_packages[package] = out["stdout"]:"";
}
- break;
}
});
}
// 4. copy the release package to the correct place
- if (release_package != "")
- {
+ foreach (string package_path, string arch, release_packages, {
// create arch directory if it does not exist
if (!contains (arch_directories, arch))
{
@@ -2329,9 +2300,8 @@
SCR::Execute (.target.mkdir, full_data_path + "/" + arch);
}
SCR::Execute (.target.bash, sformat ("/bin/cp -r %1 '%2/%3'",
- release_package, full_data_path, arch));
- }
-
+ package_path, full_data_path, arch));
+ });
// 5. delete the tmp files, so it doesn't mess possible next builds
SCR::Execute (.target.remove, prod_file_path);
SCR::Execute (.target.bash, sformat ("rm -rf '%1'", product_dir));
Modified: trunk/add-on-creator/src/complex.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/src/complex.ycp?rev=53823&r1=53822&r2=53823&view=diff
==============================================================================
--- trunk/add-on-creator/src/complex.ycp (original)
+++ trunk/add-on-creator/src/complex.ycp Tue Dec 2 16:01:38 2008
@@ -376,14 +376,39 @@
map current_product = AddOnCreator::current_product;
- string requires = AddOnCreator::product_info["REQUIRES","value"]:"";
+ /*
+ string requires = AddOnCreator::product_info["requires","value"]:"";
if (requires == "")
requires = "openSUSE-release = 11.1";
+ */
+
+ // try to read existing product dependency and transform it to one string
+ // easily understanable
+ list requres_l = AddOnCreator::product_info["requires","value"]:[];
+ map requires_m = requres_l[0]:$[];
+ // this is just internal string used to decide between predefined options
+ string requires = "";
+ if (requires_m["name"]:"" != "")
+ requires = sformat ("%1-%2", requires_m["name"]:"", requires_m["version"]:"");
+ else
+ {
+ /* TODO read current product infow:
+jsuchome@rivendell:~> more /etc/SuSE-release
+openSUSE 11.1 Beta 3 (i586)
+VERSION = 11.1
+
+dhcp86:~ # more /etc/SuSE-release
+SUSE Linux Enterprise Server 11 (x86_64)
+VERSION = 11
+PATCHLEVEL = 0
+ */
+
+ }
+ string requires_orig = requires;
string old_dir = current_product["rpm_path"]:"";
if (old_dir == nil)
current_product["rpm_path"] = "";
- string old_requires = requires;
map content_map = AddOnCreator::content_map;
string product = content_map["NAME"]:content_map["PRODUCT"]:"";
@@ -409,27 +434,27 @@
`VSpacing (0.4),
`RadioButtonGroup (`id(`rd),
`Left(`HVSquash(`VBox (
- `Left (`RadioButton(`id(`sles11), `opt (`notify),
+ `Left (`RadioButton(`id ("SUSE_SLES-11"), `opt (`notify),
// radio button label
_("SUSE &Linux Enterprise Server 11"),
- requires == "sles-release = 11")),//FIXME
- `Left (`RadioButton(`id(`sled11), `opt (`notify),
+ requires == "SUSE_SLES-11")),
+ `Left (`RadioButton(`id ("SUSE_SLED-11"), `opt (`notify),
// radio button label
_("SUSE L&inux Enterprise Desktop 11"),
- requires == "sled-release = 11")),//FIXME
- `Left (`RadioButton(`id(`sle11), `opt (`notify),
+ requires == "SUSE_SLED-11")),
+ `Left (`RadioButton(`id ("SUSE_SLE-11"), `opt (`notify),
// radio button label
- _("S&USE Linux Enterprise 11"),//FIXME
- requires == "sle-release-11")),
- `Left (`RadioButton(`id(`opensuse111), `opt (`notify),
+ _("S&USE Linux Enterprise 11"),
+ requires == "SUSE_SLE-11")),
+ `Left (`RadioButton(`id("openSUSE-11.1"), `opt (`notify),
// radio button label
_("OpenSUSE &11.1"),
- requires == "openSUSE-release = 11.1")),
+ requires == "openSUSE-11.1")),
`HBox (
`Left(`RadioButton(`id(`other), `opt (`notify),
// radio button label
- _("&Other"))),
- `InputField (`id(`other_val), "")
+ _("&Other")))
+// `InputField (`id(`other_val), "")
)
)))
),
@@ -467,10 +492,13 @@
if (UI::QueryWidget (`id(`rd), `Value) == nil)
{
UI::ChangeWidget (`id(`rd), `Value, `other);
- UI::ChangeWidget (`id(`other_val), `Value, requires);
+ requires = ""; // empty string means other than predefined values
+// UI::ChangeWidget (`id(`other_val), `Value, requires);
}
+ /*
UI::ChangeWidget (`id(`other_val), `Enabled,
UI::QueryWidget (`id(`rd), `Value) == `other);
+ */
any ret = nil;
@@ -503,23 +531,10 @@
}
else if (ret == `other)
{
- UI::SetFocus (`id(`other_val));
- }
- else if (ret == `sles11) {
- requires = ""; // FIXME...
- UI::ChangeWidget (`id(`other_val), `Enabled, false);
- }
- else if (ret == `sled11) {
- requires = "";
- UI::ChangeWidget (`id(`other_val), `Enabled, false);
- }
- else if (ret == `sle11) {
requires = "";
- UI::ChangeWidget (`id(`other_val), `Enabled, false);
}
- else if (ret == `opensuse111) {
- requires = "openSUSE-release = 11.1";
- UI::ChangeWidget (`id(`other_val), `Enabled, false);
+ else if (is (ret, string)) {
+ requires = (string) ret;
}
else if (ret == `other) {
requires = "";
@@ -547,9 +562,18 @@
if (req_dir != "" && substring (req_dir, size (req_dir) - 1, 1) != "/")
req_dir = req_dir + "/";
AddOnCreator::current_product["required_rpm_path"] = req_dir;
- if (requires == "")
- requires = (string) UI::QueryWidget (`id(`other_val), `Value);
- AddOnCreator::product_info["REQUIRES","value"] = requires;
+ if (requires != "" && requires != requires_orig)
+ {
+ list<string> req_l = splitstring (requires, "-");
+ AddOnCreator::product_info["requires","value"] = [
+ // with predefined values, use only one required product
+ $[
+ "name" : req_l[0]:"",
+ "version" : req_l[1]:"",
+ "flag" : "EQ",
+ ]
+ ];
+ }
AddOnCreator::content_map["NAME"] = product;
AddOnCreator::content_map["VERSION"] = version;
@@ -603,15 +627,9 @@
map AddContentValue (list conflicts) {
map ret = $[];
- /*
- list allowed_archs = filter (string arch, AddOnCreator::allowed_archs, {
- return !contains (conflicts, "ARCH." + arch);
- });
- */
list allowed_langs = filter (string l, AddOnCreator::GetLangCodes (true),{
return !contains (conflicts, "LABEL." + l);
});
-// string help = mergestring (maplist (string k, ["ARCH", "LABEL"], {
string help = sformat ("<p><b>%1</b></p>%2<br>",
AddOnCreator::content_specials["LABEL","helplabel"]:"",
AddOnCreator::content_specials["LABEL","help"]:"");
@@ -620,30 +638,11 @@
`HSpacing(1),
`VBox(
`VSpacing (0.5),
- /*
- `RadioButtonGroup (`id(`rd), `Left(`VBox (
- `Left (`RadioButton(`id("ARCH"), `opt (`notify),_("&ARCH"),true)),
- allowed_archs == [] ? `VSpacing (0) :
- `HBox (
- `HSpacing (),
- // combo label
- `Left (`ComboBox (`id(`base), _("&Base Architecture"),
- allowed_archs))
- ),
- `Left (`RadioButton (`id("LABEL"), `opt (`notify), _("&LABEL"))),
- `HBox (
- `HSpacing (),
- // combo label
- `Left (`ComboBox (`id(`lang), _("La&nguage Code"),
- allowed_langs))
- )
- ))),
- */
`Label (_("LABEL")),
// combo label
`Left (`ComboBox (`id(`lang), _("La&nguage Code"), allowed_langs)),
// textentry label
- `TextEntry (`id(`val), _("&Value"), ""),
+ `InputField (`id(`val),`opt (`hstretch), _("&Value"), ""),
`HBox(
`PushButton(`id(`ok),`opt(`default,`key_F10),Label::OKButton()),
`PushButton(`id(`cancel),`opt (`key_F9), Label::CancelButton()),
@@ -652,17 +651,6 @@
),
`HSpacing(1)
));
- /*
- if (allowed_archs != [])
- {
- UI::ChangeWidget (`id(`lang), `Enabled, false);
- }
- else
- {
- UI::ChangeWidget (`id("ARCH"), `Enabled, false);
- UI::ChangeWidget (`id(`rd), `Value, "LABEL");
- }
- */
UI::SetFocus (`id(`val));
while (true)
{
@@ -672,14 +660,6 @@
ret = $[];
break;
}
- /*
- string but = (string) UI::QueryWidget (`id(`rd), `Value);
- if (result == "ARCH" || result == "LABEL")
- {
- UI::ChangeWidget (`id(`lang), `Enabled, result == "LABEL");
- UI::ChangeWidget (`id(`base), `Enabled, result == "ARCH");
- }
- */
if (result == `help)
{
// Heading for help popup window
@@ -687,11 +667,6 @@
}
if (result == `ok)
{
- /*
- string key = sformat ("%1.%2", but, but == "ARCH" ?
- UI::QueryWidget (`id(`base), `Value) :
- UI::QueryWidget (`id(`lang), `Value));
- */
ret = union (AddOnCreator::content_specials["LABEL"]:$[], $[
"key" : sformat ("LABEL.%1",
UI::QueryWidget (`id(`lang), `Value)),
@@ -716,6 +691,7 @@
map current_product = AddOnCreator::current_product;
list<map> content = AddOnCreator::content;
+ map product_xml = $[]; // used only when imported
mapproduct_info = AddOnCreator::product_info;
boolean generate_release_package =AddOnCreator::generate_release_package;
integer linguas_entry = -1;
@@ -741,9 +717,32 @@
list get_prod_items () {
list ret = [];
foreach (string key, map entry, product_info, {
- ret = add (ret, `item (`id (key),
- key, entry["value"]:"", entry["label"]:"")
- );
+ if (entry["type"]:"" == "dependency")
+ {
+ string value = "";
+ foreach (map dep, entry["value"]:[], {
+ string prod = sformat ("%1-%2-%3",
+ dep["name"]:"", dep["version"]:"1", dep["flag"]:"EQ");
+ if (dep["release"]:"" != "")
+ prod = prod + "-" + dep["release"]:"";
+ if (dep["flavor"]:"" != "")
+ prod = prod + "-" + dep["flavor"]:"";
+ if (dep["patchlevel"]:"" != "")
+ prod = prod + "-" + dep["patchlevel"]:"";
+ if (value != "")
+ value = value + ",";
+ value = value + prod;
+ });
+ ret = add (ret, `item (`id (key),
+ key, value , entry["label"]:"")
+ );
+ }
+ else
+ {
+ ret = add (ret, `item (`id (key),
+ key, entry["value"]:"", entry["label"]:"")
+ );
+ }
});
return ret;
}
@@ -880,16 +879,33 @@
else if (ret == `edit_prod || ret == `prod_table) {
string key = (string)
UI::QueryWidget (`id (`prod_table), `CurrentItem);
- any val = (string) EditValue (product_info[key]:$[], "prod");
+ any val = EditValue (product_info[key]:$[], "prod");
if (val != nil)
{
product_info[key,"value"] = val;
- UI::ChangeWidget (`id (`prod_table),`Item (key,1), val);
+ if (product_info[key,"type"]:"" == "dependency")
+ UI::ChangeWidget (`id (`prod_table), `Items,
+ get_prod_items ());
+ else
+ UI::ChangeWidget (`id (`prod_table),`Item (key,1), val);
}
UI::SetFocus (`id (`prod_table));
}
- // FIXME `import_prod
- else if (ret == `next) {
+ else if (ret == `import_prod) {
+ string file = UI::AskForExistingFile (
+ current_product["base_output_path"]:"", "",
+ // popup for file selection dialog
+ _("Choose the Existing Product File")
+ );
+ if (file != nil)
+ {
+ product_xml = AddOnCreator::ReadProductXML (file);
+ product_info =
+ AddOnCreator::GetProductInfo (product_xml, false);
+ UI::ChangeWidget (`id (`prod_table), `Items, get_prod_items ());
+ }
+ }
+ else if (ret == `next) {
list<string> missing = [];
foreach (map entry, content, {
if (entry["value"]:"" == "" && entry["mandatory"]:false)
@@ -918,6 +934,8 @@
content[index,"value"] = product;
AddOnCreator::content = content;
AddOnCreator::UpdateContentMap (content);
+ if (product_xml != $[])
+ AddOnCreator::product_xml = product_xml;
AddOnCreator::product_info = product_info;
AddOnCreator::generate_release_package = generate_release_package;
break;
@@ -972,19 +990,21 @@
string type = entry["type"]:"string";
// textentry label
string label = sformat (_("Value of \"%1\""),
- table_type == "content" ? entry["key"]:"" : entry["label"]:"");
+ table_type == "content" ? entry["key"]:"" : entry["label"]:"");
any value = entry["value"]:nil;
if (value == nil)
{
if (table_type == "content" || table_type == "prod")
value = "";
- if (type == "package-list")
+ if (type == "package-list" || type == "dependency")
value = [];
}
+ list<map> lvalues = []; // list of maps for "dependency" type
- term cont = `TextEntry (`id (`main), label, sformat("%1", value));
- symbol w_id = `main;
+ term cont =
+ `InputField (`id (`main), `opt (`hstretch), label, sformat("%1",value));
+ any w_id = `main;
integer height = 5;
string help = table_type == "content" ?
@@ -1009,7 +1029,84 @@
return ret;
}
- if (type == "boolean")
+ // helper function, generate widget id distinguished by numbers
+ string get_id (string key, integer number) {
+ return sformat ("%1-%2", key, number);
+ }
+
+ // number of products reffered in the dependency tags
+ integer products = 0;
+
+ list<string> dependency_attrs =
+ ["name", "version", "flag", "release", "patchlevel", "flavor"];
+
+ // generate a term for one product present in dependency tags
+ term get_dependency_term (integer number, map value_map) {
+ string flag = value_map["flag"]:"";
+ return `Frame ("", `VBox (
+ `HBox (
+ `HWeight (1,
+ // input field label
+ `InputField (`id (get_id ("name", number)),
+ // input field label
+ _("Name"), value_map["name"]:"")
+ ),
+ `HSpacing (0.8),
+ `HWeight (1, `InputField (`id (get_id ("version", number)),
+ // input field label
+ _("Version"),value_map["version"]:"")
+ ),
+ `HSpacing (0.8),
+ // combo box label
+ `HWeight (1,
+ `ComboBox (`id (get_id ("flag", number)),_("Flag"), [
+ // combo box item
+ `item (`id ("EQ"), _("Equal"), flag=="EQ" || flag==""),
+ // combo box item
+ `item (`id ("GT"), _("Greater than"), flag == "GT"),
+ // combo box item
+ `item (`id ("LT"), _("Lower than"), flag == "LT"),
+ ]
+ ))
+ ),
+ `HBox (
+ `HWeight (1, `InputField (`id (get_id ("release",number)),
+ // input field label
+ _("Release"), value_map["release"]:"")
+ ),
+ `HSpacing (0.8),
+ `HWeight (1,
+ `InputField (`id (get_id ("flavor", number)),
+ // input field label
+ _("Flavor"), value_map["flavor"]:"")
+ ),
+ `HSpacing (0.8),
+ `HWeight (1,
+ `InputField (`id (get_id ("patchlevel", number)),
+ // input field label
+ _("Patch level"), value_map["patchlevel"]:"")
+ )
+ )
+ ));
+ }
+
+ if (type == "dependency")
+ {
+ lvalues = (list<map>) value;
+ if (lvalues == []) lvalues = [ $[] ];
+ term dep_term = `VBox ();
+ foreach (map valmap, lvalues, {
+ products = products + 1;
+ dep_term = add (dep_term,get_dependency_term (products, valmap));
+ });
+ cont = `VBox (
+ `Label (entry["label"]:label),
+ `ReplacePoint (`id (`rp_dep), dep_term),
+ `Right (`PushButton (`id (`add_dep), Label::AddButton ()))
+ );
+ w_id = "name-1";
+ }
+ else if (type == "boolean")
{
cont = `VBox (
`Label (label),
@@ -1037,7 +1134,7 @@
cont = `VBox (
`HSpacing (54),
rt,
- `MultiLineEdit(`id(`main), label, sval)
+ `MultiLineEdit(`id(`main), label, sval)
);
if (height < 9) height = 9;
}
@@ -1117,10 +1214,54 @@
all_checked = ch;
}
}
+ if (result == `add_dep)
+ {
+ term dep_term = `VBox ();
+ integer i = 1;
+ integer y = 1; // counts the non-empty parts
+ do {
+ map valmap = $[];
+ foreach (string key, dependency_attrs, {
+ string val = (string)
+ UI::QueryWidget (`id (get_id (key, i)), `Value);
+ if (val != "")
+ valmap[key] = val;
+ });
+ if (size (valmap) > 1) // there's always at least the flag
+ {
+ dep_term = add (dep_term,get_dependency_term(y, valmap));
+ y = y + 1;
+ }
+ i = i + 1;
+ } while (i <= products);
+ // if there were empty products, product number could be lower now
+ products = y;
+ dep_term = add (dep_term, get_dependency_term (products, $[]));
+ UI::ReplaceWidget (`id (`rp_dep), dep_term);
+ }
if (result == `ok)
{
if (type == "package-list")
ret = UI::QueryWidget (`id(w_id),`SelectedItems);
+ else if (type == "dependency")
+ {
+ list<map> retlist = [];
+ integer i = 1;
+ do {
+ map retmap = $[];
+ foreach (string key, dependency_attrs, {
+ string val = (string)
+ UI::QueryWidget (`id (get_id (key, i)), `Value);
+ if (val != "")
+ retmap[key] = val;
+ });
+ if (size (retmap) > 1) // there's always at least the flag
+ retlist = add (retlist, retmap);
+ i = i + 1;
+ } while (i <= products);
+ ret = retlist;
+
+ }
else
ret = UI::QueryWidget (`id(w_id),`Value);
string error = "";
@@ -1342,8 +1483,10 @@
),
`VSpacing (0.4),
`HBox (
- // textentry label
- `TextEntry (`id (`extra_prov), _("Location of the File with Additional &Dependencies"), current_product["extra_prov_file"]:""),
+ `InputField (`id (`extra_prov), `opt (`hstretch),
+ // textentry label
+ ("Location of the File with Additional &Dependencies"),
+ current_product["extra_prov_file"]:""),
`VBox (
`Label (""),
`PushButton (`id (`browse), Label::BrowseButton ())
@@ -1581,14 +1724,16 @@
`VSpacing (0.5),
// textentry label
`IntField (`id("Key-Length"), _("Key &Size"), 1024, 4096, 2048),
+ `InputField (`id("Expire-Date"), `opt (`hstretch),
+ // textentry label
+ _("E&xpiration Date")),
// textentry label
- `TextEntry (`id("Expire-Date"), _("E&xpiration Date")),
- // textentry label
- `TextEntry (`id("Name-Real"), _("&Name")),
- // textentry label
- `TextEntry (`id("Name-Comment"), _("Commen&t")),
+ `InputField (`id("Name-Real"), `opt (`hstretch), _("&Name")),
// textentry label
- `TextEntry (`id("Name-Email"), _("E-&Mail Address")),
+ `InputField (`id("Name-Comment"), `opt (`hstretch), _("Commen&t")),
+ `InputField (`id("Name-Email"), `opt (`hstretch),
+ // textentry label
+ _("E-&Mail Address")),
// password widget label
`Password (`id ("Passphrase"), `opt (`hstretch), _("&Passphrase"))
),
Modified: trunk/add-on-creator/src/template.prod
URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/src/template.prod?rev=53823&r1=53822&r2=53823&view=diff
==============================================================================
--- trunk/add-on-creator/src/template.prod (original)
+++ trunk/add-on-creator/src/template.prod Tue Dec 2 16:01:38 2008
@@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<productdefinition xmlns:xi="http://www.w3.org/2001/XInclude">
-<products>
<product schemeversion="0.0">
<vendor></vendor>
<name></name>
@@ -15,5 +13,3 @@
<urls>
</urls>
</product>
-</products>
-</productdefinition>
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org