Author: lslezak Date: Fri Apr 18 14:45:14 2008 New Revision: 46836 URL: http://svn.opensuse.org/viewcvs/yast?rev=46836&view=rev Log: - Use Pkg::PkgMediaSizes() and Pkg::PkgMediaPackageSizes() for computing total install and download size instead of quering each selected package separately (speeds up the proposal summary from 15-20 seconds to less than 1 second) - this is also a workaround for broken disk usage in libzypp (bnc#375104) - 2.16.35 Modified: trunk/packager/VERSION trunk/packager/package/yast2-packager.changes trunk/packager/src/modules/Packages.ycp trunk/packager/yast2-packager.spec.in Modified: trunk/packager/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/VERSION?rev=46836&r1... ============================================================================== --- trunk/packager/VERSION (original) +++ trunk/packager/VERSION Fri Apr 18 14:45:14 2008 @@ -1 +1 @@ -2.16.34 +2.16.35 Modified: trunk/packager/package/yast2-packager.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/package/yast2-packager.c... ============================================================================== --- trunk/packager/package/yast2-packager.changes (original) +++ trunk/packager/package/yast2-packager.changes Fri Apr 18 14:45:14 2008 @@ -1,4 +1,15 @@ ------------------------------------------------------------------- +Fri Apr 18 14:24:07 CEST 2008 - lslezak@suse.cz + +- Use Pkg::PkgMediaSizes() and Pkg::PkgMediaPackageSizes() for + computing total install and download size instead of quering + each selected package separately (speeds up the proposal summary + from 15-20 seconds to less than 1 second) +- this is also a workaround for broken disk usage in libzypp + (bnc#375104) +- 2.16.35 + +------------------------------------------------------------------- Wed Apr 16 13:37:41 CEST 2008 - locilka@suse.cz - Using pattern-xfce for XFCE Desktop selection (bnc #377584). Modified: trunk/packager/src/modules/Packages.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/modules/Packages.ycp... ============================================================================== --- trunk/packager/src/modules/Packages.ycp (original) +++ trunk/packager/src/modules/Packages.ycp Fri Apr 18 14:45:14 2008 @@ -150,35 +150,48 @@ */ global string CountSizeToBeInstalled () { integer sz = 0; - if (! Mode::installation () && !Installation::dirinstall_installing_into_dir ) - { - list<string> packages = Pkg::GetPackages (`selected, true); - foreach (string p, packages, { - sz = sz + Pkg::PkgSize (p); - }); - // convert into kB - sz = sz / 1024; - } - else // in case of fresh installation, disk is initially empty - { - map<string,list> du = Pkg::TargetGetDU (); - foreach (string mp, list usages, du, { - sz = sz + usages[2]:0 - usages[1]:0; - }); - } - y2milestone ("Total size of packages to install (kB): %1", sz); - return String::FormatSizeWithPrecision (sz*1024, 1, true); + list<list<integer> > media_sizes = Pkg::PkgMediaSizes(); + + foreach (list<integer> inst_sizes, media_sizes, + { + foreach (integer inst_size, inst_sizes, + { + sz = sz + inst_size; + } + ); + } + ); + + y2milestone ("Total size of packages to install %1 (%2kB)", sz, sz / 1024 ); + return String::FormatSizeWithPrecision (sz, 1, true); +} + +map<integer,integer> SrcMapping() +{ + map<integer,integer> srcid_to_current_src_no = $[]; + integer index = 0; + + list< list > src_list = Pkg::PkgMediaNames(); + y2debug("source names: %1", src_list); + + srcid_to_current_src_no = listmap( list src, src_list, { + index = index + 1; + return $[src[1]:-1 : index]; + }); + + y2milestone ("Repository mapping information: %1", srcid_to_current_src_no ); + return srcid_to_current_src_no; } /** * Count the total size of packages to be installed - * @return string formatted size of packages to be installed + * @return integer size of packages to be installed (in bytes) */ global integer CountSizeToBeDownloaded() { integer ret = 0; // get list of remote repositories - // consider only http and ftp protocols as remote + // consider only http(s) and ftp protocols as remote // all enabled sources list<integer> repos = Pkg::SourceGetCurrent(true); @@ -187,9 +200,9 @@ foreach(integer repo, repos, { string url = Pkg::SourceGeneralData(repo)["url"]:""; - string scheme = URL::Parse(url)["scheme"]:""; + string scheme = tolower(URL::Parse(url)["scheme"]:""); - if (tolower(scheme) == "http" || tolower(scheme) == "ftp") + if (scheme == "http" || scheme == "https" || scheme == "ftp") { y2milestone("Found remote repository %1: %2", repo, url); remote_repos = add(remote_repos, repo); @@ -204,28 +217,24 @@ return 0; } - list<string> packages = Pkg::GetPackages (`selected, true); + map<integer,integer> repo_mapping = SrcMapping(); + + list<list<integer> > media_sizes = Pkg::PkgMediaPackageSizes(); + y2debug("Media sizes: %1", media_sizes); - foreach (string p, packages, + foreach(integer repoid, remote_repos, { - list<map> properties = Pkg::ResolvableProperties(p, `package, ""); + list<integer> repo_media_sizes = media_sizes[(repo_mapping[repoid]:-1) - 1]:[]; - foreach(map prop, properties, + foreach(integer media_size, repo_media_sizes, { - // the package is selected for installation - if (prop["status"]:`unknown == `selected && contains(remote_repos, prop["source"]:-1)) - { - y2debug("Found remote package %1-%2 (%3) from repository %4", p, prop["version"]:"", prop["download_size"]:0, prop["source"]:-1); - - ret = ret + prop["download_size"]:0; - } + ret = ret + media_size; } ); } ); - y2milestone("Total size of packages to download: %1 (%2 B)", String::FormatSizeWithPrecision(ret, 1, true), ret); - + y2milestone("Total size of packages to download: %1 (%2kB)", ret, ret / 1024); return ret; } Modified: trunk/packager/yast2-packager.spec.in URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/yast2-packager.spec.in?r... ============================================================================== --- trunk/packager/yast2-packager.spec.in (original) +++ trunk/packager/yast2-packager.spec.in Fri Apr 18 14:45:14 2008 @@ -7,8 +7,8 @@ # empty package callbacks BuildRequires: yast2 >= 2.16.52 -# new registration of callbacks -BuildRequires: yast2-pkg-bindings >= 2.16.23 +# Pkg::PkgMediaPackageSizes() +BuildRequires: yast2-pkg-bindings >= 2.16.29 # Module: OneClickInstallStandard Requires: perl-XML-Bare yast2-perl-bindings @@ -17,8 +17,8 @@ Requires: yast2-country-data >= 2.16.3 Requires: yast2-installation >= 2.15.12 -# new registration of callbacks -Requires: yast2-pkg-bindings >= 2.16.23 +# Pkg::PkgMediaPackageSizes() +Requires: yast2-pkg-bindings >= 2.16.29 # empty package callbacks Requires: yast2 >= 2.16.52 -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org