[yast-commit] r49861 - /branches/tmp/lslezak/product-creator-cross-arch/src/dialogs.ycp
Author: lslezak Date: Fri Aug 8 12:56:56 2008 New Revision: 49861 URL: http://svn.opensuse.org/viewcvs/yast?rev=49861&view=rev Log: - refresh the selected sources and check chitectures after pressing [Next] in the source selection dialog Modified: branches/tmp/lslezak/product-creator-cross-arch/src/dialogs.ycp Modified: branches/tmp/lslezak/product-creator-cross-arch/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/product-creator-cross-arch/src/dialogs.ycp?rev=49861&r1=49860&r2=49861&view=diff ============================================================================== --- branches/tmp/lslezak/product-creator-cross-arch/src/dialogs.ycp (original) +++ branches/tmp/lslezak/product-creator-cross-arch/src/dialogs.ycp Fri Aug 8 12:56:56 2008 @@ -579,12 +579,6 @@ { // change the architecture ProductCreator::SetPackageArch(new_arch); - - // initialize the target, read trusted GPG keys (needed for refresh) - Pkg::TargetInit("/", true); - Pkg::SourceForceRefreshNow(SrcID); - // finish the target - Pkg::TargetFinish(); return true; } } @@ -759,15 +753,63 @@ string arch = ProductCreator::GetPackageArch() ; - if (arch != nil && arch != Arch::architecture()) + if (arch != nil) { y2milestone("Target architecture has been changed"); ProductCreator::Config["arch"] = arch; - // TODO: check archs onece again (needed after switching architecture multiple times) + boolean check_ok = true; + boolean arch_changed = false; + + do + { + string ar = ProductCreator::GetPackageArch(); + check_ok = true; + arch_changed = false; + + // all selected sources should be refreshed + // check archs onece again (needed after switching architecture multiple times) + foreach(integer src, selected_items, + { + if (!CheckArchitecture(src)) + { + check_ok = false; + break; + } + + arch_changed = arch_changed || (ar != ProductCreator::GetPackageArch()); + } + ); + } + while(arch_changed); + + if (!check_ok) + { + // error message + Report::Error(_("There is a mismatch between the selected +repositories and the machine architecture. +Either select another repositories or +change the target architecture.")); + + // don't leave the dialog + continue; + } + + // temporarily initialize the target, read trusted GPG keys (needed for refresh) + Pkg::TargetInit("/", false); + + foreach(integer src, selected_items, + { + Pkg::SourceForceRefreshNow(src); + } + ); + // reload repositories Pkg::SourceFinishAll(); Pkg::SourceStartManager(false); + + // finish the target + Pkg::TargetFinish(); } going_back = false; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
lslezak@svn.opensuse.org