Author: lslezak Date: Fri Jan 4 12:52:33 2008 New Revision: 43269 URL: http://svn.opensuse.org/viewcvs/yast?rev=43269&view=rev Log: - implemented Pkg::SaveState() and Pkg::RestoreState() (#104579) (Pkg::ClearSaveState() is empty, there is only one saved state instance which cannot be removed) - 2.16.8 Modified: trunk/pkg-bindings/VERSION trunk/pkg-bindings/package/yast2-pkg-bindings.changes trunk/pkg-bindings/src/Package.cc Modified: trunk/pkg-bindings/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/VERSION?rev=43269&r1=43268&r2=43269&view=diff ============================================================================== --- trunk/pkg-bindings/VERSION (original) +++ trunk/pkg-bindings/VERSION Fri Jan 4 12:52:33 2008 @@ -1 +1 @@ -2.16.7 +2.16.8 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=43269&r1=43268&r2=43269&view=diff ============================================================================== --- trunk/pkg-bindings/package/yast2-pkg-bindings.changes (original) +++ trunk/pkg-bindings/package/yast2-pkg-bindings.changes Fri Jan 4 12:52:33 2008 @@ -1,9 +1,13 @@ ------------------------------------------------------------------- -Thu Jan 3 16:03:29 CET 2008 - lslezak@suse.cz +Fri Jan 4 11:35:08 CET 2008 - lslezak@suse.cz - the functionality from PkgModuleFunctions has been moved to PkgFunctions to reduce compile dependency, removed unnecessary #includes +- implemented Pkg::SaveState() and Pkg::RestoreState() (#104579) + (Pkg::ClearSaveState() is empty, there is only one saved state + instance which cannot be removed) +- 2.16.8 ------------------------------------------------------------------- Tue Dec 18 11:03:33 CET 2007 - lslezak@suse.cz Modified: trunk/pkg-bindings/src/Package.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Package.cc?rev=43269&r1=43268&r2=43269&view=diff ============================================================================== --- trunk/pkg-bindings/src/Package.cc (original) +++ trunk/pkg-bindings/src/Package.cc Fri Jan 4 12:52:33 2008 @@ -1277,13 +1277,14 @@ return ret; } +bool state_saved = false; + // ------------------------ /** @builtin SaveState - @short Save the current selection state - do not use, not implemented + @short Save the current selection state, can be restored later using Pkg::RestoreState() @description - save the current package selection status for later - retrieval via Pkg::RestoreState() + Save the current status of all resolvables for later restoration via Pkg::RestoreState() function. Only one state is stored, the following call will rewrite the saved status. @return boolean @see Pkg::RestoreState @@ -1292,15 +1293,24 @@ YCPValue PkgFunctions::SaveState () { -# warning SaveState is not implemented - return YCPBoolean (true); + // a state has been already saved, it will be lost... + if (state_saved) + { + y2warning("Pkg::SaveState() has been already called, rewriting the saved state..."); + } + + y2milestone("Saving status..."); + zypp_ptr()->poolProxy().saveState(); + state_saved = true; + + return YCPBoolean(true); } // ------------------------ /** @builtin RestoreState - @short Restore Saved state - do not use, not implemented + @short Restore Saved state - restore the state saved by Pkg::SaveState() @description restore the package selection status from a former call to Pkg::SaveState() @@ -1316,26 +1326,41 @@ YCPValue PkgFunctions::RestoreState (const YCPBoolean& ch) { -# warning RestoreState is not implemented + bool ret = false; + if (!ch.isNull () && ch->value () == true) { - // return YCPBoolean (_y2pm.packageSelectionDiffState()); + // check only + ret = zypp_ptr()->poolProxy().diffState(); + } + else + { + if (!state_saved) + { + y2error("No previous state saved, state cannot be restored"); + } + else + { + y2milestone("Restoring the saved status..."); + zypp_ptr()->poolProxy().restoreState(); + ret = true; + } } - return YCPBoolean(false /*_y2pm.packageSelectionRestoreState()*/); + + return YCPBoolean(ret); } // ------------------------ /** @builtin ClearSaveState - @short clear a saved state (to reduce memory consumption) - do not use, not implemented + @short Clear the saved state - do not use, does nothing (the saved state cannot be removed, it is part of each resolvable object) @return boolean */ YCPValue PkgFunctions::ClearSaveState () { -# warning ClearSaveState is not implemented return YCPBoolean (true); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org