Author: lslezak Date: Fri Aug 8 16:50:55 2008 New Revision: 49880 URL: http://svn.opensuse.org/viewcvs/yast?rev=49880&view=rev Log: - fixed arch reset - display an error when attempting to create a kiwi image for different arch Modified: branches/tmp/lslezak/product-creator-cross-arch/src/ProductCreator.ycp branches/tmp/lslezak/product-creator-cross-arch/src/complex.ycp branches/tmp/lslezak/product-creator-cross-arch/src/dialogs.ycp Modified: branches/tmp/lslezak/product-creator-cross-arch/src/ProductCreator.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/product-creator-cr... ============================================================================== --- branches/tmp/lslezak/product-creator-cross-arch/src/ProductCreator.ycp (original) +++ branches/tmp/lslezak/product-creator-cross-arch/src/ProductCreator.ycp Fri Aug 8 16:50:55 2008 @@ -187,9 +187,12 @@ { _arch = nil; - // set the system architecture in the package manager - y2milestone("Resetting the target architecture to '%1'", Pkg::SystemArchitecture()); - Pkg::SetArchitecture(Pkg::SystemArchitecture()); + if (Pkg::GetArchitecture() != Pkg::SystemArchitecture()) + { + // set the system architecture in the package manager + y2milestone("Resetting the target architecture to '%1'", Pkg::SystemArchitecture()); + Pkg::SetArchitecture(Pkg::SystemArchitecture()); + } } Modified: branches/tmp/lslezak/product-creator-cross-arch/src/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/product-creator-cr... ============================================================================== --- branches/tmp/lslezak/product-creator-cross-arch/src/complex.ycp (original) +++ branches/tmp/lslezak/product-creator-cross-arch/src/complex.ycp Fri Aug 8 16:50:55 2008 @@ -60,6 +60,27 @@ boolean first_start = true; + // check if the selected configuration has the same target architecture as the machine architecture + // needed for creating kiwi images because kiwi cannot create cross-architecture images + boolean SameArchitecture() + { + string arch = ProductCreator::Config["arch"]:""; + string sysarch = Arch::architecture(); + + // is the target architecture different than the machine architecture? + if (arch != nil && arch != "" && arch != sysarch) + { + // error message: %1 and %2 are architecture names like i386, x86_64, ppc... + Report::Error(sformat(_("Target architecture of the current configuration (%1) +does not match the system architecture (%2). + +Kiwi cannot create images for different architectures."), arch, sysarch)); + return false; + } + + return true; + } + /** * Overview dialog * @return dialog result @@ -175,6 +196,8 @@ Package::InstallAll (["kiwi", "kiwi-desc-isoboot"])) { string current = (string) UI::QueryWidget(`id(`table), `CurrentItem); ProductCreator::Config = ProductCreator::Configs[current]:$[]; + // check the architecture + if (!SameArchitecture()) continue; Kiwi::kiwi_task = "iso"; ret = `kiwi; break; @@ -183,6 +206,8 @@ Package::InstallAll (["kiwi", "kiwi-desc-xenboot"])) { string current = (string) UI::QueryWidget(`id(`table), `CurrentItem); ProductCreator::Config = ProductCreator::Configs[current]:$[]; + // check the architecture + if (!SameArchitecture()) continue; Kiwi::kiwi_task = "xen"; ret = `kiwi; break; @@ -191,6 +216,8 @@ Package::InstallAll (["kiwi", "kiwi-desc-usbboot"])) { string current = (string) UI::QueryWidget(`id(`table), `CurrentItem); ProductCreator::Config = ProductCreator::Configs[current]:$[]; + // check the architecture + if (!SameArchitecture()) continue; Kiwi::kiwi_task = "usb"; ret = `kiwi; break; @@ -199,6 +226,8 @@ Package::InstallAll (["kiwi", "kiwi-desc-vmxboot"])) { string current = (string) UI::QueryWidget(`id(`table), `CurrentItem); ProductCreator::Config = ProductCreator::Configs[current]:$[]; + // check the architecture + if (!SameArchitecture()) continue; Kiwi::kiwi_task = "vmx"; ret = `kiwi; break; @@ -210,6 +239,10 @@ y2error("unexpected retcode: %1", ret); continue; } + + if (ret == `kiwi) + { + } } return (symbol)ret; Modified: branches/tmp/lslezak/product-creator-cross-arch/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/product-creator-cr... ============================================================================== --- branches/tmp/lslezak/product-creator-cross-arch/src/dialogs.ycp (original) +++ branches/tmp/lslezak/product-creator-cross-arch/src/dialogs.ycp Fri Aug 8 16:50:55 2008 @@ -567,11 +567,14 @@ return true; } - // the architecture is different, ask to switch + // the architecture is different, ask to switch it + // %1 is URL of the repository + // %2 is name of the architecture (like i386, x86_64, ppc...) string new_arch = AskArch( - sformat(_("The source does not support the current target architecture (%1). + sformat(_("Source %1 +does not support the current target architecture (%2). Change the target architecture? -"), ProductCreator::GetArch()), +"), general_info["url"]:"", ProductCreator::GetArch()), found_archs, found_archs[0]:""); // nil == switch has been canceled @@ -788,6 +791,7 @@ // 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.")); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org