Author: locilka
Date: Mon Feb 4 19:06:03 2008
New Revision: 44137
URL: http://svn.opensuse.org/viewcvs/yast?rev=44137&view=rev
Log:
- Modular inst-sys used for localizations (FATE #302955).
- Tabs have been removed from installation proposal.
- 2.16.16
Modified:
trunk/installation/VERSION
trunk/installation/control/control.openSUSE.xml
trunk/installation/package/yast2-installation.changes
trunk/installation/src/clients/inst_complex_welcome.ycp
trunk/installation/src/modules/InstExtensionImage.ycp
Modified: trunk/installation/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/VERSION?rev=44137&r1=44136&r2=44137&view=diff
==============================================================================
--- trunk/installation/VERSION (original)
+++ trunk/installation/VERSION Mon Feb 4 19:06:03 2008
@@ -1 +1 @@
-2.16.15
+2.16.16
Modified: trunk/installation/control/control.openSUSE.xml
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/control/control.openSUSE.xml?rev=44137&r1=44136&r2=44137&view=diff
==============================================================================
--- trunk/installation/control/control.openSUSE.xml (original)
+++ trunk/installation/control/control.openSUSE.xml Mon Feb 4 19:06:03 2008
@@ -117,6 +117,7 @@
language
runlevel
+<!--
<proposal_tabs config:type="list">
<proposal_tab>
<label>Overview</label>
@@ -141,6 +142,7 @@
</proposal_modules>
</proposal_tab>
</proposal_tabs>
+-->
</proposal>
<proposal>
Modified: trunk/installation/package/yast2-installation.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/package/yast2-installation.changes?rev=44137&r1=44136&r2=44137&view=diff
==============================================================================
--- trunk/installation/package/yast2-installation.changes (original)
+++ trunk/installation/package/yast2-installation.changes Mon Feb 4 19:06:03 2008
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Mon Feb 4 19:04:29 CET 2008 - locilka@suse.cz
+
+- Modular inst-sys used for localizations (FATE #302955).
+- Tabs have been removed from installation proposal.
+- 2.16.16
+
+-------------------------------------------------------------------
Fri Feb 1 16:08:26 CET 2008 - locilka@suse.cz
- Added new InstExtensionImage module for integration of modular
Modified: trunk/installation/src/clients/inst_complex_welcome.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/clients/inst_complex_welcome.ycp?rev=44137&r1=44136&r2=44137&view=diff
==============================================================================
--- trunk/installation/src/clients/inst_complex_welcome.ycp (original)
+++ trunk/installation/src/clients/inst_complex_welcome.ycp Mon Feb 4 19:06:03 2008
@@ -41,6 +41,7 @@
import "Icon";
import "InstData";
import "ProductLicense";
+ import "InstExtensionImage";
string language = Language::language;
@@ -70,6 +71,76 @@
}
}
+ list <string> available_lang_filenames = [];
+
+ string GetLanguageExtensionFilename (string language) {
+ list <string> check_for_languages = [language];
+
+ // 'en_US' ? add also 'en'
+ if (size (language) > 2) {
+ check_for_languages = add (check_for_languages, substring (language, 0, 2));
+ }
+
+ // Default fallback
+ string filename = "root.en_US";
+
+ foreach (string one_language, check_for_languages, {
+ if (contains (available_lang_filenames, one_language)) {
+ filename = sformat ("root.%1", one_language);
+ y2milestone ("Using %1 for %2", filename, language);
+ break;
+ }
+ });
+
+ return filename;
+ }
+
+ /**
+ * Finds out the list of supported languages
+ */
+ list <string> GetListOfSupportedLangExtensions () {
+ list <string> ret = [];
+
+ // SUPPLANGS in content file
+ string supplangs = (string) SCR::Read (.content.SUPPLANGS);
+
+ if (supplangs != nil) {
+ ret = splitstring (supplangs, " ");
+
+ ret = filter (string one_supplang, ret, {
+ return (one_supplang != nil && one_supplang != "");
+ });
+
+ return ret;
+ }
+
+ // Fallback: using list of trans-stats
+ y2milestone ("No SUPPLANGS defined, using a fallback");
+ map cmd = (map) WFM::Execute (.local.bash_output, "ls -1 /usr/lib/YaST2/trans/ | sed 's/\.status//'");
+
+ if (cmd["exit"]:-1 != 0) {
+ y2error ("Cannot find out list of languages: %1", cmd);
+ return [];
+ }
+
+ // Empty list of trans stats
+ string langs_s = cmd["stdout"]:"";
+ if (langs_s == nil || langs_s == "") {
+ y2milestone ("Empty list: %1", langs_s);
+
+ return [];
+ }
+
+ // Newline-separated langs
+ ret = splitstring (langs_s, "\n");
+
+ ret = filter (string one_supplang, ret, {
+ return (one_supplang != nil && one_supplang != "");
+ });
+
+ return ret;
+ }
+
// ------------------------------------- main part of the client -----------
map argmap = GetInstArgs::argmap();
@@ -337,6 +408,11 @@
// Returns true if the dialog needs redrawing
boolean SetLanguageIfChanged (any ret) {
+ if (Stage::initial()) {
+ // FATE #302955: Split translations out of installation system
+ InstExtensionImage::DownloadAndIntegrateExtension (GetLanguageExtensionFilename (language));
+ }
+
if (language != Language::language) {
y2milestone ("Language changed from %1 to %2", Language::language, language);
@@ -414,6 +490,12 @@
return `auto;
}
+ // FATE #302955: Split translations out of installation system
+ // [ "en_US", "en_GB", "de", "cs" ]
+ // they are in content.SUPPLANGS or as files in /usr/lib/YaST2/trans
+ available_lang_filenames = GetListOfSupportedLangExtensions();
+ y2milestone ("Supported languages are: %1", available_lang_filenames);
+
while (true) {
ret = UI::UserInput();
y2milestone ("UserInput() returned %1", ret);
Modified: trunk/installation/src/modules/InstExtensionImage.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/modules/InstExtensionImage.ycp?rev=44137&r1=44136&r2=44137&view=diff
==============================================================================
--- trunk/installation/src/modules/InstExtensionImage.ycp (original)
+++ trunk/installation/src/modules/InstExtensionImage.ycp Mon Feb 4 19:06:03 2008
@@ -11,6 +11,7 @@
* (localization, fonts, ...) and merge them to the current int-sys.
* This enables inst-sys to be modular even for running YaST.
* See FATE #302955: 'Split translations out of installation system'.
+ * This module is strictly installation-only!
*/
{
@@ -20,6 +21,9 @@
import "Linuxrc";
import "URL";
+ import "String";
+ import "Directory";
+ import "FileUtils";
/***
*
@@ -69,6 +73,18 @@
* This module remembers downloading a file so it does not
* download any file twice.
*
+ * Additional comments on the "Installation Workflow":
+ *
+ * * When Linuxrc starts loading an initial translation
+ * might already been selected. Linuxrc will download
+ * and merge the pre-selected translation itself.
+ * * Then Linuxrc starts YaST. YaST initializes itself
+ * including translations and displays the language
+ * dialog translated.
+ * * After a different language is selected, YaST downloads
+ * a localization inst-sys extension and merges it.
+ * * Then a different locale is selected and YaST redraws
+ * reruns the current YCP client.
*/
// nfs://.../, cd:/, http://.../any/
@@ -79,6 +95,11 @@
// always only params
string base_url_params = "";
+ // Directory used for storing images
+ string base_tmpdir = sformat ("%1/%2/", Directory::tmpdir, "instsys_extensions");
+ // Directory used for mounting images
+ string base_mounts = sformat ("%1/%2/", Directory::tmpdir, "instsys_extmounts");
+
boolean initialized = false;
boolean IsURLRelative (string url) {
@@ -244,14 +265,101 @@
// final params
base_url_params = MergeURLsParams (repo_url, inst_sys_url);
y2milestone ("Base URL params: %1", base_url_params);
+
+ map run = (map) WFM::Execute (.local.bash_output,
+ sformat ("/bin/mkdir -p '%1'", String::Quote (base_tmpdir))
+ );
+ if (run["exit"]:-1 != 0) {
+ y2error ("Cannot create temporary directory: %1: %2", base_tmpdir, run);
+ }
+
+ run = (map) WFM::Execute (.local.bash_output,
+ sformat ("/bin/mkdir -p '%1'", String::Quote (base_mounts))
+ );
+ if (run["exit"]:-1 != 0) {
+ y2error ("Cannot create mounts directory: %1: %2", base_mounts, run);
+ }
}
// Already downloaded (and mounted and merged) files
list <string> already_downloaded_files = [];
- // Just for testing
- global void RemoveThisFunction () {
+ /**
+ * Downloads extension archive (file system image) and integrates
+ * it to the current system.
+ *
+ * @param string extension name
+ * @return boolean if successful
+ */
+ global boolean DownloadAndIntegrateExtension (string extension) {
+ if (extension == nil || extension == "") {
+ y2error ("Such extension name can't work: %1", extension);
+ }
+
+ // Every single GLOBAL function has to use LazyInit!
LazyInit();
+
+ // download from
+ // extension='aaa' -> http://inst_base_url/aaa/?base_url_params
+ string extension_url = sformat ("%1%2?%3", base_url, extension, base_url_params);
+
+ // download to extension='aaa' -> /tmp/YaST.SomeMoreLetters/special/dir/aaa
+ string extension_localfile = sformat ("%1%2", base_tmpdir, extension);
+
+ if (contains (already_downloaded_files, extension_url)) {
+ y2milestone ("File %1 has already been downloaded", extension_url);
+ return true;
+ }
+
+ // Downloading the extension
+ string cmd = sformat ("/lbin/wget -v '%1' '%2'", String::Quote (extension_url), String::Quote (extension_localfile));
+ map cmd_run = (map) WFM::Execute (.local.bash_output, cmd);
+
+ if (cmd_run["exit"]:-1 != 0 || ! FileUtils::Exists (extension_localfile)) {
+ y2error ("Cannot download extension '%1': %2", cmd, cmd_run);
+ return false;
+ } else {
+ already_downloaded_files = add (already_downloaded_files, extension_url);
+ y2milestone ("Downloaded: %1 -> %2 (size: %3)", extension_url, extension_localfile, FileUtils::GetSize (extension_localfile));
+ }
+
+ // FIXME: Check SHA1sum against /content file
+
+ // Creating subdir for extension to be mounted
+ string extension_mount = sformat ("%1%2/", base_mounts, extension);
+ cmd_run = (map) WFM::Execute (.local.bash_output,
+ sformat ("/bin/mkdir -p '%1'", String::Quote (extension_mount))
+ );
+
+ if (cmd_run["exit"]:-1 != 0) {
+ y2error ("Cannot create mounts directory: %1: %2", base_mounts, cmd_run);
+ return false;
+ }
+
+ // Mounting the extension
+ cmd = sformat ("/bin/mount '%1' '%2'", String::Quote (extension_localfile), String::Quote (extension_mount));
+ cmd_run = (map) WFM::Execute (.local.bash_output, cmd);
+
+ if (cmd_run["exit"]:-1 != 0) {
+ y2error ("Cannot mount extension '%1': %2", cmd, cmd_run);
+ return false;
+ } else {
+ y2milestone ("Mounted: %1 -> %2", extension_localfile, extension_mount);
+ }
+
+ // Link items in the mounted directory to inst-sys
+ string where_to_lndir = "/";
+ cmd = sformat ("/lbin/lndir '%1' '%2'", String::Quote (extension_mount), String::Quote (where_to_lndir));
+ cmd_run = (map) WFM::Execute (.local.bash_output, cmd);
+
+ if (cmd_run["exit"]:-1 != 0) {
+ y2error ("Cannot >lndir '%1': %2", cmd, cmd_run);
+ return false;
+ } else {
+ y2milestone ("Lndir successful: %1 to %2", extension_mount, where_to_lndir);
+ }
+
+ return true;
}
/* EOF */
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org