Hello community, here is the log from the commit of package libstorage for openSUSE:Factory checked in at 2012-06-13 22:47:44 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libstorage (Old) and /work/SRC/openSUSE:Factory/.libstorage.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libstorage", Maintainer is "aschn...@suse.com" Changes: -------- --- /work/SRC/openSUSE:Factory/libstorage/libstorage.changes 2012-05-31 17:06:33.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.libstorage.new/libstorage.changes 2012-06-13 22:48:08.000000000 +0200 @@ -1,0 +2,6 @@ +Tue Jun 12 11:07:04 CEST 2012 - f...@suse.de + +- 2.22.5 +- get rid of usage of blocxx for logging purposes + +------------------------------------------------------------------- Old: ---- libstorage-2.22.4.tar.bz2 New: ---- libstorage-2.22.5.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libstorage.spec ++++++ --- /var/tmp/diff_new_pack.ELQm1h/_old 2012-06-13 22:48:09.000000000 +0200 +++ /var/tmp/diff_new_pack.ELQm1h/_new 2012-06-13 22:48:09.000000000 +0200 @@ -17,14 +17,13 @@ Name: libstorage -Version: 2.22.4 +Version: 2.22.5 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build Source: libstorage-%{version}.tar.bz2 Prefix: /usr -BuildRequires: blocxx-devel BuildRequires: boost-devel BuildRequires: dejagnu BuildRequires: doxygen @@ -98,7 +97,11 @@ rm -f $RPM_BUILD_ROOT/%{python_sitearch}/_libstorage.a rm -f $RPM_BUILD_ROOT/%{python_sitearch}/_libstorage.la %if 0%{?suse_version} -rm $RPM_BUILD_ROOT/%{rb_vendorarchdir}/storage.la +%if "%{?rb_vendorarchdir}" != "" +rm -f $RPM_BUILD_ROOT/%{rb_vendorarchdir}/storage.la +%else +rm -f $RPM_BUILD_ROOT/%{rb_vendorarch}/storage.la +%endif %endif %if 0%{?mandriva_version} rm $RPM_BUILD_ROOT/%{ruby_sitearchdir}/storage.la @@ -166,7 +169,6 @@ %package -n libstorage-devel -Requires: blocxx-devel Requires: boost-devel Requires: gcc-c++ Requires: libstdc++-devel @@ -228,7 +230,11 @@ %files -n libstorage-ruby %defattr(-,root,root) %if 0%{?suse_version} +%if "%{?rb_vendorarchdir}" != "" %{rb_vendorarchdir}/storage.so +%else +%{rb_vendorarch}/storage.so +%endif %endif %if 0%{?mandriva_version} %{ruby_sitearchdir}/storage.so ++++++ libstorage-2.22.4.tar.bz2 -> libstorage-2.22.5.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/VERSION new/libstorage-2.22.5/VERSION --- old/libstorage-2.22.4/VERSION 2012-05-29 11:08:49.000000000 +0200 +++ new/libstorage-2.22.5/VERSION 2012-06-12 11:08:14.000000000 +0200 @@ -1 +1 @@ -2.22.4 +2.22.5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/bindings/python/libstorage.py new/libstorage-2.22.5/bindings/python/libstorage.py --- old/libstorage-2.22.4/bindings/python/libstorage.py 2012-05-02 18:11:53.000000000 +0200 +++ new/libstorage-2.22.5/bindings/python/libstorage.py 2012-06-12 14:05:44.000000000 +0200 @@ -1670,9 +1670,21 @@ StorageInterface_swigregister(StorageInterface) -def initDefaultLogger(): - return _libstorage.initDefaultLogger() -initDefaultLogger = _libstorage.initDefaultLogger +def setLogDoCallback(*args): + return _libstorage.setLogDoCallback(*args) +setLogDoCallback = _libstorage.setLogDoCallback + +def getLogDoCallback(): + return _libstorage.getLogDoCallback() +getLogDoCallback = _libstorage.getLogDoCallback + +def setLogQueryCallback(*args): + return _libstorage.setLogQueryCallback(*args) +setLogQueryCallback = _libstorage.setLogQueryCallback + +def getLogQueryCallback(): + return _libstorage.getLogQueryCallback() +getLogQueryCallback = _libstorage.getLogQueryCallback class Environment(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, Environment, name, value) @@ -1706,6 +1718,10 @@ Environment_swigregister = _libstorage.Environment_swigregister Environment_swigregister(Environment) +def initDefaultLogger(*args): + return _libstorage.initDefaultLogger(*args) +initDefaultLogger = _libstorage.initDefaultLogger + def createStorageInterface(*args): return _libstorage.createStorageInterface(*args) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/examples/Makefile.am new/libstorage-2.22.5/examples/Makefile.am --- old/libstorage-2.22.4/examples/Makefile.am 2010-07-29 15:46:59.000000000 +0200 +++ new/libstorage-2.22.5/examples/Makefile.am 2012-06-12 10:12:47.000000000 +0200 @@ -7,7 +7,7 @@ LDADD = ../storage/libstorage.la noinst_PROGRAMS = TestDisk TestDiskLog TestStorage TestProbing TestLvm \ - TestMd TestLoop TestLock SaveGraph ShowBytes + TestMd TestLoop TestLock SaveGraph ShowBytes TestLogging TestDisk_SOURCES = TestDisk.cc @@ -25,6 +25,8 @@ TestLock_SOURCES = TestLock.cc +TestLogging_SOURCES = TestLogging.cc + SaveGraph_SOURCES = SaveGraph.cc ShowBytes_SOURCES = ShowBytes.cc @@ -32,7 +34,7 @@ exampledir = $(docdir)/examples example_DATA = TestDisk.cc TestDiskLog.cc TestProbing.cc TestLvm.cc TestMd.cc \ - TestLoop.cc SaveGraph.cc ShowBytes.cc + TestLoop.cc SaveGraph.cc ShowBytes.cc TestLogging.cc EXTRA_DIST = $(example_DATA) Makefile.example diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/examples/Makefile.in new/libstorage-2.22.5/examples/Makefile.in --- old/libstorage-2.22.4/examples/Makefile.in 2012-05-29 11:09:19.000000000 +0200 +++ new/libstorage-2.22.5/examples/Makefile.in 2012-06-13 14:26:51.000000000 +0200 @@ -42,7 +42,7 @@ noinst_PROGRAMS = TestDisk$(EXEEXT) TestDiskLog$(EXEEXT) \ TestStorage$(EXEEXT) TestProbing$(EXEEXT) TestLvm$(EXEEXT) \ TestMd$(EXEEXT) TestLoop$(EXEEXT) TestLock$(EXEEXT) \ - SaveGraph$(EXEEXT) ShowBytes$(EXEEXT) + SaveGraph$(EXEEXT) ShowBytes$(EXEEXT) TestLogging$(EXEEXT) subdir = examples DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -77,6 +77,10 @@ TestLock_OBJECTS = $(am_TestLock_OBJECTS) TestLock_LDADD = $(LDADD) TestLock_DEPENDENCIES = ../storage/libstorage.la +am_TestLogging_OBJECTS = TestLogging.$(OBJEXT) +TestLogging_OBJECTS = $(am_TestLogging_OBJECTS) +TestLogging_LDADD = $(LDADD) +TestLogging_DEPENDENCIES = ../storage/libstorage.la am_TestLoop_OBJECTS = TestLoop.$(OBJEXT) TestLoop_OBJECTS = $(am_TestLoop_OBJECTS) TestLoop_LDADD = $(LDADD) @@ -125,12 +129,14 @@ am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(SaveGraph_SOURCES) $(ShowBytes_SOURCES) \ $(TestDisk_SOURCES) $(TestDiskLog_SOURCES) $(TestLock_SOURCES) \ - $(TestLoop_SOURCES) $(TestLvm_SOURCES) $(TestMd_SOURCES) \ - $(TestProbing_SOURCES) $(TestStorage_SOURCES) + $(TestLogging_SOURCES) $(TestLoop_SOURCES) $(TestLvm_SOURCES) \ + $(TestMd_SOURCES) $(TestProbing_SOURCES) \ + $(TestStorage_SOURCES) DIST_SOURCES = $(SaveGraph_SOURCES) $(ShowBytes_SOURCES) \ $(TestDisk_SOURCES) $(TestDiskLog_SOURCES) $(TestLock_SOURCES) \ - $(TestLoop_SOURCES) $(TestLvm_SOURCES) $(TestMd_SOURCES) \ - $(TestProbing_SOURCES) $(TestStorage_SOURCES) + $(TestLogging_SOURCES) $(TestLoop_SOURCES) $(TestLvm_SOURCES) \ + $(TestMd_SOURCES) $(TestProbing_SOURCES) \ + $(TestStorage_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -307,11 +313,12 @@ TestMd_SOURCES = TestMd.cc TestLoop_SOURCES = TestLoop.cc TestLock_SOURCES = TestLock.cc +TestLogging_SOURCES = TestLogging.cc SaveGraph_SOURCES = SaveGraph.cc ShowBytes_SOURCES = ShowBytes.cc exampledir = $(docdir)/examples example_DATA = TestDisk.cc TestDiskLog.cc TestProbing.cc TestLvm.cc TestMd.cc \ - TestLoop.cc SaveGraph.cc ShowBytes.cc + TestLoop.cc SaveGraph.cc ShowBytes.cc TestLogging.cc EXTRA_DIST = $(example_DATA) Makefile.example all: all-am @@ -372,6 +379,9 @@ TestLock$(EXEEXT): $(TestLock_OBJECTS) $(TestLock_DEPENDENCIES) @rm -f TestLock$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(TestLock_OBJECTS) $(TestLock_LDADD) $(LIBS) +TestLogging$(EXEEXT): $(TestLogging_OBJECTS) $(TestLogging_DEPENDENCIES) + @rm -f TestLogging$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(TestLogging_OBJECTS) $(TestLogging_LDADD) $(LIBS) TestLoop$(EXEEXT): $(TestLoop_OBJECTS) $(TestLoop_DEPENDENCIES) @rm -f TestLoop$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(TestLoop_OBJECTS) $(TestLoop_LDADD) $(LIBS) @@ -399,6 +409,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestDisk.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestDiskLog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestLock.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestLogging.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestLoop.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestLvm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestMd.Po@am__quote@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/examples/SaveGraph.cc new/libstorage-2.22.5/examples/SaveGraph.cc --- old/libstorage-2.22.4/examples/SaveGraph.cc 2010-07-29 15:46:59.000000000 +0200 +++ new/libstorage-2.22.5/examples/SaveGraph.cc 2012-06-12 11:01:54.000000000 +0200 @@ -11,8 +11,6 @@ int main (int argc, char** argv) { - initDefaultLogger(); - StorageInterface* s = createStorageInterface(Environment(true)); saveDeviceGraph(s, "device.gv"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/examples/TestDisk.cc new/libstorage-2.22.5/examples/TestDisk.cc --- old/libstorage-2.22.4/examples/TestDisk.cc 2010-07-29 15:46:59.000000000 +0200 +++ new/libstorage-2.22.5/examples/TestDisk.cc 2012-06-12 11:02:07.000000000 +0200 @@ -10,7 +10,6 @@ main( int argc_iv, char** argv_ppcv ) { int ret; - initDefaultLogger(); StorageInterface* s = createStorageInterface(Environment(false)); string disk = "/dev/hdb"; string dev; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/examples/TestDiskLog.cc new/libstorage-2.22.5/examples/TestDiskLog.cc --- old/libstorage-2.22.4/examples/TestDiskLog.cc 2010-07-29 15:46:59.000000000 +0200 +++ new/libstorage-2.22.5/examples/TestDiskLog.cc 2012-06-12 11:02:13.000000000 +0200 @@ -11,7 +11,6 @@ main( int argc_iv, char** argv_ppcv ) { int ret; - initDefaultLogger(); StorageInterface* s = createStorageInterface(Environment(false)); string dev; ret = s->destroyPartitionTable("/dev/hdb", s->defaultDiskLabel("/dev/hdb")); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/examples/TestLock.cc new/libstorage-2.22.5/examples/TestLock.cc --- old/libstorage-2.22.4/examples/TestLock.cc 2009-11-02 14:24:29.000000000 +0100 +++ new/libstorage-2.22.5/examples/TestLock.cc 2012-06-12 11:02:18.000000000 +0200 @@ -95,8 +95,6 @@ usage(); } - initDefaultLogger(); - cout << "pid is " << getpid() << endl; Lock* lock = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/examples/TestLogging.cc new/libstorage-2.22.5/examples/TestLogging.cc --- old/libstorage-2.22.4/examples/TestLogging.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-2.22.5/examples/TestLogging.cc 2012-06-12 14:17:18.000000000 +0200 @@ -0,0 +1,151 @@ + +/** + * This program does some basic probing in read-only mode. As a result + * the disk_* and volume_* files in /var/log/YaST2/ will be generated. + */ + +#include <unistd.h> +#include <iostream> +#include <fstream> + +#include <storage/StorageInterface.h> + +using namespace storage; +using namespace std; + +ofstream logstream; +unsigned pid; + +void logDo( int level, const string& component, const char* file, + int line, const char* function, const string& content ) + { + logstream << "<" << level << "> " << component << "(" << pid << ") " + << file << "(" << function << "):" << line << " " + << content << endl; + } + +bool logQuery( int level, const string& component ) + { + return( level>=0 ); + } + +int +main (int argc, char** argv) + { + pid = getpid(); + logstream.open( "/tmp/emil_log", ios_base::app ); + storage::setLogDoCallback( logDo ); + storage::setLogQueryCallback( logQuery ); + StorageInterface* s = createStorageInterface(Environment(true)); + + deque<ContainerInfo> containers; + s->getContainers (containers); + + for (deque<ContainerInfo>::const_iterator i1 = containers.begin(); + i1 != containers.end(); ++i1) + { + switch (i1->type) + { + case DISK: { + + cout << "found container (disk) " << i1->name << '\n'; + + deque<PartitionInfo> partitions; + if (s->getPartitionInfo (i1->name, partitions) != 0) + { + cerr << "getPartitionInfo failed\n"; + exit (EXIT_FAILURE); + } + + for (deque<PartitionInfo>::const_iterator i2 = partitions.begin(); + i2 != partitions.end(); ++i2) + { + cout << " " << i2->v.name << ' '; + switch (i2->partitionType) + { + case PRIMARY: cout << "PRIMARY "; break; + case EXTENDED: cout << "EXTENDED "; break; + case LOGICAL: cout << "LOGICAL "; break; + case PTYPE_ANY: cout << "ANY "; break; + } + switch (i2->v.fs) + { + case FSUNKNOWN: cout << "UNKNOWN"; break; + case REISERFS: cout << "REISERFS"; break; + case EXT2: cout << "EXT2"; break; + case EXT3: cout << "EXT3"; break; + case EXT4: cout << "EXT4"; break; + case BTRFS: cout << "BTRFS"; break; + case VFAT: cout << "VFAT"; break; + case XFS: cout << "XFS"; break; + case JFS: cout << "JFS"; break; + case HFS: cout << "HFS"; break; + case HFSPLUS: cout << "HFSPLUS"; break; + case NTFS: cout << "NTFS"; break; + case SWAP: cout << "SWAP"; break; + case NFS: cout << "NFS"; break; + case NFS4: cout << "NFS4"; break; + case TMPFS: cout << "TMPFS"; break; + case FSNONE: cout << "NONE"; break; + } + cout << '\n'; + } + + } break; + + case MD: + { + cout << "found special container (md) " << i1->name << '\n'; + + deque<MdInfo> mds; + if (s->getMdInfo(mds) != 0) + { + cerr << "getMdInfo failed\n"; + exit (EXIT_FAILURE); + } + + for (deque<MdInfo>::const_iterator i2 = mds.begin(); + i2 != mds.end(); ++i2) + { + cout << " " << i2->v.name; + cout << '\n'; + } + + } break; + + case LVM: { + + cout << "found container (lvm) " << i1->name << '\n'; + + deque<LvmLvInfo> lvmlvs; + if (s->getLvmLvInfo (i1->name, lvmlvs) != 0) + { + cerr << "getLvmLvInfo failed\n"; + exit (EXIT_FAILURE); + } + + for (deque<LvmLvInfo>::const_iterator i2 = lvmlvs.begin(); + i2 != lvmlvs.end(); ++i2) + { + cout << " " << i2->v.name; + cout << '\n'; + } + + } break; + + default: { + + cout << "found container " << i1->name << '\n'; + + } break; + + } + + cout << '\n'; + } + + delete s; + logstream.close(); + + exit (EXIT_SUCCESS); + } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/examples/TestLoop.cc new/libstorage-2.22.5/examples/TestLoop.cc --- old/libstorage-2.22.4/examples/TestLoop.cc 2009-11-02 14:24:29.000000000 +0100 +++ new/libstorage-2.22.5/examples/TestLoop.cc 2012-06-12 11:02:26.000000000 +0200 @@ -46,7 +46,6 @@ main( int argc_iv, char** argv_ppcv ) { int ret = 0; - initDefaultLogger(); StorageInterface* s = createStorageInterface(Environment(false)); s->setCallbackProgressBar( progressbarCb ); s->setCallbackShowInstallInfo( installInfoCb ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/examples/TestLvm.cc new/libstorage-2.22.5/examples/TestLvm.cc --- old/libstorage-2.22.4/examples/TestLvm.cc 2009-11-02 14:24:29.000000000 +0100 +++ new/libstorage-2.22.5/examples/TestLvm.cc 2012-06-12 11:02:29.000000000 +0200 @@ -44,7 +44,6 @@ main( int argc_iv, char** argv_ppcv ) { int ret = 0; - initDefaultLogger(); StorageInterface* s = createStorageInterface(Environment(false)); s->setCallbackProgressBar( progressbarCb ); s->setCallbackShowInstallInfo( installInfoCb ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/examples/TestMd.cc new/libstorage-2.22.5/examples/TestMd.cc --- old/libstorage-2.22.4/examples/TestMd.cc 2010-09-27 11:01:00.000000000 +0200 +++ new/libstorage-2.22.5/examples/TestMd.cc 2012-06-12 11:02:33.000000000 +0200 @@ -46,7 +46,6 @@ main( int argc_iv, char** argv_ppcv ) { int ret = 0; - initDefaultLogger(); StorageInterface* s = createStorageInterface(Environment(false)); s->setCallbackProgressBar( progressbarCb ); s->setCallbackShowInstallInfo( installInfoCb ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/examples/TestProbing.cc new/libstorage-2.22.5/examples/TestProbing.cc --- old/libstorage-2.22.4/examples/TestProbing.cc 2011-04-28 17:52:54.000000000 +0200 +++ new/libstorage-2.22.5/examples/TestProbing.cc 2012-06-12 10:13:52.000000000 +0200 @@ -15,8 +15,6 @@ int main (int argc, char** argv) { - initDefaultLogger(); - StorageInterface* s = createStorageInterface(Environment(true)); deque<ContainerInfo> containers; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/examples/TestStorage.cc new/libstorage-2.22.5/examples/TestStorage.cc --- old/libstorage-2.22.4/examples/TestStorage.cc 2010-07-29 15:46:59.000000000 +0200 +++ new/libstorage-2.22.5/examples/TestStorage.cc 2012-06-12 11:02:46.000000000 +0200 @@ -52,7 +52,6 @@ int main( int argc_iv, char** argv_ppcv ) { - initDefaultLogger(); Storage Sto(Environment(true)); Sto.assertInit(); for( Storage::ConstContIterator i=Sto.contBegin(); i!=Sto.contEnd(); ++i ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/libstorage.spec.in new/libstorage-2.22.5/libstorage.spec.in --- old/libstorage-2.22.4/libstorage.spec.in 2012-05-25 15:33:05.000000000 +0200 +++ new/libstorage-2.22.5/libstorage.spec.in 2012-06-13 14:26:23.000000000 +0200 @@ -26,7 +26,7 @@ Prefix: /usr -BuildRequires: blocxx-devel boost-devel dejagnu doxygen gcc-c++ libtool libxml2-devel python-devel swig +BuildRequires: boost-devel dejagnu doxygen gcc-c++ libtool libxml2-devel python-devel swig BuildRequires: ruby ruby-devel Summary: Library for storage management @@ -88,8 +88,12 @@ rm -f $RPM_BUILD_ROOT/%{python_sitearch}/_libstorage.a rm -f $RPM_BUILD_ROOT/%{python_sitearch}/_libstorage.la -%if 0%{?suse_version} -rm $RPM_BUILD_ROOT/%{rb_vendorarchdir}/storage.la +%if 0%{?suse_version} +%if "%{?rb_vendorarchdir}" != "" +rm -f $RPM_BUILD_ROOT/%{rb_vendorarchdir}/storage.la +%else +rm -f $RPM_BUILD_ROOT/%{rb_vendorarch}/storage.la +%endif %endif %if 0%{?mandriva_version} rm $RPM_BUILD_ROOT/%{ruby_sitearchdir}/storage.la @@ -148,7 +152,7 @@ %package -n libstorage-devel Requires: libstorage@LIBVERSION_MAJOR@ = %version -Requires: gcc-c++ libstdc++-devel boost-devel blocxx-devel libxml2-devel +Requires: gcc-c++ libstdc++-devel boost-devel libxml2-devel Summary: Header files and documentation for libstorage Group: Development/Languages/C and C++ @@ -204,8 +208,12 @@ %files -n libstorage-ruby %defattr(-,root,root) -%if 0%{?suse_version} +%if 0%{?suse_version} +%if "%{?rb_vendorarchdir}" != "" %{rb_vendorarchdir}/storage.so +%else +%{rb_vendorarch}/storage.so +%endif %endif %if 0%{?mandriva_version} %{ruby_sitearchdir}/storage.so diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/storage/AppUtil.cc new/libstorage-2.22.5/storage/AppUtil.cc --- old/libstorage-2.22.4/storage/AppUtil.cc 2011-10-26 13:10:26.000000000 +0200 +++ new/libstorage-2.22.5/storage/AppUtil.cc 2012-06-13 11:14:03.000000000 +0200 @@ -33,12 +33,8 @@ #include <string> #include <boost/algorithm/string.hpp> -#include <blocxx/AppenderLogger.hpp> -#include <blocxx/FileAppender.hpp> -#include <blocxx/Logger.hpp> -#include <blocxx/LogMessage.hpp> - #include "storage/AsciiFile.h" +#include "storage/Storage.h" #include "storage/StorageTmpl.h" #include "storage/AppUtil.h" #include "storage/StorageTypes.h" @@ -48,7 +44,6 @@ { using namespace std; - void createPath(const string& Path_Cv) { string::size_type Pos_ii = 0; @@ -326,157 +321,80 @@ return dev; } +static const string& component = "libstorage"; +static string filename; -static const blocxx::String component = "libstorage"; - - -void createLogger(const string& name, const string& logpath, const string& logfile) -{ - using namespace blocxx; - - if (logpath != "NULL" && logfile != "NULL") +void createLogger( const string& logpath, const string& logfile ) { - 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); + filename = logpath + "/" + logfile; } -} - - -bool -testLogLevel(LogLevel level) -{ - using namespace blocxx; - - ELogLevel curLevel = LogAppender::getCurrentLogAppender()->getLogLevel(); - switch (level) +bool queryLog( LogLevel level ) { - case DEBUG: - return curLevel >= ::blocxx::E_DEBUG_LEVEL; - case MILESTONE: - return curLevel >= ::blocxx::E_INFO_LEVEL; - case WARNING: - return curLevel >= ::blocxx::E_WARNING_LEVEL; - case ERROR: - return curLevel >= ::blocxx::E_ERROR_LEVEL; - default: - return curLevel >= ::blocxx::E_FATAL_ERROR_LEVEL; + CallbackLogQuery pfc = storage::getLogQueryCallback(); + return( pfc!=NULL && pfc( level, component )); } -} +bool defaultLogQuery( int level, const string& component ) + { + return( level != DEBUG ); + } void prepareLogStream(ostringstream& stream) -{ + { stream.imbue(std::locale::classic()); stream.setf(std::ios::boolalpha); stream.setf(std::ios::showbase); -} + } ostringstream* logStreamOpen() -{ + { std::ostringstream* stream = new ostringstream; prepareLogStream(*stream); return stream; -} + } void -logStreamClose(LogLevel level, const char* file, unsigned line, const char* func, - ostringstream* stream) -{ - using namespace blocxx; - - ELogLevel curLevel = LogAppender::getCurrentLogAppender()->getLogLevel(); - String category; - - switch (level) +logStreamClose( LogLevel level, const char* file, unsigned line, + const char* func, ostringstream* stream ) { - case DEBUG: - if (curLevel >= ::blocxx::E_DEBUG_LEVEL) - category = Logger::STR_DEBUG_CATEGORY; - break; - case MILESTONE: - if (curLevel >= ::blocxx::E_INFO_LEVEL) - category = Logger::STR_INFO_CATEGORY; - break; - case WARNING: - if (curLevel >= ::blocxx::E_WARNING_LEVEL) - category = Logger::STR_WARNING_CATEGORY; - break; - case ERROR: - if (curLevel >= ::blocxx::E_ERROR_LEVEL) - category = Logger::STR_ERROR_CATEGORY; - break; - default: - if (curLevel >= ::blocxx::E_FATAL_ERROR_LEVEL) - category = Logger::STR_FATAL_CATEGORY; - break; + CallbackLogDo pfc = storage::getLogDoCallback(); + if( pfc!=NULL ) + pfc( level, component, file, line, func, stream->str() ); + delete stream; } - - if (!category.empty()) + +void defaultLogDo( int level, const string& comp, const char* file, + int line, const char* fct, const string& content ) { - string tmp = stream->str(); + ostringstream pfx; + pfx << datetime(time(0), false, true) << " <" << level << "> " + << comp << "(" << getpid() << ")" << " " << file + << "(" << fct << "):" << line; + string prefix = pfx.str(); - string::size_type pos1 = 0; + FILE* f = fopen(filename.c_str(), "a"); - 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)); + string::size_type pos1 = 0; - if (pos2 == string::npos) - break; - - pos1 = pos2 + 1; - } + while( true && f ) + { + string::size_type pos2 = content.find('\n', pos1);; + if (pos2 != string::npos || pos1 != content.length()) + fprintf(f, "%s - %s\n", prefix.c_str(), + content.substr(pos1, pos2 - pos1).c_str()); + if (pos2 == string::npos) + break; + pos1 = pos2 + 1; + } + if(f) + fclose(f); } - delete stream; -} - string udevAppendPart(const string& s, unsigned num) @@ -721,13 +639,12 @@ string - datetime() + datetime( time_t t1, bool utc, bool classic ) { - time_t t1 = time(NULL); struct tm t2; - gmtime_r(&t1, &t2); + utc ? gmtime_r(&t1, &t2) : localtime_r(&t1, &t2); char buf[64 + 1]; - if (strftime(buf, sizeof(buf), "%F %T %Z", &t2) == 0) + if (strftime(buf, sizeof(buf), classic ? "%F %T" : "%c", &t2) == 0) return string("unknown"); return string(buf); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/storage/AppUtil.h new/libstorage-2.22.5/storage/AppUtil.h --- old/libstorage-2.22.4/storage/AppUtil.h 2011-10-26 13:07:47.000000000 +0200 +++ new/libstorage-2.22.5/storage/AppUtil.h 2012-06-12 14:04:59.000000000 +0200 @@ -115,11 +115,14 @@ } -enum LogLevel { DEBUG, MILESTONE, WARNING, ERROR }; +enum LogLevel { DEBUG=0, MILESTONE=1, WARNING=2, ERROR=3 }; -void createLogger(const string& name, const string& logpath, const string& logfile); +void createLogger(const string& logpath, const string& logfile); -bool testLogLevel(LogLevel level); +bool queryLog( LogLevel level ); +bool defaultLogQuery( int level, const string& component ); +void defaultLogDo( int level, const string& component, const char* file, + int line, const char* function, const string& content ); void prepareLogStream(std::ostringstream& stream); @@ -135,7 +138,7 @@ #define y2log_op(level, file, line, func, op) \ do { \ - if (storage::testLogLevel(level)) \ + if (storage::queryLog(level)) \ { \ std::ostringstream* __buf = storage::logStreamOpen(); \ *__buf << op; \ @@ -145,7 +148,7 @@ string hostname(); - string datetime(); + string datetime( time_t t1, bool utc=false, bool classic=true ); class StopWatch diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/storage/Graph.cc new/libstorage-2.22.5/storage/Graph.cc --- old/libstorage-2.22.4/storage/Graph.cc 2011-07-04 15:36:36.000000000 +0200 +++ new/libstorage-2.22.5/storage/Graph.cc 2012-06-11 12:11:40.000000000 +0200 @@ -564,7 +564,7 @@ classic(out); out << "// generated by libstorage version " VERSION << endl; - out << "// " << hostname() << ", " << datetime() << endl; + out << "// " << hostname() << ", " << datetime(time(0)) << endl; out << endl; out << "digraph storage" << endl; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/storage/Makefile.am new/libstorage-2.22.5/storage/Makefile.am --- old/libstorage-2.22.4/storage/Makefile.am 2011-07-05 15:20:06.000000000 +0200 +++ new/libstorage-2.22.5/storage/Makefile.am 2012-06-11 12:27:02.000000000 +0200 @@ -66,7 +66,7 @@ StorageTmpl.h StorageDefines.h libstorage_la_LDFLAGS = -version-info @LIBVERSION_INFO@ -libstorage_la_LIBADD = -lblocxx -lxml2 +libstorage_la_LIBADD = -lxml2 pkgincludedir = $(includedir)/storage diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/storage/Makefile.in new/libstorage-2.22.5/storage/Makefile.in --- old/libstorage-2.22.4/storage/Makefile.in 2012-05-29 11:09:20.000000000 +0200 +++ new/libstorage-2.22.5/storage/Makefile.in 2012-06-13 14:26:51.000000000 +0200 @@ -344,7 +344,7 @@ StorageTmpl.h StorageDefines.h libstorage_la_LDFLAGS = -version-info @LIBVERSION_INFO@ -libstorage_la_LIBADD = -lblocxx -lxml2 +libstorage_la_LIBADD = -lxml2 pkginclude_HEADERS = \ StorageVersion.h \ StorageInterface.h \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/storage/Storage.cc new/libstorage-2.22.5/storage/Storage.cc --- old/libstorage-2.22.4/storage/Storage.cc 2012-05-08 15:08:24.000000000 +0200 +++ new/libstorage-2.22.5/storage/Storage.cc 2012-06-11 17:01:37.000000000 +0200 @@ -62,36 +62,30 @@ { using namespace std; +void +initDefaultLogger() + { + /* initentionally left empty for backward compatibility */ + /* logdir initialisation is in constructor of class Environment */ + } - void - initDefaultLogger() +void +initDefaultLogger( const string& logdir ) { - string path; - string file; + string path(logdir); + string file("libstorage"); if (geteuid ()) - { - struct passwd* pw = getpwuid (geteuid ()); + { + struct passwd* pw = getpwuid (geteuid()); if (pw) - { + { path = pw->pw_dir; - file = ".y2log"; - } - else - { - path = "/"; - file = "y2log"; - } - } - else - { - path = "/var/log/YaST2"; - file = "y2log"; - } - - createLogger("default", path, file); + file = ".libstorage"; + } + } + createLogger(path, file); } - std::ostream& operator<<(std::ostream& s, const Environment& env) { return s << "readonly:" << env.readonly << " testmode:" << env.testmode @@ -7614,6 +7608,14 @@ return(s); } +CallbackLogDo logger_do_fnc = defaultLogDo; +CallbackLogQuery logger_query_fnc = defaultLogQuery; + +void setLogDoCallback(CallbackLogDo pfnc) { logger_do_fnc = pfnc; } +CallbackLogDo getLogDoCallback() { return logger_do_fnc; } +void setLogQueryCallback( CallbackLogQuery pfnc) { logger_query_fnc = pfnc; } +CallbackLogQuery getLogQueryCallback() { return logger_query_fnc; } + // workaround for broken YCP bindings CallbackProgressBar progress_bar_cb_ycp = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/storage/StorageInterface.h new/libstorage-2.22.5/storage/StorageInterface.h --- old/libstorage-2.22.4/storage/StorageInterface.h 2012-04-05 12:47:17.000000000 +0200 +++ new/libstorage-2.22.5/storage/StorageInterface.h 2012-06-12 14:03:51.000000000 +0200 @@ -2698,14 +2698,54 @@ */ void initDefaultLogger(); + /** + * Initializes default logging with explicit log dir. + */ + void initDefaultLogger( const string& logdir ); + + /** + * typedef for a pointer to a function that gets called for every logged + * entry. Called function should be able to split content at newlines + */ + typedef void (*CallbackLogDo)( int level, const string& component, const char* file, + int line, const char* function, const string& content ); + + /** + * typedef for a pointer to a function that returns if specified level + * should be logged + */ + typedef bool (*CallbackLogQuery)( int level, const string& component ); + + /** + * Set logging callback function + */ + void setLogDoCallback( CallbackLogDo pfc ); + + /** + * Get logging callback function + */ + CallbackLogDo getLogDoCallback(); + + /** + * Set logging query callback function + */ + void setLogQueryCallback( CallbackLogQuery pfc ); + + /** + * Get logging callback function + */ + CallbackLogQuery getLogQueryCallback(); /** * Contains basic environment settings controlling the behaviour of libstorage. */ struct Environment { - Environment(bool readonly) : readonly(readonly), testmode(false), autodetect(true), - instsys(false), logdir("/var/log/YaST2"), testdir("tmp") {} + Environment(bool readonly, string logdr="/var/log/YaST2") : readonly(readonly), testmode(false), autodetect(true), + instsys(false), logdir(logdr), testdir("tmp") + { + storage::initDefaultLogger( logdir ); + } bool readonly; bool testmode; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/testsuite/common.cc new/libstorage-2.22.5/testsuite/common.cc --- old/libstorage-2.22.4/testsuite/common.cc 2011-04-28 17:52:54.000000000 +0200 +++ new/libstorage-2.22.5/testsuite/common.cc 2012-06-11 12:26:25.000000000 +0200 @@ -26,7 +26,7 @@ string path = name.substr(pos + 1) + ".out/out"; string file = name.substr(0, pos) + ".log"; system(string("rm -f " + path + "/" + file).c_str()); - createLogger("default", path, file); + createLogger(path, file); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/testsuite-real/align1.cc new/libstorage-2.22.5/testsuite-real/align1.cc --- old/libstorage-2.22.4/testsuite-real/align1.cc 2010-10-18 16:15:58.000000000 +0200 +++ new/libstorage-2.22.5/testsuite-real/align1.cc 2012-06-12 11:04:55.000000000 +0200 @@ -42,8 +42,6 @@ int main(int argc, char** argv) { - initDefaultLogger(); - list<string> disks(argv + 1, argv + argc); if (disks.empty()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/testsuite-real/align2.cc new/libstorage-2.22.5/testsuite-real/align2.cc --- old/libstorage-2.22.4/testsuite-real/align2.cc 2010-10-18 16:15:58.000000000 +0200 +++ new/libstorage-2.22.5/testsuite-real/align2.cc 2012-06-12 11:04:59.000000000 +0200 @@ -44,8 +44,6 @@ int main(int argc, char** argv) { - initDefaultLogger(); - list<string> disks(argv + 1, argv + argc); if (disks.empty()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/testsuite-real/format1.cc new/libstorage-2.22.5/testsuite-real/format1.cc --- old/libstorage-2.22.4/testsuite-real/format1.cc 2010-09-23 15:32:51.000000000 +0200 +++ new/libstorage-2.22.5/testsuite-real/format1.cc 2012-06-12 11:05:07.000000000 +0200 @@ -54,8 +54,6 @@ int main(int argc, char** argv) { - initDefaultLogger(); - list<string> disks(argv + 1, argv + argc); if (disks.empty()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/testsuite-real/format2.cc new/libstorage-2.22.5/testsuite-real/format2.cc --- old/libstorage-2.22.4/testsuite-real/format2.cc 2010-09-23 15:32:51.000000000 +0200 +++ new/libstorage-2.22.5/testsuite-real/format2.cc 2012-06-12 11:05:12.000000000 +0200 @@ -63,8 +63,6 @@ int main(int argc, char** argv) { - initDefaultLogger(); - list<string> disks(argv + 1, argv + argc); if (disks.empty()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/testsuite-real/lvmcreate1.cc new/libstorage-2.22.5/testsuite-real/lvmcreate1.cc --- old/libstorage-2.22.4/testsuite-real/lvmcreate1.cc 2010-09-23 15:32:51.000000000 +0200 +++ new/libstorage-2.22.5/testsuite-real/lvmcreate1.cc 2012-06-12 11:05:16.000000000 +0200 @@ -51,8 +51,6 @@ int main(int argc, char** argv) { - initDefaultLogger(); - list<string> disks(argv + 1, argv + argc); if (disks.empty()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/testsuite-real/lvmresize1.cc new/libstorage-2.22.5/testsuite-real/lvmresize1.cc --- old/libstorage-2.22.4/testsuite-real/lvmresize1.cc 2010-09-22 15:39:35.000000000 +0200 +++ new/libstorage-2.22.5/testsuite-real/lvmresize1.cc 2012-06-12 11:05:20.000000000 +0200 @@ -63,8 +63,6 @@ int main(int argc, char** argv) { - initDefaultLogger(); - list<string> disks(argv + 1, argv + argc); if (disks.empty()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/testsuite-real/mdcreate1.cc new/libstorage-2.22.5/testsuite-real/mdcreate1.cc --- old/libstorage-2.22.4/testsuite-real/mdcreate1.cc 2011-02-02 16:22:49.000000000 +0100 +++ new/libstorage-2.22.5/testsuite-real/mdcreate1.cc 2012-06-12 11:05:23.000000000 +0200 @@ -63,8 +63,6 @@ int main(int argc, char** argv) { - initDefaultLogger(); - list<string> disks(argv + 1, argv + argc); if (disks.empty()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/testsuite-real/resize1.cc new/libstorage-2.22.5/testsuite-real/resize1.cc --- old/libstorage-2.22.4/testsuite-real/resize1.cc 2010-09-22 15:39:35.000000000 +0200 +++ new/libstorage-2.22.5/testsuite-real/resize1.cc 2012-06-12 11:05:27.000000000 +0200 @@ -82,8 +82,6 @@ int main(int argc, char** argv) { - initDefaultLogger(); - list<string> disks(argv + 1, argv + argc); if (disks.empty()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.22.4/testsuite-real/resize2.cc new/libstorage-2.22.5/testsuite-real/resize2.cc --- old/libstorage-2.22.4/testsuite-real/resize2.cc 2010-09-23 15:32:51.000000000 +0200 +++ new/libstorage-2.22.5/testsuite-real/resize2.cc 2012-06-12 11:05:30.000000000 +0200 @@ -94,8 +94,6 @@ int main(int argc, char** argv) { - initDefaultLogger(); - list<string> disks(argv + 1, argv + argc); if (disks.empty()) -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org