[yast-commit] r60509 - in /trunk/wagon: package/yast2-wagon.changes src/clients/wagon_migration_products.ycp src/clients/wagon_selfupdate.ycp
Author: locilka Date: Mon Jan 25 15:35:45 2010 New Revision: 60509 URL: http://svn.opensuse.org/viewcvs/yast?rev=60509&view=rev Log: - Upgrading installed products moved after wagon self-update and restart In some cases the newly added code was not executed (BNC #573084). Modified: trunk/wagon/package/yast2-wagon.changes trunk/wagon/src/clients/wagon_migration_products.ycp trunk/wagon/src/clients/wagon_selfupdate.ycp Modified: trunk/wagon/package/yast2-wagon.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/wagon/package/yast2-wagon.changes?rev=60509&r1=60508&r2=60509&view=diff ============================================================================== --- trunk/wagon/package/yast2-wagon.changes (original) +++ trunk/wagon/package/yast2-wagon.changes Mon Jan 25 15:35:45 2010 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Mon Jan 25 11:59:30 CET 2010 - locilka@suse.cz + +- Upgrading installed products moved after wagon self-update and + restart In some cases the newly added code was not executed + (BNC #573084). + +------------------------------------------------------------------- Fri Jan 22 11:57:00 CET 2010 - locilka@suse.cz - Wagon extended to read and use migration products from the Modified: trunk/wagon/src/clients/wagon_migration_products.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/wagon/src/clients/wagon_migration_products.ycp?rev=60509&r1=60508&r2=60509&view=diff ============================================================================== --- trunk/wagon/src/clients/wagon_migration_products.ycp (original) +++ trunk/wagon/src/clients/wagon_migration_products.ycp Mon Jan 25 15:35:45 2010 @@ -36,6 +36,42 @@ return `back; } + integer UpdateInstalledProducts () { + integer affected_products = 0; + + list <map <string,any> > products = Pkg::ResolvableProperties ("", `product, ""); + + foreach (map<string, any> p, products, { + // Product is not installed + if (p["status"]:`unknown != `installed) return; + + // Make the logs readable + p["license"] = "..."; + p["description"] = "..."; + + string product_name = p["name"]:""; + string product_version = p["version"]:""; + + if (product_name == nil || product_name == "") { + y2error ("Cannot distinguish product name: %1", product_name); + return; + } + + // Product version is the same but release can be different + // product map doesn't contain the release string. To be sure, product will be reinstalled + y2milestone ("Upgrading product %1 version %2", product_name, product_version); + // The version is the same, release can be different + if (Pkg::ResolvableInstall (product_name, `product) != true) { + Report::Error (sformat(_("Cannot update installed product %1."), product_name)); + return; + } + + affected_products = affected_products + 1; + }); + + return affected_products; + } + boolean FindAndSelectMigrationProducts () { if (Wagon::InitPkg() != true) { Report::Error (_("Unable to initialize the package manager.")); @@ -99,13 +135,39 @@ return true; } + Wagon::InitPkg(); + + Wagon::ReadProductsBeforeMigration(); + Wagon::StoreProductsBeforeMigration(); + + // BNC #573084: New code (upgrading products) can be added after + // wagon self-upgrade and restart + integer products_for_upgrade = UpdateInstalledProducts(); + + if (products_for_upgrade > 0) { + symbol ret = SolveDependencies(); + + if (ret != `abort && ret != `cancel) { + y2milestone ("Upgrading %1 product packages...", products_for_upgrade); + any inst_ret = WFM::call ("inst_rpmcopy"); + y2milestone ("Product package upgrade returned: %1", inst_ret); + ret = `auto; + } else { + return `abort; + } + + ResetPackager(); + } else { + y2warning ("No products selected for upgrade"); + } + if (FindAndSelectMigrationProducts() != true) { return `auto; } symbol ret = SolveDependencies(); - if (ret != `abort) { + if (ret != `abort && ret != `cancel) { // Solver ends with some resolvables changed if (Pkg::IsAnyResolvable (`any, `to_install) == true || Pkg::IsAnyResolvable (`any, `to_remove) == true) { y2milestone ("Installing packages..."); Modified: trunk/wagon/src/clients/wagon_selfupdate.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/wagon/src/clients/wagon_selfupdate.ycp?rev=60509&r1=60508&r2=60509&view=diff ============================================================================== --- trunk/wagon/src/clients/wagon_selfupdate.ycp (original) +++ trunk/wagon/src/clients/wagon_selfupdate.ycp Mon Jan 25 15:35:45 2010 @@ -135,50 +135,8 @@ return pkgs_affected; } - integer UpdateInstalledProducts () { - integer affected_products = 0; - - list <map <string,any> > products = Pkg::ResolvableProperties ("", `product, ""); - - foreach (map<string, any> p, products, { - // Product is not installed - if (p["status"]:`unknown != `installed) return; - - // Make the logs readable - p["license"] = "..."; - p["description"] = "..."; - - string product_name = p["name"]:""; - string product_version = p["version"]:""; - - if (product_name == nil || product_name == "") { - y2error ("Cannot distinguish product name: %1", product_name); - return; - } - - // Product version is the same but release can be different - // product map doesn't contain the release string. To be sure, product will be reinstalled - y2milestone ("Upgrading product %1 version %2", product_name, product_version); - // The version is the same, release can be different - if (Pkg::ResolvableInstall (product_name, `product) != true) { - Report::Error (sformat(_("Cannot update installed product %1."), product_name)); - return; - } - - affected_products = affected_products + 1; - }); - - return affected_products; - } - Wagon::InitPkg(); - list <map <string, any> > products = Pkg::ResolvableProperties ("", `product, ""); - y2milestone ("All known products: %1", products); - - Wagon::ReadProductsBeforeMigration(); - Wagon::StoreProductsBeforeMigration(); - symbol ret = `auto; // Patches need solver run @@ -202,12 +160,6 @@ } } - integer products_selected_for_update = UpdateInstalledProducts(); - if (products_selected_for_update > 0) { - y2milestone ("%1 products were selected for update", products_selected_for_update); - selected = products_selected_for_update; - } - y2milestone ("Selected resolvables: %1", selected); if (selected < 1) { y2milestone ("Neither patches nor packages for self-update have been selected"); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
locilka@svn.opensuse.org