Hello community,

here is the log from the commit of package yast2-snapper for openSUSE:Factory
checked in at Tue Oct 11 17:08:43 CEST 2011.



--------
--- openSUSE:Factory/yast2-snapper/yast2-snapper.changes        2011-10-04 
18:03:32.000000000 +0200
+++ /mounts/work_src_done/STABLE/yast2-snapper/yast2-snapper.changes    
2011-10-10 12:47:17.000000000 +0200
@@ -1,0 +2,22 @@
+Mon Oct 10 12:44:44 CEST 2011 - jsuch...@suse.cz
+
+- agent: pass map refereces as arguments
+- quote strings passed to bash commands
+- fixed testsuite
+- 2.21.13
+
+-------------------------------------------------------------------
+Fri Oct  7 14:36:51 CEST 2011 - jsuch...@suse.cz
+
+- removed conflicting statusToString
+- 2.21.12
+
+-------------------------------------------------------------------
+Fri Oct  7 11:15:53 CEST 2011 - jsuch...@suse.cz
+
+- support more snapper configurations (bnc#719482)
+- show path to current subvolume above filesystem tree (bnc#719482)
+- close the feedback window correctly (bnc#722477)
+- 2.21.11 
+
+-------------------------------------------------------------------

calling whatdependson for head-i586


Old:
----
  yast2-snapper-2.21.10.tar.bz2

New:
----
  yast2-snapper-2.21.13.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-snapper.spec ++++++
--- /var/tmp/diff_new_pack.vyEr0f/_old  2011-10-11 17:08:35.000000000 +0200
+++ /var/tmp/diff_new_pack.vyEr0f/_new  2011-10-11 17:08:35.000000000 +0200
@@ -19,17 +19,15 @@
 
 
 Name:           yast2-snapper
-Version:        2.21.10
+Version:        2.21.13
 Release:        0
 Group:          System/YaST
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Source0:        yast2-snapper-%{version}.tar.bz2
 
-Prefix:         /usr
-
 Requires:       yast2 >= 2.21.22
-License:        GPL v2 or later
+License:        GPL-2.0+
 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
@@ -41,23 +39,23 @@
 %setup -n yast2-snapper-%{version}
 
 %build
-%{prefix}/bin/y2tool y2autoconf
-%{prefix}/bin/y2tool y2automake
+%{_prefix}/bin/y2tool y2autoconf
+%{_prefix}/bin/y2tool y2automake
 autoreconf --force --install
 
 export CFLAGS="$RPM_OPT_FLAGS -DNDEBUG"
 export CXXFLAGS="$RPM_OPT_FLAGS -DNDEBUG"
 
 %{?suse_update_config:%{suse_update_config -f}}
-./configure --libdir=%{_libdir} --prefix=%{prefix} --mandir=%{_mandir}
+./configure --libdir=%{_libdir} --prefix=%{_prefix} --mandir=%{_mandir}
 # V=1: verbose build in case we used AM_SILENT_RULES(yes)
 # so that RPM_OPT_FLAGS check works
 make %{?jobs:-j%jobs} V=1
 
 %install
 make install DESTDIR="$RPM_BUILD_ROOT"
-[ -e "%{prefix}/share/YaST2/data/devtools/NO_MAKE_CHECK" ] || 
Y2DIR="$RPM_BUILD_ROOT/usr/share/YaST2" make check DESTDIR="$RPM_BUILD_ROOT"
-for f in `find $RPM_BUILD_ROOT/%{prefix}/share/applications/YaST2/ -name 
"*.desktop"` ; do
+[ -e "%{_prefix}/share/YaST2/data/devtools/NO_MAKE_CHECK" ] || 
Y2DIR="$RPM_BUILD_ROOT/usr/share/YaST2" make check DESTDIR="$RPM_BUILD_ROOT"
+for f in `find $RPM_BUILD_ROOT/%{_prefix}/share/applications/YaST2/ -name 
"*.desktop"` ; do
     d=${f##*/}
     %suse_update_desktop_file -d ycc_${d%.desktop} ${d%.desktop}
 done
@@ -71,9 +69,9 @@
 /usr/share/YaST2/include/snapper/*
 /usr/share/YaST2/clients/snapper.ycp
 /usr/share/YaST2/modules/Snapper.*
-%{prefix}/share/applications/YaST2/snapper.desktop
+%{_prefix}/share/applications/YaST2/snapper.desktop
 /usr/share/YaST2/scrconf/*.scr
 %{_libdir}/YaST2/plugin/libpy2ag_snapper*
-%doc %{prefix}/share/doc/packages/yast2-snapper
+%doc %{_prefix}/share/doc/packages/yast2-snapper
 
 %changelog

++++++ yast2-snapper-2.21.10.tar.bz2 -> yast2-snapper-2.21.13.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-snapper-2.21.10/VERSION 
new/yast2-snapper-2.21.13/VERSION
--- old/yast2-snapper-2.21.10/VERSION   2011-09-28 23:05:13.000000000 +0200
+++ new/yast2-snapper-2.21.13/VERSION   2011-10-10 12:45:23.000000000 +0200
@@ -1 +1 @@
-2.21.10
+2.21.13
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-snapper-2.21.10/agent-snapper/src/SnapperAgent.cc 
new/yast2-snapper-2.21.13/agent-snapper/src/SnapperAgent.cc
--- old/yast2-snapper-2.21.10/agent-snapper/src/SnapperAgent.cc 2011-09-28 
23:04:27.000000000 +0200
+++ new/yast2-snapper-2.21.13/agent-snapper/src/SnapperAgent.cc 2011-10-10 
12:43:23.000000000 +0200
@@ -18,13 +18,13 @@
 /*
  * search the map for value of given key; both key and value have to be strings
  */
-string SnapperAgent::getValue (const YCPMap map, const string key)
+string SnapperAgent::getValue (const YCPMap &map, const string key, const 
string deflt)
 {
     if (!map->value(YCPString(key)).isNull()
        && map->value(YCPString(key))->isString())
        return map->value(YCPString(key))->asString()->value();
     else
-       return "";
+       return deflt;
 }
 
 /**
@@ -33,7 +33,7 @@
  * @param key key we are looking for
  * @param deflt the default value to be returned if key is not found
  */
-int SnapperAgent::getIntValue (const YCPMap map, const string key, int deflt)
+int SnapperAgent::getIntValue (const YCPMap &map, const string key, const int 
deflt)
 {
     if (!map->value(YCPString(key)).isNull() && 
map->value(YCPString(key))->isInteger()) {
        return map->value(YCPString(key))->asInteger()->value(); 
@@ -50,7 +50,7 @@
  * Search the map for value of given key;
  * key is string and value is YCPList
  */
-YCPList SnapperAgent::getListValue (const YCPMap map, const string key)
+YCPList SnapperAgent::getListValue (const YCPMap &map, const string key)
 {
     if (!map->value(YCPString(key)).isNull() && 
map->value(YCPString(key))->isList())
        return map->value(YCPString(key))->asList();
@@ -59,28 +59,6 @@
 }
 
 
-string statusToString(unsigned int status)
-{
-       string ret;
-
-       if (status & CREATED)
-           ret += "+";
-       else if (status & DELETED)
-           ret += "-";
-       else if (status & TYPE)
-           ret += "t";
-       else if (status & CONTENT)
-           ret += "c";
-       else
-           ret += ".";
-
-       ret += status & PERMISSIONS ? "p" : ".";
-       ret += status & USER ? "u" : ".";
-       ret += status & GROUP ? "g" : ".";
-
-       return ret;
-}
-
 /**
  * Constructor
  */
@@ -139,7 +117,7 @@
     if (!arg.isNull() && arg->isMap())
        argmap = arg->asMap();
 
-    if (!snapper_initialized && PC(0) != "error") {
+    if (!snapper_initialized && PC(0) != "error" && PC(0) != "configs") {
        y2error ("snapper not initialized: use Execute (.snapper) first!");
        snapper_error = "not_initialized";
        return YCPVoid();
@@ -147,6 +125,24 @@
        
     if (path->length() == 1) {
 
+       if (PC(0) == "configs") {
+           YCPList retlist;
+
+           try {
+               list<ConfigInfo> configs = Snapper::getConfigs();
+               for (list<ConfigInfo>::const_iterator it = configs.begin(); it 
!= configs.end(); ++it)
+               {
+                   retlist->add (YCPString (it->config_name));
+               }
+           }
+           catch (const ListConfigsFailedException& e)
+           {
+               y2error ("sysconfig file not found.");
+               snapper_error   = "sysconfig_not_found";
+               return YCPVoid();
+           }
+           return retlist;
+       }
        /**
         * Read (.snapper.error) -> returns last error message
         */
@@ -242,7 +238,10 @@
 
            for (Files::const_iterator it = files.begin(); it != files.end(); 
++it)
            {
-               retmap->add (YCPString (it->getName()), YCPString 
(statusToString (it->getPreToPostStatus())));
+               YCPMap file_map;
+               file_map->add (YCPString ("status"), YCPString (statusToString 
(it->getPreToPostStatus())));
+               file_map->add (YCPString ("full_path"), YCPString 
(it->getAbsolutePath (LOC_SYSTEM)));
+               retmap->add (YCPString (it->getName()), file_map);
            }
            return retmap;
        }
@@ -317,9 +316,17 @@
      * Execute (.snapper) call: Initialize snapper object
      */
     if (path->length() == 0) {
+    
+       snapper_initialized     = false;
+       if (sh)
+       {
+           y2milestone ("deleting existing snapper object");
+           deleteSnapper(sh);
+       }
 
+       string config_name = getValue (argmap, "config", "root");
        try {
-           sh = createSnapper();
+           sh = createSnapper (config_name);
        }
        catch (const ConfigNotFoundException& e)
        {
@@ -371,8 +378,8 @@
                    }
                    else
                    {
-                       it->setRollback(true);
-                       it->doRollback ();
+                       it->setUndo(true);
+                       it->doUndo();
                    }
                }
            }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-snapper-2.21.10/agent-snapper/src/SnapperAgent.h 
new/yast2-snapper-2.21.13/agent-snapper/src/SnapperAgent.h
--- old/yast2-snapper-2.21.10/agent-snapper/src/SnapperAgent.h  2011-09-28 
23:04:27.000000000 +0200
+++ new/yast2-snapper-2.21.13/agent-snapper/src/SnapperAgent.h  2011-10-10 
12:43:00.000000000 +0200
@@ -35,9 +35,9 @@
 
     /**
      * 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
+     * when key is not present, default value is returned
      */
-    string getValue (const YCPMap map, const string key);
+    string getValue (const YCPMap &map, const string key, const string deflt);
 
     /**
      * Search the map for value of given key
@@ -45,13 +45,13 @@
      * @param key key we are looking for
      * @param deflt the default value to be returned if key is not found
      */
-    int getIntValue ( const YCPMap map, const string key, int deflt);
+    int getIntValue ( const YCPMap &map, const string key, const int deflt);
 
     /**
      * Search the map for value of given key;
      * key is string and value is YCPList
      */
-    YCPList getListValue (const YCPMap map, const string key);
+    YCPList getListValue (const YCPMap &map, const string key);
 
 public:
     /**
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-snapper-2.21.10/configure.in 
new/yast2-snapper-2.21.13/configure.in
--- old/yast2-snapper-2.21.10/configure.in      2011-09-28 23:06:23.000000000 
+0200
+++ new/yast2-snapper-2.21.13/configure.in      2011-10-05 10:10:47.000000000 
+0200
@@ -1,6 +1,6 @@
 dnl configure.in for yast2-snapper
 dnl
-dnl -- This file is generated by y2autoconf 2.21.2 - DO NOT EDIT! --
+dnl -- This file is generated by y2autoconf 2.21.3 - DO NOT EDIT! --
 dnl    (edit configure.in.in instead)
 
 AC_INIT(yast2-snapper, 2.21.10, http://bugs.opensuse.org/, yast2-snapper)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-snapper-2.21.10/snapper.pot 
new/yast2-snapper-2.21.13/snapper.pot
--- old/yast2-snapper-2.21.10/snapper.pot       1970-01-01 01:00:00.000000000 
+0100
+++ new/yast2-snapper-2.21.13/snapper.pot       2011-10-05 10:11:03.000000000 
+0200
@@ -0,0 +1,297 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR SuSE Linux Products GmbH, Nuernberg
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-10-05 10:11+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <l...@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. popup error
+#: src/Snapper.ycp:84
+#, ycp-format
+msgid "Snapshot '%1' was not found."
+msgstr ""
+
+#. error popup
+#: src/Snapper.ycp:195
+msgid "File /etc/sysconfig/snapper is not available"
+msgstr ""
+
+#: src/Snapper.ycp:214
+msgid "Reason not known."
+msgstr ""
+
+#: src/Snapper.ycp:217
+msgid "Configuration not found."
+msgstr ""
+
+#: src/Snapper.ycp:221
+msgid "Configuration is not valid."
+msgstr ""
+
+#. error popup
+#: src/Snapper.ycp:226
+#, ycp-format
+msgid ""
+"Failed to initialize snapper library:\n"
+"%1"
+msgstr ""
+
+#. Snapper read dialog caption
+#: src/Snapper.ycp:240
+msgid "Initializing Snapper"
+msgstr ""
+
+#. Progress stage 1/3
+#: src/Snapper.ycp:247
+msgid "Read the list of snapshots"
+msgstr ""
+
+#. Progress step 1/3
+#: src/Snapper.ycp:250
+msgid "Reading the database..."
+msgstr ""
+
+#. Progress finished
+#: src/Snapper.ycp:252
+msgid "Finished"
+msgstr ""
+
+#. label for log window
+#: src/Snapper.ycp:298
+msgid "Restoring Files..."
+msgstr ""
+
+#. log entry (%1 is file name)
+#: src/Snapper.ycp:315
+#, ycp-format
+msgid "%1 does not exist in snapshot %2\n"
+msgstr ""
+
+#. log entry (%1 is file name)
+#: src/Snapper.ycp:340
+#, ycp-format
+msgid "%1 skipped\n"
+msgstr ""
+
+#. summary dialog caption
+#: src/dialogs.ycp:68
+msgid "Snapshots"
+msgstr ""
+
+#: src/dialogs.ycp:90
+msgid "Single"
+msgstr ""
+
+#: src/dialogs.ycp:104
+msgid "Pre & Post"
+msgstr ""
+
+#. combo box label
+#: src/dialogs.ycp:117
+msgid "Current Configuration"
+msgstr ""
+
+#. table header
+#: src/dialogs.ycp:125
+msgid "ID"
+msgstr ""
+
+#: src/dialogs.ycp:125
+msgid "Type"
+msgstr ""
+
+#: src/dialogs.ycp:125
+msgid "Start Date"
+msgstr ""
+
+#: src/dialogs.ycp:125
+msgid "End Date"
+msgstr ""
+
+#: src/dialogs.ycp:125
+msgid "Description"
+msgstr ""
+
+#: src/dialogs.ycp:129
+msgid "Show Changes"
+msgstr ""
+
+#. busy popup message
+#: src/dialogs.ycp:175
+msgid "Reading list of snapshots..."
+msgstr ""
+
+#. dialog caption
+#: src/dialogs.ycp:204
+msgid "Selected Snapshot Overview"
+msgstr ""
+
+#. '%1: %2' means 'ID: description', adapt the order if necessary
+#: src/dialogs.ycp:234
+#, ycp-format
+msgid "%1: %2"
+msgstr ""
+
+#. busy popup message
+#: src/dialogs.ycp:251
+msgid "Calculating changed files..."
+msgstr ""
+
+#. busy popup message
+#: src/dialogs.ycp:320
+msgid "Calculating file modifications..."
+msgstr ""
+
+#. text label, %1, %2 are file modes (like '-rw-r--r--')
+#: src/dialogs.ycp:353
+#, ycp-format
+msgid "File mode was changed from '%1' to '%2'."
+msgstr ""
+
+#. text label, %1, %2 are user names
+#: src/dialogs.ycp:361
+#, ycp-format
+msgid "File user ownership was changed from '%1' to '%2'."
+msgstr ""
+
+#. text label, %1, %2 are group names
+#: src/dialogs.ycp:370
+#, ycp-format
+msgid "File group ownership was changed from '%1' to '%2'."
+msgstr ""
+
+#. button label
+#: src/dialogs.ycp:391
+msgid "R&estore From First"
+msgstr ""
+
+#. button label
+#: src/dialogs.ycp:393
+msgid "Restore"
+msgstr ""
+
+#: src/dialogs.ycp:393
+msgid "Res&tore From Second"
+msgstr ""
+
+#. radio button label
+#: src/dialogs.ycp:428
+msgid "Show the difference between snapshot and current system"
+msgstr ""
+
+#. radio button label, snapshot selection will follow
+#: src/dialogs.ycp:432
+msgid "Show the difference between current and selected snapshot:"
+msgstr ""
+
+#. radio button label
+#: src/dialogs.ycp:453
+msgid "Show the difference between first and second snapshot"
+msgstr ""
+
+#. radio button label
+#: src/dialogs.ycp:456
+msgid "Show the difference between first snapshot and current system"
+msgstr ""
+
+#. radio button label
+#: src/dialogs.ycp:459
+msgid "Show the difference between second snapshot and current system"
+msgstr ""
+
+#. label, date string will follow at the end of line
+#: src/dialogs.ycp:477
+msgid "Time of taking the first snapshot:"
+msgstr ""
+
+#. label, date string will follow at the end of line
+#: src/dialogs.ycp:482
+msgid "Time of taking the second snapshot:"
+msgstr ""
+
+#. label, date string will follow at the end of line
+#: src/dialogs.ycp:491
+msgid "Time of taking the snapshot:"
+msgstr ""
+
+#. button label
+#: src/dialogs.ycp:510
+msgid "&Open"
+msgstr ""
+
+#. button label
+#: src/dialogs.ycp:534
+msgid "Restore Selected"
+msgstr ""
+
+#. popup message
+#: src/dialogs.ycp:637
+msgid "No file was selected for restoring"
+msgstr ""
+
+#. FIXME restore from PRE or POST? (PRE by default)
+#. popup headline
+#: src/dialogs.ycp:642
+msgid "Restoring files"
+msgstr ""
+
+#. popup message, %1 is snapshot number, %2 list of files
+#: src/dialogs.ycp:644
+#, ycp-format
+msgid "These files will be copied from snapshot '%1' to current system: 
<p>%2</p>Are you sure?"
+msgstr ""
+
+#. Read dialog help
+#: src/helps.ycp:40
+msgid ""
+"<p><b><big>Reading the list of snapshots</big></b><br>\n"
+"Please wait...<br></p>\n"
+msgstr ""
+
+#. Summary dialog help:
+#: src/helps.ycp:45
+msgid ""
+"<p><b><big>Snapshots Configuration</big></b><p>\n"
+"<p>The table shows a list of root filesystem snapshots. There are three types 
of snapshots, <b>single</b>, <b>pre</b> and <b>post</b>. Single snapshots are 
used for storing file system state in certain time, while Pre and Post are used 
to define the changes done by special operation proceeded between taking those 
two snapshots. Pre and Post snapshots are coupled together in the table.</p>\n"
+"<p>Select a snapshot or snapshot couple and click <b>Show Changes</b> to see 
the file system changes new in specified snapshot.</p>\n"
+msgstr ""
+
+#. Show snapshot dialog help
+#: src/helps.ycp:51
+msgid ""
+"<p><b><big>Snapshot Overview</big></b><p>\n"
+"<p>\n"
+"The tree shows all the files that were modified between creating first 
('pre') and second ('post') snapshot. On the right side, you can see the 
description generated when the first snapshot was created and the time of 
creation for both snapshots.\n"
+"</p>\n"
+"<p>\n"
+"When file is selected in the tree, you can see the changes done to it. By 
default, changes between selected coupled snapshots are shown, but it is 
possible to compare the file with different versions.\n"
+"</p>"
+msgstr ""
+
+#. Show snapshot dialog help, alternative for single snapshots
+#: src/helps.ycp:60
+msgid ""
+"<p><b><big>Snapshot Overview</big></b><p>\n"
+"<p>\n"
+"The tree shows all the files that are different between selected snapshot and 
current system. On the right side, you can see the snapshot description and 
time of its creation.\n"
+"</p>\n"
+"<p>\n"
+"When file is selected in the tree, you can see the its difference between 
snapshot version and current system.\n"
+"</p>"
+msgstr ""
+
+#: src/snapper.ycp:53
+msgid "Configuration of system snapshots"
+msgstr ""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-snapper-2.21.10/src/Snapper.ycp 
new/yast2-snapper-2.21.13/src/Snapper.ycp
--- old/yast2-snapper-2.21.10/src/Snapper.ycp   2011-09-28 23:04:27.000000000 
+0200
+++ new/yast2-snapper-2.21.13/src/Snapper.ycp   2011-10-10 12:54:08.000000000 
+0200
@@ -23,7 +23,7 @@
  * Summary:    Snapper settings, input and output functions
  * Authors:    Jiri Suchomel <jsuch...@suse.cz>
  *
- * $Id: Snapper.ycp 64540 2011-06-22 10:58:44Z jsuchome $
+ * $Id: Snapper.ycp 66356 2011-10-10 10:54:07Z jsuchome $
  *
  * Representation of the configuration of snapper.
  * Input and output routines.
@@ -38,7 +38,7 @@
 import "Label";
 import "Progress";
 import "Report";
-
+import "String";
 
 // global list of all snapshot
 global list<map> snapshots     = [];
@@ -51,12 +51,17 @@
 // index to snapshots list
 global integer selected_snapshot_index = 0;
 
+// list of configurations
+global list<string> configs    = [ "root" ];
+
+global string current_config   = "root";
+
 /**
  * Return map of files modified between given snapshots
  * Return structure has just one level, and maps each modified file to it's 
modification map
  */
-global map<string,string> ReadModifiedFilesIndex (integer from, integer to) {
-    return (map<string,string>) SCR::Read (.snapper.diff_index, $[ "from" : 
from, "to" : to]);
+global map<string,map> ReadModifiedFilesIndex (integer from, integer to) {
+    return (map<string,map>) SCR::Read (.snapper.diff_index, $[ "from" : from, 
"to" : to]);
 }
 
 /**
@@ -82,6 +87,16 @@
 }
 
 /**
+ * Return the full path to the given file from currently selected 
configuration (subvolume)
+ * @param file path, relatively to current config
+ * GetFileFullPath ("/testfile.txt") -> /abc/testfile.txt for /abc subvolume
+ */
+global string GetFileFullPath (string file) {
+
+    return 
snapshots[selected_snapshot_index,"files_index",file,"full_path"]:file;
+}
+
+/**
  * Describe what was done with given file between given snapshots
  * - when new is 0, meaning is 'current system'
  */
@@ -89,10 +104,10 @@
 
     map ret    = $[];
     string file1       = sformat ("%1%2", GetSnapshotPath (old), file);
-    string file2       = file;
-    if (new != 0)
+    string file2       = sformat ("%1%2", GetSnapshotPath (new), file);
+    if (new == 0)
     {
-       file2   = sformat ("%1%2", GetSnapshotPath (new), file);
+       file2   = GetFileFullPath (file);
     }
 
     y2milestone ("comparing '%1' and '%2'", file1, file2);
@@ -101,7 +116,7 @@
     {
        list<string> status     = [ "no_change" ];
        map out = (map) SCR::Execute (.target.bash_output,
-           sformat ("/usr/bin/diff -u %1 %2", file1, file2));
+           sformat ("/usr/bin/diff -u '%1' '%2'", String::Quote (file1), 
String::Quote (file2)));
        if (out["stderr"]:"" != "")
        {
            y2warning ("out: %1", out);
@@ -116,7 +131,8 @@
 
        // check mode and ownerships
        out = (map) SCR::Execute (.target.bash_output,
-           sformat ("ls -ld %1 %2 | cut -f 1,3,4 -d ' '", file1, file2));
+           sformat ("ls -ld -- '%1' '%2' | cut -f 1,3,4 -d ' '",
+           String::Quote (file1), String::Quote (file2)));
        list<string> parts      = splitstring (out["stdout"]:""," \n");
 
        if (parts[0]:"" != parts[3]:"")
@@ -159,7 +175,7 @@
  */
 global boolean ReadSnapshots () {
 
-
+    snapshots          = [];
     list<map> snapshot_maps    = (list<map>) SCR::Read (.snapper.snapshots);
     if (snapshot_maps == nil) snapshot_maps = [];
     integer i  = 0;
@@ -172,8 +188,6 @@
        id2index[id]    = i;
        i               = i + 1;
     });
-
-
     return true;
 }
 
@@ -182,13 +196,28 @@
     return (map) SCR::Read (.snapper.error);
 }
 
+
+global list<string> ReadConfigs () {
+
+    configs            = (list<string>) SCR::Read (.snapper.configs);
+    if (configs == nil)
+    {
+       // error popup
+       Report::Error (_("File /etc/sysconfig/snapper is not available"));
+       configs = [ "root" ];
+    }
+    return configs;
+}
+
+
+
 /**
  * Initialize snapper agent
  * Return true on success
  */
-global boolean InitializeSnapper () {
+global boolean InitializeSnapper (string config) {
 
-    boolean init       = (boolean) SCR::Execute (.snapper);
+    boolean init       = (boolean) SCR::Execute (.snapper, $[ "config" : 
config ]);
     if (!init)
     {
        map err_map     = LastSnapperErrorMap ();
@@ -238,7 +267,9 @@
 
     Progress::NextStage();
 
-    if (!InitializeSnapper ())
+    ReadConfigs ();
+
+    if (!InitializeSnapper (current_config))
     {
        return false;
     }
@@ -252,10 +283,11 @@
 /**
  * Return the given file mode as octal number
  */
-global integer GetFileMode (string file) {
+integer GetFileMode (string file) {
 
-    map out = (map) SCR::Execute (.target.bash_output, "/bin/stat --printf=%a 
" + file);
-    string mode        = out["stdout"]:"";
+    map out = (map) SCR::Execute (.target.bash_output,
+       sformat ("/bin/stat --printf=%%a '%1'", String::Quote (file)));
+    string mode        = out["stdout"]:"";
     if (mode == nil || mode == "")
        return 644;
     return tointeger (mode);
@@ -287,8 +319,9 @@
        UI::ChangeWidget (`id (`progress ), `Value, progress);
 
        string orig     = GetSnapshotPath (snapshot_num) + file;
+       string full_path= GetFileFullPath (file);
+       string dir      = substring (full_path, 0, findlastof (full_path, "/"));
 
-       string dir      = substring (file, 0, findlastof (file, "/"));
        if (!FileUtils::Exists (orig))
        {
            // log entry (%1 is file name)
@@ -300,24 +333,27 @@
            if (FileUtils::IsDirectory (orig) == true)
            {
                map stat        = (map) SCR::Read (.target.stat, orig);
-               if (!FileUtils::Exists (file))
+               if (!FileUtils::Exists (full_path))
                {
-                   SCR::Execute (.target.mkdir, file);
+                   SCR::Execute (.target.mkdir, full_path);
                }
-               SCR::Execute (.target.bash, sformat ("/bin/chown %1:%2 '%3'", 
stat["uid"]:0, stat["gid"]:0, file));
-               SCR::Execute (.target.bash, sformat ("/bin/chmod %1 '%2'", 
GetFileMode (orig), file));
+               SCR::Execute (.target.bash, sformat ("/bin/chown -- %1:%2 '%3'",
+                   stat["uid"]:0, stat["gid"]:0, String::Quote (full_path)));
+               SCR::Execute (.target.bash, sformat ("/bin/chmod -- %1 '%2'",
+                   GetFileMode (orig), String::Quote (full_path)));
            }
            else
            {
-               SCR::Execute (.target.bash, sformat ("/bin/cp -a '%1' '%2'", 
orig, file));
+               SCR::Execute (.target.bash, sformat ("/bin/cp -a -- '%1' '%2'",
+                   String::Quote (orig), String::Quote (full_path)));
            }
-           UI::ChangeWidget (`id (`log), `LastLine, file + "\n");
+           UI::ChangeWidget (`id (`log), `LastLine, full_path + "\n");
        }
        else
        {
-           y2milestone ("failed to copy file '%1' to '%2' (dir: %3)", orig, 
file, dir);
+           y2milestone ("failed to copy file '%1' to '%2' (dir: %3)", orig, 
full_path, dir);
            // log entry (%1 is file name)
-           UI::ChangeWidget (`id (`log), `LastLine, sformat (_("%1 
skipped\n"), file));
+           UI::ChangeWidget (`id (`log), `LastLine, sformat (_("%1 
skipped\n"), full_path));
        }
        sleep (100);
        progress        = progress + 1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-snapper-2.21.10/src/dialogs.ycp 
new/yast2-snapper-2.21.13/src/dialogs.ycp
--- old/yast2-snapper-2.21.10/src/dialogs.ycp   2011-09-28 23:04:27.000000000 
+0200
+++ new/yast2-snapper-2.21.13/src/dialogs.ycp   2011-10-10 12:54:08.000000000 
+0200
@@ -24,7 +24,7 @@
  * Summary:    Dialogs definitions
  * Authors:    Jiri Suchomel <jsuch...@suse.cz>
  *
- * $Id: dialogs.ycp 63806 2011-04-18 07:18:26Z jsuchome $
+ * $Id: dialogs.ycp 66356 2011-10-10 10:54:07Z jsuchome $
  */
 
 {
@@ -37,6 +37,7 @@
 import "Popup";
 import "Wizard";
 import "Snapper";
+import "String";
 
 include "snapper/helps.ycp";
 
@@ -67,12 +68,16 @@
     /* summary dialog caption */
     string caption = _("Snapshots");
 
-    list<map> snapshots        = Snapper::snapshots;
-    integer i  = -1;
+    list<map> snapshots                = Snapper::snapshots;
+    list<string> configs       = Snapper::configs;
 
     list snapshot_items        = [];
 
-    foreach (map s, snapshots, {
+    list get_snapshot_items () {
+
+      integer i        = -1;
+      snapshot_items   = [];
+      foreach (map s, snapshots, {
        i       = i + 1;
 
        integer num     = s["num"]:0;
@@ -103,13 +108,23 @@
        {
            y2milestone ("skipping pre snapshot: %1", num);
        }
-    });
+      });
+      return snapshot_items;
+    }
 
     term contents = `VBox (
+       `HBox (
+           // combo box label
+           `Label (_("Current Configuration")),
+           `ComboBox (`id (`configs), `opt (`notify), "", maplist (string 
config, configs, {
+               return `item (`id (config), config, config == 
Snapper::current_config);
+           })),
+           `HStretch ()
+       ),
        `Table (`id (`snapshots_table), `opt(`notify, `keepSorting), `header (
                // table header
                _("ID"), _("Type"), _("Start Date"), _("End Date"), 
_("Description")),
-               snapshot_items
+               get_snapshot_items ()
        ),
        `HBox (
            `PushButton (`id (`show_c), `opt (`default), _("Show Changes")),
@@ -127,6 +142,7 @@
     {
        UI::ChangeWidget (`id (`show_c), `Enabled, false);
     }
+    UI::ChangeWidget (`id (`configs), `Enabled, size (configs) > 1);
 
     any ret = nil;
     while(true) {
@@ -150,8 +166,25 @@
            Snapper::selected_snapshot_index    = selected;
             break;
         }
-        else if(ret == `next) {
-           // TODO check if something needs to be written (description)
+       else if (ret == `configs) {
+           string config       = (string) UI::QueryWidget (`id (ret), `Value);
+           if (config != Snapper::current_config)
+           {
+               Snapper::current_config = config;
+
+               // busy popup message
+               Popup::ShowFeedback ("", _("Reading list of snapshots..."));
+
+               Snapper::InitializeSnapper (config);
+               Snapper::ReadSnapshots ();
+               snapshots               = Snapper::snapshots;
+               Popup::ClearFeedback ();
+
+               UI::ChangeWidget (`id (`snapshots_table), `Items, 
get_snapshot_items ());
+               continue;
+           }
+       }
+        else if (ret == `next) {
             break;
         }
         else {
@@ -221,16 +254,16 @@
     if (!haskey (snapshot, "tree_map"))
     {
        snapshot["tree_map"]    = Snapper::ReadModifiedFilesMap (from, to);
-       Popup::ClearFeedback ();
        tree_map        = snapshot["tree_map"]:$[];
     }
     // full paths of files marked as modified, mapping to changes string
-    map<string,string> files_index     = $[];
+    map<string,map> files_index        = $[];
     if (!haskey (snapshot, "files_index"))
     {
        snapshot["files_index"] = Snapper::ReadModifiedFilesIndex (from, to);
        Snapper::snapshots[Snapper::selected_snapshot_index]    = snapshot;
     }
+    Popup::ClearFeedback ();
     files_index        = snapshot["files_index"]:$[];
 
     // update the global snapshots list
@@ -242,12 +275,11 @@
     map<string,boolean> selected_items = $[];
 
     boolean file_was_created (string file) {
-       return (substring (files_index[file]:"", 0, 1) == "+");
+       return (substring (files_index[file,"status"]:"", 0, 1) == "+");
     }
     boolean file_was_removed (string file) {
-       return (substring (files_index[file]:"", 0, 1) == "-");
+       return (substring (files_index[file,"status"]:"", 0, 1) == "-");
     }
-
     // go through the map defining filesystem tree and create the widget items
     list<term> generate_tree_items (string current_path, map<string,map> 
current_branch) {
 
@@ -439,6 +471,10 @@
     }
 
     string tree_label  = sformat ("%1 - %2", previous_num, snapshot_num);
+    // find out the path to current subvolume
+    string subtree_path = Snapper::GetSnapshotPath (snapshot_num);
+    subtree_path = substring (subtree_path, 0, find (subtree_path, 
".snapshots/"));
+
     term date_widget   = `VBox (
            `HBox (
                // label, date string will follow at the end of line
@@ -465,9 +501,10 @@
        `HWeight (1, `HBox (`VSpacing (20), `VBox (`HSpacing(70),
            `HBox (
                `HSpacing (),
-               `ReplacePoint (`id (`reptree),
+               `ReplacePoint (`id (`reptree), `VBox (
+                   `Left (`Label (subtree_path)),
                    `Tree (`id(`tree), tree_label, [])
-               ),
+               )),
                `HSpacing ()
            ),
            `HBox (
@@ -505,9 +542,10 @@
 
     if (size (tree_items) > 0)
     {
-       UI::ReplaceWidget (`id (`reptree),
+       UI::ReplaceWidget (`id (`reptree), `VBox (
+           `Left (`Label (subtree_path)),
            `Tree (`id(`tree), `opt (`notify, `immediate, `multiSelection, 
`recursiveSelection), tree_label, tree_items)
-       );
+       ));
        // no item is selected
        UI::ChangeWidget (`tree, `CurrentItem, nil);
     }
@@ -575,7 +613,7 @@
 
 %1
 
-from snapshot '%2' to current system?", current_file, previous_num)))
+from snapshot '%2' to current system?", Snapper::GetFileFullPath 
(current_file), previous_num)))
            {
                Snapper::RestoreFiles (previous_num, [current_file]);
            }
@@ -587,7 +625,7 @@
 
 %1
 
-from snapshot '%2' to current system?", current_file, snapshot_num)))
+from snapshot '%2' to current system?", Snapper::GetFileFullPath 
(current_file), snapshot_num)))
            {
                Snapper::RestoreFiles (snapshot_num, [current_file]);
            }
@@ -595,22 +633,30 @@
        }
         else if (ret == `next) {
            list<string> files  = (list<string>) UI::QueryWidget (`id (`tree), 
`SelectedItems);
+           list<string> to_restore     = [];
            files = filter (string file, files, {
-               return haskey (files_index, file);
+               if (haskey (files_index, file))
+               {
+                   to_restore  = add (to_restore, String::Quote 
(Snapper::GetFileFullPath (file)));
+                   return true;
+               }
+               else
+               {
+                   return false;
+               }
            });
 
-           if (files == [])
+           if (to_restore == [])
            {
                // popup message
                Popup::Message (_("No file was selected for restoring"));
                continue;
            }
-           // FIXME restore from PRE or POST? (PRE by default)
            // popup headline
            if (Popup::AnyQuestionRichText (_("Restoring files"),
                // popup message, %1 is snapshot number, %2 list of files
                sformat (_("These files will be copied from snapshot '%1' to 
current system: <p>%2</p>Are you sure?"),
-                   previous_num, mergestring (files, "<br>")),
+                   previous_num, mergestring (to_restore, "<br>")),
                60, 20,  Label::YesButton (), Label::NoButton (), `focus_no))
            {
                Snapper::RestoreFiles (previous_num, files);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-snapper-2.21.10/testsuite/tests/GetFileMode.out 
new/yast2-snapper-2.21.13/testsuite/tests/GetFileMode.out
--- old/yast2-snapper-2.21.10/testsuite/tests/GetFileMode.out   2011-09-28 
23:04:28.000000000 +0200
+++ new/yast2-snapper-2.21.13/testsuite/tests/GetFileMode.out   2011-10-10 
12:32:40.000000000 +0200
@@ -1,4 +1,4 @@
-Execute        .target.bash_output "/bin/stat --printf=%a /tmp/1" 
$["stdout":"755"]
+Execute        .target.bash_output "/bin/stat --printf=%a '/tmp/1'" 
$["stdout":"755"]
 Return 755
-Execute        .target.bash_output "/bin/stat --printf=%a /tmp/2" 
$["stderr":"/bin/stat: cannot stat `/tmp/2': No such file or directory\n", 
"stdout":""]
+Execute        .target.bash_output "/bin/stat --printf=%a '/tmp/2'" 
$["stderr":"/bin/stat: cannot stat `/tmp/2': No such file or directory\n", 
"stdout":""]
 Return 644
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-snapper-2.21.10/testsuite/tests/GetFileModification.out 
new/yast2-snapper-2.21.13/testsuite/tests/GetFileModification.out
--- old/yast2-snapper-2.21.10/testsuite/tests/GetFileModification.out   
2011-09-28 23:04:28.000000000 +0200
+++ new/yast2-snapper-2.21.13/testsuite/tests/GetFileModification.out   
2011-10-10 12:33:22.000000000 +0200
@@ -1,12 +1,13 @@
 Read   .snapper.path $["num":1] "/snapshots/1/snapshot"
-Execute        .target.bash_output "/usr/bin/diff -u 
/snapshots/1/snapshot/etc/passwd /etc/passwd" $["stderr":"error while diffing"]
+Read   .snapper.path $["num":0] "/snapshots/1/snapshot"
+Execute        .target.bash_output "/usr/bin/diff -u 
'/snapshots/1/snapshot/etc/passwd' '/etc/passwd'" $["stderr":"error while 
diffing"]
 Log    out: $["stderr":"error while diffing"]
-Execute        .target.bash_output "ls -ld /snapshots/1/snapshot/etc/passwd 
/etc/passwd | cut -f 1,3,4 -d ' '" $["stderr":"error while diffing"]
+Execute        .target.bash_output "ls -ld -- 
'/snapshots/1/snapshot/etc/passwd' '/etc/passwd' | cut -f 1,3,4 -d ' '" 
$["stderr":"error while diffing"]
 Return $["diff":"error while diffing", "status":["no_change"]]
 Read   .snapper.path $["num":1] "/snapshots/1/snapshot"
 Read   .snapper.path $["num":2] "/snapshots/1/snapshot"
-Execute        .target.bash_output "/usr/bin/diff -u 
/snapshots/1/snapshot/etc/passwd /snapshots/1/snapshot/etc/passwd" 
$["stdout":"+new user line"]
-Execute        .target.bash_output "ls -ld /snapshots/1/snapshot/etc/passwd 
/snapshots/1/snapshot/etc/passwd | cut -f 1,3,4 -d ' '" $["stdout":"+new user 
line"]
+Execute        .target.bash_output "/usr/bin/diff -u 
'/snapshots/1/snapshot/etc/passwd' '/snapshots/1/snapshot/etc/passwd'" 
$["stdout":"+new user line"]
+Execute        .target.bash_output "ls -ld -- 
'/snapshots/1/snapshot/etc/passwd' '/snapshots/1/snapshot/etc/passwd' | cut -f 
1,3,4 -d ' '" $["stdout":"+new user line"]
 Return $["diff":"+new user line", "group1":"line", "group2":"", 
"mode1":"+new", "mode2":"", "status":["diff", "mode", "user", "group"], 
"user1":"user", "user2":""]
 Read   .snapper.path $["num":1] "/snapshots/1/snapshot"
 Read   .snapper.path $["num":2] "/snapshots/1/snapshot"

continue with "q"...



Remember to have fun...

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to