[yast-commit] r64148 - in /branches/SuSE-Code-11-SP2-Branch/snapper: VERSION agent-snapper/doc/snapper.html agent-snapper/src/SnapperAgent.cc package/yast2-snapper.changes src/Snapper.ycp
Author: jsuchome Date: Mon May 30 16:06:28 2011 New Revision: 64148 URL: http://svn.opensuse.org/viewcvs/yast?rev=64148&view=rev Log: - ask snapper library for snapshot paths - 2.17.3 Modified: branches/SuSE-Code-11-SP2-Branch/snapper/VERSION branches/SuSE-Code-11-SP2-Branch/snapper/agent-snapper/doc/snapper.html branches/SuSE-Code-11-SP2-Branch/snapper/agent-snapper/src/SnapperAgent.cc branches/SuSE-Code-11-SP2-Branch/snapper/package/yast2-snapper.changes branches/SuSE-Code-11-SP2-Branch/snapper/src/Snapper.ycp Modified: branches/SuSE-Code-11-SP2-Branch/snapper/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snappe... ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/VERSION (original) +++ branches/SuSE-Code-11-SP2-Branch/snapper/VERSION Mon May 30 16:06:28 2011 @@ -1 +1 @@ -2.17.2 +2.17.3 Modified: branches/SuSE-Code-11-SP2-Branch/snapper/agent-snapper/doc/snapper.html URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snappe... ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/agent-snapper/doc/snapper.html (original) +++ branches/SuSE-Code-11-SP2-Branch/snapper/agent-snapper/doc/snapper.html Mon May 30 16:06:28 2011 @@ -56,6 +56,21 @@ </td> </tr> + <tr><td><tt>.snapper.path</td><td>YCPMap</td><td align="left">YCPMap</td> + <td>Return the path to directory with given snapshot<br> + <b>Example of argument map</b>: + <pre> + $[ + "num" : 1, + $] + </pre> + <b>Example of result</b>: + <pre> + "/snapshots/1/snapshot" + </pre> + </td> + </tr> + <tr><td><tt>.snapper.snapshots</td><td>(none)</td><td align="left">YCPList</td> <td>Return list of current snapshot maps.<br> <b>Example of result</b>: Modified: branches/SuSE-Code-11-SP2-Branch/snapper/agent-snapper/src/SnapperAgent.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snappe... ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/agent-snapper/src/SnapperAgent.cc (original) +++ branches/SuSE-Code-11-SP2-Branch/snapper/agent-snapper/src/SnapperAgent.cc Mon May 30 16:06:28 2011 @@ -148,7 +148,7 @@ if (path->length() == 1) { /** - * error: Read (.snapper.error) -> returns last error message + * Read (.snapper.error) -> returns last error message */ if (PC(0) == "error") { YCPMap retmap; @@ -156,6 +156,21 @@ return retmap; } /** + * Read (.snapper.path, $[ "num" : num]) -> returns the path to directory with given snapshot + */ + if (PC(0) == "path") { + unsigned int num = getIntValue (argmap, "num", 0); + const Snapshots& snapshots = sh->getSnapshots(); + Snapshots::const_iterator snap = snapshots.find(num); + if (snap == snapshots.end()) + { + y2error ("snapshot '%d' not found", num); + return ret; + } + return YCPString (snap->snapshotDir()); + } + + /** * Read(.snapper.snapshots) -> return list of snapshot description maps */ if (PC(0) == "snapshots") { Modified: branches/SuSE-Code-11-SP2-Branch/snapper/package/yast2-snapper.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snappe... ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/package/yast2-snapper.changes (original) +++ branches/SuSE-Code-11-SP2-Branch/snapper/package/yast2-snapper.changes Mon May 30 16:06:28 2011 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Mon May 30 14:56:42 CEST 2011 - jsuchome@suse.cz + +- ask snapper library for snapshot paths +- 2.17.3 + +------------------------------------------------------------------- Wed May 11 11:35:31 CEST 2011 - jsuchome@suse.cz - only require libsnapper-devel Modified: branches/SuSE-Code-11-SP2-Branch/snapper/src/Snapper.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snappe... ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/src/Snapper.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/snapper/src/Snapper.ycp Mon May 30 16:06:28 2011 @@ -43,8 +43,6 @@ // global list of all snapshot global list<map> snapshots = []; -global string snapshots_path = "/snapshots"; - global map selected_snapshot = $[]; // mapping of snapshot number to index in snapshots list @@ -70,15 +68,28 @@ } /** + * Return the path to given snapshot + */ +global string GetSnapshotPath (integer snapshot_num) { + string ret = (string) SCR::Read (.snapper.path, $[ "num" : snapshot_num ]); + if (ret == nil) + { + ret = ""; + // popup error + Report::Error (sformat (_("Snapshot '%1' was not found."), snapshot_num)); + } + return ret; +} + +/** * Describe what was done with given file between given snapshots * - when new is 0, meaning is 'current system' */ global map GetFileModification (string file, integer old, integer new) { map ret = $[]; - - string file1 = sformat ("%1/%2/snapshot%3", snapshots_path, old, file); - string file2 = sformat ("%1/%2/snapshot%3", snapshots_path, new, file); + string file1 = sformat ("%1%2", GetSnapshotPath (old), file); + string file2 = sformat ("%1%2", GetSnapshotPath (new), file); if (new == 0) file2 = file; @@ -270,7 +281,7 @@ UI::ChangeWidget (`id (`progress ), `Value, progress); - string orig = sformat ("%1/%2/snapshot", snapshots_path, snapshot_num) + file; + string orig = GetSnapshotPath (snapshot_num) + file; string dir = substring (file, 0, findlastof (file, "/")); if (!FileUtils::Exists (orig)) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
jsuchome@svn2.opensuse.org