Hello community, here is the log from the commit of package snapper for openSUSE:Factory checked in at Fri Jun 10 11:41:17 CEST 2011.
-------- --- snapper/snapper.changes 2011-04-19 14:15:10.000000000 +0200 +++ /mounts/work_src_done/STABLE/snapper/snapper.changes 2011-06-09 17:54:43.000000000 +0200 @@ -1,0 +2,11 @@ +Thu Jun 09 17:52:41 CEST 2011 - aschn...@suse.de + +- added man-page + +------------------------------------------------------------------- +Mon Jun 06 15:01:13 CEST 2011 - aschn...@suse.de + +- place snapshots in .snapshots directory +- version 0.0.6 + +------------------------------------------------------------------- @@ -15 +26 @@ -- started development +- started development (fate #303699) calling whatdependson for head-i586 Old: ---- snapper-0.0.5.tar.bz2 New: ---- snapper-0.0.6.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ snapper.spec ++++++ --- /var/tmp/diff_new_pack.kNKEYO/_old 2011-06-10 11:40:19.000000000 +0200 +++ /var/tmp/diff_new_pack.kNKEYO/_new 2011-06-10 11:40:19.000000000 +0200 @@ -19,7 +19,7 @@ Name: snapper -Version: 0.0.5 +Version: 0.0.6 Release: 1 License: GPL Group: System/Packages @@ -27,9 +27,10 @@ Source: snapper-%{version}.tar.bz2 Prefix: /usr BuildRequires: blocxx-devel boost-devel dejagnu doxygen gcc-c++ libxml2-devel -Requires: libsnapper0 = %version +Requires: libsnapper1 = %version Recommends: cron logrotate Summary: Tool for filesystem snapshot management +Url: http://en.opensuse.org/Portal:Snapper %description This package contains snapper, a tool for filesystem snapshot management. @@ -66,25 +67,26 @@ %files -f snapper.lang %defattr(-,root,root) %{prefix}/bin/snapper +%doc %{_mandir}/*/* %config(noreplace) %{_sysconfdir}/logrotate.d/snapper /etc/cron.hourly/suse.de-snapper /etc/cron.daily/suse.de-snapper -%package -n libsnapper0 -License: GPL +%package -n libsnapper1 + Summary: Library for filesystem snapshot management Group: System/Libraries Requires: btrfsprogs diffutils util-linux PreReq: %fillup_prereq -%description -n libsnapper0 +%description -n libsnapper1 This package contains libsnapper, a library for filesystem snapshot management. Authors: -------- Arvin Schnell <aschn...@suse.de> -%files -n libsnapper0 +%files -n libsnapper1 %defattr(-,root,root) %{_libdir}/libsnapper.so.* %dir %{_sysconfdir}/snapper @@ -101,16 +103,16 @@ %dir %{prefix}/lib/snapper/bin %{prefix}/lib/snapper/bin/compare-dirs -%post -n libsnapper0 +%post -n libsnapper1 /sbin/ldconfig %{fillup_only -n snapper} -%postun -n libsnapper0 +%postun -n libsnapper1 /sbin/ldconfig %package -n libsnapper-devel -License: GPL -Requires: libsnapper0 = %version + +Requires: libsnapper1 = %version Requires: gcc-c++ libstdc++-devel boost-devel blocxx-devel libxml2-devel Summary: Header files and documentation for libsnapper Group: Development/Languages/C and C++ @@ -128,5 +130,4 @@ %{_libdir}/libsnapper.la %{_libdir}/libsnapper.so %{prefix}/include/snapper - %changelog ++++++ snapper-0.0.5.tar.bz2 -> snapper-0.0.6.tar.bz2 ++++++ ++++ 2381 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/LIBVERSION new/snapper-0.0.6/LIBVERSION --- old/snapper-0.0.5/LIBVERSION 1970-01-01 01:00:00.000000000 +0100 +++ new/snapper-0.0.6/LIBVERSION 2011-06-06 15:03:22.000000000 +0200 @@ -0,0 +1 @@ +1.0.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/Makefile.am new/snapper-0.0.6/Makefile.am --- old/snapper-0.0.5/Makefile.am 2011-04-07 10:18:43.000000000 +0200 +++ new/snapper-0.0.6/Makefile.am 2011-06-08 11:28:32.000000000 +0200 @@ -2,13 +2,13 @@ # Makefile.am for snapper # -SUBDIRS = snapper examples tools scripts data po testsuite-real +SUBDIRS = snapper examples tools scripts data doc po testsuite-real AUTOMAKE_OPTIONS = foreign dist-bzip2 no-dist-gzip doc_DATA = AUTHORS COPYING -EXTRA_DIST = $(doc_DATA) VERSION +EXTRA_DIST = $(doc_DATA) VERSION LIBVERSION snapper-$(VERSION).tar.bz2: dist-bzip2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/VERSION new/snapper-0.0.6/VERSION --- old/snapper-0.0.5/VERSION 2011-04-19 14:12:00.000000000 +0200 +++ new/snapper-0.0.6/VERSION 2011-06-09 17:40:25.000000000 +0200 @@ -1 +1 @@ -0.0.5 +0.0.6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/configure.in new/snapper-0.0.6/configure.in --- old/snapper-0.0.5/configure.in 2011-04-07 10:19:31.000000000 +0200 +++ new/snapper-0.0.6/configure.in 2011-06-09 17:37:50.000000000 +0200 @@ -3,6 +3,16 @@ VERSION=`cat ./VERSION` +LIBVERSION=`cat ./LIBVERSION` +LIBVERSION_MAJOR=`cut -d . -f 1 ./LIBVERSION` +LIBVERSION_MINOR=`cut -d . -f 2 ./LIBVERSION` +LIBVERSION_PATCHLEVEL=`cut -d . -f 3 ./LIBVERSION` + +LIBVERSION_CURRENT=`expr $LIBVERSION_MAJOR + $LIBVERSION_MINOR` +LIBVERSION_REVISON=`expr $LIBVERSION_PATCHLEVEL` +LIBVERSION_AGE=`expr $LIBVERSION_MINOR` +LIBVERSION_INFO=$LIBVERSION_CURRENT:$LIBVERSION_REVISON:$LIBVERSION_AGE + AM_INIT_AUTOMAKE(snapper, $VERSION) AM_CONFIG_HEADER(config.h) @@ -25,6 +35,8 @@ fillupdir=/var/adm/fillup-templates AC_SUBST(VERSION) +AC_SUBST(LIBVERSION_MAJOR) +AC_SUBST(LIBVERSION_INFO) AC_SUBST(docdir) AC_SUBST(fillupdir) @@ -36,6 +48,8 @@ tools/utils/Makefile scripts/Makefile data/Makefile + doc/Makefile + doc/snapper.8:doc/snapper.8.in po/Makefile testsuite-real/Makefile package/snapper.spec:snapper.spec.in diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/doc/Makefile.am new/snapper-0.0.6/doc/Makefile.am --- old/snapper-0.0.5/doc/Makefile.am 1970-01-01 01:00:00.000000000 +0100 +++ new/snapper-0.0.6/doc/Makefile.am 2011-06-08 11:27:07.000000000 +0200 @@ -0,0 +1,8 @@ +# +# Makefile.am for snapper/doc +# + +man_MANS = snapper.8 + +EXTRA_DIST = $(man_MANS) + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/doc/snapper.8 new/snapper-0.0.6/doc/snapper.8 --- old/snapper-0.0.5/doc/snapper.8 1970-01-01 01:00:00.000000000 +0100 +++ new/snapper-0.0.6/doc/snapper.8 2011-06-10 11:16:47.000000000 +0200 @@ -0,0 +1,190 @@ +.TH "snapper" "8" 0.0.6 "snapper" "System Tools" +.SH "NAME" +.LP +snapper - Command\-line program for btrfs snapshot management + +.SH "SYNTAX" +.LP +snapper [\fI\-\-global\-opts\fR] <\fBcommand\fR> [\fI\-\-command\-opts\fR] +[\fBcommand-arguments\fR] + +snapper \fBhelp\fR + +.SH "DESCRIPTION" +.LP +Snapper is a command\-line program for btrfs snapshot management. It can +create, delete and compare snapshots and rollback changes between snapshots. + +.SH CONCEPTS + +.SS Configurations +.LP +For each btrfs subvolume that should be snapshotted by snapper a configuration +file is required. The complete setup can be done with the create-config +command. + +.SS Snapshots +.LP +Snapper distinguishes three types of snapshots. +.LP +\fBpre\fR - Pre snapshots should always have a corresponding post +snapshot. The intention of pre/post shotshot pairs is to snapshot the +filesystem before and after a modification. +.LP +\fBpost\fR - See pre type. +.LP +\fBsingle\fR - These snapshots have no special relationship to other +snapshots. +.LP +Note that btrfs\-wise all three types are the same. + +.SS Automatic Snapshot Creation +Next to manual snapshot creation snapshots are also created automatically. +.LP +\fBcron\-job\fR - A cron\-job creates hourly snapshots. +.LP +\fBcertain programs\fR - Certain programs like YaST and zypper create pre/post +snapshot pairs when modifying the system. + +.SS Cleanup Algorithms +.LP +Snapper provides several algorithms to cleanup old snapshots. The algorithms +are executed in a daily cron\-job. This can be configured in the corresponding +configurations files along with parameters for every algorithm. +.LP +\fBnumber\fR - Deletes old snapshots when a certain number of snapshots is +reached. +.LP +\fBtimeline\fR - Deletes old snapshots but keeps a number of hourly, daily, +monthly and yearly snapshots. +.LP +\fBempty\-pre\-post\fR - Deletes pre/post snapshot pairs with empty diffs. + +.SH "GLOBAL OPTIONS" + +.TP +.I \-q, \-\-quiet +Suppress normal output. Error messages will still be printed, though. +.TP +.I \-v, \-\-verbose +Increase verbosity. +.TP +.I \-t, \-\-table\-style +Specifies table style to use. Table style is identified by an integer number. +.TP +.I \-c, \-\-config <name> +Use specified configuration instead of the default. +.TP +.I \-\-version +Print version and exit. + +.SH "COMMANDS" +.LP +snapper provides a number of \fBcommands\fR. Each command accepts the options +listed in the GLOBAL OPTIONS section. These options must be specified +\fIbefore\fR the command name. In addition, many commands have specific +options, which are listed in this section. These command-specific options must +be specified \fIafter\fR the name of the command and \fIbefore\fR any of the +command arguments. + +.TP +.B help +Show short help text. + +.TP +.B list-configs +List available configurations. + +.TP +.B create-config [options] <subvolume> +Create a new configuration for a btrfs subvolume. +.TP +\fI\-t, \-\-template\fR <name> +Name of template for the new configuration file. + +.TP +.B list [options] +List snapshots. +.TP +\fI\-t, \-\-type\fR <type> +Selects type of snapshots to list. Possible values are all, single and pre-post. + +.TP +.B create [options] +Create a new snapshot. +.TP +\fI\-t, \-\-type\fR <type> +Specifies the type of the new snapshot. Possible values are single, pre and post. +.TP +\fI\-\-pre\-number\fR <number> +For post snapshots the number of the pre snapshot must be provided. +.TP +\fI\-d, \-\-description\fR <description> +Description for the snapshot. +.TP +\fI\-p, \-\-print\-number\fR +Print number of the created snapshot. +.TP +\fI\-c, \-\-cleanup\-algorithm\fR <cleanup-algorithm> +Sets the cleanup-algorithm for the snapshot. + +.TP +.B modify [options] <number> +Modify a snapshot. +.TP +\fI\-d, \-\-description\fR <description> +New description for snapshot. + +.TP +.B delete <number> +Delete a snapshot. + +.TP +.B diff [options] <number1> <number2> +Compare two snapshots. This will show a list of files and directories +that have been created, modified or deleted in the time between the two +snapshots have been made. +.TP +\fI\-o, \-\-output\fR <file> +Write output to file <file>. +.TP +\fI\-f, \-\-file\fR <file> +Compare the file <file> between the two snapshots. + +.TP +.B rollback [options] <number1> <number2> +Rollback changes between the two snapshots. +.TP +\fI\-f, \-\-file\fR <file> +Read the files to rollback from the file <file>. + +.TP +.B cleanup <cleanup-algorithm> +Run the cleanup algorithm <cleanup-algorithm>. Currently implemented cleanup +algorithms are number, timeline and empty-pre-post. + +.SH "FILES" +.TP +.B /etc/sysconfig/snapper +Global configuration file. +.TP +.B /etc/snapper/configs +Directory containing configuration files. +.TP +.B /etc/snapper/config-templates +Directory containing configuration templates. +.TP +.B /etc/snapper/filters +Directory containing filter files. + +.SH "HOMEPAGE" +.LP +http://en.opensuse.org/Portal:Snapper + +.SH "AUTHORS" +.LP +Arvin Schnell <aschn...@suse.de> + +.SH "SEE ALSO" +.LP +btrfs(8) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/doc/snapper.8.in new/snapper-0.0.6/doc/snapper.8.in --- old/snapper-0.0.5/doc/snapper.8.in 1970-01-01 01:00:00.000000000 +0100 +++ new/snapper-0.0.6/doc/snapper.8.in 2011-06-10 10:37:15.000000000 +0200 @@ -0,0 +1,190 @@ +.TH "snapper" "8" @VERSION@ "snapper" "System Tools" +.SH "NAME" +.LP +snapper - Command\-line program for btrfs snapshot management + +.SH "SYNTAX" +.LP +snapper [\fI\-\-global\-opts\fR] <\fBcommand\fR> [\fI\-\-command\-opts\fR] +[\fBcommand-arguments\fR] + +snapper \fBhelp\fR + +.SH "DESCRIPTION" +.LP +Snapper is a command\-line program for btrfs snapshot management. It can +create, delete and compare snapshots and rollback changes between snapshots. + +.SH CONCEPTS + +.SS Configurations +.LP +For each btrfs subvolume that should be snapshotted by snapper a configuration +file is required. The complete setup can be done with the create-config +command. + +.SS Snapshots +.LP +Snapper distinguishes three types of snapshots. +.LP +\fBpre\fR - Pre snapshots should always have a corresponding post +snapshot. The intention of pre/post shotshot pairs is to snapshot the +filesystem before and after a modification. +.LP +\fBpost\fR - See pre type. +.LP +\fBsingle\fR - These snapshots have no special relationship to other +snapshots. +.LP +Note that btrfs\-wise all three types are the same. + +.SS Automatic Snapshot Creation +Next to manual snapshot creation snapshots are also created automatically. +.LP +\fBcron\-job\fR - A cron\-job creates hourly snapshots. +.LP +\fBcertain programs\fR - Certain programs like YaST and zypper create pre/post +snapshot pairs when modifying the system. + +.SS Cleanup Algorithms +.LP +Snapper provides several algorithms to cleanup old snapshots. The algorithms +are executed in a daily cron\-job. This can be configured in the corresponding +configurations files along with parameters for every algorithm. +.LP +\fBnumber\fR - Deletes old snapshots when a certain number of snapshots is +reached. +.LP +\fBtimeline\fR - Deletes old snapshots but keeps a number of hourly, daily, +monthly and yearly snapshots. +.LP +\fBempty\-pre\-post\fR - Deletes pre/post snapshot pairs with empty diffs. + +.SH "GLOBAL OPTIONS" + +.TP +.I \-q, \-\-quiet +Suppress normal output. Error messages will still be printed, though. +.TP +.I \-v, \-\-verbose +Increase verbosity. +.TP +.I \-t, \-\-table\-style +Specifies table style to use. Table style is identified by an integer number. +.TP +.I \-c, \-\-config <name> +Use specified configuration instead of the default. +.TP +.I \-\-version +Print version and exit. + +.SH "COMMANDS" +.LP +snapper provides a number of \fBcommands\fR. Each command accepts the options +listed in the GLOBAL OPTIONS section. These options must be specified +\fIbefore\fR the command name. In addition, many commands have specific +options, which are listed in this section. These command-specific options must +be specified \fIafter\fR the name of the command and \fIbefore\fR any of the +command arguments. + +.TP +.B help +Show short help text. + +.TP +.B list-configs +List available configurations. + +.TP +.B create-config [options] <subvolume> +Create a new configuration for a btrfs subvolume. +.TP +\fI\-t, \-\-template\fR <name> +Name of template for the new configuration file. + +.TP +.B list [options] +List snapshots. +.TP +\fI\-t, \-\-type\fR <type> +Selects type of snapshots to list. Possible values are all, single and pre-post. + +.TP +.B create [options] +Create a new snapshot. +.TP +\fI\-t, \-\-type\fR <type> +Specifies the type of the new snapshot. Possible values are single, pre and post. +.TP +\fI\-\-pre\-number\fR <number> +For post snapshots the number of the pre snapshot must be provided. +.TP +\fI\-d, \-\-description\fR <description> +Description for the snapshot. +.TP +\fI\-p, \-\-print\-number\fR +Print number of the created snapshot. +.TP +\fI\-c, \-\-cleanup\-algorithm\fR <cleanup-algorithm> +Sets the cleanup-algorithm for the snapshot. + +.TP +.B modify [options] <number> +Modify a snapshot. +.TP +\fI\-d, \-\-description\fR <description> +New description for snapshot. + +.TP +.B delete <number> +Delete a snapshot. + +.TP +.B diff [options] <number1> <number2> +Compare two snapshots. This will show a list of files and directories +that have been created, modified or deleted in the time between the two +snapshots have been made. +.TP +\fI\-o, \-\-output\fR <file> +Write output to file <file>. +.TP +\fI\-f, \-\-file\fR <file> +Compare the file <file> between the two snapshots. + +.TP +.B rollback [options] <number1> <number2> +Rollback changes between the two snapshots. +.TP +\fI\-f, \-\-file\fR <file> +Read the files to rollback from the file <file>. + +.TP +.B cleanup <cleanup-algorithm> +Run the cleanup algorithm <cleanup-algorithm>. Currently implemented cleanup +algorithms are number, timeline and empty-pre-post. + +.SH "FILES" +.TP +.B /etc/sysconfig/snapper +Global configuration file. +.TP +.B /etc/snapper/configs +Directory containing configuration files. +.TP +.B /etc/snapper/config-templates +Directory containing configuration templates. +.TP +.B /etc/snapper/filters +Directory containing filter files. + +.SH "HOMEPAGE" +.LP +http://en.opensuse.org/Portal:Snapper + +.SH "AUTHORS" +.LP +Arvin Schnell <aschn...@suse.de> + +.SH "SEE ALSO" +.LP +btrfs(8) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/snapper/AppUtil.cc new/snapper-0.0.6/snapper/AppUtil.cc --- old/snapper-0.0.5/snapper/AppUtil.cc 2011-05-03 15:19:07.000000000 +0200 +++ new/snapper-0.0.6/snapper/AppUtil.cc 2011-05-18 14:36:24.000000000 +0200 @@ -71,37 +71,6 @@ bool -getStatMode(const string& Path_Cv, mode_t& val ) -{ - struct stat Stat_ri; - int ret_ii = stat(Path_Cv.c_str(), &Stat_ri); - - if( ret_ii==0 ) - val = Stat_ri.st_mode; - else - y2mil( "stat " << Path_Cv << " ret:" << ret_ii ); - - return (ret_ii==0); -} - -bool -setStatMode(const string& Path_Cv, mode_t val ) -{ - int ret_ii = chmod( Path_Cv.c_str(), val ); - if( ret_ii!=0 ) - y2mil( "chmod " << Path_Cv << " ret:" << ret_ii ); - return( ret_ii==0 ); -} - - - bool - getLStat(const string& path, struct stat& fs) - { - return lstat(path.c_str(), &fs) == 0; - } - - -bool checkNormalFile(const string& Path_Cv) { struct stat Stat_ri; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/snapper/AppUtil.h new/snapper-0.0.6/snapper/AppUtil.h --- old/snapper-0.0.5/snapper/AppUtil.h 2011-05-03 15:19:07.000000000 +0200 +++ new/snapper-0.0.6/snapper/AppUtil.h 2011-05-18 14:36:24.000000000 +0200 @@ -43,10 +43,6 @@ void createPath(const string& Path_Cv); bool checkNormalFile(const string& Path_Cv); bool checkDir(const string& Path_Cv); -bool getStatMode(const string& Path_Cv, mode_t& val ); -bool setStatMode(const string& Path_Cv, mode_t val ); - - bool getLStat(const string& path, struct stat& fs); list<string> glob(const string& path, int flags); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/snapper/AsciiFile.cc new/snapper-0.0.6/snapper/AsciiFile.cc --- old/snapper-0.0.5/snapper/AsciiFile.cc 2011-04-21 09:00:40.000000000 +0200 +++ new/snapper-0.0.6/snapper/AsciiFile.cc 2011-06-01 18:59:06.000000000 +0200 @@ -190,10 +190,14 @@ SysconfigFile::getValue(const string& key, vector<string>& values) const { string tmp; - if (!getValue("SNAPPER_CONFIGS", tmp)) + if (!getValue(key, tmp)) return false; - boost::split(values, tmp, boost::is_any_of(" \t")); + values.clear(); + + if (!tmp.empty()) + boost::split(values, tmp, boost::is_any_of(" \t"), boost::token_compress_on); + return true; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/snapper/Compare.cc new/snapper-0.0.6/snapper/Compare.cc --- old/snapper-0.0.5/snapper/Compare.cc 2011-04-21 09:03:42.000000000 +0200 +++ new/snapper-0.0.6/snapper/Compare.cc 2011-05-20 15:20:53.000000000 +0200 @@ -45,7 +45,7 @@ cmpFilesContentReg(const string& fullname1, struct stat stat1, const string& fullname2, struct stat stat2) { - if (stat1.st_mtime == stat2.st_mtime) + if (stat1.st_mtim.tv_sec == stat2.st_mtim.tv_sec && stat1.st_mtim.tv_nsec == stat2.st_mtim.tv_nsec) return true; if (stat1.st_size != stat2.st_size) @@ -125,7 +125,7 @@ cmpFilesContentLnk(const string& fullname1, struct stat stat1, const string& fullname2, struct stat stat2) { - if (stat1.st_mtime == stat2.st_mtime) + if (stat1.st_mtim.tv_sec == stat2.st_mtim.tv_sec && stat1.st_mtim.tv_nsec == stat2.st_mtim.tv_nsec) return true; string tmp1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/snapper/File.cc new/snapper-0.0.6/snapper/File.cc --- old/snapper-0.0.5/snapper/File.cc 2011-05-03 15:19:07.000000000 +0200 +++ new/snapper-0.0.6/snapper/File.cc 2011-05-26 15:38:04.000000000 +0200 @@ -25,6 +25,7 @@ #include <string.h> #include <unistd.h> #include <fnmatch.h> +#include <errno.h> #include "snapper/File.h" #include "snapper/Snapper.h" @@ -373,99 +374,202 @@ bool - File::doRollback() + File::createParentDirectories(const string& path) const { - if (getPreToPostStatus() & CREATED || getPreToPostStatus() & TYPE) + string::size_type pos = path.rfind('/'); + if (pos == string::npos) + return true; + + const string& leading_path = path.substr(0, pos); + + struct stat fs; + if (stat(leading_path.c_str(), &fs) == 0) + { + if (!S_ISDIR(fs.st_mode)) + { + y2err("not a directory path:" << leading_path); + return false; + } + + return true; + } + + if (!createParentDirectories(leading_path)) + return false; + + if (mkdir(leading_path.c_str(), 0777) != 0) { - if (getSnapper()->getRollbackCallback()) - getSnapper()->getRollbackCallback()->deleteInfo(name); + y2err("mkdir failed path:" << leading_path << " errno:" << errno); + return false; + } + + return true; + } - struct stat fs; - getLStat(getAbsolutePath(LOC_POST), fs); + bool + File::createAllTypes() const + { + struct stat fs; + if (lstat(getAbsolutePath(LOC_PRE).c_str(), &fs) != 0) + { + y2err("lstat failed path:" << getAbsolutePath(LOC_SYSTEM) << " errno:" << errno); + return false; + } + else if (!createParentDirectories(getAbsolutePath(LOC_SYSTEM))) + { + return false; + } + else + { switch (fs.st_mode & S_IFMT) { case S_IFDIR: { - if (rmdir(getAbsolutePath(LOC_SYSTEM).c_str()) != 0) - { - y2err("rmdir failed for " << getAbsolutePath(LOC_SYSTEM)); - if (getSnapper()->getRollbackCallback()) - getSnapper()->getRollbackCallback()->deleteError(name); - } + if (!createDirectory(fs.st_mode, fs.st_uid, fs.st_gid)) + return false; } break; case S_IFREG: { - if (unlink(getAbsolutePath(LOC_SYSTEM).c_str()) != 0) - { - y2err("unlink failed for " << getAbsolutePath(LOC_SYSTEM)); - if (getSnapper()->getRollbackCallback()) - getSnapper()->getRollbackCallback()->deleteError(name); - } + if (!createFile(fs.st_mode, fs.st_uid, fs.st_gid)) + return false; } break; case S_IFLNK: { - if (unlink(getAbsolutePath(LOC_SYSTEM).c_str()) != 0) - { - y2err("unlink failed for " << getAbsolutePath(LOC_SYSTEM)); - if (getSnapper()->getRollbackCallback()) - getSnapper()->getRollbackCallback()->deleteError(name); - } + if (!createLink(fs.st_uid, fs.st_gid)) + return false; } break; } } - if (getPreToPostStatus() & DELETED || getPreToPostStatus() & TYPE) + return true; + } + + + bool + File::createDirectory(mode_t mode, uid_t owner, gid_t group) const + { + if (mkdir(getAbsolutePath(LOC_SYSTEM).c_str(), 0) != 0) + { + if (errno == EEXIST && !checkDir(getAbsolutePath(LOC_SYSTEM))) + { + y2err("mkdir failed path:" << getAbsolutePath(LOC_SYSTEM) << " errno:" << errno); + return false; + } + } + + if (chmod(getAbsolutePath(LOC_SYSTEM).c_str(), mode) != 0) + { + y2err("chmod failed path:" << getAbsolutePath(LOC_SYSTEM) << " errno:" << errno); + return false; + } + + if (chown(getAbsolutePath(LOC_SYSTEM).c_str(), owner, group) != 0) + { + y2err("chown failed path:" << getAbsolutePath(LOC_SYSTEM) << " errno:" << errno); + return false; + } + + return true; + } + + + bool + File::createFile(mode_t mode, uid_t owner, gid_t group) const + { + // TODO: use clonefile + SystemCmd cmd(CPBIN " --preserve=mode,ownership " + + getAbsolutePath(LOC_PRE) + " " + getAbsolutePath(LOC_SYSTEM)); + return cmd.retcode() == 0; + } + + + bool + File::createLink(uid_t owner, gid_t group) const + { + string tmp; + readlink(getAbsolutePath(LOC_PRE), tmp); + + if (symlink(tmp, getAbsolutePath(LOC_SYSTEM)) != 0) { - if (getSnapper()->getRollbackCallback()) - getSnapper()->getRollbackCallback()->createInfo(name); + y2err("symlink failed path:" << getAbsolutePath(LOC_SYSTEM) << + " errno:" << errno); + return false; + } + + if (lchown(getAbsolutePath(LOC_SYSTEM).c_str(), owner, group) != 0) + { + y2err("lchown failed path:" << getAbsolutePath(LOC_SYSTEM) << " errno:" << errno); + return false; + } + + return true; + } - struct stat fs; - getLStat(getAbsolutePath(LOC_PRE), fs); + bool + File::deleteAllTypes() const + { + struct stat fs; + if (lstat(getAbsolutePath(LOC_POST).c_str(), &fs) == 0) + { switch (fs.st_mode & S_IFMT) { case S_IFDIR: { - mkdir(getAbsolutePath(LOC_SYSTEM).c_str(), 0); - chmod(getAbsolutePath(LOC_SYSTEM).c_str(), fs.st_mode); - chown(getAbsolutePath(LOC_SYSTEM).c_str(), fs.st_uid, fs.st_gid); - } break; - - case S_IFREG: { - SystemCmd cmd(CPBIN " --preserve=mode,ownership " + - getAbsolutePath(LOC_PRE) + " " + getAbsolutePath(LOC_SYSTEM)); + if (rmdir(getAbsolutePath(LOC_SYSTEM).c_str()) != 0) + { + y2err("rmdir failed path:" << getAbsolutePath(LOC_SYSTEM) << + " errno:" << errno); + return false; + } } break; + case S_IFREG: case S_IFLNK: { - string tmp; - readlink(getAbsolutePath(LOC_PRE), tmp); - symlink(tmp, getAbsolutePath(LOC_SYSTEM)); - lchown(getAbsolutePath(LOC_SYSTEM).c_str(), fs.st_uid, fs.st_gid); + if (unlink(getAbsolutePath(LOC_SYSTEM).c_str()) != 0) + { + y2err("unlink failed path:" << getAbsolutePath(LOC_SYSTEM) << + " errno:" << errno); + return false; + } } break; } } - if (getPreToPostStatus() & (CONTENT | PERMISSIONS | USER | GROUP)) - { - if (getSnapper()->getRollbackCallback()) - getSnapper()->getRollbackCallback()->modifyInfo(name); + return true; + } - struct stat fs; - getLStat(getAbsolutePath(LOC_PRE), fs); + bool + File::modifyAllTypes() const + { + struct stat fs; + if (lstat(getAbsolutePath(LOC_PRE).c_str(), &fs) != 0) + { + y2err("lstat failed path:" << getAbsolutePath(LOC_SYSTEM) << " errno:" << errno); + return false; + } + else if (!createParentDirectories(getAbsolutePath(LOC_SYSTEM))) + { + return false; + } + else + { if (getPreToPostStatus() & CONTENT) { switch (fs.st_mode & S_IFMT) { case S_IFREG: { - SystemCmd cmd(CPBIN " --preserve=mode,ownership " + - getAbsolutePath(LOC_PRE) + " " + getAbsolutePath(LOC_SYSTEM)); + if (!deleteAllTypes()) + return false; + else if (!createFile(fs.st_mode, fs.st_uid, fs.st_gid)) + return false; } break; case S_IFLNK: { - unlink(getAbsolutePath(LOC_SYSTEM).c_str()); - string tmp; - readlink(getAbsolutePath(LOC_PRE), tmp); - symlink(tmp, getAbsolutePath(LOC_SYSTEM)); + if (!deleteAllTypes()) + return false; + else if (!createLink(fs.st_uid, fs.st_gid)) + return false; } break; } } @@ -474,9 +578,9 @@ { if (chmod(getAbsolutePath(LOC_SYSTEM).c_str(), fs.st_mode) != 0) { - y2err("chmod failed for " << getAbsolutePath(LOC_SYSTEM)); - if (getSnapper()->getRollbackCallback()) - getSnapper()->getRollbackCallback()->modifyError(name); + y2err("chmod failed path:" << getAbsolutePath(LOC_SYSTEM) << + " errno:" << errno); + return false; } } @@ -484,9 +588,9 @@ { if (lchown(getAbsolutePath(LOC_SYSTEM).c_str(), fs.st_uid, fs.st_gid) != 0) { - y2err("lchown failed for " << getAbsolutePath(LOC_SYSTEM)); - if (getSnapper()->getRollbackCallback()) - getSnapper()->getRollbackCallback()->modifyError(name); + y2err("lchown failed path:" << getAbsolutePath(LOC_SYSTEM) << + " errno:" << errno); + return false; } } } @@ -495,6 +599,64 @@ } + bool + File::doRollback() + { + if (getSnapper()->getRollbackCallback()) + { + switch (getAction()) + { + case CREATE: getSnapper()->getRollbackCallback()->createInfo(name); break; + case MODIFY: getSnapper()->getRollbackCallback()->modifyInfo(name); break; + case DELETE: getSnapper()->getRollbackCallback()->deleteInfo(name); break; + } + } + + bool error = false; + + if (getPreToPostStatus() & CREATED || getPreToPostStatus() & TYPE) + { + if (!deleteAllTypes()) + error = true; + } + + if (getPreToPostStatus() & DELETED || getPreToPostStatus() & TYPE) + { + if (!createAllTypes()) + error = true; + } + + if (getPreToPostStatus() & (CONTENT | PERMISSIONS | USER | GROUP)) + { + if (!modifyAllTypes()) + error = true; + } + + if (error && getSnapper()->getRollbackCallback()) + { + switch (getAction()) + { + case CREATE: getSnapper()->getRollbackCallback()->createError(name); break; + case MODIFY: getSnapper()->getRollbackCallback()->modifyError(name); break; + case DELETE: getSnapper()->getRollbackCallback()->deleteError(name); break; + } + } + + return true; + } + + + File::Action + File::getAction() const + { + if (getPreToPostStatus() == CREATED) + return DELETE; + if (getPreToPostStatus() == DELETED) + return CREATE; + return MODIFY; + } + + RollbackStatistic Files::getRollbackStatistic() const { @@ -504,12 +666,12 @@ { if (it->getRollback()) { - if (it->getPreToPostStatus() == CREATED) - rs.numDelete++; - else if (it->getPreToPostStatus() == DELETED) - rs.numCreate++; - else - rs.numModify++; + switch (it->getAction()) + { + case File::CREATE: rs.numCreate++; break; + case File::MODIFY: rs.numModify++; break; + case File::DELETE: rs.numDelete++; break; + } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/snapper/File.h new/snapper-0.0.6/snapper/File.h --- old/snapper-0.0.5/snapper/File.h 2011-04-04 14:22:31.000000000 +0200 +++ new/snapper-0.0.6/snapper/File.h 2011-05-26 15:38:04.000000000 +0200 @@ -24,6 +24,8 @@ #define FILE_H +#include <sys/stat.h> + #include <string> #include <vector> @@ -96,12 +98,27 @@ bool doRollback(); + enum Action { CREATE, MODIFY, DELETE }; + + Action getAction() const; + friend std::ostream& operator<<(std::ostream& s, const File& file); private: const Snapper* getSnapper() const; + bool createParentDirectories(const string& path) const; + + bool createAllTypes() const; + bool createDirectory(mode_t mode, uid_t owner, gid_t group) const; + bool createFile(mode_t mode, uid_t owner, gid_t group) const; + bool createLink(uid_t owner, gid_t group) const; + + bool deleteAllTypes() const; + + bool modifyAllTypes() const; + const Comparison* comparison; string name; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/snapper/Makefile.am new/snapper-0.0.6/snapper/Makefile.am --- old/snapper-0.0.5/snapper/Makefile.am 2011-05-06 21:13:08.000000000 +0200 +++ new/snapper-0.0.6/snapper/Makefile.am 2011-05-09 14:05:42.000000000 +0200 @@ -24,7 +24,7 @@ SnapperTypes.h \ SnapperDefines.h -libsnapper_la_LDFLAGS = -version-info 0:0 +libsnapper_la_LDFLAGS = -version-info @LIBVERSION_INFO@ libsnapper_la_LIBADD = -lblocxx -lxml2 pkgincludedir = $(includedir)/snapper diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/snapper/Snapper.cc new/snapper-0.0.6/snapper/Snapper.cc --- old/snapper-0.0.5/snapper/Snapper.cc 2011-05-03 15:19:07.000000000 +0200 +++ new/snapper-0.0.6/snapper/Snapper.cc 2011-06-06 16:50:34.000000000 +0200 @@ -24,6 +24,7 @@ #include <sys/types.h> #include <glob.h> #include <string.h> +#include <boost/algorithm/string.hpp> #include "config.h" #include "snapper/Snapper.h" @@ -543,6 +544,16 @@ y2mil("config_name:" << config_name << " subvolume:" << subvolume << " template_name:" << template_name); + if (config_name.empty() || config_name.find_first_of(" \t") != string::npos) + { + throw AddConfigFailedException("illegal config name"); + } + + if (!boost::starts_with(subvolume, "/") || !checkDir(subvolume)) + { + throw AddConfigFailedException("illegal subvolume"); + } + if (access(string(CONFIGTEMPLATEDIR "/" + template_name).c_str(), R_OK) != 0) { throw AddConfigFailedException("cannot access template config"); @@ -570,7 +581,7 @@ quote(CONFIGSDIR "/" + config_name)); if (cmd1.retcode() != 0) { - throw AddConfigFailedException("copying template failed"); + throw AddConfigFailedException("copying config template failed"); } try @@ -583,7 +594,7 @@ throw AddConfigFailedException("modifying config failed"); } - SystemCmd cmd2(BTRFSBIN " subvolume create " + subvolume + "/snapshots"); + SystemCmd cmd2(BTRFSBIN " subvolume create " + subvolume + SNAPSHOTSDIR); if (cmd2.retcode() != 0) { throw AddConfigFailedException("creating snapshot failed"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/snapper/SnapperDefines.h new/snapper-0.0.6/snapper/SnapperDefines.h --- old/snapper-0.0.5/snapper/SnapperDefines.h 2011-04-08 10:54:53.000000000 +0200 +++ new/snapper-0.0.6/snapper/SnapperDefines.h 2011-06-06 15:03:22.000000000 +0200 @@ -32,7 +32,7 @@ #define FILTERSDIR "/etc/snapper/filters" #define SNAPSHOTDIR "/snapshot" -#define SNAPSHOTSDIR "/snapshots" +#define SNAPSHOTSDIR "/.snapshots" #define BTRFSBIN "/sbin/btrfs" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/snapper.spec.in new/snapper-0.0.6/snapper.spec.in --- old/snapper-0.0.5/snapper.spec.in 2011-05-06 21:17:01.000000000 +0200 +++ new/snapper-0.0.6/snapper.spec.in 2011-06-08 17:52:09.000000000 +0200 @@ -12,9 +12,10 @@ Source: snapper-%{version}.tar.bz2 Prefix: /usr BuildRequires: gcc-c++ boost-devel blocxx-devel doxygen dejagnu libxml2-devel -Requires: libsnapper0 = %version +Requires: libsnapper@LIBVERSION_MAJOR@ = %version Recommends: cron logrotate Summary: Tool for filesystem snapshot management +Url: http://en.opensuse.org/Portal:Snapper %description This package contains snapper, a tool for filesystem snapshot management. @@ -51,24 +52,25 @@ %files -f snapper.lang %defattr(-,root,root) %{prefix}/bin/snapper +%doc %{_mandir}/*/* %config(noreplace) %{_sysconfdir}/logrotate.d/snapper /etc/cron.hourly/suse.de-snapper /etc/cron.daily/suse.de-snapper -%package -n libsnapper0 +%package -n libsnapper@LIBVERSION_MAJOR@ Summary: Library for filesystem snapshot management Group: System/Libraries Requires: btrfsprogs diffutils util-linux PreReq: %fillup_prereq -%description -n libsnapper0 +%description -n libsnapper@LIBVERSION_MAJOR@ This package contains libsnapper, a library for filesystem snapshot management. Authors: -------- Arvin Schnell <aschn...@suse.de> -%files -n libsnapper0 +%files -n libsnapper@LIBVERSION_MAJOR@ %defattr(-,root,root) %{_libdir}/libsnapper.so.* %dir %{_sysconfdir}/snapper @@ -85,15 +87,15 @@ %dir %{prefix}/lib/snapper/bin %{prefix}/lib/snapper/bin/compare-dirs -%post -n libsnapper0 +%post -n libsnapper@LIBVERSION_MAJOR@ /sbin/ldconfig %{fillup_only -n snapper} -%postun -n libsnapper0 +%postun -n libsnapper@LIBVERSION_MAJOR@ /sbin/ldconfig %package -n libsnapper-devel -Requires: libsnapper0 = %version +Requires: libsnapper@LIBVERSION_MAJOR@ = %version Requires: gcc-c++ libstdc++-devel boost-devel blocxx-devel libxml2-devel Summary: Header files and documentation for libsnapper Group: Development/Languages/C and C++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/testsuite-real/Makefile.am new/snapper-0.0.6/testsuite-real/Makefile.am --- old/snapper-0.0.5/testsuite-real/Makefile.am 2011-05-03 15:28:12.000000000 +0200 +++ new/snapper-0.0.6/testsuite-real/Makefile.am 2011-05-23 10:06:20.000000000 +0200 @@ -10,7 +10,8 @@ noinst_SCRIPTS = run-all -noinst_PROGRAMS = simple1 permissions1 permissions2 owner1 owner2 error1 +noinst_PROGRAMS = simple1 permissions1 permissions2 owner1 owner2 owner3 \ + directory1 missing-directory1 error1 error2 error4 simple1_SOURCES = simple1.cc common.h common.cc @@ -19,8 +20,15 @@ owner1_SOURCES = owner1.cc common.h common.cc owner2_SOURCES = owner2.cc common.h common.cc +owner3_SOURCES = owner3.cc common.h common.cc + +directory1_SOURCES = directory1.cc common.h common.cc + +missing_directory1_SOURCES = missing-directory1.cc common.h common.cc error1_SOURCES = error1.cc common.h common.cc +error2_SOURCES = error2.cc common.h common.cc +error4_SOURCES = error4.cc common.h common.cc EXTRA_DIST = $(noinst_SCRIPTS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/testsuite-real/common.cc new/snapper-0.0.6/testsuite-real/common.cc --- old/snapper-0.0.5/testsuite-real/common.cc 2011-05-03 15:19:07.000000000 +0200 +++ new/snapper-0.0.6/testsuite-real/common.cc 2011-06-06 15:03:22.000000000 +0200 @@ -11,6 +11,7 @@ #include <snapper/Snapshot.h> #include <snapper/Comparison.h> #include <snapper/File.h> +#include <snapper/SnapperDefines.h> #include "snapper/AppUtil.h" @@ -59,7 +60,7 @@ void setup() { - system("/usr/bin/find " SUBVOLUME " -mindepth 1 -maxdepth 1 -not -path " SUBVOLUME "/snapshots " + system("/usr/bin/find " SUBVOLUME " -mindepth 1 -maxdepth 1 -not -path " SUBVOLUME SNAPSHOTSDIR " " "-exec rm -r {} \\;"); initDefaultLogger(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/testsuite-real/directory1.cc new/snapper-0.0.6/testsuite-real/directory1.cc --- old/snapper-0.0.5/testsuite-real/directory1.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/snapper-0.0.6/testsuite-real/directory1.cc 2011-05-23 10:06:20.000000000 +0200 @@ -0,0 +1,34 @@ + +#include <stdlib.h> +#include <iostream> + +#include "common.h" + +using namespace std; + + +int +main() +{ + setup(); + + run_command("mkdir already-here"); + + first_snapshot(); + + run_command("rmdir already-here"); + + second_snapshot(); + + run_command("mkdir already-here"); + + check_rollback_statistics(1, 0, 0); + + rollback(); + + check_rollback_errors(0, 0, 0); + + check_first(); + + exit(EXIT_SUCCESS); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/testsuite-real/error2.cc new/snapper-0.0.6/testsuite-real/error2.cc --- old/snapper-0.0.5/testsuite-real/error2.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/snapper-0.0.6/testsuite-real/error2.cc 2011-05-12 10:42:14.000000000 +0200 @@ -0,0 +1,33 @@ + +#include <stdlib.h> +#include <iostream> + +#include "common.h" + +using namespace std; + + +int +main() +{ + setup(); + + run_command("touch not-here"); + + first_snapshot(); + + run_command("chmod a+rxw not-here"); + run_command("chown nobody not-here"); + + second_snapshot(); + + run_command("rm not-here"); + + check_rollback_statistics(0, 1, 0); + + rollback(); + + check_rollback_errors(0, 1, 0); + + exit(EXIT_SUCCESS); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/testsuite-real/error4.cc new/snapper-0.0.6/testsuite-real/error4.cc --- old/snapper-0.0.5/testsuite-real/error4.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/snapper-0.0.6/testsuite-real/error4.cc 2011-05-20 12:32:14.000000000 +0200 @@ -0,0 +1,34 @@ + +#include <stdlib.h> +#include <iostream> + +#include "common.h" + +using namespace std; + + +int +main() +{ + setup(); + + run_command("mkdir wrong-type"); + run_command("touch wrong-type/file"); + + first_snapshot(); + + run_command("rm wrong-type/file"); + + second_snapshot(); + + run_command("rmdir wrong-type"); + run_command("touch wrong-type"); + + check_rollback_statistics(1, 0, 0); + + rollback(); + + check_rollback_errors(1, 0, 0); + + exit(EXIT_SUCCESS); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/testsuite-real/missing-directory1.cc new/snapper-0.0.6/testsuite-real/missing-directory1.cc --- old/snapper-0.0.5/testsuite-real/missing-directory1.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/snapper-0.0.6/testsuite-real/missing-directory1.cc 2011-05-20 12:32:14.000000000 +0200 @@ -0,0 +1,37 @@ + +#include <stdlib.h> +#include <iostream> + +#include "common.h" + +using namespace std; + + +int +main() +{ + setup(); + + run_command("mkdir not-here"); + run_command("touch not-here/file"); + run_command("mkdir not-here/directory"); + + first_snapshot(); + + run_command("rm not-here/file"); + run_command("rmdir not-here/directory"); + + second_snapshot(); + + run_command("rmdir not-here"); + + check_rollback_statistics(2, 0, 0); + + rollback(); + + check_rollback_errors(0, 0, 0); + + check_first(); + + exit(EXIT_SUCCESS); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/testsuite-real/owner3.cc new/snapper-0.0.6/testsuite-real/owner3.cc --- old/snapper-0.0.5/testsuite-real/owner3.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/snapper-0.0.6/testsuite-real/owner3.cc 2011-05-20 15:20:53.000000000 +0200 @@ -0,0 +1,35 @@ + +#include <stdlib.h> +#include <iostream> + +#include "common.h" + +using namespace std; + + +int +main() +{ + setup(); + + run_command("ln --symbolic test1 link"); + run_command("chown --no-dereference nobody link"); + + first_snapshot(); + + run_command("rm link"); + run_command("ln --symbolic test2 link"); + run_command("chown --no-dereference nobody link"); + + second_snapshot(); + + check_rollback_statistics(0, 1, 0); + + rollback(); + + check_rollback_errors(0, 0, 0); + + check_first(); + + exit(EXIT_SUCCESS); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/testsuite-real/run-all new/snapper-0.0.6/testsuite-real/run-all --- old/snapper-0.0.5/testsuite-real/run-all 2011-05-03 15:19:07.000000000 +0200 +++ new/snapper-0.0.6/testsuite-real/run-all 2011-05-23 10:06:20.000000000 +0200 @@ -4,14 +4,12 @@ function run() { cmd=$1 - shift - args=$* echo - echo "*** running $cmd $args ***" + echo "*** running $cmd ***" echo - ./$cmd $args + ./$cmd if [ $? != 0 ] ; then echo "failed" @@ -27,6 +25,13 @@ run owner1 run owner2 +run owner3 + +run directory1 + +run missing-directory1 run error1 +run error2 +run error4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/snapper-0.0.5/tools/snapper.cc new/snapper-0.0.6/tools/snapper.cc --- old/snapper-0.0.5/tools/snapper.cc 2011-05-04 09:38:21.000000000 +0200 +++ new/snapper-0.0.6/tools/snapper.cc 2011-06-09 17:02:31.000000000 +0200 @@ -3,6 +3,7 @@ #include <string.h> #include <iostream> +#include "config.h" #include <snapper/Factory.h> #include <snapper/Snapper.h> #include <snapper/Snapshot.h> @@ -681,6 +682,7 @@ << _("\t--verbose, -v\t\t\tIncrease verbosity.") << endl << _("\t--table-style, -t <style>\tTable style (integer).") << endl << _("\t--config, -c <name>\t\tSet name of config to use.") << endl + << _("\t--version\t\t\tPrint version and exit.") << endl << endl; help_list_configs(); @@ -750,27 +752,13 @@ { "verbose", no_argument, 0, 'v' }, { "table-style", required_argument, 0, 't' }, { "config", required_argument, 0, 'c' }, + { "version", no_argument, 0, 0 }, { 0, 0, 0, 0 } }; getopts.init(argc, argv); GetOpts::parsed_opts opts = getopts.parse(options); - if (!getopts.hasArgs()) - { - cerr << _("No command provided.") << endl - << _("Try 'snapper help' for more information.") << endl; - exit(EXIT_FAILURE); - } - - const char* command = getopts.popArg(); - map<string, cmd_fnc>::const_iterator cmd = cmds.find(command); - if (cmd == cmds.end()) - { - cerr << sformat(_("Unknown command '%s'."), command) << endl - << _("Try 'snapper help' for more information.") << endl; - exit(EXIT_FAILURE); - } GetOpts::parsed_opts::const_iterator opt; @@ -796,6 +784,28 @@ if ((opt = opts.find("config")) != opts.end()) config_name = opt->second; + if ((opt = opts.find("version")) != opts.end()) + { + cout << "snapper " << VERSION << endl; + exit(EXIT_SUCCESS); + } + + if (!getopts.hasArgs()) + { + cerr << _("No command provided.") << endl + << _("Try 'snapper help' for more information.") << endl; + exit(EXIT_FAILURE); + } + + const char* command = getopts.popArg(); + map<string, cmd_fnc>::const_iterator cmd = cmds.find(command); + if (cmd == cmds.end()) + { + cerr << sformat(_("Unknown command '%s'."), command) << endl + << _("Try 'snapper help' for more information.") << endl; + exit(EXIT_FAILURE); + } + if (cmd->first == "help" || cmd->first == "list-configs" || cmd->first == "create-config") { (*cmd->second)(); ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org