[yast-commit] r46831 - in /trunk/pkg-bindings: package/yast2-pkg-bindings.changes src/Package.cc src/PkgFunctions.h
Author: lslezak Date: Fri Apr 18 13:34:57 2008 New Revision: 46831 URL: http://svn.opensuse.org/viewcvs/yast?rev=46831&view=rev Log: - added Pkg::PkgMediaPackageSizes() to speed up computing the download size of the selected packages Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes trunk/pkg-bindings/src/Package.cc trunk/pkg-bindings/src/PkgFunctions.h Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/package/yast2-pkg-bindings.changes?rev=46831&r1=46830&r2=46831&view=diff ============================================================================== --- trunk/pkg-bindings/package/yast2-pkg-bindings.changes (original) +++ trunk/pkg-bindings/package/yast2-pkg-bindings.changes Fri Apr 18 13:34:57 2008 @@ -1,6 +1,8 @@ ------------------------------------------------------------------- -Fri Apr 18 11:52:11 CEST 2008 - lslezak@suse.cz +Fri Apr 18 13:27:33 CEST 2008 - lslezak@suse.cz +- added Pkg::PkgMediaPackageSizes() to speed up computing + the download size of the selected packages - added Pkg::TargetRebuildInit(string root) function which rebuilds the RPM DB ('rpm --rebuilddb') before initializing the target (bnc#308352) Modified: trunk/pkg-bindings/src/Package.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Package.cc?rev=46831&r1=46830&r2=46831&view=diff ============================================================================== --- trunk/pkg-bindings/src/Package.cc (original) +++ trunk/pkg-bindings/src/Package.cc Fri Apr 18 13:34:57 2008 @@ -253,23 +253,9 @@ -// ------------------------ -/** - * @builtin PkgMediaSizes - * @short Return size of packages to be installed - * @description - * return cumulated sizes (in bytes !) to be installed from different sources and media - * - * Returns the install size, not the archivesize !! - * - * @return list<list<integer>> - * @usage Pkg::PkgMediaSizes () -> [ [src1_media_1_size, src1_media_2_size, ...], ..] - */ YCPValue -PkgFunctions::PkgMediaSizesOrCount (bool sizes) +PkgFunctions::PkgMediaSizesOrCount (bool sizes, bool download_size) { -# warning No installation order - // all enabled sources std::list<RepoId> source_ids; @@ -322,7 +308,7 @@ if (medium > 0) { - zypp::ByteCount size = sizes ? pkg->size() : zypp::ByteCount(1); //count only + zypp::ByteCount size = sizes ? (download_size ? pkg->downloadSize() : pkg->size()) : zypp::ByteCount(1); //count only // refence to the found media array std::vector<zypp::ByteCount> &ref = result[source_map[pkg->repoInfo().alias()]]; @@ -355,7 +341,7 @@ res->add( source ); } - y2milestone( "Pkg::%s result: %s", sizes?"PkgMediaSizes": "PkgMediaCount", res->toString().c_str()); + y2milestone( "Pkg::%s result: %s", sizes ? (download_size ? "PkgMediaPackageSizes" : "PkgMediaSizes" ): "PkgMediaCount", res->toString().c_str()); return res; } @@ -380,6 +366,24 @@ // ------------------------ /** + * @builtin PkgMediaPackageSizes + * @short Return size of packages to be installed + * @description + * return cumulated sizes (in bytes !) to be installed from different sources and media + * + * Returns the archive sizes! + * + * @return list<list<integer>> + * @usage Pkg::PkgMediaPackageSizes () -> [ [src1_media_1_size, src1_media_2_size, ...], ..] + */ +YCPValue +PkgFunctions::PkgMediaPackageSizes() +{ + return PkgMediaSizesOrCount (true, true); +} + +// ------------------------ +/** * @builtin PkgMediaCount * @short Return number of packages to be installed * @description Modified: trunk/pkg-bindings/src/PkgFunctions.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/PkgFunctions.h?rev=46831&r1=46830&r2=46831&view=diff ============================================================================== --- trunk/pkg-bindings/src/PkgFunctions.h (original) +++ trunk/pkg-bindings/src/PkgFunctions.h Fri Apr 18 13:34:57 2008 @@ -118,7 +118,7 @@ YCPValue GetPkgLocation(const YCPString& p, bool full_path); YCPValue PkgProp( zypp::PoolItem item ); - YCPValue PkgMediaSizesOrCount (bool sizes); + YCPValue PkgMediaSizesOrCount (bool sizes, bool download_size = false); YCPValue TargetInitInternal(const YCPString& root, bool rebuild_rpmdb); bool aliasExists(const std::string &alias) const; @@ -658,6 +658,8 @@ /* TYPEINFO: list<list<integer>>()*/ YCPValue PkgMediaSizes (); /* TYPEINFO: list<list<integer>>()*/ + YCPValue PkgMediaPackageSizes(); + /* TYPEINFO: list<list<integer>>()*/ YCPValue PkgMediaCount(); /* TYPEINFO: list<list<any>>()*/ YCPValue PkgMediaNames (); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
lslezak@svn.opensuse.org