Author: jsuchome
Date: Mon Nov 24 14:43:57 2008
New Revision: 53545
URL: http://svn.opensuse.org/viewcvs/yast?rev=53545&view=rev
Log:
- really include the template in the package
- read info from possible existing release package
- call bs_productconvert to build a spec file for release package
- build release package using rpmbuild (fate#305172)
- 2.17.6
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
trunk/add-on-creator/yast2-add-on-creator.spec.in
Modified: trunk/add-on-creator/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/VERSION?rev=53545&r1=53544&r2=53545&view=diff
==============================================================================
--- trunk/add-on-creator/VERSION (original)
+++ trunk/add-on-creator/VERSION Mon Nov 24 14:43:57 2008
@@ -1 +1 @@
-2.17.5
+2.17.6
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=53545&r1=53544&r2=53545&view=diff
==============================================================================
--- trunk/add-on-creator/package/yast2-add-on-creator.changes (original)
+++ trunk/add-on-creator/package/yast2-add-on-creator.changes Mon Nov 24 14:43:57 2008
@@ -1,4 +1,13 @@
-------------------------------------------------------------------
+Mon Nov 24 14:35:01 CET 2008 - jsuchome@suse.cz
+
+- really include the template in the package
+- read info from possible existing release package
+- call bs_productconvert to build a spec file for release package
+- build release package using rpmbuild (fate#305172)
+- 2.17.6
+
+-------------------------------------------------------------------
Wed Oct 22 15:57:06 CEST 2008 - jsuchome@suse.cz
- added template for .prod files
Modified: trunk/add-on-creator/src/AddOnCreator.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/src/AddOnCreator.ycp?rev=53545&r1=53544&r2=53545&view=diff
==============================================================================
--- trunk/add-on-creator/src/AddOnCreator.ycp (original)
+++ trunk/add-on-creator/src/AddOnCreator.ycp Mon Nov 24 14:43:57 2008
@@ -166,6 +166,13 @@
"value" : "1",
"mandatory" : true,
],
+ "RELEASE" : $[
+ "key" : "RELEASE",
+ // table item label
+ "label" : _("The release number"),
+ "value" : "0",
+ "mandatory" : true,
+ ],
"DISTRIBUTION" : $[
"key" : "DISTRIBUTION",
// label of content file key
@@ -768,6 +775,13 @@
// table item label
"label" : _("Product summary"),
],
+ "productline" : $[
+ "key" : "productline",
+ // table item label
+ "label" : _("Product line"),
+ // help text for 'productline' key
+ "help" : _("A short name of the product which do not change between service packs and versions."),
+ ],
];
// the content of .prod file, as read using any_xml agent
@@ -840,6 +854,9 @@
// if package description files should be compressed
global boolean compress_package_descriptions = false;
+// if we should generate -release package containing .prod file
+global boolean generate_release_package = true;
+
/**
* Data was modified?
*/
@@ -864,9 +881,6 @@
*/
global string content_key = "__yast_content__";
-// data for .prod file (dependencies..., part will be copied from content file)
-global map prod_file = $[];
-
/**
* Data was modified?
* @return true if modified
@@ -1007,9 +1021,7 @@
if (out["stdout"]:"" != "0\n" && out["stdout"]:"" != "")
{
out = (map) SCR::Execute (.target.bash_output, "echo $HOME");
- string home = deletechars (out["stdout"]:"", "\n");
-// FIXME update to new yast2-core
-// string home = getenv ("HOME");
+ string home = getenv ("HOME");
if (home != "" && home != nil)
add_on_products_file = home + "/add_on_products.ycp";
}
@@ -1058,11 +1070,10 @@
== "yes")
compress_package_descriptions = true;
- // FIXME importing existing product: read product_xml from the release
- // package and create product_info map from it
if (product_xml == $[])
// read the template file
- product_xml = ReadProductXML ("/home/jsuchome/buildservice/template.prod");
+ product_xml = ReadProductXML (
+ Directory::datadir + "/add-on-creator/template.prod");
return true;
}
@@ -1512,12 +1523,14 @@
string arch_dir = splitdir[1]:"";
if (contains (allowed_archs, arch_dir))
{
-// arch_map["ARCH." + arch_dir ] = ValueForArchitecture (arch_dir);
arch_directories = add (arch_directories, arch_dir);
}
});
Progress::NextStage();
+ // name of -release package, if found
+ string release_package = "";
+
if (!clone)
{
// 2. get the list of architectures from RPM's
@@ -1554,6 +1567,14 @@
else
srcpackage2filename[arch,name] = f;
}
+ if (name != "" && release_package == "" && size (name) > 8)
+ {
+ if (substring (name, size (name) - 8) == "-release")
+ {
+ y2milestone ("release package found: %1, %2", name, f);
+ release_package = f;
+ }
+ }
});
y2milestone ("... done");
Progress::NextStage();
@@ -1610,9 +1631,63 @@
Progress::Finish ();
return;
}
+ // read the product info contained in release package
+ if (release_package != "")
+ {
+ string reldir = tmpdir + "/release";
+ if (SCR::Execute (.target.mkdir, reldir) == true)
+ {
+ SCR::Execute (.target.bash,
+ sformat ("cp %1 %2", release_package, reldir));
+ SCR::Execute (.target.bash,
+ sformat ("cd %1; rpm2cpio %2 | cpio -imud 2>/dev/null",
+ reldir,
+ substring (release_package, findlastof(release_package, "/")+1))
+ );
+ out = (map) SCR::Execute (.target.bash_output, sformat (
+ "ls -A1 %1/release/etc/products.d/*.prod 2>/dev/null", tmpdir));
+ list out_l = splitstring (out["stdout"]:"", "\n");
+ string prod_file = out_l[0]:""; // we care about the first one
+
+ // when release package is present, do not offer to change it
+ generate_release_package = false;
+
+ 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);
+ }
+ }
// generate tmp package descriptions...
- // TODO move to other function?
if ((generate_descriptions || !clone) &&
FileUtils::Exists ("/usr/bin/create_package_descr"))
{
@@ -2098,7 +2173,7 @@
if (arch != "ZZZ_imported" && arch != "ZZZ_required" &&
FileUtils::Exists (out_dir))
{
- y2milestone ("copying packages of '%1' arhitecture", arch);
+ y2milestone ("copying packages of '%1' architecture", arch);
// arch_directories will be needed later for CreateMD5SUMS and
// resign_packages
arch_directories = (list<string>)
@@ -2139,43 +2214,65 @@
*/
global boolean GenerateReleasePackage (string base_path) {
- /*
- string contents = "";
-
-// contents = MapAny2XML ("description", config["description",0]:$[], 1);
-
-
- contents = sformat ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>
-http://www.w3.org/2001/XInclude\">
-<products>
-%1
-</products>
-</productdefinition>", contents);
+ if (!generate_release_package)
+ {
+ y2milestone ("release package should not be generated");
+ return true;
+ }
+ if (!Package::Install ("obs-productconverter"))
+ {
+ y2error ("obs-productconverter not installed, not generating -release");
+ return false;
+ }
+ if (!FileUtils::Exists (base_path))
+ return false;
- SCR::Write (.target.string, tmpdir + "/add-on.prod.xml", contents);
- */
+ // release package name and architecture
+ string release_package = "";
+ string arch = "";
// 1. update product_xml map using product_info and content,
// write the result into temporary .prod file
string name = content_map["NAME"]:"add-on";
- product_xml["product",0,"id"] = name;
- product_xml["product",0,"name",0, content_key] = name;
- product_xml["product",0,"version",0, content_key] = content_map["VERSION"]:"1.0";
+ map submap= product_xml["productdefinition",0,"products",0,"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"]:"";
foreach (string key, ["release", "summary", "description"], {
- product_xml["product",0,key,0,content_key]=product_info[key,"value"]:"";
+ submap[key,0,content_key]=product_info[key,"value"]:"";
});
+
if (product_info["releasenotes","value"]:"" != "")
- product_xml["product",0,"urls"] = [ $[
- "url" : [ $[
- content_key : product_info["releasenotes","value"]:"",
- ]],
- ]];
+ {
+ integer i = -1;
+ foreach (map url, submap["urls",0,"url"]:[], {
+ i = i + 1;
+ if (url["name"]:"" == "releasenotes")
+ {
+ submap["urls",0,"url",i,content_key] = product_info["releasenotes","value"]:"";
+ }
+ });
+ if (i == -1)
+ {
+ submap["urls"] = [ $[
+ "url" : [ $[
+ "name" : "releasenotes",
+ content_key : product_info["releasenotes","value"]:"",
+ ]],
+ ]];
+ }
+ }
+
+ product_xml["productdefinition",0,"products",0,"product"] = [ submap ];
+ string prod_file_path = sformat ("%1/%2.product", tmpdir, name);
SCR::Write (.anyxml, $[
- "file" : sformat ("%1/%2.prod", tmpdir, content_map["NAME"]:"add-on"),
+ "file" : prod_file_path,
"xml" : product_xml,
"args" : $[
"XMLDecl" : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
@@ -2187,11 +2284,57 @@
]
]);
- // 2. FIXME call bs_productconvert to generate a packgae/spec file
- // (is the call of rpmbuild needed?)
+ string product_dir = tmpdir + "/" + name;
+ SCR::Execute (.target.mkdir, product_dir);
- // 3. FIXME copy package into the place
+ // 2. call bs_productconvert to generate a spec file for -release package
+ map out = (map) SCR::Execute (.target.bash_output, sformat (
+ "bs_productconvert %1 %2 %3", prod_file_path, product_dir, name));
+
+ // 3. build the release package from generated .spec file
+ string cmd = sformat (
+ "rpmbuild -bb `find -L %1 -name %2-release.spec`", tmpdir, name);
+ out = (map) SCR::Execute (.target.bash_output, cmd, $["LANG":"C"]);
+ if (out["exit"]:0 != 0)
+ {
+ y2error ("command '%1' failed with: \n%2", cmd, out["stderr"]:"");
+ }
+ else
+ {
+ foreach (string line, splitstring (out["stdout"]:"", "\n"), {
+ if (size (line) > 8 && substring (line, 0, 7) == "Wrote: ")
+ {
+ list ll = splitstring (line, " \t\n");
+ string package = ll[1]:"";
+ if (package != "" && FileUtils::Exists (package))
+ {
+ 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"]:"";
+ }
+ break;
+ }
+ });
+ }
+ // 4. copy the release package to the correct place
+ if (release_package != "")
+ {
+ // create arch directory if it does not exist
+ if (!contains (arch_directories, arch))
+ {
+ arch_directories = add (arch_directories, arch);
+ 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));
+ }
+
+ // 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));
return true;
}
@@ -2669,6 +2812,7 @@
map modified_product = union (current_product, $[
"content_map" : content_map,
"product_info" : product_info,
+ "generate_release_package" : generate_release_package,
"available_packages" : available_packages,
"arch_directories" : arch_directories,
"package2filename" : package2filename,
@@ -2696,6 +2840,7 @@
current_product = product;
content_map = product["content_map"]:$[];
product_info = product["product_info"]:$[];
+ generate_release_package = product["generate_release_package"]:false;
// generate content from content_map
content = [];
@@ -2793,6 +2938,8 @@
// Progress stage
_("Copy the packages"),
// Progress stage
+ _("Generate the release package"),
+ // Progress stage
_("Create MD5 sums"),
// Progress stage
_("Sign resulting product"),
@@ -2806,6 +2953,8 @@
_("Writing the patterns..."),
// Progress step
_("Copying the packages..."),
+ // Progress stage
+ _("Generating the release package..."),
// Progress step
_("Creating MD5 sums..."),
// Progress stage
@@ -2896,6 +3045,8 @@
CopyRPMs (current_product["rpm_path"]:"", base_output_path);
+ Progress::NextStage();
+
GenerateReleasePackage (base_output_path);
WritePackageDescriptions (
Modified: trunk/add-on-creator/src/complex.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/src/complex.ycp?rev=53545&r1=53544&r2=53545&view=diff
==============================================================================
--- trunk/add-on-creator/src/complex.ycp (original)
+++ trunk/add-on-creator/src/complex.ycp Mon Nov 24 14:43:57 2008
@@ -717,7 +717,7 @@
map current_product = AddOnCreator::current_product;
list<map> content = AddOnCreator::content;
mapproduct_info = AddOnCreator::product_info;
-
+ boolean generate_release_package =AddOnCreator::generate_release_package;
integer linguas_entry = -1;
// generate items for content file table
@@ -773,6 +773,10 @@
)
),
`VSpacing (0.4),
+ `Left (`CheckBox (`id (`release_package), `opt (`notify),
+ // check box label
+ ("Generate Release Package"), generate_release_package)
+ ),
// label
`Left (`Label (_("Product File"))),
`Table (`id(`prod_table), `opt(`notify), `header (
@@ -798,6 +802,9 @@
Label::BackButton(), Label::NextButton());
UI::SetFocus (`id(`content_table));
+ foreach (symbol w, [ `prod_table, `edit_prod, `import_prod ], {
+ UI::ChangeWidget (`id (w), `Enabled , generate_release_package);
+ });
any ret = nil;
boolean mandatory = true;
while(true) {
@@ -862,6 +869,14 @@
}
UI::SetFocus (`id (`content_table));
}
+ if (ret == `release_package)
+ {
+ generate_release_package = (boolean)
+ UI::QueryWidget (`id (ret), `Value);
+ foreach (symbol w, [ `prod_table, `edit_prod, `import_prod ], {
+ UI::ChangeWidget (`id (w), `Enabled , generate_release_package);
+ });
+ }
else if (ret == `edit_prod || ret == `prod_table) {
string key = (string)
UI::QueryWidget (`id (`prod_table), `CurrentItem);
@@ -887,6 +902,8 @@
%1"), mergestring (missing, "\n")));
continue;
}
+ // FIXME some data are both in prod file and content file
+ // (vendor, version, release, id (=name) ... -> popup
integer i = 0;
integer index = -1;
string product = "";
@@ -902,6 +919,7 @@
AddOnCreator::content = content;
AddOnCreator::UpdateContentMap (content);
AddOnCreator::product_info = product_info;
+ AddOnCreator::generate_release_package = generate_release_package;
break;
}
else if(ret == `abort || ret == `cancel) {
Modified: trunk/add-on-creator/src/template.prod
URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/src/template.prod?rev=53545&r1=53544&r2=53545&view=diff
==============================================================================
--- trunk/add-on-creator/src/template.prod (original)
+++ trunk/add-on-creator/src/template.prod Mon Nov 24 14:43:57 2008
@@ -1,4 +1,6 @@
<?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>
@@ -13,3 +15,5 @@
<urls>
</urls>
</product>
+</products>
+</productdefinition>
Modified: trunk/add-on-creator/yast2-add-on-creator.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/yast2-add-on-creator.spec.in?rev=53545&r1=53544&r2=53545&view=diff
==============================================================================
--- trunk/add-on-creator/yast2-add-on-creator.spec.in (original)
+++ trunk/add-on-creator/yast2-add-on-creator.spec.in Mon Nov 24 14:43:57 2008
@@ -32,7 +32,7 @@
@moduledir@/PackagesDescr.pm
@desktopdir@/add-on-creator.desktop
%dir @ydatadir@/add-on-creator
-@ydatadir@/add-on-creator/
+@ydatadir@/add-on-creator/*
#agents:
@scrconfdir@/*.scr
@agentdir@/ag_*
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org