[yast-commit] r49917 - in /trunk/product-creator: VERSION package/yast2-product-creator.changes src/ProductCreator.ycp src/complex.ycp src/dialogs.ycp src/helps.ycp src/wizards.ycp
Author: lslezak
Date: Mon Aug 11 12:02:47 2008
New Revision: 49917
URL: http://svn.opensuse.org/viewcvs/yast?rev=49917&view=rev
Log:
- added cross-architecture support (e.g. create a PPC installation
iso image on an i386 machine, but does not work in the kiwi part)
(fate#301883)
- 2.17.6
- note: merged from tmp/lslezak/product-creator-cross-arch SVN branch
Modified:
trunk/product-creator/VERSION
trunk/product-creator/package/yast2-product-creator.changes
trunk/product-creator/src/ProductCreator.ycp
trunk/product-creator/src/complex.ycp
trunk/product-creator/src/dialogs.ycp
trunk/product-creator/src/helps.ycp
trunk/product-creator/src/wizards.ycp
Modified: trunk/product-creator/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/VERSION?rev=49917&r1=49916&r2=49917&view=diff
==============================================================================
--- trunk/product-creator/VERSION (original)
+++ trunk/product-creator/VERSION Mon Aug 11 12:02:47 2008
@@ -1 +1 @@
-2.17.5
+2.17.6
Modified: trunk/product-creator/package/yast2-product-creator.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/package/yast2-product-creator.changes?rev=49917&r1=49916&r2=49917&view=diff
==============================================================================
--- trunk/product-creator/package/yast2-product-creator.changes (original)
+++ trunk/product-creator/package/yast2-product-creator.changes Mon Aug 11 12:02:47 2008
@@ -1,4 +1,12 @@
-------------------------------------------------------------------
+Mon Aug 11 11:57:43 CEST 2008 - lslezak@suse.cz
+
+- added cross-architecture support (e.g. create a PPC installation
+ iso image on an i386 machine, but does not work in the kiwi part)
+ (fate#301883)
+- 2.17.6
+
+-------------------------------------------------------------------
Fri Aug 1 15:36:32 CEST 2008 - jsuchome@suse.cz
- Image Creator: added GUI to configure image compression
Modified: trunk/product-creator/src/ProductCreator.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/ProductCreator.ycp?rev=49917&r1=49916&r2=49917&view=diff
==============================================================================
--- trunk/product-creator/src/ProductCreator.ycp (original)
+++ trunk/product-creator/src/ProductCreator.ycp Mon Aug 11 12:02:47 2008
@@ -26,6 +26,7 @@
import "Directory";
import "Profile";
import "AutoinstSoftware";
+// NOTE: do not use Arch:: directly in this module, use GetArch() function instead!
import "Arch";
import "Package";
import "PackageAI";
@@ -93,6 +94,109 @@
*/
global block<boolean> AbortFunction = nil;
+
+/*
+ Target architecture
+ Initialized to the current architecture
+*/
+
+// forward declaration
+string ToPackageArch(string arch);
+
+// default is the system architecture
+string _arch = nil;
+
+string ToPackageArch(string arch)
+{
+ if (arch == "s390_64")
+ {
+ arch = "s390x";
+ }
+ if (arch == "s390_32")
+ {
+ arch = "s390";
+ }
+
+ if (!contains(["i386", "i486", "i586", "i686", "sparc", "sparc64", "mips", "mips64", "ppc", "ppc64", "alpha", "s390", "s390x", "ia64", "x86_64"], arch))
+ {
+ y2error("Unknown architecture '%1'!", arch);
+ return nil;
+ }
+
+ return arch;
+}
+
+/**
+ Set the target package architecture
+ @param new_arch new architecture (i386, i486, i586, i686, sparc, sparc64, mips, mips64, ppc, ppc64, alpha, s390, s390x, ia64, x86_64)
+ @return true on success
+*/
+global boolean SetPackageArch(string new_arch)
+{
+ string pkgarch = ToPackageArch(new_arch);
+
+ if (pkgarch == nil)
+ {
+ return false;
+ }
+
+ _arch = pkgarch;
+ y2milestone("Target architecture set to '%1'", new_arch);
+
+ // set the architecture in the package manager
+ Pkg::SetArchitecture(_arch);
+
+ return true;
+}
+
+// convert package (like i686) arch to system arch (i386)
+global string GetArch()
+{
+ string ret = _arch;
+
+ // not set, use the current arch
+ if (ret == nil)
+ {
+ ret = Arch::architecture();
+ }
+
+ // convert x86 package archs to i386 system arch
+ if (contains(["i486", "i586", "i686"], ret))
+ {
+ ret = "i386";
+ }
+ else if (ret == "s390_64")
+ {
+ ret = "s390x";
+ }
+ else if (ret == "s390_32")
+ {
+ ret = "s390";
+ }
+
+ return ret;
+}
+
+// nil means not set
+global string GetPackageArch()
+{
+ return _arch;
+}
+
+global void ResetArch()
+{
+ _arch = nil;
+
+ 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());
+ }
+}
+
+
+
/**
* Data was modified?
*/
@@ -178,7 +282,7 @@
global boolean isCode10Source()
{
boolean code10 = false;
- string arch = Arch::architecture ();
+ string arch = GetArch();
if (arch == "s390_64") arch = "s390x";
foreach (string url , ProductCreator::Config["sources"]:[],
{
@@ -619,7 +723,7 @@
}
else
{
- string arch = Arch::architecture();
+ string arch = GetArch();
if (arch == "s390_64") arch = "s390x";
bootconfig_path = sformat("boot/%1/loader/isolinux.cfg", arch);
@@ -961,84 +1065,66 @@
boolean CopyPPCBoot(integer srcid, string target)
{
y2milestone("Copying PPC boot files");
+ boolean ret = true;
- list<string> lst = GetList(srcid, 1, "");
- if (lst == nil)
+ y2milestone("Copying /ppc subdirectory");
+ boolean r = CopyDirectoryRecOpt(srcid, 1, "/ppc", target);
+
+ if (!r)
{
- lst = [];
+ y2milestone("Directory listing may be missing, copying /ppc/bootinfo.txt");
+ CopyFile(srcid, 1, "/ppc/bootinfo.txt", target + "/ppc");
}
- boolean ret = true;
+ ret = ret && r;
- if (contains(lst, "ppc/"))
- {
- y2milestone("Copying /ppc subdirectory");
- boolean r = CopyDirectoryRecOpt(srcid, 1, "/ppc", target);
- if (!r)
- {
- y2milestone("Directory listing may be missing, copying /ppc/bootinfo.txt");
- CopyFile(srcid, 1, "/ppc/bootinfo.txt", target + "/ppc");
- }
+ y2milestone("Copying /PS3 subdirectory");
+ r = CopyDirectoryRecOpt(srcid, 1, "/PS3", target);
- ret = ret && r;
+ if (!r)
+ {
+ y2milestone("Directory listing may be missing, copying /ppc/bootinfo.txt");
+ Exec(sformat("/bin/mkdir -p '%1/PS3/otheros'", String::Quote(target)));
+ CopyFile(srcid, 1, "/PS3/otheros/otheros.bld", target + "/PS3/otheros");
}
- if (contains(lst, "PS3/"))
- {
- y2milestone("Copying /ppc subdirectory");
- boolean r = CopyDirectoryRecOpt(srcid, 1, "/PS3", target);
+ ret = ret && r;
- if (!r)
- {
- y2milestone("Directory listing may be missing, copying /ppc/bootinfo.txt");
- Exec(sformat("/bin/mkdir -p '%1/PS3/otheros'", String::Quote(target)));
- CopyFile(srcid, 1, "/PS3/otheros/otheros.bld", target + "/PS3/otheros");
- }
- ret = ret && r;
- }
+ y2milestone("Copying /suseboot subdirectory");
+ r = CopyDirectoryRecOpt(srcid, 1, "/suseboot", target);
+ y2milestone("Result: %1", r);
- if (contains(lst, "suseboot/"))
+ if (!r)
{
- y2milestone("Copying /suseboot subdirectory");
- boolean r = CopyDirectoryRecOpt(srcid, 1, "/suseboot", target);
- y2milestone("Result: %1", r);
-
- if (!r)
- {
- list<string> files = [
- "/suseboot/inst32", "/suseboot/inst64", "/suseboot/os-chooser",
- "/suseboot/yaboot", "/suseboot/yaboot.cnf", "/suseboot/yaboot.ibm",
- "/suseboot/yaboot.txt"
- ];
-
- y2milestone("Directory listing may be missing using fixed list: %1", files);
+ list<string> files = [
+ "/suseboot/inst32", "/suseboot/inst64", "/suseboot/os-chooser",
+ "/suseboot/yaboot", "/suseboot/yaboot.cnf", "/suseboot/yaboot.ibm",
+ "/suseboot/yaboot.txt"
+ ];
- foreach(string f, files,
- {
- CopyFile(srcid, 1, f, target + f);
- }
- );
- }
+ y2milestone("Directory listing may be missing using fixed list: %1", files);
- ret = ret && r;
+ foreach(string f, files,
+ {
+ CopyFile(srcid, 1, f, target + f);
+ }
+ );
}
- if (contains(lst, "etc/"))
- {
- y2milestone("Copying /etc subdirectory");
- boolean r = CopyDirectoryRecOpt(srcid, 1, "/etc", target);
- if (!r)
- {
- y2milestone("Directory listing may be missing, copying /etc/yaboot.conf");
- CopyFile(srcid, 1, "/etc/yaboot.conf", target + "/etc");
- }
+ y2milestone("Copying /etc subdirectory");
+ r = CopyDirectoryRecOpt(srcid, 1, "/etc", target);
- ret = ret && r;
+ if (!r)
+ {
+ y2milestone("Directory listing may be missing, copying /etc/yaboot.conf");
+ CopyOptionalFile(srcid, 1, "/etc/yaboot.conf", target + "/etc");
}
+ ret = ret && r;
+
return ret;
}
@@ -1356,7 +1442,7 @@
string sles_path = "";
integer sles_src = 0;
string descr_dir = "";
- string arch = Arch::architecture();
+ string arch = GetArch();
if (arch == "s390_64") arch = "s390x";
y2milestone("Config: %1", Config);
@@ -1390,7 +1476,7 @@
if (bootable_product)
{
- if (Arch::i386() || Arch::x86_64())
+ if (_arch == "i386" || _arch == "x86_64")
{
if (Config["code10"]:false)
{
@@ -1401,7 +1487,7 @@
Exec(sformat("/bin/mkdir -p '%1/boot/loader'", String::Quote(skel_root)));
}
}
- else if (Arch::ppc() || Arch::ppc64())
+ else if (_arch == "ppc" || _arch == "ppc64")
{
Exec(sformat("/bin/mkdir -p '%1/PS3'", String::Quote(skel_root)));
Exec(sformat("/bin/mkdir -p '%1/ppc'", String::Quote(skel_root)));
@@ -1473,7 +1559,7 @@
CopyFile(id, 1, "boot/rescue", sformat("%1/boot", skel_root));
}
// Loader, x86 specific
- if (Arch::i386() || Arch::x86_64())
+ if (_arch == "i386" || _arch == "x86_64")
{
if (Config["code10"]:false)
{
@@ -1489,7 +1575,7 @@
CopyDirectoryRec(id, 1, "boot/loader", sformat("%1/boot", skel_root));
}
}
- else if (Arch::ppc() || Arch::ppc64())
+ else if (_arch == "ppc" || _arch == "ppc64")
{
// recursive copy of /boot
CopyDirectoryRec(id, 1, "boot", skel_root);
@@ -1503,7 +1589,7 @@
{
CopyDirectoryRec(id, 1, "boot", skel_root);
- if (Arch::ppc() || Arch::ppc64())
+ if (_arch == "ppc" || _arch == "ppc64")
{
CopyPPCBoot(id, skel_root);
}
@@ -1643,7 +1729,7 @@
}
// Loader, x86 specific
- if (Arch::i386() || Arch::x86_64())
+ if (_arch == "i386" || _arch == "x86_64")
{
if (Config["code10"]:false)
{
@@ -1659,7 +1745,7 @@
CopyDirectoryRec(base_source, 1, "boot/loader", sformat("%1/boot", skel_root));
}
}
- else if (Arch::ppc() || Arch::ppc64())
+ else if (_arch == "ppc" || _arch == "ppc64")
{
CopyPPCBoot(base_source, skel_root);
@@ -1676,7 +1762,7 @@
{
CopyDirectoryRec(base_source, 1, "boot", skel_root);
- if (Arch::ppc() || Arch::ppc64())
+ if (_arch == "ppc" || _arch == "ppc64")
{
CopyPPCBoot(base_source, skel_root);
}
@@ -2268,7 +2354,7 @@
global define boolean CopyMiscFiles() ``{
string cpCmd = "";
- string arch = Arch::architecture();
+ string arch = GetArch();
if (arch == "s390_64") arch = "s390x";
y2debug("isolinux.cfg: %1", Config["bootconfig"]:"" );
if (Config["bootconfig"]:"" != "")
Modified: trunk/product-creator/src/complex.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/complex.ycp?rev=49917&r1=49916&r2=49917&view=diff
==============================================================================
--- trunk/product-creator/src/complex.ycp (original)
+++ trunk/product-creator/src/complex.ycp Mon Aug 11 12:02:47 2008
@@ -11,7 +11,6 @@
textdomain "product-creator";
- import "Arch";
import "CommandLine";
import "Directory";
import "FileUtils";
@@ -61,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
@@ -122,6 +142,8 @@
any ret = nil;
while(true) {
+ // reset the current architecture (needed when going back)
+ ProductCreator::ResetArch();
ret = UI::UserInput();
@@ -174,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;
@@ -182,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;
@@ -190,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;
@@ -198,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;
@@ -209,6 +239,10 @@
y2error("unexpected retcode: %1", ret);
continue;
}
+
+ if (ret == `kiwi)
+ {
+ }
}
return (symbol)ret;
@@ -303,7 +337,7 @@
y2debug("bootconfig available");
string fname = (ProductCreator::Config["code10"]:false)
- ? sformat("%1/boot/%2/loader/isolinux.cfg", ProductCreator::skel_root, Arch::architecture())
+ ? sformat("%1/boot/%2/loader/isolinux.cfg", ProductCreator::skel_root, ProductCreator::GetArch())
: sformat("%1/boot/loader/isolinux.cfg", ProductCreator::skel_root);
SCR::Write(.target.string, fname, ProductCreator::Config["bootconfig"]:"" );
@@ -369,7 +403,7 @@
{
Popup::ShowFeedback(_("Creating CD Image..."), _("This may take a while"));
}
- string arch = Arch::architecture ();
+ string arch = ProductCreator::GetArch();
if (arch == "s390_64") arch = "s390x";
string command = sformat("/usr/lib/YaST2/bin/y2mkiso '%1' '%2' '%3'", String::Quote(isodir), String::Quote(isofile), String::Quote((ProductCreator::Config["code10"]:false) ? arch : ""));
@@ -481,6 +515,12 @@
boolean success = true;
+ string arch = ProductCreator::Config["arch"]:"";
+ if (arch != nil && arch != "")
+ {
+ ProductCreator::SetPackageArch(arch);
+ }
+
Progress::NextStage();
Pkg::TargetFinish ();
@@ -552,7 +592,7 @@
// skip isolinux configuration if the architecture
// is not i386 or x86_64 - there is no isolinux
- if (Arch::architecture() != "i386" && Arch::architecture() != "x86_64")
+ if (ProductCreator::GetArch() != "i386" && ProductCreator::GetArch() != "x86_64")
{
return `skip_isolinux;
}
Modified: trunk/product-creator/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/dialogs.ycp?rev=49917&r1=49916&r2=49917&view=diff
==============================================================================
--- trunk/product-creator/src/dialogs.ycp (original)
+++ trunk/product-creator/src/dialogs.ycp Mon Aug 11 12:02:47 2008
@@ -16,7 +16,6 @@
import "SourceManager";
import "Report";
import "URL";
- import "Arch";
import "Label";
import "Popup";
import "URL";
@@ -25,6 +24,7 @@
import "CWM";
import "String";
import "Package";
+ import "Arch";
include "product-creator/routines.ycp";
include "product-creator/helps.ycp";
@@ -198,6 +198,13 @@
}
else if(ret == `next ) {
+ // set architecture if configured
+ string arch = ProductCreator::Config["arch"]:"";
+ if (arch != nil && arch != "")
+ {
+ ProductCreator::SetPackageArch(arch);
+ }
+
string name = (string)UI::QueryWidget(`id(`name), `Value);
if (name == "")
@@ -419,6 +426,170 @@
return (symbol)ret;
}
+string AskArch(string label, list<string> archs, string preselected)
+{
+ term widget1 = `VBox();
+ term widget2 = `VBox();
+
+ const integer max_lines = 6;
+
+ if (!contains(archs, preselected))
+ {
+ y2warning("The preselected architecture is missing in the list!");
+ // add the missing preselected arch
+ archs = prepend(archs, preselected);
+ }
+
+ integer archsz = size(archs);
+ integer col1num = (archsz > max_lines) ? (archsz + 1) / 2 : archsz;
+ y2milestone("Number of archs in the first column: %1", col1num);
+
+ // preselect the first item
+ foreach(string a, archs,
+ {
+ if (col1num > 0)
+ {
+ widget1 = add(widget1, `MinWidth(10, `Left(`RadioButton(`id(a), a, a == preselected))));
+ }
+ else
+ {
+ widget2 = add(widget2, `MinWidth(10, `Left(`RadioButton(`id(a), a, a == preselected))));
+ }
+
+ col1num = col1num - 1;
+ }
+ );
+
+ term content = `MarginBox(1, 0.5,
+ `VBox(
+ `Label(label),
+ `VSpacing(1),
+ `Frame(_("Target Architecture"),
+ `RadioButtonGroup(`id(`rb),
+ `HBox(
+ `Top(widget1),
+ `HStretch(),
+ `Top(widget2),
+ `HStretch()
+ )
+ )
+ ),
+ `VSpacing(1),
+ `HBox(
+ `HSpacing(`opt(`hstretch), 2),
+ `HWeight(1, `PushButton(`id(`ok), Label::OKButton())),
+ `HSpacing(2),
+ `HWeight(1, `PushButton(`id(`cancel), Label::CancelButton())),
+ `HSpacing(`opt(`hstretch), 2)
+ )
+ )
+ );
+
+ UI::OpenDialog(content);
+
+ any ui = UI::UserInput();
+ string ret = (string)UI::QueryWidget(`id(`rb), `CurrentButton);
+
+ UI::CloseDialog();
+
+ if (ui == `cancel || ui == `close)
+ {
+ // canceled
+ return nil;
+ }
+ else if (ui == `ok)
+ {
+ y2milestone("Selected architecture: %1", ret);
+ return ret;
+ }
+ else
+ {
+ y2error("Unhandled user input %1", ui);
+ return nil;
+ }
+}
+
+
+boolean CheckArchitecture(integer SrcID)
+{
+ map general_info = Pkg::SourceGeneralData(SrcID);
+ boolean found_architecture = false;
+ list<string> found_archs = [];
+
+ string arch = ProductCreator::GetArch();
+ if (arch == "s390_64") arch = "s390x";
+
+ // architecture check is possible only for YaST sources
+ if (general_info["type"]:"" == "YaST")
+ {
+ // Check architecture
+ map
participants (1)
-
lslezak@svn.opensuse.org