Hello community,
here is the log from the commit of package yast2-snapper for openSUSE:Factory
checked in at Wed May 18 09:22:39 CEST 2011.
--------
--- yast2-snapper/yast2-snapper.changes 2011-04-18 09:20:39.000000000 +0200
+++ /mounts/work_src_done/STABLE/yast2-snapper/yast2-snapper.changes 2011-05-11 11:27:09.000000000 +0200
@@ -1,0 +2,7 @@
+Wed May 11 10:41:42 CEST 2011 - jsuchome@suse.cz
+
+- added initialization code to agent, check for exceptions
+- updated agent documentation
+- 2.21.5
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
_cvsignore
yast2-snapper-2.21.4.tar.bz2
New:
----
yast2-snapper-2.21.5.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-snapper.spec ++++++
--- /var/tmp/diff_new_pack.WnyffJ/_old 2011-05-18 09:17:57.000000000 +0200
+++ /var/tmp/diff_new_pack.WnyffJ/_new 2011-05-18 09:17:57.000000000 +0200
@@ -19,18 +19,18 @@
Name: yast2-snapper
-Version: 2.21.4
+Version: 2.21.5
Release: 1
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-snapper-2.21.4.tar.bz2
+Source0: yast2-snapper-2.21.5.tar.bz2
Prefix: /usr
-Requires: yast2 libsnapper
-License: GPLv2+
-BuildRequires: doxygen gcc-c++ libsnapper libsnapper-devel perl-XML-Writer update-desktop-files yast2 yast2-core-devel yast2-devtools yast2-testsuite
+Requires: yast2
+License: GPL v2 or later
+BuildRequires: doxygen gcc-c++ libsnapper-devel perl-XML-Writer update-desktop-files yast2 yast2-core-devel yast2-devtools yast2-testsuite
Summary: YaST - file system snapshots review
@@ -38,7 +38,7 @@
YaST module for accessing and managing btrfs system snapshots
%prep
-%setup -n yast2-snapper-2.21.4
+%setup -n yast2-snapper-2.21.5
%build
%{prefix}/bin/y2tool y2autoconf
++++++ yast2-snapper-2.21.4.tar.bz2 -> yast2-snapper-2.21.5.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-snapper-2.21.4/VERSION new/yast2-snapper-2.21.5/VERSION
--- old/yast2-snapper-2.21.4/VERSION 2011-04-18 09:18:55.000000000 +0200
+++ new/yast2-snapper-2.21.5/VERSION 2011-05-11 10:42:39.000000000 +0200
@@ -1 +1 @@
-2.21.4
+2.21.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-snapper-2.21.4/agent-snapper/doc/snapper.html new/yast2-snapper-2.21.5/agent-snapper/doc/snapper.html
--- old/yast2-snapper-2.21.4/agent-snapper/doc/snapper.html 2011-03-24 13:15:50.000000000 +0100
+++ new/yast2-snapper-2.21.5/agent-snapper/doc/snapper.html 2011-05-11 11:24:58.000000000 +0200
@@ -32,6 +32,8 @@
<ul><tt>.snapper</tt></ul>
+The initialization call of Execute (.snapper) must be done before any other calls.
+
<P>
<h2>Complete Read paths table</h2>
@@ -43,7 +45,18 @@
<th align="left">Result</th>
</tr>
- <tr><td><tt>.snapper.snapshots</td><td></td><td align="left">YCPList</td>
+ <tr><td><tt>.snapper.error</td><td>(none)</td><td align="left">YCPMap</td>
+ <td>Return information about last error.<br>
+ <b>Example of result</b>:
+ <pre>
+ $[
+ "type" : "config_not_found"
+ ]
+ </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>:
<pre>
@@ -75,7 +88,7 @@
</td>
</tr>
- <tr><td><tt>.snapper.diff</td><td>YCPMap</td><td align="left">YCPList</td>
+ <tr><td><tt>.snapper.diff_list</td><td>YCPMap</td><td align="left">YCPList</td>
<td>Returns the list of files modified between given snapshots.
Each file is described by YCPMap which contains file path and type of the change.
Argument map contains 2 integers, identifying the snapshots.<br>
@@ -100,6 +113,93 @@
]
</pre>
</td></tr>
+
+ <tr><td><tt>.snapper.diff_index</td><td>YCPMap</td><td align="left">YCPMap</td>
+ <td>Returns the differences between snapnots num1 and num2 as one-level map
+ (mapping each file to its changes).<br>
+ <b>Example of argument map</b>:
+ <pre>
+ $[
+ "from" : 1,
+ "to" : 2
+ $]
+ </pre>
+ <b>Example of result</b>:
+ <pre>
+ $[
+ "/etc/group" : "c...",
+ "/etc/group.YaST2save" : "c..."
+ ]
+ </pre>
+ </td></tr>
+
+ <tr><td><tt>.snapper.diff_tree</td><td>YCPMap</td><td align="left">YCPMap</td>
+ <td>Returns the differences between snapnots num1 and num2 as a tree.
+ Map is recursively describing the filesystem structure; it is used to build Tree widget contents
+ in yast2-snapper UI.
+ <br>
+ <b>Example of argument map</b>:
+ <pre>
+ $[
+ "from" : 1,
+ "to" : 2
+ $]
+ </pre>
+ <b>Example of result</b>:
+ <pre>
+ $[
+ "etc" : $[
+ "group" : $[],
+ "group.YaST2save" : $[],
+ "passwd" : $[],
+ "passwd.YaST2save" : $[]
+ ],
+ "var" : $[
+ "log" : $[
+ "YaST2" : $[
+ "y2changes" : $[],
+ "y2log" : $[]
+ ],
+ "messages" : $[],
+ "snapper.log" : $[]
+ ]
+ ]
+ ]
+ </pre>
+ </td></tr>
+</table>
+
+<P>
+<h2>Complete Execute paths table</h2>
+
+<table border=3>
+ <tr>
+ <th width="20%" align="left">Path</th>
+ <th width="10%" align="left">Argument</th>
+ <th width="10%" align="left">Type of Result</th>
+ <th align="left">Result</th>
+ </tr>
+
+ <tr><td><tt>.snapper</td><td>(none)</td><td align="left">YCPBoolean</td>
+ <td>Initializes snapper object. In case of init failure, sets the internal error ID.
+ Use Read (.snapper.error) to get the error info.
+ </td>
+ </tr>
+
+ <tr><td><tt>.snapper.rollback</td><td>YCPMap</td><td align="left">YCPBoolean</td>
+ <td>Rollback the list of given files from snapshot num1 to num2. If num2 is not present,
+ current system is used as a default.
+ <b>Example of argument map</b>:
+ <pre>
+ $[
+ "files" : [
+ "/etc/passwd",
+ "/etc/group"
+ ]
+ "from" : 1,
+ $]
+ </pre>
+ </td></tr>
</table>
<P>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-snapper-2.21.4/agent-snapper/src/SnapperAgent.cc new/yast2-snapper-2.21.5/agent-snapper/src/SnapperAgent.cc
--- old/yast2-snapper-2.21.4/agent-snapper/src/SnapperAgent.cc 2011-04-15 11:37:11.000000000 +0200
+++ new/yast2-snapper-2.21.5/agent-snapper/src/SnapperAgent.cc 2011-05-06 08:28:32.000000000 +0200
@@ -86,7 +86,9 @@
*/
SnapperAgent::SnapperAgent() : SCRAgent()
{
- sh = createSnapper();
+ sh = NULL;
+ snapper_initialized = false;
+ snapper_error = "";
}
/**
@@ -94,7 +96,10 @@
*/
SnapperAgent::~SnapperAgent()
{
- deleteSnapper(sh);
+ if (sh)
+ {
+ deleteSnapper(sh);
+ }
}
@@ -133,14 +138,21 @@
YCPMap argmap;
if (!arg.isNull() && arg->isMap())
argmap = arg->asMap();
+
+ if (!snapper_initialized && PC(0) != "error") {
+ y2error ("snapper not initialized: use Execute (.snapper) first!");
+ snapper_error = "not_initialized";
+ return YCPVoid();
+ }
if (path->length() == 1) {
/**
- * error: Read(.snapper.error) -> returns last error message
+ * error: Read (.snapper.error) -> returns last error message
*/
if (PC(0) == "error") {
YCPMap retmap;
+ retmap->add (YCPString ("type"), YCPString (snapper_error));
return retmap;
}
/**
@@ -286,6 +298,38 @@
if (!arg.isNull() && arg->isMap())
argmap = arg->asMap();
+ /**
+ * Execute (.snapper) call: Initialize snapper object
+ */
+ if (path->length() == 0) {
+
+ try {
+ sh = createSnapper();
+ }
+ catch (const ConfigNotFoundException& e)
+ {
+ y2error ("Config not found.");
+ snapper_error = "config_not_found";
+ sh = NULL;
+ return YCPBoolean (false);
+ }
+ catch (const InvalidConfigException& e)
+ {
+ y2error ("Config is invalid.");
+ snapper_error = "config_invalid";
+ sh = NULL;
+ return YCPBoolean (false);
+ }
+ snapper_initialized = true;
+ return ret;
+ }
+
+ if (!snapper_initialized) {
+ y2error ("snapper not initialized: use Execute (.snapper) first!");
+ snapper_error = "not_initialized";
+ return YCPVoid();
+ }
+
if (path->length() == 1) {
/**
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-snapper-2.21.4/agent-snapper/src/SnapperAgent.h new/yast2-snapper-2.21.5/agent-snapper/src/SnapperAgent.h
--- old/yast2-snapper-2.21.4/agent-snapper/src/SnapperAgent.h 2011-04-14 10:50:11.000000000 +0200
+++ new/yast2-snapper-2.21.5/agent-snapper/src/SnapperAgent.h 2011-05-06 08:06:27.000000000 +0200
@@ -29,6 +29,10 @@
* Agent private variables and methods
*/
+ snapper::Snapper* sh;
+ bool snapper_initialized;
+ string snapper_error;
+
/**
* search the map for value of given key; both key and value have to be strings
* when key is not present, empty string is returned
@@ -92,11 +96,6 @@
* Used for mounting the agent.
*/
virtual YCPValue otherCommand(const YCPTerm& term);
-
-private:
-
- snapper::Snapper* sh;
-
};
#endif /* _SnapperAgent_h */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-snapper-2.21.4/src/Snapper.ycp new/yast2-snapper-2.21.5/src/Snapper.ycp
--- old/yast2-snapper-2.21.4/src/Snapper.ycp 2011-04-15 11:34:54.000000000 +0200
+++ new/yast2-snapper-2.21.5/src/Snapper.ycp 2011-05-06 08:06:27.000000000 +0200
@@ -23,7 +23,7 @@
* Summary: Snapper settings, input and output functions
* Authors: Jiri Suchomel