[yast-commit] r60544 - in /branches/SuSE-Code-11-SP1-Branch/wagon: ./ package/ src/clients/ src/config/ src/include/ src/modules/
Author: locilka Date: Wed Jan 27 12:04:31 2010 New Revision: 60544 URL: http://svn.opensuse.org/viewcvs/yast?rev=60544&view=rev Log: - Disabling repositories that provide some old version of product to be upgraded (BNC #573092). - Fixed RPM dependencies. - 2.17.11 Added: branches/SuSE-Code-11-SP1-Branch/wagon/src/clients/wagon_modify_repositories.ycp Modified: branches/SuSE-Code-11-SP1-Branch/wagon/VERSION branches/SuSE-Code-11-SP1-Branch/wagon/package/yast2-wagon.changes branches/SuSE-Code-11-SP1-Branch/wagon/src/clients/wagon.ycp branches/SuSE-Code-11-SP1-Branch/wagon/src/clients/wagon_migration_products.ycp branches/SuSE-Code-11-SP1-Branch/wagon/src/config/online_migration.xml branches/SuSE-Code-11-SP1-Branch/wagon/src/include/common_func.ycp branches/SuSE-Code-11-SP1-Branch/wagon/src/modules/Wagon.ycp branches/SuSE-Code-11-SP1-Branch/wagon/yast2-wagon.spec.in Modified: branches/SuSE-Code-11-SP1-Branch/wagon/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/wagon/VERSION?rev=60544&r1=60543&r2=60544&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/wagon/VERSION (original) +++ branches/SuSE-Code-11-SP1-Branch/wagon/VERSION Wed Jan 27 12:04:31 2010 @@ -1 +1 @@ -2.17.10 +2.17.11 Modified: branches/SuSE-Code-11-SP1-Branch/wagon/package/yast2-wagon.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/wagon/package/yast2-wagon.changes?rev=60544&r1=60543&r2=60544&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/wagon/package/yast2-wagon.changes (original) +++ branches/SuSE-Code-11-SP1-Branch/wagon/package/yast2-wagon.changes Wed Jan 27 12:04:31 2010 @@ -1,4 +1,12 @@ ------------------------------------------------------------------- +Wed Jan 27 11:52:01 CET 2010 - locilka@suse.cz + +- Disabling repositories that provide some old version of product + to be upgraded (BNC #573092). +- Fixed RPM dependencies. +- 2.17.11 + +------------------------------------------------------------------- Tue Jan 26 15:13:12 CET 2010 - locilka@suse.cz - Added support for migration hook scripts. Modified: branches/SuSE-Code-11-SP1-Branch/wagon/src/clients/wagon.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/wagon/src/clients/wagon.ycp?rev=60544&r1=60543&r2=60544&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/wagon/src/clients/wagon.ycp (original) +++ branches/SuSE-Code-11-SP1-Branch/wagon/src/clients/wagon.ycp Wed Jan 27 12:04:31 2010 @@ -206,6 +206,24 @@ false, true ); + y2milestone ("Repositories disabled by migration: %1", Wagon::disabled_repositories); + foreach (string repo_alias, Wagon::disabled_repositories, { + integer repo_id = FindRepoIdByAlias (repo_alias); + + if (repo_id == nil) { + y2error ("Cannot enable repo (alias)%1, repo not found ", repo_alias); + Report::Error (sformat(_("Cannot enable repository with alias +%1 +Repository was not found."), repo_alias)); + return; + } + + y2milestone ("Enabling repository %1 returned: %2", repo_id, Pkg::SourceSetEnabled (repo_id, true)); + }); + + Pkg::SourceSaveAll(); + Wagon::InitPkg(); + // Remove all the migration products using packages approach manually // Removing via ResolvableRemove + PkgSolve usually produces errors, // dependency loops etc. Modified: branches/SuSE-Code-11-SP1-Branch/wagon/src/clients/wagon_migration_products.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/wagon/src/clients/wagon_migration_products.ycp?rev=60544&r1=60543&r2=60544&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/wagon/src/clients/wagon_migration_products.ycp (original) +++ branches/SuSE-Code-11-SP1-Branch/wagon/src/clients/wagon_migration_products.ycp Wed Jan 27 12:04:31 2010 @@ -135,6 +135,77 @@ return true; } + /** + * Finds all products that contain information about their migration product + * finds which repositories provide these products and disables the + * repositories. + * + * @see BNC #573092 + */ + boolean FindOldRepositoriesToBeDisabled () { + if (Wagon::InitPkg() != true) { + Report::Error (_("Unable to initialize the package manager.")); + return false; + } + + list <map <string,any> > products = Pkg::ResolvableProperties ("", `product, ""); + + foreach (map<string, any> p, products, { + if (p["status"]:`unknown != `installed) { + y2milestone ("Product %1 (%2) is not installed, skipping...", + p["name"]:"not-defined", p["short_name"]:p["display_name"]:"not-defined"); + return; + } + + if (! haskey (p, "upgrades") || p["upgrades"]:[] == []) { + y2warning ("Product %1 (%2) does not contain 'upgrades' section...", + p["name"]:"not-defined", p["short_name"]:p["display_name"]:"not-defined"); + return; + } + + y2milestone ("Going to disable repositories providing product %1 (%2)", + p["name"]:"not-defined", p["short_name"]:p["display_name"]:"not-defined"); + + if (p["name"]:"" == nil || p["name"]:"" == "") { + y2error ("Product %1 doesn't have a name, reverting will be impossible", p); + Report::Error (sformat(_("Product %1 does not have a machine-readable 'name'. +Cannot disable ."), p["short_name"]:p["display_name"]:"not-defined")); + } + + // Find all available products + list <map <string, any> > matching_products = Pkg::ResolvableProperties (p["name"]:"", `product, ""); + matching_products = filter (map <string, any> one_product, matching_products, { + return (one_product["status"]:`unknown == `available); + }); + + if (matching_products == nil || size (matching_products) == 0) { + y2error ("Nothing provides product: '%1'", p["name"]:""); + Report::Error (sformat(_("No repository provides product %1 (%2). +Migration might not work."), + p["name"]:"not-defined", p["short_name"]:p["display_name"]:"not-defined")); + } + + integer repo_id = nil; + map repo_details = nil; + + foreach (map <string, any> one_product, matching_products, { + repo_id = one_product["source"]:-1; + + if (repo_id < 0) { + y2error ("Available product with source<0: %1", Wagon::MinimizeProductMap (one_product)); + return; + } + + repo_details = Pkg::SourceGeneralData (repo_id); + Wagon::repositories_to_disable = add (Wagon::repositories_to_disable, repo_details["alias"]:""); + }); + }); + + y2milestone ("Repositories to be disabled later: %1", Wagon::repositories_to_disable); + + return true; + } + Wagon::InitPkg(); Wagon::ReadProductsBeforeMigration(); @@ -183,6 +254,9 @@ ResetPackager(); + // Remembers all repositories that will be disabled later (after registration run) + FindOldRepositoriesToBeDisabled(); + y2milestone ("Returning: %1", ret); return ret; Added: branches/SuSE-Code-11-SP1-Branch/wagon/src/clients/wagon_modify_repositories.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/wagon/src/clients/wagon_modify_repositories.ycp?rev=60544&view=auto ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/wagon/src/clients/wagon_modify_repositories.ycp (added) +++ branches/SuSE-Code-11-SP1-Branch/wagon/src/clients/wagon_modify_repositories.ycp Wed Jan 27 12:04:31 2010 @@ -0,0 +1,62 @@ +/** + * File: + * clients/wagon_migration_products.ycp + * + * Module: + * Wagon + * + * Authors: + * Lukas Ocilka <locilka@suse.cz> + * + * Summary: + * Online Migration Tool + * + * $Id$ + * + */ + +{ + /** + * Modify repositories as needed. + */ + + textdomain "wagon"; + + import "Wagon"; + import "GetInstArgs"; + import "Report"; + + include "wagon/common_func.ycp"; + + if (GetInstArgs::going_back()) { + y2milestone ("Going back..."); + return `back; + } + + symbol ret = `auto; + + Wagon::InitPkg(); + + integer repo_id = nil; + + foreach (string repo_alias, Wagon::repositories_to_disable, { + repo_id = FindRepoIdByAlias (repo_alias); + + if (repo_id == nil) { + y2error ("Cannot disable repository %1, alias not found", repo_alias); + return; + } + + y2milestone ("Disabling repository (alias)%1 (id)%2 returned: %3", repo_alias, repo_id, Pkg::SourceSetEnabled (repo_id, false)); + Wagon::disabled_repositories = add (Wagon::disabled_repositories, repo_alias); + }); + + if (size (Wagon::disabled_repositories) > 0) + Pkg::SourceSaveAll(); + + ResetPackager(); + + y2milestone ("Returning: %1", ret); + + return ret; +} Modified: branches/SuSE-Code-11-SP1-Branch/wagon/src/config/online_migration.xml URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/wagon/src/config/online_migration.xml?rev=60544&r1=60543&r2=60544&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/wagon/src/config/online_migration.xml (original) +++ branches/SuSE-Code-11-SP1-Branch/wagon/src/config/online_migration.xml Wed Jan 27 12:04:31 2010 @@ -31,6 +31,7 @@ <module>update_online_mechanism</module> <module>install_migration_products</module> <module>suse_register_workflow</module> + <module>wagon_modify_repositories</module> <module>prepare_progress</module> <module>point_of_no_return</module> <module>wagon_kickoff</module> @@ -60,6 +61,7 @@ <module>suse_register_workflow</module> <module>wagon_custom_url</module> <module>wagon_selfupdate_from_url</module> + <module>wagon_modify_repositories</module> <module>prepare_progress</module> <module>point_of_no_return</module> <module>wagon_kickoff</module> @@ -85,6 +87,7 @@ <!-- Workflow is switched after this module --> <module>update_url_dialog</module> <module>suse_register_workflow</module> + <module>wagon_modify_repositories</module> <module>prepare_progress</module> <module>point_of_no_return</module> <module>wagon_kickoff</module> @@ -111,6 +114,7 @@ <module>update_url_dialog</module> <module>wagon_custom_url</module> <module>wagon_selfupdate_from_url</module> + <module>wagon_modify_repositories</module> <module>prepare_progress</module> <module>point_of_no_return</module> <module>wagon_kickoff</module> @@ -256,6 +260,11 @@ </module> <module> + <name>wagon_modify_repositories</name> + <execute>wagon_modify_repositories</execute> + </module> + + <module> <heading>yes</heading> <label>Migration</label> </module> Modified: branches/SuSE-Code-11-SP1-Branch/wagon/src/include/common_func.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/wagon/src/include/common_func.ycp?rev=60544&r1=60543&r2=60544&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/wagon/src/include/common_func.ycp (original) +++ branches/SuSE-Code-11-SP1-Branch/wagon/src/include/common_func.ycp Wed Jan 27 12:04:31 2010 @@ -125,4 +125,21 @@ Wagon::InitPkg(); Pkg::PkgSolve (true); } + + integer FindRepoIdByAlias (string repo_alias) { + integer repo_id = nil; + + map one_repo = $[]; + + foreach (integer repo_id_to_check, Pkg::SourceGetCurrent (false /* all repos */), { + one_repo = Pkg::SourceGeneralData (repo_id_to_check); + + if (one_repo["alias"]:"" == repo_alias) { + repo_id = repo_id_to_check; + break; + } + }); + + return repo_id; + } } Modified: branches/SuSE-Code-11-SP1-Branch/wagon/src/modules/Wagon.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/wagon/src/modules/Wagon.ycp?rev=60544&r1=60543&r2=60544&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/wagon/src/modules/Wagon.ycp (original) +++ branches/SuSE-Code-11-SP1-Branch/wagon/src/modules/Wagon.ycp Wed Jan 27 12:04:31 2010 @@ -42,6 +42,12 @@ // Products installed before the migration global list <map <string, string> > products_before_migration = []; + // Repositories that were disabled by wagon during migration + // List of aliases (unique identification) + // BNC #573092 + global list <string> disabled_repositories = []; + global list <string> repositories_to_disable = []; + // When aborting before the real migration starts, we can still // revert to the old products global boolean abort_can_revert_products = true; @@ -499,6 +505,5 @@ return true; } - /* EOF */ } Modified: branches/SuSE-Code-11-SP1-Branch/wagon/yast2-wagon.spec.in URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/wagon/yast2-wagon.spec.in?rev=60544&r1=60543&r2=60544&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/wagon/yast2-wagon.spec.in (original) +++ branches/SuSE-Code-11-SP1-Branch/wagon/yast2-wagon.spec.in Wed Jan 27 12:04:31 2010 @@ -7,6 +7,9 @@ # <upgrades> section from product file Requires: yast2-pkg-bindings >= 2.17.44 +# Called in proposal and in code +Requires: yast2-packager yast2-update yast2-add-on + BuildRequires: perl-XML-Writer update-desktop-files yast2 yast2-devtools yast2-testsuite yast2-update # xmllint -- 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