Hello community, here is the log from the commit of package snapper for openSUSE:Factory checked in at 2012-09-14 12:38:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/snapper (Old) and /work/SRC/openSUSE:Factory/.snapper.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "snapper", Maintainer is "ASchnell@suse.com" Changes: -------- --- /work/SRC/openSUSE:Factory/snapper/snapper.changes 2012-06-13 22:46:25.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.snapper.new/snapper.changes 2012-09-14 12:38:51.000000000 +0200 @@ -1,0 +2,24 @@ +Wed Aug 22 18:43:47 CEST 2012 - aschnell@suse.de + +- fixed segmentation fault for unknown fstype +- 0.0.14 + +------------------------------------------------------------------- +Tue Aug 14 12:03:50 CEST 2012 - aschnell@suse.de + +- fixed logging during program termination + +------------------------------------------------------------------- +Wed Jul 25 10:44:38 CEST 2012 - aschnell@suse.de + +- take mount options from original filesystem when mounting + snapshots +- 0.0.13 + +------------------------------------------------------------------- +Tue Jul 24 14:35:44 CEST 2012 - aschnell@suse.de + +- added experimental support for LVM thin-provisioned snapshots +- 0.0.12 + +------------------------------------------------------------------- Old: ---- snapper-0.0.11.tar.bz2 New: ---- snapper-0.0.14.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ snapper.spec ++++++ --- /var/tmp/diff_new_pack.2vPbCc/_old 2012-09-14 12:38:52.000000000 +0200 +++ /var/tmp/diff_new_pack.2vPbCc/_new 2012-09-14 12:38:52.000000000 +0200 @@ -17,7 +17,7 @@ Name: snapper -Version: 0.0.11 +Version: 0.0.14 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build Source: snapper-%{version}.tar.bz2 @@ -66,7 +66,7 @@ automake --add-missing --copy autoconf -./configure --libdir=%{_libdir} --prefix=%{prefix} --mandir=%{_mandir} --disable-silent-rules +./configure --libdir=%{_libdir} --prefix=%{prefix} --mandir=%{_mandir} --docdir=%{prefix}/share/doc/packages/snapper --disable-silent-rules make %{?jobs:-j%jobs} %install @@ -127,9 +127,9 @@ %else %config(noreplace) %{_sysconfdir}/sysconfig/snapper %endif -%dir %{prefix}/lib/snapper -%dir %{prefix}/lib/snapper/bin -%{prefix}/lib/snapper/bin/compare-dirs +%dir %{_libdir}/snapper +%dir %{_libdir}/snapper/bin +%{_libdir}/snapper/bin/compare-dirs %post -n libsnapper1 /sbin/ldconfig @@ -201,6 +201,6 @@ %dir /usr/lib/zypp/plugins %dir /usr/lib/zypp/plugins/commit %endif -/usr/lib/zypp/plugins/commit/snapper.py +/usr/lib/zypp/plugins/commit/snapper.py* %changelog ++++++ snapper-0.0.11.tar.bz2 -> snapper-0.0.14.tar.bz2 ++++++ ++++ 9798 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.11/VERSION new/snapper-0.0.14/VERSION --- old/snapper-0.0.11/VERSION 2012-06-12 10:08:30.000000000 +0200 +++ new/snapper-0.0.14/VERSION 2012-08-22 18:43:25.000000000 +0200 @@ -1 +1 @@ -0.0.11 +0.0.14 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.11/bindings/python/libsnapper.py new/snapper-0.0.14/bindings/python/libsnapper.py --- old/snapper-0.0.11/bindings/python/libsnapper.py 2012-06-13 12:41:52.000000000 +0200 +++ new/snapper-0.0.14/bindings/python/libsnapper.py 2012-09-13 15:39:27.000000000 +0200 @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 2.0.4 +# Version 2.0.7 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. @@ -77,8 +77,8 @@ __swig_destroy__ = _libsnapper.delete_SwigPyIterator __del__ = lambda self : None; def value(self): return _libsnapper.SwigPyIterator_value(self) - def incr(self, n = 1): return _libsnapper.SwigPyIterator_incr(self, n) - def decr(self, n = 1): return _libsnapper.SwigPyIterator_decr(self, n) + def incr(self, n=1): return _libsnapper.SwigPyIterator_incr(self, n) + def decr(self, n=1): return _libsnapper.SwigPyIterator_decr(self, n) def distance(self, *args): return _libsnapper.SwigPyIterator_distance(self, *args) def equal(self, *args): return _libsnapper.SwigPyIterator_equal(self, *args) def copy(self): return _libsnapper.SwigPyIterator_copy(self) @@ -97,6 +97,10 @@ SwigPyIterator_swigregister(SwigPyIterator) +def createSnapper(config_name="root", disable_filters=False): + return _libsnapper.createSnapper(config_name, disable_filters) +createSnapper = _libsnapper.createSnapper + def deleteSnapper(*args): return _libsnapper.deleteSnapper(*args) deleteSnapper = _libsnapper.deleteSnapper @@ -116,10 +120,6 @@ SnapperException_swigregister = _libsnapper.SnapperException_swigregister SnapperException_swigregister(SnapperException) -def createSnapper(config_name = "root", disable_filters = False): - return _libsnapper.createSnapper(config_name, disable_filters) -createSnapper = _libsnapper.createSnapper - class FileNotFoundException(SnapperException): __swig_setmethods__ = {} for _s in [SnapperException]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{})) @@ -556,7 +556,7 @@ __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, Snapper, name) __repr__ = _swig_repr - def __init__(self, config_name = "root", disable_filters = False): + def __init__(self, config_name="root", disable_filters=False): this = _libsnapper.new_Snapper(config_name, disable_filters) try: self.this.append(this) except: self.this = this @@ -675,6 +675,10 @@ File_swigregister = _libsnapper.File_swigregister File_swigregister(File) + +def __lt__(*args): + return _libsnapper.__lt__(*args) +__lt__ = _libsnapper.__lt__ class Files(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, Files, name, value) @@ -698,10 +702,6 @@ Files_swigregister = _libsnapper.Files_swigregister Files_swigregister(Files) -def __lt__(*args): - return _libsnapper.__lt__(*args) -__lt__ = _libsnapper.__lt__ - def statusToString(*args): return _libsnapper.statusToString(*args) 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.11/config.h.in new/snapper-0.0.14/config.h.in --- old/snapper-0.0.11/config.h.in 2012-06-13 12:41:34.000000000 +0200 +++ new/snapper-0.0.14/config.h.in 2012-09-13 18:15:24.000000000 +0200 @@ -1,5 +1,14 @@ /* config.h.in. Generated from configure.in by autoheader. */ +/* Enable Btrfs internal snapshots support */ +#undef ENABLE_BTRFS + +/* Enable Ext4 snapshots support */ +#undef ENABLE_EXT4 + +/* Enable LVM thinprovisioned snapshots support */ +#undef ENABLE_LVM + /* Define to 1 if you have the <dlfcn.h> header file. */ #undef HAVE_DLFCN_H 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.11/configure.in new/snapper-0.0.14/configure.in --- old/snapper-0.0.11/configure.in 2012-06-11 14:35:04.000000000 +0200 +++ new/snapper-0.0.14/configure.in 2012-08-28 12:24:36.000000000 +0200 @@ -32,9 +32,33 @@ CFLAGS="${CFLAGS} -Wall -Wformat=2 -Wmissing-prototypes" CXXFLAGS="${CXXFLAGS} -std=c++0x -DHAVE_CXX0X -Wall -Wextra -Wformat=2 -Wnon-virtual-dtor -Wno-unused-parameter" -docdir=\${prefix}/share/doc/packages/snapper fillupdir=/var/adm/fillup-templates +AC_ARG_ENABLE([ext4], AC_HELP_STRING([--disable-ext4],[Disable ext4 snapshots support]), + [with_ext4=$enableval],[with_ext4=yes]) + +if test "x$with_ext4" = "xyes"; then + AC_DEFINE(ENABLE_EXT4, 1, [Enable Ext4 snapshots support]) +fi + +AC_ARG_ENABLE([lvm], AC_HELP_STRING([--disable-lvm],[Disable LVM thinprovisioned snapshots support]), + [with_lvm=$enableval],[with_lvm=yes]) + +if test "x$with_lvm" = "xyes"; then + AC_DEFINE(ENABLE_LVM, 1, [Enable LVM thinprovisioned snapshots support]) +fi + +AC_ARG_ENABLE([btrfs], AC_HELP_STRING([--disable-btrfs],[Disable Btrfs internal snapshots support]), + [with_btrfs=$enableval],[with_btrfs=yes]) + +if test "x$with_btrfs" = "xyes"; then + AC_DEFINE(ENABLE_BTRFS, 1, [Enable Btrfs internal snapshots support]) +fi + +if test "x$with_lvm" != "xyes" -a "x$with_ext4" != "xyes" -a "x$with_btrfs" != "xyes"; then + AC_MSG_ERROR([You have to enable at least one snapshot type (remove some --disable-xxx parameter)]) +fi + AC_SUBST(VERSION) AC_SUBST(LIBVERSION_MAJOR) AC_SUBST(LIBVERSION_INFO) 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.11/doc/snapper.8 new/snapper-0.0.14/doc/snapper.8 --- old/snapper-0.0.11/doc/snapper.8 2012-06-13 12:41:38.000000000 +0200 +++ new/snapper-0.0.14/doc/snapper.8 2012-09-13 18:15:28.000000000 +0200 @@ -1,4 +1,4 @@ -.TH "SNAPPER" "8" "2012-03-20" "0.0.11" "Filesystem Snapshot Management" +.TH "SNAPPER" "8" "2012-07-24" "0.0.14" "Filesystem Snapshot Management" .SH "NAME" .LP snapper - Command\-line program for filesystem snapshot management @@ -16,7 +16,8 @@ create, delete and compare snapshots and undo changes done between snapshots. .LP Snapper never modifies the content of snapshots. Thus snapper creates -read-only snapshots. Supported filesystems are btrfs and ext4. +read-only snapshots. Supported filesystems are btrfs and ext4 as well as +snapshots of LVM logical volumes with thin-provisioning. .SH CONCEPTS @@ -115,8 +116,12 @@ \fBCONCEPTS\fR. .TP \fI\-f, \-\-fstype\fR <fstype> -Manually set filesystem type. Supported values are btrfs and ext4. Without -this option snapper detect the filesystem. +Manually set filesystem type. Supported values are btrfs, ext4 and lvm. For +lvm snapper used LVM thin-provisioned snapshots. The filesystem type on top of +LVM can be provided in parentheses, e.g. lvm(xfs). This is required for XFS. + +Without this option snapper tries to detect the filesystem. + .TP \fI\-t, \-\-template\fR <name> Name of template for the new configuration file. @@ -251,4 +256,4 @@ .SH "SEE ALSO" .LP -btrfs(8) +btrfs(8), lvcreate(2) 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.11/doc/snapper.8.in new/snapper-0.0.14/doc/snapper.8.in --- old/snapper-0.0.11/doc/snapper.8.in 2012-04-26 14:22:11.000000000 +0200 +++ new/snapper-0.0.14/doc/snapper.8.in 2012-08-22 16:47:09.000000000 +0200 @@ -1,4 +1,4 @@ -.TH "SNAPPER" "8" "2012-03-20" "@VERSION@" "Filesystem Snapshot Management" +.TH "SNAPPER" "8" "2012-07-24" "@VERSION@" "Filesystem Snapshot Management" .SH "NAME" .LP snapper - Command\-line program for filesystem snapshot management @@ -16,7 +16,8 @@ create, delete and compare snapshots and undo changes done between snapshots. .LP Snapper never modifies the content of snapshots. Thus snapper creates -read-only snapshots. Supported filesystems are btrfs and ext4. +read-only snapshots. Supported filesystems are btrfs and ext4 as well as +snapshots of LVM logical volumes with thin-provisioning. .SH CONCEPTS @@ -115,8 +116,12 @@ \fBCONCEPTS\fR. .TP \fI\-f, \-\-fstype\fR <fstype> -Manually set filesystem type. Supported values are btrfs and ext4. Without -this option snapper detect the filesystem. +Manually set filesystem type. Supported values are btrfs, ext4 and lvm. For +lvm snapper used LVM thin-provisioned snapshots. The filesystem type on top of +LVM can be provided in parentheses, e.g. lvm(xfs). This is required for XFS. + +Without this option snapper tries to detect the filesystem. + .TP \fI\-t, \-\-template\fR <name> Name of template for the new configuration file. @@ -251,4 +256,4 @@ .SH "SEE ALSO" .LP -btrfs(8) +btrfs(8), lvcreate(2) 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.11/examples/Create.cc new/snapper-0.0.14/examples/Create.cc --- old/snapper-0.0.11/examples/Create.cc 2012-04-26 14:22:11.000000000 +0200 +++ new/snapper-0.0.14/examples/Create.cc 2012-08-22 16:47:09.000000000 +0200 @@ -2,7 +2,6 @@ #include <stdlib.h> #include <iostream> -#include <snapper/Factory.h> #include <snapper/Snapper.h> using namespace snapper; @@ -11,9 +10,11 @@ int main(int argc, char** argv) { - Snapper* sh = createSnapper(); + Snapper* sh = new Snapper(); sh->createSingleSnapshot("test"); + delete sh; + 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.11/examples/CreateTimeline.cc new/snapper-0.0.14/examples/CreateTimeline.cc --- old/snapper-0.0.11/examples/CreateTimeline.cc 2012-04-26 14:22:11.000000000 +0200 +++ new/snapper-0.0.14/examples/CreateTimeline.cc 2012-08-22 16:47:09.000000000 +0200 @@ -3,7 +3,6 @@ #include <vector> #include <iostream> -#include <snapper/Factory.h> #include <snapper/Snapper.h> using namespace snapper; @@ -13,7 +12,7 @@ void deleteAll() { - Snapper* sh = createSnapper("testsuite"); + Snapper* sh = new Snapper("testsuite"); Snapshots snapshots = sh->getSnapshots(); @@ -25,7 +24,7 @@ for (vector<Snapshots::iterator>::iterator it = tmp.begin(); it != tmp.end(); ++it) sh->deleteSnapshot(*it); - deleteSnapper(sh); + delete sh; } @@ -34,7 +33,7 @@ { deleteAll(); - Snapper* sh = createSnapper("testsuite"); + Snapper* sh = new Snapper("testsuite"); time_t t = time(NULL) - 100 * 24*60*60; while (t < time(NULL)) @@ -46,7 +45,7 @@ t += 60*60; } - deleteSnapper(sh); + delete sh; 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.11/examples/List.cc new/snapper-0.0.14/examples/List.cc --- old/snapper-0.0.11/examples/List.cc 2012-04-26 14:22:11.000000000 +0200 +++ new/snapper-0.0.14/examples/List.cc 2012-08-22 16:47:09.000000000 +0200 @@ -2,7 +2,6 @@ #include <stdlib.h> #include <iostream> -#include <snapper/Factory.h> #include <snapper/Snapper.h> using namespace snapper; @@ -11,7 +10,7 @@ int main(int argc, char** argv) { - Snapper* sh = createSnapper(); + Snapper* sh = new Snapper(); const Snapshots& snapshots = sh->getSnapshots(); for (Snapshots::const_iterator it = snapshots.begin(); it != snapshots.end(); ++it) @@ -19,5 +18,7 @@ cout << *it << endl; } + delete sh; + 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.11/examples/ListAll.cc new/snapper-0.0.14/examples/ListAll.cc --- old/snapper-0.0.11/examples/ListAll.cc 2012-04-26 14:22:11.000000000 +0200 +++ new/snapper-0.0.14/examples/ListAll.cc 2012-08-22 16:47:09.000000000 +0200 @@ -2,7 +2,6 @@ #include <stdlib.h> #include <iostream> -#include <snapper/Factory.h> #include <snapper/Snapper.h> using namespace 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.11/examples/SnapTest.cc new/snapper-0.0.14/examples/SnapTest.cc --- old/snapper-0.0.11/examples/SnapTest.cc 2012-04-26 14:22:11.000000000 +0200 +++ new/snapper-0.0.14/examples/SnapTest.cc 2012-08-22 16:47:09.000000000 +0200 @@ -2,7 +2,6 @@ #include <stdlib.h> #include <iostream> -#include <snapper/Factory.h> #include <snapper/Snapper.h> #include <snapper/Comparison.h> #include <snapper/File.h> 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.11/missing new/snapper-0.0.14/missing --- old/snapper-0.0.11/missing 2012-06-13 12:41:35.000000000 +0200 +++ new/snapper-0.0.14/missing 2012-09-13 18:15:24.000000000 +0200 @@ -1,10 +1,9 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2009-04-28.21; # UTC +scriptversion=2012-01-06.18; # UTC -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, -# 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 1996-2012 Free Software Foundation, Inc. # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # This program is free software; you can redistribute it and/or modify @@ -26,7 +25,7 @@ # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" + echo 1>&2 "Try '$0 --help' for more information" exit 1 fi @@ -34,7 +33,7 @@ sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' -# In the cases where this matters, `missing' is being run in the +# In the cases where this matters, 'missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac @@ -65,7 +64,7 @@ echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +Handle 'PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: @@ -74,21 +73,20 @@ --run try to run the given command, and emulate it if it fails Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' + aclocal touch file 'aclocal.m4' + autoconf touch file 'configure' + autoheader touch file 'config.h.in' autom4te touch the output file, or create a stub one - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c + automake touch all 'Makefile.in' files + bison create 'y.tab.[ch]', if possible, from existing .[ch] + flex create 'lex.yy.c', if possible, from existing .c help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c + lex create 'lex.yy.c', if possible, from existing .c makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch] + yacc create 'y.tab.[ch]', if possible, from existing .[ch] -Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and -\`g' are ignored when checking the name. +Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and +'g' are ignored when checking the name. Send bug reports to <bug-automake@gnu.org>." exit $? @@ -100,8 +98,8 @@ ;; -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" + echo 1>&2 "$0: Unknown '$1' option" + echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; @@ -122,22 +120,13 @@ # Not GNU programs, they don't have --version. ;; - tar*) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether + # running '$TOOL --version' or '$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi @@ -149,27 +138,27 @@ case $program in aclocal*) echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from +WARNING: '$1' is $msg. You should only need it if + you modified 'acinclude.m4' or '${configure_ac}'. You might want + to install the Automake and Perl packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU +WARNING: '$1' is $msg. You should only need it if + you modified '${configure_ac}'. You might want to install the + Autoconf and GNU m4 packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them +WARNING: '$1' is $msg. You should only need it if + you modified 'acconfig.h' or '${configure_ac}'. You might want + to install the Autoconf and GNU m4 packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" @@ -186,9 +175,9 @@ automake*) echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. +WARNING: '$1' is $msg. You should only need it if + you modified 'Makefile.am', 'acinclude.m4' or '${configure_ac}'. + You might want to install the Automake and Perl packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | @@ -197,10 +186,10 @@ autom4te*) echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. +WARNING: '$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU + You can get '$1' as part of Autoconf from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` @@ -220,13 +209,13 @@ bison*|yacc*) echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package +WARNING: '$1' $msg. You should only need it if + you modified a '.y' file. You may need the Bison package in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." + Bison from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then - eval LASTARG="\${$#}" + eval LASTARG=\${$#} case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` @@ -250,13 +239,13 @@ lex*|flex*) echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package +WARNING: '$1' is $msg. You should only need it if + you modified a '.l' file. You may need the Flex package in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." + Flex from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then - eval LASTARG="\${$#}" + eval LASTARG=\${$#} case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` @@ -273,10 +262,10 @@ help2man*) echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if +WARNING: '$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." + Help2man package in order for those modifications to take + effect. You can get Help2man from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` @@ -291,12 +280,12 @@ makeinfo*) echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file +WARNING: '$1' is $msg. You should only need it if + you modified a '.texi' or '.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." + call might also be the consequence of using a buggy 'make' (AIX, + DU, IRIX). You might want to install the Texinfo package or + the GNU make package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` @@ -318,49 +307,14 @@ touch $file ;; - tar*) - shift - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case $firstarg in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case $firstarg in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - *) echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. +WARNING: '$1' is needed, and is $msg. You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, + proper tools for further handling them. Check the 'README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." + some other package would contain this missing '$1' program." exit 1 ;; esac 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.11/py-compile new/snapper-0.0.14/py-compile --- old/snapper-0.0.11/py-compile 2012-06-13 12:41:35.000000000 +0200 +++ new/snapper-0.0.14/py-compile 2012-09-13 18:15:24.000000000 +0200 @@ -1,10 +1,9 @@ #!/bin/sh # py-compile - Compile a Python program -scriptversion=2009-04-28.21; # UTC +scriptversion=2011-06-08.12; # UTC -# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2008, 2009 Free Software -# Foundation, Inc. +# Copyright (C) 2000-2012 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -32,28 +31,36 @@ PYTHON=python fi +me=py-compile + +usage_error () +{ + echo "$me: $*" >&2 + echo "Try \`$me --help' for more information." >&2 + exit 1 +} + basedir= destdir= -files= while test $# -ne 0; do case "$1" in --basedir) - basedir=$2 - if test -z "$basedir"; then - echo "$0: Missing argument to --basedir." 1>&2 - exit 1 + if test $# -lt 2; then + usage_error "option '--basedir' requires an argument" + else + basedir=$2 fi shift ;; --destdir) - destdir=$2 - if test -z "$destdir"; then - echo "$0: Missing argument to --destdir." 1>&2 - exit 1 + if test $# -lt 2; then + usage_error "option '--destdir' requires an argument" + else + destdir=$2 fi shift ;; - -h|--h*) + -h|--help) cat <<\EOF Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] FILES..." @@ -69,20 +76,27 @@ EOF exit $? ;; - -v|--v*) - echo "py-compile $scriptversion" + -v|--version) + echo "$me $scriptversion" exit $? ;; + --) + shift + break + ;; + -*) + usage_error "unrecognized option '$1'" + ;; *) - files="$files $1" + break ;; esac shift done +files=$* if test -z "$files"; then - echo "$0: No files given. Try \`$0 --help' for more information." 1>&2 - exit 1 + usage_error "no files given" fi # if basedir was given, then it should be prepended to filenames before 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.11/snapper/AppUtil.cc new/snapper-0.0.14/snapper/AppUtil.cc --- old/snapper-0.0.11/snapper/AppUtil.cc 2012-05-09 15:49:22.000000000 +0200 +++ new/snapper-0.0.14/snapper/AppUtil.cc 2012-08-22 16:47:09.000000000 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) [2004-2011] Novell, Inc. + * Copyright (c) [2004-2012] Novell, Inc. * * All Rights Reserved. * @@ -31,6 +31,7 @@ #include <sys/utsname.h> #include <sys/ioctl.h> #include <dirent.h> +#include <mntent.h> #include <string> #include <libxml/tree.h> #include <boost/algorithm/string.hpp> @@ -73,6 +74,14 @@ } + bool + checkAnything(const string& Path_Cv) + { + struct stat Stat_ri; + return stat(Path_Cv.c_str(), &Stat_ri) >= 0; + } + + list<string> glob(const string& path, int flags) { @@ -199,6 +208,42 @@ } + bool + getMtabData(const string& mount_point, bool& found, MtabData& mtab_data) + { + FILE* f = setmntent("/etc/mtab", "r"); + if (!f) + { + y2err("setmntent failed"); + return false; + } + + found = false; + + struct mntent* m; + while ((m = getmntent(f))) + { + if (strcmp(m->mnt_type, "rootfs") == 0) + continue; + + if (m->mnt_dir == mount_point) + { + found = true; + mtab_data.device = m->mnt_fsname; + mtab_data.dir = m->mnt_dir; + mtab_data.type = m->mnt_type; + boost::split(mtab_data.options, m->mnt_opts, boost::is_any_of(","), + boost::token_compress_on); + break; + } + } + + endmntent(f); + + return true; + } + + string sformat(const string& format, ...) { 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.11/snapper/AppUtil.h new/snapper-0.0.14/snapper/AppUtil.h --- old/snapper-0.0.11/snapper/AppUtil.h 2012-04-26 14:22:11.000000000 +0200 +++ new/snapper-0.0.14/snapper/AppUtil.h 2012-08-22 16:47:09.000000000 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) [2004-2011] Novell, Inc. + * Copyright (c) [2004-2012] Novell, Inc. * * All Rights Reserved. * @@ -31,6 +31,7 @@ #include <string> #include <list> #include <map> +#include <vector> namespace snapper @@ -38,11 +39,13 @@ using std::string; using std::list; using std::map; + using std::vector; void createPath(const string& Path_Cv); bool checkNormalFile(const string& Path_Cv); bool checkDir(const string& Path_Cv); + bool checkAnything(const string& Path_Cv); list<string> glob(const string& path, int flags); @@ -56,6 +59,17 @@ string realpath(const string& path); + struct MtabData + { + string device; + string dir; + string type; + vector<string> options; + }; + + bool getMtabData(const string& mount_point, bool& found, MtabData& mtab_data); + + template<class StreamType> void classic(StreamType& stream) { 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.11/snapper/Filesystem.cc new/snapper-0.0.14/snapper/Filesystem.cc --- old/snapper-0.0.11/snapper/Filesystem.cc 2012-05-21 15:29:39.000000000 +0200 +++ new/snapper-0.0.14/snapper/Filesystem.cc 2012-08-22 16:52:51.000000000 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Novell, Inc. + * Copyright (c) [2011-2012] Novell, Inc. * * All Rights Reserved. * @@ -25,7 +25,7 @@ #include <sys/types.h> #include <errno.h> #include <unistd.h> -#include <mntent.h> +#include <boost/algorithm/string.hpp> #include "snapper/Log.h" #include "snapper/Filesystem.h" @@ -33,24 +33,77 @@ #include "snapper/SnapperTmpl.h" #include "snapper/SystemCmd.h" #include "snapper/SnapperDefines.h" +#include "snapper/Regex.h" +#include "config.h" namespace snapper { + bool + mount(const string& device, const string& mount_point, const string& mount_type, + const vector<string>& options) + { + string cmd_line = MOUNTBIN " -t " + mount_type + " --read-only"; + + if (!options.empty()) + cmd_line += " -o " + boost::join(options, ","); + + cmd_line += " " + quote(device) + " " + quote(mount_point); + + SystemCmd cmd(cmd_line); + return cmd.retcode() == 0; + } + + + bool + umount(const string& mount_point) + { + SystemCmd cmd(UMOUNTBIN " " + quote(mount_point)); + return cmd.retcode() == 0; + } + + Filesystem* Filesystem::create(const string& fstype, const string& subvolume) { - if (fstype == "btrfs") - return new Btrfs(subvolume); + typedef Filesystem* (*func_t)(const string& fstype, const string& subvolume); - if (fstype == "ext4") - return new Ext4(subvolume); + static const func_t funcs[] = { +#ifdef ENABLE_BTRFS + &Btrfs::create, +#endif +#ifdef ENABLE_EXT4 + &Ext4::create, +#endif +#ifdef ENABLE_LVM + &Lvm::create, +#endif + NULL }; + + for (const func_t* func = funcs; *func != NULL; ++func) + { + Filesystem* fs = (*func)(fstype, subvolume); + if (fs) + return fs; + } + y2err("do not know about fstype '" << fstype << "'"); throw InvalidConfigException(); } +#ifdef ENABLE_BTRFS + Filesystem* + Btrfs::create(const string& fstype, const string& subvolume) + { + if (fstype == "btrfs") + return new Btrfs(subvolume); + + return NULL; + } + + Btrfs::Btrfs(const string& subvolume) : Filesystem(subvolume) { @@ -89,8 +142,8 @@ string Btrfs::snapshotDir(unsigned int num) const { - return (subvolume == "/" ? "" : subvolume) + "/.snapshots/" + - decString(num) + "/snapshot"; + return (subvolume == "/" ? "" : subvolume) + "/.snapshots/" + decString(num) + + "/snapshot"; } @@ -137,6 +190,18 @@ { return checkDir(snapshotDir(num)); } + // ENABLE_BTRFS +#endif + +#ifdef ENABLE_EXT4 + Filesystem* + Ext4::create(const string& fstype, const string& subvolume) + { + if (fstype == "ext4") + return new Ext4(subvolume); + + return NULL; + } Ext4::Ext4(const string& subvolume) @@ -151,13 +216,32 @@ { throw ProgramNotInstalledException(CHATTRBIN " not installed"); } + + bool found = false; + MtabData mtab_data; + + if (!getMtabData(subvolume, found, mtab_data)) + throw InvalidConfigException(); + + if (!found) + { + y2err("filesystem not mounted"); + throw InvalidConfigException(); + } + + mount_options = mtab_data.options; + mount_options.erase(remove(mount_options.begin(), mount_options.end(), "rw"), + mount_options.end()); + mount_options.push_back("noatime"); + mount_options.push_back("loop"); + mount_options.push_back("noload"); } void Ext4::createConfig() const { - int r1 = mkdir((subvolume + "/.snapshots").c_str(), 700); + int r1 = mkdir((subvolume + "/.snapshots").c_str(), 0700); if (r1 == 0) { SystemCmd cmd1(CHATTRBIN " +x " + quote(subvolume + "/.snapshots")); @@ -170,7 +254,7 @@ throw CreateConfigFailedException("mkdir failed"); } - int r2 = mkdir((subvolume + "/.snapshots/.info").c_str(), 700); + int r2 = mkdir((subvolume + "/.snapshots/.info").c_str(), 0700); if (r2 == 0) { SystemCmd cmd2(CHATTRBIN " -x " + quote(subvolume + "/.snapshots/.info")); @@ -250,29 +334,11 @@ bool Ext4::isSnapshotMounted(unsigned int num) const { - FILE* f = setmntent("/etc/mtab", "r"); - if (!f) - { - y2err("setmntent failed"); - throw IsSnapshotMountedFailedException(); - } - bool mounted = false; + MtabData mtab_data; - struct mntent* m; - while ((m = getmntent(f))) - { - if (strcmp(m->mnt_type, "rootfs") == 0) - continue; - - if (m->mnt_dir == snapshotDir(num)) - { - mounted = true; - break; - } - } - - endmntent(f); + if (!getMtabData(snapshotDir(num), mounted, mtab_data)) + throw IsSnapshotMountedFailedException(); return mounted; } @@ -295,9 +361,7 @@ throw MountSnapshotFailedException(); } - SystemCmd cmd2(MOUNTBIN " -t ext4 -r -o loop,noload " + quote(snapshotFile(num)) + - " " + quote(snapshotDir(num))); - if (cmd2.retcode() != 0) + if (!mount(snapshotFile(num), snapshotDir(num), "ext4", mount_options)) throw MountSnapshotFailedException(); } @@ -308,12 +372,11 @@ if (!isSnapshotMounted(num)) return; - SystemCmd cmd1(UMOUNTBIN " " + quote(snapshotDir(num))); - if (cmd1.retcode() != 0) + if (!umount(snapshotDir(num))) throw UmountSnapshotFailedException(); - SystemCmd cmd2(CHSNAPBIN " -n " + quote(snapshotFile(num))); - if (cmd2.retcode() != 0) + SystemCmd cmd1(CHSNAPBIN " -n " + quote(snapshotFile(num))); + if (cmd1.retcode() != 0) throw UmountSnapshotFailedException(); rmdir(snapshotDir(num).c_str()); @@ -325,5 +388,197 @@ { return checkNormalFile(snapshotFile(num)); } + // ENABLE_EXT4 +#endif + +#ifdef ENABLE_LVM + Filesystem* + Lvm::create(const string& fstype, const string& subvolume) + { + if (fstype == "lvm") + return new Lvm(subvolume, "auto"); + + Regex rx("^lvm\\(([_a-z0-9]+)\\)$"); + if (rx.match(fstype)) + return new Lvm(subvolume, rx.cap(1)); + + return NULL; + } + + + Lvm::Lvm(const string& subvolume, const string& mount_type) + : Filesystem(subvolume), mount_type(mount_type) + { + if (access(LVCREATE, X_OK) != 0) + { + throw ProgramNotInstalledException(LVCREATE " not installed"); + } + + bool found = false; + MtabData mtab_data; + + if (!getMtabData(subvolume, found, mtab_data)) + throw InvalidConfigException(); + + if (!found) + { + y2err("filesystem not mounted"); + throw InvalidConfigException(); + } + + if (!detectLvmNames(mtab_data)) + throw InvalidConfigException(); + + mount_options = mtab_data.options; + mount_options.erase(remove(mount_options.begin(), mount_options.end(), "rw"), + mount_options.end()); + mount_options.push_back("noatime"); + if (mount_type == "xfs") + mount_options.push_back("nouuid"); + } + + + void + Lvm::createConfig() const + { + int r1 = mkdir((subvolume + "/.snapshots").c_str(), 0700); + if (r1 != 0 && errno != EEXIST) + { + y2err("mkdir failed errno:" << errno << " (" << strerror(errno) << ")"); + throw CreateConfigFailedException("mkdir failed"); + } + } + + + void + Lvm::deleteConfig() const + { + int r1 = rmdir((subvolume + "/.snapshots").c_str()); + if (r1 != 0) + { + y2err("rmdir failed errno:" << errno << " (" << strerror(errno) << ")"); + throw DeleteConfigFailedException("rmdir failed"); + } + } + + + string + Lvm::infosDir() const + { + return (subvolume == "/" ? "" : subvolume) + "/.snapshots"; + } + + + string + Lvm::snapshotDir(unsigned int num) const + { + return (subvolume == "/" ? "" : subvolume) + "/.snapshots/" + decString(num) + + "/snapshot"; + } + + + string + Lvm::snapshotLvName(unsigned int num) const + { + return lv_name + "-snapshot" + decString(num); + } + + + void + Lvm::createSnapshot(unsigned int num) const + { + sync(); // TODO looks like a bug that this is needed (with ext4) + + SystemCmd cmd(LVCREATE " --snapshot --name " + quote(snapshotLvName(num)) + " " + + quote(vg_name + "/" + lv_name)); + if (cmd.retcode() != 0) + throw CreateSnapshotFailedException(); + + int r1 = mkdir(snapshotDir(num).c_str(), 0700); + if (r1 != 0 && errno != EEXIST) + { + y2err("mkdir failed errno:" << errno << " (" << strerror(errno) << ")"); + throw CreateSnapshotFailedException(); + } + } + + + void + Lvm::deleteSnapshot(unsigned int num) const + { + SystemCmd cmd(LVREMOVE " --force " + quote(vg_name + "/" + snapshotLvName(num))); + if (cmd.retcode() != 0) + throw DeleteSnapshotFailedException(); + + rmdir(snapshotDir(num).c_str()); + } + + + bool + Lvm::isSnapshotMounted(unsigned int num) const + { + bool mounted = false; + MtabData mtab_data; + + if (!getMtabData(snapshotDir(num), mounted, mtab_data)) + throw IsSnapshotMountedFailedException(); + + return mounted; + } + + + void + Lvm::mountSnapshot(unsigned int num) const + { + if (isSnapshotMounted(num)) + return; + + if (!mount(getDevice(num), snapshotDir(num), mount_type, mount_options)) + throw MountSnapshotFailedException(); + } + + + void + Lvm::umountSnapshot(unsigned int num) const + { + if (!isSnapshotMounted(num)) + return; + + if (!umount(snapshotDir(num))) + throw UmountSnapshotFailedException(); + } + + + bool + Lvm::checkSnapshot(unsigned int num) const + { + return checkAnything(getDevice(num)); + } + + + bool + Lvm::detectLvmNames(const MtabData& mtab_data) + { + Regex rx("^/dev/mapper/(.+[^-])-([^-].+)$"); + if (rx.match(mtab_data.device)) + { + vg_name = boost::replace_all_copy(rx.cap(1), "--", "-"); + lv_name = boost::replace_all_copy(rx.cap(2), "--", "-"); + return true; + } + + y2err("could not detect lvm names from '" << mtab_data.device << "'"); + return false; + } + + + string + Lvm::getDevice(unsigned int num) const + { + return "/dev/mapper/" + boost::replace_all_copy(vg_name, "-", "--") + "-" + + boost::replace_all_copy(snapshotLvName(num), "-", "--"); + } + // ENABLE_LVM +#endif } 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.11/snapper/Filesystem.h new/snapper-0.0.14/snapper/Filesystem.h --- old/snapper-0.0.11/snapper/Filesystem.h 2012-04-26 14:22:11.000000000 +0200 +++ new/snapper-0.0.14/snapper/Filesystem.h 2012-08-22 16:48:20.000000000 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Novell, Inc. + * Copyright (c) [2011-2012] Novell, Inc. * * All Rights Reserved. * @@ -25,14 +25,18 @@ #include <string> +#include <vector> +#include "config.h" namespace snapper { using std::string; + using std::vector; class Snapper; + class MtabData; class Filesystem @@ -44,7 +48,7 @@ static Filesystem* create(const string& fstype, const string& subvolume); - virtual string name() const = 0; + virtual string fstype() const = 0; virtual void createConfig() const = 0; virtual void deleteConfig() const = 0; @@ -67,14 +71,16 @@ }; - +#ifdef ENABLE_BTRFS class Btrfs : public Filesystem { public: + static Filesystem* create(const string& fstype, const string& subvolume); + Btrfs(const string& subvolume); - virtual string name() const { return "btrfs"; } + virtual string fstype() const { return "btrfs"; } virtual void createConfig() const; virtual void deleteConfig() const; @@ -92,15 +98,18 @@ virtual bool checkSnapshot(unsigned int num) const; }; +#endif - +#ifdef ENABLE_EXT4 class Ext4 : public Filesystem { public: + static Filesystem* create(const string& fstype, const string& subvolume); + Ext4(const string& subvolume); - virtual string name() const { return "ext4"; } + virtual string fstype() const { return "ext4"; } virtual void createConfig() const; virtual void deleteConfig() const; @@ -118,7 +127,55 @@ virtual bool checkSnapshot(unsigned int num) const; + private: + + vector<string> mount_options; + + }; +#endif + +#ifdef ENABLE_LVM + class Lvm : public Filesystem + { + public: + + static Filesystem* create(const string& fstype, const string& subvolume); + + Lvm(const string& subvolume, const string& mount_type); + + virtual string fstype() const { return "lvm(" + mount_type + ")"; } + + virtual void createConfig() const; + virtual void deleteConfig() const; + + virtual string infosDir() const; + virtual string snapshotDir(unsigned int num) const; + virtual string snapshotLvName(unsigned int num) const; + + virtual void createSnapshot(unsigned int num) const; + virtual void deleteSnapshot(unsigned int num) const; + + virtual bool isSnapshotMounted(unsigned int num) const; + virtual void mountSnapshot(unsigned int num) const; + virtual void umountSnapshot(unsigned int num) const; + + virtual bool checkSnapshot(unsigned int num) const; + + private: + + const string mount_type; + + bool detectLvmNames(const MtabData& mtab_data); + + string getDevice(unsigned int num) const; + + string vg_name; + string lv_name; + + vector<string> mount_options; + }; +#endif } 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.11/snapper/Logger.cc new/snapper-0.0.14/snapper/Logger.cc --- old/snapper-0.0.11/snapper/Logger.cc 2012-06-12 13:40:43.000000000 +0200 +++ new/snapper-0.0.14/snapper/Logger.cc 2012-08-22 16:47:09.000000000 +0200 @@ -37,7 +37,10 @@ using namespace std; - string filename = "/var/log/snapper.log"; + // Use a pointer to avoid a global destructor. Otherwise the Snapper + // destructor in Factory.cc can be called after when logging does not work + // anymore. TODO: nicer solution. + string* filename = new string("/var/log/snapper.log"); LogDo log_do = NULL; LogQuery log_query = NULL; @@ -66,7 +69,7 @@ string prefix = sformat("%s %s libsnapper(%d) %s(%s):%d", datetime(time(0), false, true).c_str(), ln[level], getpid(), file, func, line); - FILE* f = fopen(filename.c_str(), "a"); + FILE* f = fopen(filename->c_str(), "a"); if (f) { string tmp = text; @@ -130,14 +133,16 @@ void initDefaultLogger() { - filename = "/var/log/snapper.log"; + delete filename; + filename = new string("/var/log/snapper.log"); if (geteuid()) { struct passwd* pw = getpwuid(geteuid()); if (pw) { - filename = string(pw->pw_dir) + "/.snapper.log"; + delete filename; + filename = new string(string(pw->pw_dir) + "/.snapper.log"); } } 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.11/snapper/Makefile.am new/snapper-0.0.14/snapper/Makefile.am --- old/snapper-0.0.11/snapper/Makefile.am 2012-06-11 16:34:12.000000000 +0200 +++ new/snapper-0.0.14/snapper/Makefile.am 2012-08-28 12:24:30.000000000 +0200 @@ -2,7 +2,7 @@ # Makefile.am for snapper/snapper # -AM_CXXFLAGS = -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2 +AM_CXXFLAGS = -D_FILE_OFFSET_BITS=64 -DLIBDIR=\"$(libdir)\" -I/usr/include/libxml2 lib_LTLIBRARIES = libsnapper.la 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.11/snapper/Snapper.cc new/snapper-0.0.14/snapper/Snapper.cc --- old/snapper-0.0.11/snapper/Snapper.cc 2012-04-26 14:22:11.000000000 +0200 +++ new/snapper-0.0.14/snapper/Snapper.cc 2012-08-28 12:24:15.000000000 +0200 @@ -71,7 +71,7 @@ config->getValue("FSTYPE", fstype); filesystem = Filesystem::create(fstype, subvolume); - y2mil("subvolume:" << subvolume << " filesystem:" << filesystem->name()); + y2mil("subvolume:" << subvolume << " filesystem:" << filesystem->fstype()); if (!disable_filters) loadIgnorePatterns(); @@ -628,7 +628,7 @@ { SysconfigFile config(CONFIGSDIR "/" + config_name); config.setValue("SUBVOLUME", subvolume); - config.setValue("FSTYPE", fstype); + config.setValue("FSTYPE", filesystem->fstype()); } catch (const FileNotFoundException& e) { 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.11/snapper/SnapperDefines.h new/snapper-0.0.14/snapper/SnapperDefines.h --- old/snapper-0.0.11/snapper/SnapperDefines.h 2012-04-26 14:22:11.000000000 +0200 +++ new/snapper-0.0.14/snapper/SnapperDefines.h 2012-08-28 12:08:18.000000000 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) [2004-2011] Novell, Inc. + * Copyright (c) [2004-2012] Novell, Inc. * * All Rights Reserved. * @@ -35,7 +35,7 @@ #define CHSNAPBIN "/sbin/chsnap" -#define COMPAREDIRSBIN "/usr/lib/snapper/bin/compare-dirs" +#define COMPAREDIRSBIN LIBDIR "/snapper/bin/compare-dirs" #define NICEBIN "/usr/bin/nice" #define IONICEBIN "/usr/bin/ionice" @@ -49,5 +49,8 @@ #define MOUNTBIN "/bin/mount" #define UMOUNTBIN "/bin/umount" +#define LVCREATE "/sbin/lvcreate" +#define LVREMOVE "/sbin/lvremove" + #endif 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.11/snapper.spec.in new/snapper-0.0.14/snapper.spec.in --- old/snapper-0.0.11/snapper.spec.in 2012-06-11 14:35:53.000000000 +0200 +++ new/snapper-0.0.14/snapper.spec.in 2012-08-28 12:17:42.000000000 +0200 @@ -61,7 +61,7 @@ automake --add-missing --copy autoconf -./configure --libdir=%{_libdir} --prefix=%{prefix} --mandir=%{_mandir} --disable-silent-rules +./configure --libdir=%{_libdir} --prefix=%{prefix} --mandir=%{_mandir} --docdir=%{prefix}/share/doc/packages/snapper --disable-silent-rules make %{?jobs:-j%jobs} %install @@ -121,9 +121,9 @@ %else %config(noreplace) %{_sysconfdir}/sysconfig/snapper %endif -%dir %{prefix}/lib/snapper -%dir %{prefix}/lib/snapper/bin -%{prefix}/lib/snapper/bin/compare-dirs +%dir %{_libdir}/snapper +%dir %{_libdir}/snapper/bin +%{_libdir}/snapper/bin/compare-dirs %post -n libsnapper@LIBVERSION_MAJOR@ /sbin/ldconfig @@ -190,6 +190,6 @@ %dir /usr/lib/zypp/plugins %dir /usr/lib/zypp/plugins/commit %endif -/usr/lib/zypp/plugins/commit/snapper.py +/usr/lib/zypp/plugins/commit/snapper.py* %changelog 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.11/tools/Makefile.am new/snapper-0.0.14/tools/Makefile.am --- old/snapper-0.0.11/tools/Makefile.am 2012-04-26 14:22:11.000000000 +0200 +++ new/snapper-0.0.14/tools/Makefile.am 2012-08-28 10:05:12.000000000 +0200 @@ -7,7 +7,7 @@ INCLUDES = -I$(top_srcdir) -toolsbindir = /usr/lib/snapper/bin +toolsbindir = $(libdir)/snapper/bin toolsbin_PROGRAMS = compare-dirs -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org