Author: lslezak Date: Mon Jul 18 15:03:25 2011 New Revision: 64869 URL: http://svn.opensuse.org/viewcvs/yast?rev=64869&view=rev Log: - added new core/full migration selection dialog - 2.17.23 Modified: branches/SuSE-Code-11-SP2-Branch/wagon/VERSION branches/SuSE-Code-11-SP2-Branch/wagon/package/yast2-wagon.changes branches/SuSE-Code-11-SP2-Branch/wagon/src/clients/wagon_dup_repositories.ycp branches/SuSE-Code-11-SP2-Branch/wagon/src/clients/wagon_registration_handler.ycp branches/SuSE-Code-11-SP2-Branch/wagon/src/modules/Wagon.ycp Modified: branches/SuSE-Code-11-SP2-Branch/wagon/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/wagon/VERSION?rev=64869&r1=64868&r2=64869&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/wagon/VERSION (original) +++ branches/SuSE-Code-11-SP2-Branch/wagon/VERSION Mon Jul 18 15:03:25 2011 @@ -1 +1 @@ -2.17.22 +2.17.23 Modified: branches/SuSE-Code-11-SP2-Branch/wagon/package/yast2-wagon.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/wagon/package/yast2-wagon.changes?rev=64869&r1=64868&r2=64869&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/wagon/package/yast2-wagon.changes (original) +++ branches/SuSE-Code-11-SP2-Branch/wagon/package/yast2-wagon.changes Mon Jul 18 15:03:25 2011 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Mon Jul 18 12:48:20 UTC 2011 - lslezak@suse.cz + +- added new core/full migration selection dialog +- 2.17.23 + +------------------------------------------------------------------- Mon Jul 4 11:28:46 UTC 2011 - lslezak@suse.cz - if the system is managed by SUSE Manager display a message Modified: branches/SuSE-Code-11-SP2-Branch/wagon/src/clients/wagon_dup_repositories.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/wagon/src/clients/wagon_dup_repositories.ycp?rev=64869&r1=64868&r2=64869&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/wagon/src/clients/wagon_dup_repositories.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/wagon/src/clients/wagon_dup_repositories.ycp Mon Jul 18 15:03:25 2011 @@ -150,8 +150,138 @@ return ret; } + void SetMigrationSelectionDialogContent() + { + // heading text + string heading_text = _("Migration Type"); - symbol ret = DupSelectionDialog(); + term contents = `VBox( + // frame label + `Frame(_("Migration type"), + `HSquash( + `MarginBox(2, 0.5, + `RadioButtonGroup(`id(`migration_type), + `VBox( + // radio button + `Left(`RadioButton(`id(`minimal), _("&Minimal migration (only the core packages)"), true)), + // radio button + `Left(`RadioButton(`id(`full), _("&Full migration (all packages)"))) + ) + ) + ) + ) + ), + + `VSpacing(2), + + // push button + `PushButton(`id(`advanced), _("Advanced...")) + ); + + // help text + string help_text = "<p>" + _("Select the requested migration type.") + // help text + + "</p><p>" + _("Minimal migration migrates only minimal set of packages (the core packages providing basic system functionality), full migration migrates all installed packages.") + "</p>"; + + Wizard::SetContents (heading_text, contents, help_text, + GetInstArgs::enable_back(), GetInstArgs::enable_next()); + } + + symbol MigrationSelectionDialog() + { + SetMigrationSelectionDialogContent(); + + symbol ret = nil; + + while (true) { + ret = (symbol)UI::UserInput(); + + if (ret == `next) + { + // set the update repositories + symbol mtype = (symbol) UI::QueryWidget(`id(`migration_type), `CurrentButton); + y2milestone("Selected migration type: %1", mtype); + + if (mtype == `full) + { + // DUP: all repositories + y2milestone("Selected full migration, using %1 repositories", size(Pkg::SourceGetCurrent(true))); + Wagon::SetDupRepos(Pkg::SourceGetCurrent(true)); + } + else if (mtype == `minimal) + { + // DUP: only added repositories + y2milestone("Selected minimal migration, using these repositories: %1", Wagon::RegistrationRepos()); + + map<string, integer> alias_to_id = $[]; + foreach(integer repo, Pkg::SourceGetCurrent(true), + { + alias_to_id[Pkg::SourceGeneralData(repo)["alias"]:""] = repo; + } + ); + + list<integer> added_repos = maplist(string alias, Wagon::RegistrationRepos(), + { + return alias_to_id[alias]:-1; + } + ); + + y2milestone("Converted aliases to ids: %1", added_repos); + + Wagon::SetDupRepos(added_repos); + } + else + { + // error popup message + Popup::Error(sformat(_("Selected unknown migration type: %1"), mtype)); + y2error("Unknown migratinon type: %1", mtype); + + continue; + } + + break; + } + else if (ret == `back) + { + break; + } + else if (ret == `abort || ret == `close) + { + break; + } + else if (ret == `advanced) + { + // manually select DUP repositories + y2milestone("Manual DUP repository selection selected"); + ret = DupSelectionDialog(); + + if (ret == `abort || ret == `close || ret == `next) + { + break; + } + else if (ret == `back) + { + // refresh the dialog + SetMigrationSelectionDialogContent(); + } + else + { + y2error("Unexpected user input: %1", ret); + } + } + else + { + y2error("Unexpected user input: %1", ret); + } + } + + return ret; + } + + // for custom migration repo we cannot select full/core migration type, + // and also when there is no new registration repo we cannot detect full/core migrations + // => go directly to the repository selection (advanced option) + symbol ret = (Wagon::GetMigrationMethod() == "suse_register" && size(Wagon::RegistrationRepos()) > 0) ? MigrationSelectionDialog() : DupSelectionDialog(); y2milestone ("Result: %1", ret); Modified: branches/SuSE-Code-11-SP2-Branch/wagon/src/clients/wagon_registration_handler.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/wagon/src/clients/wagon_registration_handler.ycp?rev=64869&r1=64868&r2=64869&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/wagon/src/clients/wagon_registration_handler.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/wagon/src/clients/wagon_registration_handler.ycp Mon Jul 18 15:03:25 2011 @@ -57,6 +57,16 @@ return sort (ret); } + list<string> AddedRepos(list<string> prev, list<string> curr) + { + list<string> ret = []; + + // added repos = all current which were not in the previous state + ret = filter(string curr_repo, curr, {return !contains(prev, curr_repo);}); + + return ret; + } + // all repository aliases list <string> all_repos = GetCurrentlyEnabledReposByAlias(); y2milestone ("Currently registered repositories: %1", all_repos); @@ -91,7 +101,13 @@ list <string> current_repos = GetCurrentlyEnabledReposByAlias(); if (all_repos != current_repos) { Wagon::repos_already_registered = true; + + // remember the added repositories + list<string> added = AddedRepos(all_repos, current_repos); + Wagon::SetRegistrationRepos(added); + y2milestone ("List of repositories has changed: %1", current_repos); + y2milestone("Added repositories: %1", added); break; } Modified: branches/SuSE-Code-11-SP2-Branch/wagon/src/modules/Wagon.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/wagon/src/modules/Wagon.ycp?rev=64869&r1=64868&r2=64869&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/wagon/src/modules/Wagon.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/wagon/src/modules/Wagon.ycp Mon Jul 18 15:03:25 2011 @@ -123,6 +123,21 @@ dup_repos = repos; } + // list of repositories (aliases) added by suse_register + list<string> new_registration_repos = []; + + // returns list of repositories (aliases) added by suse_register + global list<string> RegistrationRepos() + { + return new_registration_repos; + } + + // set list of repositories (aliases) added by suse_register + global void SetRegistrationRepos(list<string> repos) + { + y2milestone("Repositories added by registration: %1", new_registration_repos); + new_registration_repos = repos; + } void ResetWorkflowSteps () { ProductControl::UnDisableAllModulesAndProposals (Mode::mode(), Stage::stage()); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org