Author: locilka
Date: Fri Apr 11 17:55:43 2008
New Revision: 46442
URL: http://svn.opensuse.org/viewcvs/yast?rev=46442&view=rev
Log:
- Added another per-image progress into the Installation images
deployment (it requires details.xml).
- 2.13.33
Added:
trunk/installation/doc/details.xml.example
Modified:
trunk/installation/VERSION
trunk/installation/doc/images.xml.example
trunk/installation/package/yast2-installation.changes
trunk/installation/src/clients/inst_deploy_image.ycp
trunk/installation/src/modules/ImageInstallation.ycp
Modified: trunk/installation/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/VERSION?rev=46442&r1=46441&r2=46442&view=diff
==============================================================================
--- trunk/installation/VERSION (original)
+++ trunk/installation/VERSION Fri Apr 11 17:55:43 2008
@@ -1 +1 @@
-2.16.32
+2.16.33
Added: trunk/installation/doc/details.xml.example
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/doc/details.xml.example?rev=46442&view=auto
==============================================================================
--- trunk/installation/doc/details.xml.example (added)
+++ trunk/installation/doc/details.xml.example Fri Apr 11 17:55:43 2008
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<!DOCTYPE details>
+http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
+ <details config:type="list">
+ <image>
+ <file>common-base-root.tar.lzma</file>
+ <files>28004</files>
+ <!-- Read checkpoint 49500 -->
+ <size>509624320</size>
+ </image>
+ <image>
+ <file>common-xorg-root.tar.lzma</file>
+ <files>10437</files>
+ <!-- Read checkpoint 21500 -->
+ <size>220549120</size>
+ </image>
+ <image>
+ <file>common-qt.tar.lzma</file>
+ <files>6</files>
+ <size>10240</size>
+ </image>
+ <image>
+ <file>common-desktop-root.tar.lzma</file>
+ <files>6742</files>
+ <!-- Read checkpoint 7500 -->
+ <size>79964160</size>
+ </image>
+ <image>
+ <file>kde_cd-root.tar.lzma</file>
+ <files>32010</files>
+ <!-- Read checkpoint 39000 -->
+ <size>403128320</size>
+ </image>
+ <image>
+ <file>kde_cd-root-meta.tar.lzma</file>
+ <files>30</files>
+ <!-- Read checkpoint 2000 -->
+ <size>21442560</size>
+ </image>
+ </details>
+
Modified: trunk/installation/doc/images.xml.example
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/doc/images.xml.example?rev=46442&r1=46441&r2=46442&view=diff
==============================================================================
--- trunk/installation/doc/images.xml.example (original)
+++ trunk/installation/doc/images.xml.example Fri Apr 11 17:55:43 2008
@@ -7,65 +7,148 @@
http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
+ <patterns>kde,x11,enhanced_base</patterns>
+ <archs>i386,ixxx,iyyy</archs>
+ kde-meta.tar.bz2
<images config:type="list">
<image>
- <name>root</name>
+ <name>KDE [base]</name>
+ <type>tar</type>
+ <file>common-base-root.tar.lzma</file>
+ </image>
+ <image>
+ <name>KDE [xorg]</name>
+ <type>tar</type>
+ <file>common-xorg-root.tar.lzma</file>
+ </image>
+ <image>
+ <name>KDE [qt3]</name>
+ <type>tar</type>
+ <file>common-qt.tar.lzma</file>
+ </image>
+ <image>
+ <name>KDE [desktop]</name>
+ <type>tar</type>
+ <file>common-desktop-root.tar.lzma</file>
+ </image>
+ <image>
+ <name>KDE</name>
+ <type>tar</type>
+ <file>kde_cd-root.tar.lzma</file>
+ </image>
+ <image>
+ <name>KDE [meta]</name>
+ <type>tar</type>
+ <file>kde_cd-root-meta.tar.lzma</file>
+ </image>
+ </images>
+
+
+ <patterns>gnome,x11,enhanced_base</patterns>
+ <archs>i386,ixxx,iyyy</archs>
+ gnome-meta.tar.bz2
+ <images config:type="list">
+ <image>
+ <name>GNOME [1]</name>
+ <type>tar</type>
+ <file>common-base-root</file>
+ </image>
+ <image>
+ <name>GNOME [2]</name>
+ <type>tar</type>
+ <file>common-xorg-root</file>
+ </image>
+ <image>
+ <name>GNOME [3]</name>
+ <type>tar</type>
+ <file>x11-gnome</file>
+ </image>
+ <image>
+ <name>GNOME [4]</name>
<type>tar</type>
- <file>root.tar.bz2</file>
+ <file>common-desktop-root.tar.lzma</file>
</image>
<image>
- <name>opt</name>
+ <name>GNOME</name>
<type>tar</type>
- <file>opt.tar.bz2</file>
+ <file>gnome_cd-root.tar.lzma</file>
</image>
-
</images>
-
+
Modified: trunk/installation/package/yast2-installation.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/package/yast2-installation.changes?rev=46442&r1=46441&r2=46442&view=diff
==============================================================================
--- trunk/installation/package/yast2-installation.changes (original)
+++ trunk/installation/package/yast2-installation.changes Fri Apr 11 17:55:43 2008
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Fri Apr 11 17:55:32 CEST 2008 - locilka@suse.cz
+
+- Added another per-image progress into the Installation images
+ deployment (it requires details.xml).
+- 2.13.33
+
+-------------------------------------------------------------------
Fri Apr 11 15:33:17 CEST 2008 - juhliarik@suse.cz
- Added loading kernel via kexec (fate #303395)
Modified: trunk/installation/src/clients/inst_deploy_image.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/clients/inst_deploy_image.ycp?rev=46442&r1=46441&r2=46442&view=diff
==============================================================================
--- trunk/installation/src/clients/inst_deploy_image.ycp (original)
+++ trunk/installation/src/clients/inst_deploy_image.ycp Fri Apr 11 17:55:43 2008
@@ -34,7 +34,7 @@
UI::ChangeWidget (
`id ("deploying_progress"),
`Label,
- sformat (_("Deploying Image (%1/%2)..."), (image + 1), size (images))
+ sformat (_("Deploying Images (%1/%2)..."), (image + 1), size (images))
);
}
}
@@ -46,17 +46,54 @@
);
}
+integer _last_progress = -1;
+string _last_image_id = nil;
+
+void SetOneImageProgress (integer current_progress) {
+ map current_image = ImageInstallation::GetCurrentImageDetails();
+ integer max_progress = current_image["max_progress"]:0;
+
+ // another file
+ if (current_image["file"]:"" != _last_image_id) {
+ _last_image_id = current_image["file"]:"";
+ _last_progress = -1;
+ }
+
+ if (max_progress == nil || max_progress == 0) {
+ y2milestone ("Can't find max_progress: %1", current_image);
+ return;
+ }
+
+ integer x_progress = (100 * current_progress / max_progress);
+ if (x_progress > 100) x_progress = 100;
+
+ if (x_progress > _last_progress) {
+ UI::ChangeWidget (`id ("deploying_image"), `Value, x_progress);
+ _last_progress = x_progress;
+ }
+}
+
+ImageInstallation::SetDeployTarImageProgress (SetOneImageProgress);
+
ImageInstallation::StoreAllChanges();
Pkg::TargetFinish ();
Wizard::SetContents (
_("Deploying Installation Images"),
- `ProgressBar (
- `id ("deploying_progress"),
- _("Deploying Images..."),
- size(images),
- 0
+ `VBox (
+ `ProgressBar (
+ `id ("deploying_image"),
+ _("Deploying image..."),
+ 100,
+ 0
+ ),
+ `ProgressBar (
+ `id ("deploying_progress"),
+ _("Deploying Images..."),
+ size(images),
+ 0
+ )
),
"",
false, false
Modified: trunk/installation/src/modules/ImageInstallation.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/modules/ImageInstallation.ycp?rev=46442&r1=46441&r2=46442&view=diff
==============================================================================
--- trunk/installation/src/modules/ImageInstallation.ycp (original)
+++ trunk/installation/src/modules/ImageInstallation.ycp Fri Apr 11 17:55:43 2008
@@ -57,6 +57,33 @@
list<string> _mounted_images = [];
/**
+ * @struct $[
+ * "image_filaname" : $[
+ * // size of an unpacked image in bytes
+ * "size" : integer,
+ * // number of files and directories in an image
+ * "files" : integer,
+ * ]
+ * ]
+ */
+map > images_details = $[];
+
+/**
+ * Image currently being deployed
+ */
+map _current_image = $[];
+
+/**
+ * display progress messages every NUMBERth record
+ */
+integer _checkpoint = 400;
+
+/**
+ * NUMBER of bytes per record, multiple of 512
+ */
+integer _record_size = 10240;
+
+/**
* Set the repository to get images from
* @param repo integer the repository identification
*/
@@ -118,7 +145,7 @@
*/
void RemoveTemporaryImage (string image) {
map out = (map) SCR::Execute (
- .target.bash_ouptut,
+ .target.bash_output,
sformat ("test -w '%1' && echo -n writable", String::Quote (image))
);
@@ -153,6 +180,9 @@
return false;
}
+ if (tar_image_progress != nil)
+ tar_image_progress (0);
+
y2milestone ("Creating target directory");
string cmd = sformat ("test -d %1 || mkdir -p %1", target);
map out = (map)SCR::Execute (.target.bash_output, cmd);
@@ -160,19 +190,55 @@
y2milestone ("Untarring the image");
- // TODO: Progress `tar --checkpoint`
-
// lzma
if (regexpmatch (image, "\.lzma$")) {
- cmd = sformat ("lzmadec < '%1' | tar --totals -C '%2' -xf -", String::Quote (image), String::Quote (target));
+ cmd = sformat (
+ "lzmadec < '%1' | tar --totals --checkpoint=%3 --record-size=%4 -C '%2' -xf -",
+ String::Quote (image), String::Quote (target), _checkpoint, _record_size
+ );
// bzip2, gzip
} else {
- cmd = sformat ("tar --totals -C '%2' -xf '%1'", String::Quote (image), String::Quote (target));
+ cmd = sformat (
+ "tar --checkpoint=%3 --record-size=%4 --totals -C '%2' -xf '%1'",
+ String::Quote (image), String::Quote (target), _checkpoint, _record_size
+ );
}
y2milestone ("Calling: %1", cmd);
- out = (map)SCR::Execute (.target.bash_output, cmd);
- y2milestone ("Returned %1", out);
+ integer pid = (integer) SCR::Execute(.process.start_shell, cmd);
+
+ string newline = "";
+
+ string read_checkpoint_str = "^tar: Read checkpoint ([0123456789]+)$";
+
+ // Otherwise it will never make 100%
+ integer better_feeling_constant = _checkpoint;
+
+ while (SCR::Read (.process.running, pid) == true) {
+ newline = (string) SCR::Read (.process.read_line_stderr, pid);
+
+ if (newline != nil) {
+ if (! regexpmatch (newline, read_checkpoint_str)) {
+ y2milestone ("Deploying image: %1", newline);
+ continue;
+ }
+
+ newline = regexpsub (newline, read_checkpoint_str, "\\1");
+
+ if (newline == nil || newline == "")
+ continue;
+
+ if (tar_image_progress != nil)
+ tar_image_progress (tointeger (newline) + better_feeling_constant);
+ } else {
+ // FIXME: UI::PollInput
+ sleep (200);
+ }
+ }
+ y2milestone ("Finished");
+
+ if (tar_image_progress != nil)
+ tar_image_progress (100);
RemoveTemporaryImage (image);
@@ -256,6 +322,25 @@
// FIXME unmounting
}
+void SetCurrentImageDetails (map img) {
+ if (size (images_details) == 0) {
+ y2warning ("Images details are empty");
+ }
+
+ _current_image = $[
+ "file" : img["file"]:"",
+ "name" : img["name"]:"",
+ "size" : images_details[img["file"]:"","size"]:0,
+ "files" : images_details[img["file"]:"","files"]:0,
+ // 100% progress
+ "max_progress" : tointeger (images_details[img["file"]:"","size"]:0 / _record_size),
+ ];
+}
+
+global map GetCurrentImageDetails () {
+ return _current_image;
+}
+
/**
* Deploy an image (internal implementation)
* @param id string the id of the image
@@ -272,6 +357,8 @@
string type = img["type"]:"";
+ SetCurrentImageDetails (img);
+
if (type == "fs")
return temporary
? MountFsImage (id, target)
@@ -325,12 +412,56 @@
}
/**
+ * Loads non-mandatory details for every single selected image.
+ */
+global boolean FillUpImagesDetails () {
+ string filename = Pkg::SourceProvideOptionalFile (_repo, 1, sformat (_image_path, "details.xml"));
+ if (filename == nil) {
+ y2milestone ("No image installation details found");
+ return false;
+ }
+
+ map read_details = XML::XMLToYCPFile (filename);
+ if (read_details == nil) {
+ y2error ("Cannot parse imagesets details");
+ return false;
+ }
+
+ if (! haskey (read_details, "details")) {
+ y2warning ("No images details in details.xml");
+ return false;
+ }
+
+ images_details = $[];
+
+ foreach (map image_detail, read_details["details"]:[], {
+ string file = image_detail["file"]:"";
+
+ if (file == nil || file == "") return;
+
+ integer files = tointeger (image_detail["files"]:"0");
+ integer isize = tointeger (image_detail["size"]:"0");
+
+ images_details[file] = $[
+ "files" : files,
+ "size" : isize,
+ ];
+ });
+
+ // FIXME: y2debug
+ y2milestone ("Details: %1", images_details);
+ return true;
+}
+
+/**
* Deploy all images
* @param images a list of images to deploy
* @param target string directory where to deploy the images
* @param progress a function to report overal progress
*/
global boolean DeployImages (list<string> images, string target, void(integer,integer) progress) {
+ FillUpImagesDetails();
+
integer num = -1;
foreach (string img, images, {
@@ -382,7 +513,7 @@
_metadata_image = "";
// checking whether images are supported
- string filename = Pkg::SourceProvideOptionalFile (_repo, 1, "/images/images.xml");
+ string filename = Pkg::SourceProvideOptionalFile (_repo, 1, sformat (_image_path, "images.xml"));
if (filename == nil)
{
Installation::image_installation = false;
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org