Hello community, here is the log from the commit of package snapper for openSUSE:Factory checked in at 2012-06-13 22:46:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/snapper (Old) and /work/SRC/openSUSE:Factory/.snapper.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "snapper", Maintainer is "[email protected]" Changes: -------- --- /work/SRC/openSUSE:Factory/snapper/snapper.changes 2012-03-17 13:23:20.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.snapper.new/snapper.changes 2012-06-13 22:46:25.000000000 +0200 @@ -1,0 +2,6 @@ +Tue Jun 12 10:07:08 CEST 2012 - [email protected] + +- removed blocxx (fate #313242) +- 0.0.11 + +------------------------------------------------------------------- Old: ---- snapper-0.0.10.tar.bz2 New: ---- snapper-0.0.11.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ snapper.spec ++++++ --- /var/tmp/diff_new_pack.XiZdPP/_old 2012-06-13 22:46:26.000000000 +0200 +++ /var/tmp/diff_new_pack.XiZdPP/_new 2012-06-13 22:46:26.000000000 +0200 @@ -16,30 +16,31 @@ # - Name: snapper -Version: 0.0.10 +Version: 0.0.11 Release: 0 -License: GPL-2.0 -Group: System/Packages BuildRoot: %{_tmppath}/%{name}-%{version}-build Source: snapper-%{version}.tar.bz2 Patch1: no-readonly.diff Prefix: /usr -BuildRequires: boost-devel doxygen gcc-c++ libtool libxml2-devel -BuildRequires: python-devel swig -%if 0%{?suse_version} -BuildRequires: libblocxx-devel -%if 0%{?suse_version} >= 1210 +BuildRequires: boost-devel +BuildRequires: doxygen +BuildRequires: gcc-c++ +BuildRequires: libtool +BuildRequires: libxml2-devel +BuildRequires: python-devel +BuildRequires: swig +%if (0%{?suse_version} && 0%{?suse_version} >= 1210) BuildRequires: libzypp(plugin:commit) %endif -%endif Requires: libsnapper1 = %version %if 0%{?suse_version} Recommends: cron logrotate snapper-zypp-plugin Supplements: btrfsprogs %endif Summary: Tool for filesystem snapshot management +License: GPL-2.0 +Group: System/Packages Url: http://en.opensuse.org/Portal:Snapper %description @@ -96,7 +97,8 @@ %package -n libsnapper1 Summary: Library for filesystem snapshot management Group: System/Libraries -Requires: diffutils util-linux +Requires: diffutils +Requires: util-linux %if 0%{?suse_version} PreReq: %fillup_prereq %endif @@ -139,11 +141,11 @@ /sbin/ldconfig %package -n libsnapper-devel +Requires: boost-devel +Requires: gcc-c++ Requires: libsnapper1 = %version -Requires: gcc-c++ libstdc++-devel boost-devel libxml2-devel -%if 0%{?suse_version} -Requires: blocxx-devel -%endif +Requires: libstdc++-devel +Requires: libxml2-devel Summary: Header files and documentation for libsnapper Group: Development/Languages/C and C++ @@ -178,7 +180,9 @@ %attr(755,root,root) %{python_sitearch}/_libsnapper.so %package -n snapper-zypp-plugin -Requires: snapper libzypp(plugin:commit) zypp-plugin-python +Requires: snapper +Requires: zypp-plugin-python +Requires: libzypp(plugin:commit) Summary: A zypp commit plugin for calling snapper Group: System/Packages ++++++ snapper-0.0.10.tar.bz2 -> snapper-0.0.11.tar.bz2 ++++++ ++++ 17296 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.10/LIBVERSION new/snapper-0.0.11/LIBVERSION --- old/snapper-0.0.10/LIBVERSION 2011-10-12 15:20:19.000000000 +0200 +++ new/snapper-0.0.11/LIBVERSION 2012-06-12 10:06:56.000000000 +0200 @@ -1 +1 @@ -1.5.0 +1.6.0 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.10/VERSION new/snapper-0.0.11/VERSION --- old/snapper-0.0.10/VERSION 2012-03-06 17:23:43.000000000 +0100 +++ new/snapper-0.0.11/VERSION 2012-06-12 10:08:30.000000000 +0200 @@ -1 +1 @@ -0.0.10 +0.0.11 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.10/bindings/python/libsnapper.py new/snapper-0.0.11/bindings/python/libsnapper.py --- old/snapper-0.0.10/bindings/python/libsnapper.py 2011-12-23 15:34:43.000000000 +0100 +++ new/snapper-0.0.11/bindings/python/libsnapper.py 2012-06-13 12:41:52.000000000 +0200 @@ -1,9 +1,10 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.40 +# Version 2.0.4 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. -# This file is compatible with both classic and new-style classes. + + from sys import version_info if version_info >= (2,6,0): @@ -39,7 +40,7 @@ return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) - if (not static) or hasattr(self,name): + if (not static): self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self) @@ -839,6 +840,10 @@ def __nonzero__(self): return _libsnapper.mapstringstring___nonzero__(self) def __bool__(self): return _libsnapper.mapstringstring___bool__(self) def __len__(self): return _libsnapper.mapstringstring___len__(self) + def __iter__(self): return self.key_iterator() + def iterkeys(self): return self.key_iterator() + def itervalues(self): return self.value_iterator() + def iteritems(self): return self.iterator() def __getitem__(self, *args): return _libsnapper.mapstringstring___getitem__(self, *args) def __delitem__(self, *args): return _libsnapper.mapstringstring___delitem__(self, *args) def has_key(self, *args): return _libsnapper.mapstringstring_has_key(self, *args) @@ -848,11 +853,8 @@ def __contains__(self, *args): return _libsnapper.mapstringstring___contains__(self, *args) def key_iterator(self): return _libsnapper.mapstringstring_key_iterator(self) def value_iterator(self): return _libsnapper.mapstringstring_value_iterator(self) - def __iter__(self): return self.key_iterator() - def iterkeys(self): return self.key_iterator() - def itervalues(self): return self.value_iterator() - def iteritems(self): return self.iterator() def __setitem__(self, *args): return _libsnapper.mapstringstring___setitem__(self, *args) + def asdict(self): return _libsnapper.mapstringstring_asdict(self) def __init__(self, *args): this = _libsnapper.new_mapstringstring(*args) try: self.this.append(this) @@ -1037,5 +1039,6 @@ listSnapshot_swigregister = _libsnapper.listSnapshot_swigregister listSnapshot_swigregister(listSnapshot) +# This file is compatible with both classic and new-style classes. 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.10/config.h.in new/snapper-0.0.11/config.h.in --- old/snapper-0.0.10/config.h.in 2012-03-15 11:00:30.000000000 +0100 +++ new/snapper-0.0.11/config.h.in 2012-06-13 12:41:34.000000000 +0200 @@ -6,9 +6,6 @@ /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H -/* Define if you have libblocxx */ -#undef HAVE_LIBBLOCXX - /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_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.10/configure.in new/snapper-0.0.11/configure.in --- old/snapper-0.0.10/configure.in 2012-02-27 15:34:47.000000000 +0100 +++ new/snapper-0.0.11/configure.in 2012-06-11 14:35:04.000000000 +0200 @@ -25,12 +25,6 @@ AC_PREFIX_DEFAULT(/usr) -dnl Check for blocxx -AC_CHECK_LIB(blocxx, main, - AC_SUBST([LIBBLOCXX], ["-lblocxx"]) - AC_DEFINE([HAVE_LIBBLOCXX], [1], - [Define if you have libblocxx])) - dnl Automake 1.11 enables silent compilation dnl Disable it by "configure --disable-silent-rules" or "make V=1" m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 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.10/doc/snapper.8 new/snapper-0.0.11/doc/snapper.8 --- old/snapper-0.0.10/doc/snapper.8 2012-03-15 11:00:39.000000000 +0100 +++ new/snapper-0.0.11/doc/snapper.8 2012-06-13 12:41:38.000000000 +0200 @@ -1,4 +1,4 @@ -.TH "snapper" "8" 0.0.10 "snapper" "System Tools" +.TH "SNAPPER" "8" "2012-03-20" "0.0.11" "Filesystem Snapshot Management" .SH "NAME" .LP snapper - Command\-line program for filesystem snapshot management @@ -111,7 +111,7 @@ .TP .B create-config [options] <subvolume> Create a new configuration for a filesystem or subvolume. For this command you -will likely need to global option \fI--config\fR, see \fBGLOBAL OPTIONS\fR and +will likely need the global option \fI--config\fR, see \fBGLOBAL OPTIONS\fR and \fBCONCEPTS\fR. .TP \fI\-f, \-\-fstype\fR <fstype> 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.10/doc/snapper.8.in new/snapper-0.0.11/doc/snapper.8.in --- old/snapper-0.0.10/doc/snapper.8.in 2012-03-06 17:23:43.000000000 +0100 +++ new/snapper-0.0.11/doc/snapper.8.in 2012-04-26 14:22:11.000000000 +0200 @@ -1,4 +1,4 @@ -.TH "snapper" "8" @VERSION@ "snapper" "System Tools" +.TH "SNAPPER" "8" "2012-03-20" "@VERSION@" "Filesystem Snapshot Management" .SH "NAME" .LP snapper - Command\-line program for filesystem snapshot management @@ -111,7 +111,7 @@ .TP .B create-config [options] <subvolume> Create a new configuration for a filesystem or subvolume. For this command you -will likely need to global option \fI--config\fR, see \fBGLOBAL OPTIONS\fR and +will likely need the global option \fI--config\fR, see \fBGLOBAL OPTIONS\fR and \fBCONCEPTS\fR. .TP \fI\-f, \-\-fstype\fR <fstype> 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.10/scripts/snapper-daily new/snapper-0.0.11/scripts/snapper-daily --- old/snapper-0.0.10/scripts/snapper-daily 2011-03-07 11:06:22.000000000 +0100 +++ new/snapper-0.0.11/scripts/snapper-daily 2012-04-26 14:22:11.000000000 +0200 @@ -9,7 +9,7 @@ # -# get information from /etc/sysconfig +# get information from /etc/sysconfig/snapper # if [ -f /etc/sysconfig/snapper ] ; then . /etc/sysconfig/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.10/scripts/snapper-hourly new/snapper-0.0.11/scripts/snapper-hourly --- old/snapper-0.0.10/scripts/snapper-hourly 2011-06-29 12:44:00.000000000 +0200 +++ new/snapper-0.0.11/scripts/snapper-hourly 2012-04-26 14:22:11.000000000 +0200 @@ -9,7 +9,7 @@ # -# get information from /etc/sysconfig +# get information from /etc/sysconfig/snapper # if [ -f /etc/sysconfig/snapper ] ; then . /etc/sysconfig/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.10/snapper/Log.cc new/snapper-0.0.11/snapper/Log.cc --- old/snapper-0.0.10/snapper/Log.cc 2012-03-15 11:00:15.000000000 +0100 +++ new/snapper-0.0.11/snapper/Log.cc 2012-06-12 13:51:46.000000000 +0200 @@ -20,21 +20,6 @@ */ -#include <pwd.h> -#include <unistd.h> -#include <sys/types.h> -#include <libxml/tree.h> -#include <string> - -#include "config.h" - -#ifdef HAVE_LIBBLOCXX -#include <blocxx/AppenderLogger.hpp> -#include <blocxx/FileAppender.hpp> -#include <blocxx/Logger.hpp> -#include <blocxx/LogMessage.hpp> -#endif - #include "snapper/Log.h" #include "snapper/AppUtil.h" @@ -43,99 +28,14 @@ { using namespace std; -#ifdef HAVE_LIBBLOCXX - - using namespace blocxx; - - static const String component = "libsnapper"; - -#else - - string filename; - -#endif - - - void createLogger(const string& name, const string& logpath, const string& logfile) - { -#ifdef HAVE_LIBBLOCXX - - if (logpath != "NULL" && logfile != "NULL") - { - String nm = name.c_str(); - LoggerConfigMap configItems; - LogAppenderRef logApp; - if (logpath != "STDERR" && logfile != "STDERR" && - logpath != "SYSLOG" && logfile != "SYSLOG") - { - String StrKey; - String StrPath; - StrKey.format("log.%s.location", name.c_str()); - StrPath = (logpath + "/" + logfile).c_str(); - configItems[StrKey] = StrPath; - logApp = - LogAppender::createLogAppender(nm, LogAppender::ALL_COMPONENTS, - LogAppender::ALL_CATEGORIES, - "%d %-5p %c(%P) %F(%M):%L - %m", - LogAppender::TYPE_FILE, - configItems); - } - else if (logpath == "STDERR" && logfile == "STDERR") - { - logApp = - LogAppender::createLogAppender(nm, LogAppender::ALL_COMPONENTS, - LogAppender::ALL_CATEGORIES, - "%d %-5p %c(%P) %F(%M):%L - %m", - LogAppender::TYPE_STDERR, - configItems); - } - else - { - logApp = - LogAppender::createLogAppender(nm, LogAppender::ALL_COMPONENTS, - LogAppender::ALL_CATEGORIES, - "%d %-5p %c(%P) %F(%M):%L - %m", - LogAppender::TYPE_SYSLOG, - configItems); - } - - LogAppender::setDefaultLogAppender(logApp); - } - -#else - filename = logpath + "/" + logfile; - -#endif - } + const string component = "libsnapper"; bool testLogLevel(LogLevel level) { -#ifdef HAVE_LIBBLOCXX - - ELogLevel curLevel = LogAppender::getCurrentLogAppender()->getLogLevel(); - - switch (level) - { - case DEBUG: - return false; // curLevel >= E_DEBUG_LEVEL; - case MILESTONE: - return curLevel >= E_INFO_LEVEL; - case WARNING: - return curLevel >= E_WARNING_LEVEL; - case ERROR: - return curLevel >= E_ERROR_LEVEL; - default: - return curLevel >= E_FATAL_ERROR_LEVEL; - } - -#else - - return level != DEBUG; - -#endif + return callLogQuery(level, component); } @@ -161,125 +61,8 @@ logStreamClose(LogLevel level, const char* file, unsigned line, const char* func, ostringstream* stream) { -#ifdef HAVE_LIBBLOCXX - - ELogLevel curLevel = LogAppender::getCurrentLogAppender()->getLogLevel(); - String category; - - switch (level) - { - case DEBUG: - if (curLevel >= E_DEBUG_LEVEL) - category = Logger::STR_DEBUG_CATEGORY; - break; - case MILESTONE: - if (curLevel >= E_INFO_LEVEL) - category = Logger::STR_INFO_CATEGORY; - break; - case WARNING: - if (curLevel >= E_WARNING_LEVEL) - category = Logger::STR_WARNING_CATEGORY; - break; - case ERROR: - if (curLevel >= E_ERROR_LEVEL) - category = Logger::STR_ERROR_CATEGORY; - break; - default: - if (curLevel >= E_FATAL_ERROR_LEVEL) - category = Logger::STR_FATAL_CATEGORY; - break; - } - - if (!category.empty()) - { - string tmp = stream->str(); - - string::size_type pos1 = 0; - - while (true) - { - string::size_type pos2 = tmp.find('\n', pos1); - - if (pos2 != string::npos || pos1 != tmp.length()) - LogAppender::getCurrentLogAppender()->logMessage(LogMessage(component, category, - String(tmp.substr(pos1, pos2 - pos1)), - file, line, func)); - - if (pos2 == string::npos) - break; - - pos1 = pos2 + 1; - } - } - -#else - - static const char* ln[4] = { "DEB", "MIL", "WAR", "ERR" }; - - 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"); - - string tmp = stream->str(); - - string::size_type pos1 = 0; - - while (true) - { - string::size_type pos2 = tmp.find('\n', pos1); - - if (pos2 != string::npos || pos1 != tmp.length()) - fprintf(f, "%s - %s\n", prefix.c_str(), tmp.substr(pos1, pos2 - pos1).c_str()); - - if (pos2 == string::npos) - break; - - pos1 = pos2 + 1; - } - - fclose(f); - -#endif - + callLogDo(level, component, file, line, func, stream->str()); delete stream; } - - void - xml_error_func(void* ctx, const char* msg, ...) - { - } - - xmlGenericErrorFunc xml_error_func_ptr = &xml_error_func; - - - void initDefaultLogger() - { - string path; - string file; - if (geteuid()) - { - struct passwd* pw = getpwuid(geteuid()); - if (pw) - { - path = pw->pw_dir; - file = "snapper.log"; - } - else - { - path = "/"; - file = "snapper.log"; - } - } - else - { - path = "/var/log"; - file = "snapper.log"; - } - createLogger("default", path, file); - - initGenericErrorDefaultFunc(&xml_error_func_ptr); - } - } 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.10/snapper/Log.h new/snapper-0.0.11/snapper/Log.h --- old/snapper-0.0.10/snapper/Log.h 2011-10-12 15:20:19.000000000 +0200 +++ new/snapper-0.0.11/snapper/Log.h 2012-06-12 10:11:36.000000000 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) [2004-2011] Novell, Inc. + * Copyright (c) [2004-2012] Novell, Inc. * * All Rights Reserved. * @@ -24,7 +24,8 @@ #define SNAPPER_LOG_H #include <sstream> -#include <string> + +#include "Logger.h" namespace snapper @@ -32,10 +33,6 @@ using std::string; - enum LogLevel { DEBUG, MILESTONE, WARNING, ERROR }; - - void createLogger(const string& name, const string& logpath, const string& logfile); - bool testLogLevel(LogLevel level); void prepareLogStream(std::ostringstream& stream); @@ -45,8 +42,6 @@ void logStreamClose(LogLevel level, const char* file, unsigned line, const char* func, std::ostringstream*); - void initDefaultLogger(); - #define y2deb(op) y2log_op(snapper::DEBUG, __FILE__, __LINE__, __FUNCTION__, op) #define y2mil(op) y2log_op(snapper::MILESTONE, __FILE__, __LINE__, __FUNCTION__, op) #define y2war(op) y2log_op(snapper::WARNING, __FILE__, __LINE__, __FUNCTION__, op) 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.10/snapper/Logger.cc new/snapper-0.0.11/snapper/Logger.cc --- old/snapper-0.0.10/snapper/Logger.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/snapper-0.0.11/snapper/Logger.cc 2012-06-12 13:40:43.000000000 +0200 @@ -0,0 +1,150 @@ +/* + * Copyright (c) [2004-2012] Novell, Inc. + * + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, contact Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, you may + * find current contact information at www.novell.com. + */ + + +#include <pwd.h> +#include <unistd.h> +#include <sys/types.h> +#include <libxml/tree.h> +#include <string> + +#include "config.h" + +#include "snapper/Log.h" +#include "snapper/AppUtil.h" + + +namespace snapper +{ + using namespace std; + + + string filename = "/var/log/snapper.log"; + + LogDo log_do = NULL; + LogQuery log_query = NULL; + + + void + setLogDo(LogDo new_log_do) + { + log_do = new_log_do; + } + + + void + setLogQuery(LogQuery new_log_query) + { + log_query = new_log_query; + } + + + static void + simple_log_do(LogLevel level, const string& component, const char* file, int line, + const char* func, const string& text) + { + static const char* ln[4] = { "DEB", "MIL", "WAR", "ERR" }; + + 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"); + if (f) + { + string tmp = text; + + string::size_type pos1 = 0; + + while (true) + { + string::size_type pos2 = tmp.find('\n', pos1); + + if (pos2 != string::npos || pos1 != tmp.length()) + fprintf(f, "%s - %s\n", prefix.c_str(), tmp.substr(pos1, pos2 - pos1).c_str()); + + if (pos2 == string::npos) + break; + + pos1 = pos2 + 1; + } + + fclose(f); + } + } + + + static bool + simple_log_query(LogLevel level, const string& component) + { + return level != DEBUG; + } + + + void + callLogDo(LogLevel level, const string& component, const char* file, int line, + const char* func, const string& text) + { + if (log_do) + (log_do)(level, component, file, line, func, text); + else + simple_log_do(level, component, file, line, func, text); + } + + + bool + callLogQuery(LogLevel level, const string& component) + { + if (log_query) + return (log_query)(level, component); + else + return simple_log_query(level, component); + } + + + void + xml_error_func(void* ctx, const char* msg, ...) + { + } + + xmlGenericErrorFunc xml_error_func_ptr = &xml_error_func; + + + void + initDefaultLogger() + { + filename = "/var/log/snapper.log"; + + if (geteuid()) + { + struct passwd* pw = getpwuid(geteuid()); + if (pw) + { + filename = string(pw->pw_dir) + "/.snapper.log"; + } + } + + log_do = NULL; + log_query = NULL; + + initGenericErrorDefaultFunc(&xml_error_func_ptr); + } + +} 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.10/snapper/Logger.h new/snapper-0.0.11/snapper/Logger.h --- old/snapper-0.0.10/snapper/Logger.h 1970-01-01 01:00:00.000000000 +0100 +++ new/snapper-0.0.11/snapper/Logger.h 2012-06-12 13:40:04.000000000 +0200 @@ -0,0 +1,57 @@ +/* + * Copyright (c) [2011-2012] Novell, Inc. + * + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, contact Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, you may + * find current contact information at www.novell.com. + */ + + +#ifndef SNAPPER_LOGGER_H +#define SNAPPER_LOGGER_H + +#include <string> + + +namespace snapper +{ + using std::string; + + + enum LogLevel { DEBUG, MILESTONE, WARNING, ERROR }; + + /* + * Called function should be able to split content at newlines. + */ + typedef void (*LogDo)(LogLevel level, const string& component, const char* file, int line, + const char* func, const string& content); + + typedef bool (*LogQuery)(LogLevel level, const string& component); + + void setLogDo(LogDo log_do); + + void setLogQuery(LogQuery log_query); + + void callLogDo(LogLevel level, const string& component, const char* file, int line, + const char* func, const string& text); + + bool callLogQuery(LogLevel level, const string& component); + + void initDefaultLogger(); + +} + +#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.10/snapper/Makefile.am new/snapper-0.0.11/snapper/Makefile.am --- old/snapper-0.0.10/snapper/Makefile.am 2012-02-27 15:34:47.000000000 +0100 +++ new/snapper-0.0.11/snapper/Makefile.am 2012-06-11 16:34:12.000000000 +0200 @@ -17,6 +17,7 @@ Enum.cc Enum.h \ AppUtil.cc AppUtil.h \ Log.cc Log.h \ + Logger.cc Logger.h \ Compare.cc Compare.h \ SystemCmd.cc SystemCmd.h \ AsciiFile.cc AsciiFile.h \ @@ -27,7 +28,7 @@ SnapperDefines.h libsnapper_la_LDFLAGS = -version-info @LIBVERSION_INFO@ -libsnapper_la_LIBADD = @LIBBLOCXX@ -lxml2 -lz -lm +libsnapper_la_LIBADD = -lxml2 -lz -lm pkgincludedir = $(includedir)/snapper @@ -37,5 +38,6 @@ Snapshot.h \ File.h \ Comparison.h \ - Exception.h + Exception.h \ + Logger.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.10/snapper.spec.in new/snapper-0.0.11/snapper.spec.in --- old/snapper-0.0.10/snapper.spec.in 2012-02-29 18:38:35.000000000 +0100 +++ new/snapper-0.0.11/snapper.spec.in 2012-06-11 14:35:53.000000000 +0200 @@ -27,12 +27,9 @@ Prefix: /usr BuildRequires: boost-devel doxygen gcc-c++ libtool libxml2-devel BuildRequires: python-devel swig -%if 0%{?suse_version} -BuildRequires: libblocxx-devel -%if 0%{?suse_version} >= 1210 +%if (0%{?suse_version} && 0%{?suse_version} >= 1210) BuildRequires: libzypp(plugin:commit) %endif -%endif Requires: libsnapper@LIBVERSION_MAJOR@ = %version %if 0%{?suse_version} Recommends: cron logrotate snapper-zypp-plugin @@ -140,9 +137,6 @@ %package -n libsnapper-devel Requires: libsnapper@LIBVERSION_MAJOR@ = %version Requires: gcc-c++ libstdc++-devel boost-devel libxml2-devel -%if 0%{?suse_version} -Requires: blocxx-devel -%endif Summary: Header files and documentation for libsnapper Group: Development/Languages/C and C++ -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
