Mailinglist Archive: yast-commit (819 mails)

< Previous Next >
[yast-commit] r54940 - in /trunk/packager: ./ package/ src/clients/ src/modules/
  • From: lslezak@xxxxxxxxxxxxxxxx
  • Date: Fri, 23 Jan 2009 12:45:45 -0000
  • Message-id: <E1LQLPt-0001YH-E3@xxxxxxxxxxxxxxxx>
Author: lslezak
Date: Fri Jan 23 13:45:44 2009
New Revision: 54940

URL: http://svn.opensuse.org/viewcvs/yast?rev=54940&view=rev
Log:
- installation callbacks - collect installation data for the
summary dialog (bnc#431854)
- sw_single.ycp - do the action specified in PKGMGR_ACTION_AT_EXIT
sysconfig variable when package installation is finished
- 2.18.2

Modified:
trunk/packager/VERSION
trunk/packager/package/yast2-packager.changes
trunk/packager/src/clients/sw_single.ycp
trunk/packager/src/modules/AddOnProduct.ycp
trunk/packager/src/modules/PackageInstallation.ycp
trunk/packager/src/modules/PackageSlideShow.ycp
trunk/packager/src/modules/SlideShowCallbacks.ycp
trunk/packager/yast2-packager.spec.in

Modified: trunk/packager/VERSION
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/packager/VERSION?rev=54940&r1=54939&r2=54940&view=diff
==============================================================================
--- trunk/packager/VERSION (original)
+++ trunk/packager/VERSION Fri Jan 23 13:45:44 2009
@@ -1 +1 @@
-2.18.1
+2.18.2

Modified: trunk/packager/package/yast2-packager.changes
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/packager/package/yast2-packager.changes?rev=54940&r1=54939&r2=54940&view=diff
==============================================================================
--- trunk/packager/package/yast2-packager.changes (original)
+++ trunk/packager/package/yast2-packager.changes Fri Jan 23 13:45:44 2009
@@ -1,4 +1,13 @@
-------------------------------------------------------------------
+Thu Jan 22 18:47:00 CET 2009 - lslezak@xxxxxxx
+
+- installation callbacks - collect installation data for the
+ summary dialog (bnc#431854)
+- sw_single.ycp - do the action specified in PKGMGR_ACTION_AT_EXIT
+ sysconfig variable when package installation is finished
+- 2.18.2
+
+-------------------------------------------------------------------
Fri Jan 16 15:35:18 CET 2009 - lslezak@xxxxxxx

- checkmedia - better module description (bnc#461985)

Modified: trunk/packager/src/clients/sw_single.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/clients/sw_single.ycp?rev=54940&r1=54939&r2=54940&view=diff
==============================================================================
--- trunk/packager/src/clients/sw_single.ycp (original)
+++ trunk/packager/src/clients/sw_single.ycp Fri Jan 23 13:45:44 2009
@@ -19,7 +19,6 @@
{
textdomain "packager";

- import "Arch";
import "Confirm";
import "Installation";
import "Mode";
@@ -32,13 +31,14 @@
import "Wizard";
import "Popup";
import "GetInstArgs";
- import "Label";
import "PackageSystem";
import "Report";
import "FileUtils";
import "PackagesUI";
import "CommandLine";
import "Progress";
+ import "Directory";
+ import "String";

symbol StartSWSingle()
{
@@ -555,8 +555,57 @@
// prepare "you must boot" popup in inst_suseconfig
Kernel::SetInformAboutKernelChange (oldvmlinuzsize !=
newvmlinuzsize);

+ string suseconfig_log = Directory::logdir + "/y2log.SuSEconfig";
+ integer suseconfig_log_size =
FileUtils::GetSize(suseconfig_log);
+
+ if (suseconfig_log_size < 0)
+ {
+ suseconfig_log_size = 0;
+ }
+
result = (symbol) WFM::CallFunction ("inst_suseconfig",
[GetInstArgs::Buttons(false, false)]);
+
+ // read only the new lines at the end
+ string command = sformat("dd bs=1 if='%1' skip=%2",
String::Quote(suseconfig_log), suseconfig_log_size);
+ y2milestone("Reading new susconfig log: %1", command);
+
+ map out = (map)SCR::Execute(.target.bash_output, command);
+ if (out["exit"]:-1 == 0)
+ {
+ PackagesUI::SetPackageSummaryItem("postinstall_log",
out["stdout"]:"");
+ }
+ else
+ {
+ y2error("Could not read susconfig log: %1", out);
+ }
}
+
+ if (Mode::normal())
+ {
+ string PKGMGR_ACTION_AT_EXIT =
(string)SCR::Read(.sysconfig.yast2.PKGMGR_ACTION_AT_EXIT);
+
+ if (PKGMGR_ACTION_AT_EXIT == nil)
+ {
+ PKGMGR_ACTION_AT_EXIT = "close";
+ }
+
+ y2milestone("PKGMGR_ACTION_AT_EXIT: %1", PKGMGR_ACTION_AT_EXIT);
+
+ // display installation summary if there has been an error
+ // or if it's enabled in sysconfig
+ if (PKGMGR_ACTION_AT_EXIT == "summary"
+ || size(commit_result[1]:[]) > 0)
+ {
+ if (PackagesUI::ShowInstallationSummary() == `back)
+ {
+ force_restart = true;
+ }
+ }
+ else if (PKGMGR_ACTION_AT_EXIT == "restart")
+ {
+ force_restart = true;
+ }
+ }
}
} while ( force_restart );


Modified: trunk/packager/src/modules/AddOnProduct.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/modules/AddOnProduct.ycp?rev=54940&r1=54939&r2=54940&view=diff
==============================================================================
--- trunk/packager/src/modules/AddOnProduct.ycp (original)
+++ trunk/packager/src/modules/AddOnProduct.ycp Fri Jan 23 13:45:44 2009
@@ -1077,7 +1077,8 @@
),
`HBox (
`HStretch(),
- `PushButton (`id (`ok), _("Add Selected Products")),
+ // push button label
+ `PushButton (`id (`ok), _("Add Selected &Products")),
`HSpacing (1),
`PushButton (`id (`cancel), Label::CancelButton())
)

Modified: trunk/packager/src/modules/PackageInstallation.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/modules/PackageInstallation.ycp?rev=54940&r1=54939&r2=54940&view=diff
==============================================================================
--- trunk/packager/src/modules/PackageInstallation.ycp (original)
+++ trunk/packager/src/modules/PackageInstallation.ycp Fri Jan 23 13:45:44 2009
@@ -17,6 +17,7 @@
import "Packages";
import "SlideShow";
import "PackageSlideShow";
+ import "PackagesUI";

import "Label";

@@ -132,6 +133,8 @@
do_commit = size (pkgs) > 0;
}

+ integer start_time = time();
+
list commit_result = [];
if (do_commit)
{
@@ -152,6 +155,9 @@
y2milestone ("No package from media %1 left for installation",
media_number);
}

+ integer installation_time = time() - start_time;
+ y2milestone("Installation took %1 seconds", installation_time);
+
// see if installation of some packages failed
list<string> errpacks = (list<string>) (commit_result[1]:[]);
if (size (errpacks) > 0)
@@ -170,6 +176,25 @@
merge (old_failed_packs, errpacks));
}

+ if (Mode::normal())
+ {
+ // collect and set installation summary data
+ map<string,any> summary = PackageSlideShow::GetPackageSummary();
+
+ summary["time_seconds"] = installation_time;
+ summary["success"] = size(errpacks) == 0;
+ summary["remaining"] = commit_result[2]:[];
+ summary["install_log"] = SlideShow::inst_log;
+
+ if (size(errpacks) > 0)
+ {
+ summary["error"] = Pkg::LastError();
+ summary["failed"] = errpacks;
+ }
+
+ PackagesUI::SetPackageSummary(summary);
+ }
+
return commit_result;
};


Modified: trunk/packager/src/modules/PackageSlideShow.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/modules/PackageSlideShow.ycp?rev=54940&r1=54939&r2=54940&view=diff
==============================================================================
--- trunk/packager/src/modules/PackageSlideShow.ycp (original)
+++ trunk/packager/src/modules/PackageSlideShow.ycp Fri Jan 23 13:45:44 2009
@@ -15,6 +15,7 @@
import "Slides";
import "SlideShow";
import "String";
+ import "Mode";

global list<list<integer> > total_sizes_per_cd_per_src = []; //
total sizes per inst-src: [ [42, 43, 44], [12, 13, 14] ]
global list<list<integer> > remaining_sizes_per_cd_per_src = []; //
remaining sizes
@@ -47,6 +48,57 @@
string provide_size = ""; // currently
downlaoded package size


+ // package summary
+ // package counters
+ integer installed_packages = 0;
+ integer updated_packages = 0;
+ integer removed_packages = 0;
+
+ integer total_downloaded = 0;
+ integer total_installed = 0;
+
+ // package list (only used in installed system)
+ list<string> installed_packages_list = [];
+ list<string> updated_packages_list = [];
+ list<string> removed_packages_list = [];
+// integer avg_download_rate = 0;
+
+ integer current_provide_size = 0;
+ integer current_install_size = 0;
+ string current_pkg_name = "";
+ boolean updating = false;
+
+ void ResetPackageSummary()
+ {
+ installed_packages = 0;
+ updated_packages = 0;
+ removed_packages = 0;
+ total_downloaded = 0;
+ total_installed = 0;
+// avg_download_rate = 0;
+
+ // temporary values
+ current_provide_size = 0;
+ current_install_size = 0;
+ current_pkg_name = "";
+ updating = false;
+ }
+
+ global map<string,any> GetPackageSummary()
+ {
+ return $[
+ "installed" : installed_packages,
+ "updated" : updated_packages,
+ "removed" : removed_packages,
+ "installed_list" : installed_packages_list,
+ "updated_list" : updated_packages_list,
+ "removed_list" : removed_packages_list,
+ "downloaded_bytes" : total_downloaded,
+ "installed_bytes" : total_installed,
+ ];
+ }
+
+
/*****************************************************************************/
/*************** Formatting functions and helpers ***************************/
/*****************************************************************************/
@@ -173,41 +225,6 @@
return total_size_to_install - TotalRemainingSize();
}

-
- /**
- * Format an integer number as (at least) two digits; use leading zeroes if
- * necessary.
- * @return number as two-digit string
- **/
- string FormatTwoDigits( integer x )
- {
- return x < 10 && x >= 0 ?
- sformat( "0%1", x ) :
- sformat( "%1", x );
- }
-
-
- /**
- * Format an integer seconds value with min:sec or hours:min:sec
- **/
- string FormatTime( integer seconds )
- {
- if ( seconds < 0 )
- return "";
-
- if ( seconds < 3600 ) // Less than one hour
- {
- return sformat( "%1:%2", FormatTwoDigits( seconds / 60 ),
FormatTwoDigits( seconds % 60 ) );
- }
- else // More than one hour - we don't hope this will ever happen,
but who knows?
- {
- integer hours = seconds / 3600;
- seconds = seconds % 3600;
- return sformat( "%1:%2:%3", hours, FormatTwoDigits( seconds / 60 ),
FormatTwoDigits( seconds % 60 ) );
- }
- }
-
-
/**
* Format an integer seconds value with min:sec or hours:min:sec
*
@@ -224,11 +241,11 @@
// cut off the predicted time at a reasonable maximum.
// "%1" is a predefined maximum time.

- text = sformat( _(">%1"), FormatTime( -seconds ) );
+ text = sformat( _(">%1"), String::FormatTime( -seconds ) );
}
else
{
- text = FormatTime( seconds );
+ text = String::FormatTime( seconds );
}

return text;
@@ -294,7 +311,7 @@
// %2: Media name ("SuSE Linux Professional CD 2" )
// %3: Time remaining until this media will be needed
text = sformat( _("Next %1: %2 -- %3"), media_type,
next_media_name,
- FormatTime( remaining_times_per_cd_per_src[
current_src_no-1, current_cd_no-1 ]: 1) );
+ String::FormatTime(
remaining_times_per_cd_per_src[ current_src_no-1, current_cd_no-1 ]: 1) );
}
else
{
@@ -325,8 +342,8 @@
{
if ( ! silent )
{
- y2error( "SlideShow::SanityCheck(): Slide show not correctly
initialized: " +
- "SlideShow::InitPkgData() never called!" );
+ y2error( "PackageSlideShow::SanityCheck(): Slide show not
correctly initialized: " +
+ "PackageSlideShow::InitPkgData() never called!" );
}
return false;
}
@@ -340,7 +357,7 @@
}
else if (!silent)
{
- y2error(-1, "SlideShow::SanityCheck(): Illegal values for
current_src (%1) or current_cd (%2)",
+ y2error(-1, "PackageSlideShow::SanityCheck(): Illegal values
for current_src_no (%1) or current_cd_no (%2)",
current_src_no, current_cd_no );
y2milestone( "total sizes: %1", total_sizes_per_cd_per_src );
}
@@ -398,6 +415,7 @@
if ( init_pkg_data_complete && ! force)
return;

+ ResetPackageSummary();
// Reinititalize some globals (in case this is a second run)
total_size_installed = 0;
//total_time_elapsed = 0;
@@ -434,9 +452,12 @@
remaining_pkg_count_per_cd_per_src = (list<list <integer> >) eval
(total_pkg_count_per_cd_per_src);
total_cd_count = size( flatten(
total_sizes_per_cd_per_src ) );
init_pkg_data_complete = true;
-
- y2milestone( "SlideShow::InitPkgData() done;
total_sizes_per_cd_per_src: %1", total_sizes_per_cd_per_src );
- y2milestone( "SlideShow::InitPkgData(): pkg: %1",
total_pkg_count_per_cd_per_src );
+
+ // reset the history log
+ SlideShow::inst_log = "";
+
+ y2milestone( "PackageSlideShow::InitPkgData() done;
total_sizes_per_cd_per_src: %1", total_sizes_per_cd_per_src );
+ y2milestone( "PackageSlideShow::InitPkgData(): pkg: %1",
total_pkg_count_per_cd_per_src );

// RebuildDialog(true);
}
@@ -839,7 +860,7 @@
if ( unit_is_seconds && bytes_per_second > 0 )
{
remaining = remaining / bytes_per_second;
- rem_time = FormatTime( remaining );
// column #2
+ rem_time = String::FormatTime( remaining );
// column #2

if ( remaining > max_time_per_cd ) // clip
off at 2 hours
{
@@ -887,6 +908,8 @@
// update the download rate
global void UpdateCurrentPackageRateProgress(integer pkg_percent, integer
bps_avg, integer bps_current)
{
+// avg_download_rate = bps_avg;
+
if( ! SlideShow::ShowingDetails() ) return;

string new_text = nil; // no update of the label
@@ -904,6 +927,13 @@
SlideShow::SubProgress( pkg_percent, new_text );
}

+ global void DoneProvide( integer error, string reason, string name )
+ {
+ if (error == 0)
+ {
+ total_downloaded = total_downloaded + current_provide_size;
+ }
+ }

/**
* Update progress widgets for all CDs.
@@ -959,8 +989,37 @@

UpdateTotalProgress(false);

+ if (updating)
+ {
+ updated_packages = updated_packages + 1;
+
+ if (Mode::normal())
+ {
+ updated_packages_list = add(updated_packages_list,
current_pkg_name);
+ }
+ }
+ else
+ {
+ installed_packages = installed_packages + 1;
+
+ if (Mode::normal())
+ {
+ installed_packages_list = add(installed_packages_list,
current_pkg_name);
+ }
+ }
+
+ total_installed = total_installed + current_install_size;
+
} // ! deleting
+ else
+ {
+ removed_packages = removed_packages + 1;

+ if (Mode::normal())
+ {
+ removed_packages_list = add(removed_packages_list,
current_pkg_name);
+ }
+ }
}


@@ -1013,12 +1072,17 @@
// Heading for the progress bar for the current package
// while it is deleted. "%1" is the package name.
msg = sformat( _("Deleting %1"), pkg_name );
+ current_pkg_name = pkg_name;
}
else
{
+ updating = Pkg::PkgInstalled(current_pkg_name);
+
// package installation - summary text
// %1 is RPM name, %2 is installed (unpacked) size (e.g. 6.20MB)
msg = sformat( _("Installing %1 (installed size %2)"), pkg_name,
String::FormatSize( pkg_size ) );
+
+ current_install_size = pkg_size;
}


@@ -1102,10 +1166,16 @@
*/
global void SlideProvideStart (string pkg_name, integer sz, boolean remote)
{
- // message in the installatino log, %1 is package name,
- // %2 is package size
- SlideGenericProvideStart (pkg_name, sz, _("Downloading %1 (download
size %2)"),
- remote);
+ current_provide_size = remote ? sz : 0;
+ current_pkg_name = pkg_name;
+
+ if (remote)
+ {
+ // message in the installatino log, %1 is package name,
+ // %2 is package size
+ SlideGenericProvideStart (pkg_name, sz, _("Downloading %1 (download
size %2)"),
+ remote);
+ }
}



Modified: trunk/packager/src/modules/SlideShowCallbacks.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/modules/SlideShowCallbacks.ycp?rev=54940&r1=54939&r2=54940&view=diff
==============================================================================
--- trunk/packager/src/modules/SlideShowCallbacks.ycp (original)
+++ trunk/packager/src/modules/SlideShowCallbacks.ycp Fri Jan 23 13:45:44 2009
@@ -80,12 +80,9 @@
global void StartProvide( string name, integer archivesize, boolean remote
)
{
pkg_inprogress = name;
+ _remote_provide = remote;

- if ( remote )
- {
- PackageSlideShow::SlideProvideStart (name , archivesize, remote);
- _remote_provide = true;
- }
+ PackageSlideShow::SlideProvideStart (name , archivesize, remote);
}


@@ -119,6 +116,7 @@
if ( _remote_provide )
{
PackageSlideShow::UpdateCurrentPackageProgress( 100 );
+ PackageSlideShow::DoneProvide( error, reason, name );
_remote_provide = false;
}
if (SlideShow::GetUserAbort())
@@ -534,8 +532,7 @@
}

/**
- * Install callbacks for slideshow. Should be in SlideShowCallbacks but
- * that doesn't work at the moment.
+ * Install callbacks for slideshow.
*/
global void InstallSlideShowCallbacks()
{

Modified: trunk/packager/yast2-packager.spec.in
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/packager/yast2-packager.spec.in?rev=54940&r1=54939&r2=54940&view=diff
==============================================================================
--- trunk/packager/yast2-packager.spec.in (original)
+++ trunk/packager/yast2-packager.spec.in Fri Jan 23 13:45:44 2009
@@ -7,8 +7,8 @@
# HTTP.ycp
BuildRequires: yast2-transfer

-# URL::HidePassword()
-BuildRequires: yast2 >= 2.17.47
+# Installation summary in PackagesUI::
+BuildRequires: yast2 >= 2.18.1

# "keeppackages" repo property
BuildRequires: yast2-pkg-bindings >= 2.17.27
@@ -19,8 +19,8 @@
# "keeppackages" repo property
Requires: yast2-pkg-bindings >= 2.17.27

-# URL::HidePassword()
-Requires: yast2 >= 2.17.47
+# Installation summary in PackagesUI::
+Requires: yast2 >= 2.18.1

# unzipping license file
Requires: unzip

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages