Author: lslezak Date: Fri Apr 18 11:53:53 2008 New Revision: 46824 URL: http://svn.opensuse.org/viewcvs/yast?rev=46824&view=rev Log: - added Pkg::TargetRebuildInit(string root) function which rebuilds the RPM DB ('rpm --rebuilddb') before initializing the target (bnc#308352) Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes trunk/pkg-bindings/src/PkgFunctions.h trunk/pkg-bindings/src/Target_Load.cc Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/package/yast2-pkg-bi... ============================================================================== --- trunk/pkg-bindings/package/yast2-pkg-bindings.changes (original) +++ trunk/pkg-bindings/package/yast2-pkg-bindings.changes Fri Apr 18 11:53:53 2008 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Fri Apr 18 11:52:11 CEST 2008 - lslezak@suse.cz + +- added Pkg::TargetRebuildInit(string root) function which rebuilds + the RPM DB ('rpm --rebuilddb') before initializing the target + (bnc#308352) + +------------------------------------------------------------------- Thu Apr 17 13:04:03 CEST 2008 - schubi@suse.de - do not iterate over the repo's if the target does not exist. Modified: trunk/pkg-bindings/src/PkgFunctions.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/PkgFunctions.h?r... ============================================================================== --- trunk/pkg-bindings/src/PkgFunctions.h (original) +++ trunk/pkg-bindings/src/PkgFunctions.h Fri Apr 18 11:53:53 2008 @@ -119,6 +119,7 @@ YCPValue GetPkgLocation(const YCPString& p, bool full_path); YCPValue PkgProp( zypp::PoolItem item ); YCPValue PkgMediaSizesOrCount (bool sizes); + YCPValue TargetInitInternal(const YCPString& root, bool rebuild_rpmdb); bool aliasExists(const std::string &alias) const; @@ -506,6 +507,8 @@ // target related /* TYPEINFO: boolean(string,boolean)*/ YCPValue TargetInit (const YCPString& root, const YCPBoolean& unused); + /* TYPEINFO: boolean(string)*/ + YCPValue TargetRebuildInit(const YCPString& root); /* TYPEINFO: boolean(string)*/ YCPValue TargetInitialize (const YCPString& root); /* TYPEINFO: boolean()*/ Modified: trunk/pkg-bindings/src/Target_Load.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Target_Load.cc?r... ============================================================================== --- trunk/pkg-bindings/src/Target_Load.cc (original) +++ trunk/pkg-bindings/src/Target_Load.cc Fri Apr 18 11:53:53 2008 @@ -38,17 +38,8 @@ Textdomain "pkg-bindings" */ -/** ------------------------ - * - * @builtin TargetInit - * @deprecated - * @short Initialize Target and load resolvables - * @param string root Root Directory - * @param boolean unused Dummy option, only for backward compatibility - * @return boolean - */ YCPValue -PkgFunctions::TargetInit (const YCPString& root, const YCPBoolean & /*unused_and_broken*/) +PkgFunctions::TargetInitInternal(const YCPString& root, bool rebuild_rpmdb) { const std::string r(root->value()); @@ -69,7 +60,12 @@ try { - zypp_ptr()->initializeTarget(r); + if (rebuild_rpmdb) + { + y2milestone("Initializing the target with rebuild"); + } + + zypp_ptr()->initializeTarget(r, rebuild_rpmdb); pkgprogress.NextStage(); zypp_ptr()->target()->load(); _target_loaded = true; @@ -90,6 +86,34 @@ /** ------------------------ * + * @builtin TargetInit + * @short Initialize Target and load resolvables + * @param string root Root Directory + * @param boolean unused Dummy option, only for backward compatibility + * @return boolean + */ +YCPValue +PkgFunctions::TargetInit (const YCPString& root, const YCPBoolean & /*unused_and_broken*/) +{ + return TargetInitInternal(root, false); +} + +/** ------------------------ + * + * @builtin TargetRebuildInit + * @short Similar to TargetInit, but the RPM DB is rebuilt ('rpm --rebuilddb') before reading it + * @param string root Root Directory + * @param boolean unused Dummy option, only for backward compatibility + * @return boolean + */ +YCPValue +PkgFunctions::TargetRebuildInit(const YCPString& root) +{ + return TargetInitInternal(root, true); +} + +/** ------------------------ + * * @builtin TargetInitialize * @short Initialize Target, read the keys. * @param string root Root Directory -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org