Hello community, here is the log from the commit of package libzypp for openSUSE:Factory checked in at 2012-11-14 16:52:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libzypp (Old) and /work/SRC/openSUSE:Factory/.libzypp.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libzypp", Maintainer is "[email protected]" Changes: -------- --- /work/SRC/openSUSE:Factory/libzypp/libzypp.changes 2012-10-23 19:39:33.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.libzypp.new/libzypp.changes 2012-11-14 16:52:26.000000000 +0100 @@ -1,0 +2,29 @@ +Tue Nov 13 15:40:10 CET 2012 - [email protected] + +- Forward userdata string to commit plugins in BEGINPLUGIN (fate#312521) +- Extend ZConfig to store a user defined string value (fate#312521) +- Add SIGSEGV handler trying to log a stack trace +- Add zypp::dumpBacktrace to dump current stack trace to a stream. +- Use gettext plural handling (bnc#784666) +- version 12.4.0 (0) + +------------------------------------------------------------------- +Sun Nov 4 01:13:21 CET 2012 - [email protected] + +- Update zypp-po.tar.bz2 + +------------------------------------------------------------------- +Wed Oct 24 10:40:38 CEST 2012 - [email protected] + +- Add simple sysconfig::write (bnc#766598) +- For installed products also filelists when trying to find the buddy + (bnc#784900) +- Provide information whether product license needs to be accepted. +- version 12.3.0 (0) + +------------------------------------------------------------------- +Thu Oct 18 01:13:43 CEST 2012 - [email protected] + +- Update zypp-po.tar.bz2 + +------------------------------------------------------------------- Old: ---- libzypp-12.2.0.tar.bz2 New: ---- libzypp-12.4.0.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libzypp.spec ++++++ --- /var/tmp/diff_new_pack.t8uVPO/_old 2012-11-14 16:52:27.000000000 +0100 +++ /var/tmp/diff_new_pack.t8uVPO/_new 2012-11-14 16:52:27.000000000 +0100 @@ -24,7 +24,7 @@ Group: System/Packages BuildRoot: %{_tmppath}/%{name}-%{version}-build Summary: Package, Patch, Pattern, and Product Management -Version: 12.2.0 +Version: 12.4.0 Release: 1 Source: %{name}-%{version}.tar.bz2 Source1: %{name}-rpmlintrc ++++++ libzypp-12.2.0.tar.bz2 -> libzypp-12.4.0.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/CMakeLists.txt new/libzypp-12.4.0/CMakeLists.txt --- old/libzypp-12.2.0/CMakeLists.txt 2012-10-15 15:57:59.000000000 +0200 +++ new/libzypp-12.4.0/CMakeLists.txt 2012-11-14 12:43:31.000000000 +0100 @@ -29,8 +29,8 @@ CHECK_C_COMPILER_FLAG("-Werror=format-security" CC_FORMAT_SECURITY) CHECK_CXX_COMPILER_FLAG("-Werror=format-security" CXX_FORMAT_SECURITY) -SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden -fno-strict-aliasing -fPIC -g -Wall -Woverloaded-virtual -Wnon-virtual-dtor -Wl,-as-needed -std=c++0x" ) -SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing -fPIC -g -Wall -Wl,-as-needed" ) +SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden -fno-strict-aliasing -fPIC -g -rdynamic -Wall -Woverloaded-virtual -Wnon-virtual-dtor -Wl,-as-needed -std=c++0x" ) +SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing -fPIC -g -rdynamic -Wall -Wl,-as-needed" ) set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3" ) set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3" ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/VERSION.cmake new/libzypp-12.4.0/VERSION.cmake --- old/libzypp-12.2.0/VERSION.cmake 2012-10-15 15:58:00.000000000 +0200 +++ new/libzypp-12.4.0/VERSION.cmake 2012-11-14 12:43:31.000000000 +0100 @@ -60,9 +60,9 @@ # SET(LIBZYPP_MAJOR "12") SET(LIBZYPP_COMPATMINOR "0") -SET(LIBZYPP_MINOR "2") +SET(LIBZYPP_MINOR "4") SET(LIBZYPP_PATCH "0") # -# LAST RELEASED: 12.2.0 (0) +# LAST RELEASED: 12.4.0 (0) # (The number in parenthesis is LIBZYPP_COMPATMINOR) #======= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/doc/autoinclude/Plugin-Commit.doc new/libzypp-12.4.0/doc/autoinclude/Plugin-Commit.doc --- old/libzypp-12.2.0/doc/autoinclude/Plugin-Commit.doc 2012-10-15 15:57:59.000000000 +0200 +++ new/libzypp-12.4.0/doc/autoinclude/Plugin-Commit.doc 2012-11-14 12:43:31.000000000 +0100 @@ -24,6 +24,8 @@ def PLUGINBEGIN(self, headers, body): # commit is going to start. + if headers.has_key('userdata'): + print "Commit starts with TID '%s'" % headers['userdata'] self.ack() def PLUGINEND(self, headers, body): @@ -40,11 +42,14 @@ \section pluginbegin PLUGINBEGIN \verbatim PLUGINBEGIN +userdata:TIDfoo42 ^@ \endverbatim Sent as 1st message after the plugin was launched. Prepare your plugin and send an \c ACC message when you are done. Commit will start after all plugins are initialized. +\li \c userdata:stringval Optional header sent if the application has provided a user data string. \see \ref zypp-userdata + <HR><!-- ====================================================================== --> \section pluginend PLUGINEND diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/doc/autoinclude/Plugins.doc new/libzypp-12.4.0/doc/autoinclude/Plugins.doc --- old/libzypp-12.2.0/doc/autoinclude/Plugins.doc 2012-10-15 15:57:59.000000000 +0200 +++ new/libzypp-12.4.0/doc/autoinclude/Plugins.doc 2012-11-14 12:43:31.000000000 +0100 @@ -22,14 +22,14 @@ \subsection plugin-protocol-stateful Stateful -This type of plugin is called by ZYpp and a conversation using a simple protocol. The protocol is based on STOMP http://stomp.codehaus.org/Protocol (Streaming Text Orientated Messaging Protocol). Messages (called "frames") look like the following: +This type of plugin is called by ZYpp and a conversation using a simple protocol. The protocol is based on STOMP http://stomp.github.com (Streaming Text Orientated Messaging Protocol). Messages (called "frames") look like the following: \verbatim COMMAND param1:val1 param2:val2 ... -Thus a COMMAND hollowed by key:value header lines +Thus a COMMAND followed by key:value header lines and a multiline body separated from header by an empty line and terminated by NUL. ^@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/doc/autoinclude/Testcases.doc new/libzypp-12.4.0/doc/autoinclude/Testcases.doc --- old/libzypp-12.2.0/doc/autoinclude/Testcases.doc 2012-10-15 15:57:59.000000000 +0200 +++ new/libzypp-12.4.0/doc/autoinclude/Testcases.doc 2012-11-14 12:43:31.000000000 +0100 @@ -1,6 +1,6 @@ /** \page Testcases Writing and tunning testcases -\section Introduction +\section Introduction Introduction ZYpp has a suite of tests located in under test/ directory of the source tree. @@ -18,7 +18,7 @@ - <a href="http://www.boost.org/doc/libs/1_36_0/libs/test/doc/html/utf.html">The Unit Test Framework</a> - <a href="http://www.boost.org/doc/libs/1_36_0/libs/test/doc/html/utf/testing-tools/reference.html">The UTF testing tools reference</a> -\section Anatomy of a ZYpp testcase +\section Anatomy Anatomy of a ZYpp testcase The file should be in one of the described groups, and by general rule it is named ClassName_test.cc where ClassName is the name of the class or module the test covers. @@ -38,7 +38,7 @@ } \endcode -\section Building and running the testsuite +\section Building Building and running the testsuite - Build the testsuite diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/doc/autoinclude/UserData.doc new/libzypp-12.4.0/doc/autoinclude/UserData.doc --- old/libzypp-12.2.0/doc/autoinclude/UserData.doc 1970-01-01 01:00:00.000000000 +0100 +++ new/libzypp-12.4.0/doc/autoinclude/UserData.doc 2012-11-14 12:43:31.000000000 +0100 @@ -0,0 +1,15 @@ +/** +\page zypp-userdata User data as transaction id + +\author Michael Andres <[email protected]> + +<HR><!-- ====================================================================== --> +\section userdata-introduction Introduction + +It is possible to store a user defined data string via \ref zypp::ZConfig::setUserData inside libzypp for use as a transaction id. \c Zypper e.g. supports this via its global <tt>'--userdata <string>'</tt> option. + +\li Setting a new user data string, a line will be written to the log file. So you can \c grep for it, or for <tt>'(setUserData)'</tt> to find all locations where user data strings were set. + +\li The user data string will also be passed to commit plugins, so they can make use of it. The btrfs e.g would be able to tag created snapshots with this string. \see \ref plugin-commit + +*/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/package/libzypp.changes new/libzypp-12.4.0/package/libzypp.changes --- old/libzypp-12.2.0/package/libzypp.changes 2012-10-15 15:57:59.000000000 +0200 +++ new/libzypp-12.4.0/package/libzypp.changes 2012-11-14 12:43:31.000000000 +0100 @@ -1,4 +1,33 @@ ------------------------------------------------------------------- +Tue Nov 13 15:40:10 CET 2012 - [email protected] + +- Forward userdata string to commit plugins in BEGINPLUGIN (fate#312521) +- Extend ZConfig to store a user defined string value (fate#312521) +- Add SIGSEGV handler trying to log a stack trace +- Add zypp::dumpBacktrace to dump current stack trace to a stream. +- Use gettext plural handling (bnc#784666) +- version 12.4.0 (0) + +------------------------------------------------------------------- +Sun Nov 4 01:13:21 CET 2012 - [email protected] + +- Update zypp-po.tar.bz2 + +------------------------------------------------------------------- +Wed Oct 24 10:40:38 CEST 2012 - [email protected] + +- Add simple sysconfig::write (bnc#766598) +- For installed products also filelists when trying to find the buddy + (bnc#784900) +- Provide information whether product license needs to be accepted. +- version 12.3.0 (0) + +------------------------------------------------------------------- +Thu Oct 18 01:13:43 CEST 2012 - [email protected] + +- Update zypp-po.tar.bz2 + +------------------------------------------------------------------- Sun Oct 7 01:13:41 CEST 2012 - [email protected] - Update zypp-po.tar.bz2 Files old/libzypp-12.2.0/po/zypp-po.tar.bz2 and new/libzypp-12.4.0/po/zypp-po.tar.bz2 differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/tests/zypp/base/Sysconfig_test.cc new/libzypp-12.4.0/tests/zypp/base/Sysconfig_test.cc --- old/libzypp-12.2.0/tests/zypp/base/Sysconfig_test.cc 2012-10-15 15:58:00.000000000 +0200 +++ new/libzypp-12.4.0/tests/zypp/base/Sysconfig_test.cc 2012-11-14 12:43:31.000000000 +0100 @@ -1,5 +1,6 @@ #include <iostream> +#include <sstream> #include <fstream> #include <map> #include <string> @@ -10,6 +11,7 @@ #include "zypp/base/Exception.h" #include "zypp/TmpPath.h" #include "zypp/PathInfo.h" +#include "zypp/ExternalProgram.h" #include "zypp/base/Sysconfig.h" @@ -24,7 +26,7 @@ BOOST_AUTO_TEST_CASE(Sysconfig) { - Pathname file = DATADIR + "proxy"; + Pathname file = DATADIR / "proxy"; map<string,string> values = zypp::base::sysconfig::read(file); BOOST_CHECK_EQUAL( values.size(), 6 ); BOOST_CHECK_EQUAL( values["PROXY_ENABLED"], "no"); @@ -32,3 +34,43 @@ BOOST_CHECK_EQUAL( values["NO_PROXY"], "localhost, 127.0.0.1"); } +BOOST_AUTO_TEST_CASE(SysconfigWrite) +{ + Pathname file = DATADIR / "proxy"; + filesystem::TmpFile tmpf( filesystem::TmpFile::makeSibling( file ) ); + filesystem::copy( file, tmpf.path() ); + + BOOST_REQUIRE_THROW( zypp::base::sysconfig::writeStringVal( "/tmp/wrzlprmpf", "PROXY_ENABLED", "yes", "# fifi\n fofo\n" ), + zypp::Exception ); + BOOST_CHECK( zypp::base::sysconfig::writeStringVal( tmpf.path(), "PROXY_ENABLED", "yes", "# fifi\n fofo\n" ) ); + BOOST_CHECK( !zypp::base::sysconfig::writeStringVal( tmpf.path(), "NEW1","12" ) ); + BOOST_CHECK( zypp::base::sysconfig::writeStringVal( tmpf.path(), "NEW2","13", "# fifi\n# fofo" ) ); + BOOST_CHECK( zypp::base::sysconfig::writeStringVal( tmpf.path(), "NEW3","13\"str\"", "fifi\nffofo" ) ); + + std::ostringstream s; + ExternalProgram( "diff -u " + file.asString() + " " + tmpf.path().asString() + " | tail -n +3" ) >> s; + BOOST_CHECK_EQUAL( s.str(), + "@@ -8,7 +8,7 @@\n" + " # This setting allows to turn the proxy on and off while\n" + " # preserving the particular proxy setup.\n" + " #\n" + "-PROXY_ENABLED=\"no\"\n" + "+PROXY_ENABLED=\"yes\"\n" + " \n" + " ## Type:\tstring\n" + " ## Default:\t\"\"\n" + "@@ -49,3 +49,11 @@\n" + " # Example: NO_PROXY=\"www.me.de, do.main, localhost\"\n" + " #\n" + " NO_PROXY=\"localhost, 127.0.0.1\"\n" + "+\n" + "+# fifi\n" + "+# fofo\n" + "+NEW2=\"13\"\n" + "+\n" + "+# fifi\n" + "+# ffofo\n" + "+NEW3=\"13\\\"str\\\"\"\n" + ); +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/tests/zypp/base/data/Sysconfig/proxy new/libzypp-12.4.0/tests/zypp/base/data/Sysconfig/proxy --- old/libzypp-12.2.0/tests/zypp/base/data/Sysconfig/proxy 2012-10-15 15:58:00.000000000 +0200 +++ new/libzypp-12.4.0/tests/zypp/base/data/Sysconfig/proxy 2012-11-14 12:43:31.000000000 +0100 @@ -1,5 +1,5 @@ ## Path: Network/Proxy -## Description: +## Description: ## Type: yesno ## Default: no ## Config: kde,profiles @@ -7,7 +7,7 @@ # Enable a generation of the proxy settings to the profile. # This setting allows to turn the proxy on and off while # preserving the particular proxy setup. -# +# PROXY_ENABLED="no" ## Type: string diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/zypp/CMakeLists.txt new/libzypp-12.4.0/zypp/CMakeLists.txt --- old/libzypp-12.2.0/zypp/CMakeLists.txt 2012-10-15 15:57:59.000000000 +0200 +++ new/libzypp-12.4.0/zypp/CMakeLists.txt 2012-11-14 12:43:31.000000000 +0100 @@ -191,6 +191,7 @@ SET( zypp_base_SRCS base/InterProcessMutex.cc + base/Backtrace.cc base/SerialNumber.cc base/Random.cc base/Measure.cc @@ -215,6 +216,7 @@ SET( zypp_base_HEADERS base/InterProcessMutex.h + base/Backtrace.h base/Collector.h base/SerialNumber.h base/Easy.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/zypp/RepoManager.cc new/libzypp-12.4.0/zypp/RepoManager.cc --- old/libzypp-12.2.0/zypp/RepoManager.cc 2012-10-15 15:57:59.000000000 +0200 +++ new/libzypp-12.4.0/zypp/RepoManager.cc 2012-11-14 12:43:31.000000000 +0100 @@ -910,7 +910,9 @@ assert_urls(info); // we will throw this later if no URL checks out fine - RepoException rexception(_("Valid metadata not found at specified URL(s)")); + RepoException rexception(_PL("Valid metadata not found at specified URL", + "Valid metadata not found at specified URLs", + info.baseUrlsSize() ) ); // try urls one by one for ( RepoInfo::urls_const_iterator it = info.baseUrlsBegin(); it != info.baseUrlsEnd(); ++it ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/zypp/ResObject.h new/libzypp-12.4.0/zypp/ResObject.h --- old/libzypp-12.2.0/zypp/ResObject.h 2012-10-15 15:57:59.000000000 +0200 +++ new/libzypp-12.4.0/zypp/ResObject.h 2012-11-14 12:43:31.000000000 +0100 @@ -273,11 +273,11 @@ template<class _Res> inline typename ResTraits<_Res>::constPtrType ResObject::asKind() const - { return make<_Res>( *this ); } + { return dynamic_cast<const _Res *>( this ); } template<class _Res> inline typename ResTraits<_Res>::PtrType ResObject::asKind() - { return make<_Res>( *this ); } + { return dynamic_cast<_Res *>( this ); } ///////////////////////////////////////////////////////////////// } // namespace zypp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/zypp/ZConfig.cc new/libzypp-12.4.0/zypp/ZConfig.cc --- old/libzypp-12.2.0/zypp/ZConfig.cc 2012-10-15 15:57:59.000000000 +0200 +++ new/libzypp-12.4.0/zypp/ZConfig.cc 2012-11-14 12:43:31.000000000 +0100 @@ -577,6 +577,8 @@ Pathname credentials_global_dir_path; Pathname credentials_global_file_path; + std::string userData; + Option<Pathname> pluginsPath; private: @@ -705,6 +707,31 @@ } /////////////////////////////////////////////////////////////////// + // user data + /////////////////////////////////////////////////////////////////// + + bool ZConfig::hasUserData() const + { return !_pimpl->userData.empty(); } + + std::string ZConfig::userData() const + { return _pimpl->userData; } + + bool ZConfig::setUserData( const std::string & str_r ) + { + for_( ch, str_r.begin(), str_r.end() ) + { + if ( *ch < ' ' && *ch != '\t' ) + { + ERR << "New user data string rejectded: char " << (int)*ch << " at position " << (ch - str_r.begin()) << endl; + return false; + } + } + MIL << "Set user data string to '" << str_r << "'" << endl; + _pimpl->userData = str_r; + return true; + } + + /////////////////////////////////////////////////////////////////// Pathname ZConfig::repoCachePath() const { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/zypp/ZConfig.h new/libzypp-12.4.0/zypp/ZConfig.h --- old/libzypp-12.2.0/zypp/ZConfig.h 2012-10-15 15:57:59.000000000 +0200 +++ new/libzypp-12.4.0/zypp/ZConfig.h 2012-11-14 12:43:31.000000000 +0100 @@ -109,6 +109,24 @@ { setTextLocale( defaultTextLocale() ); } public: + /** \name Maintain user data + * \see \ref zypp-userdata + */ + //@{ + /** Whether a (non empty) user data sting is defined. */ + bool hasUserData() const; + + /** User defined string value to be passed to log, history, plugins... */ + std::string userData() const; + + /** Set a new \ref userData string. + * \returns \c TRUE if the string was accepted; \c FALSE if the + * string was rejected due to nonprintable characters or newlines. + */ + bool setUserData( const std::string & str_r ); + //@} + + public: /** * Path where the caches are kept (/var/cache/zypp) * \ingroup g_ZC_REPOCACHE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/zypp/ZYppFactory.cc new/libzypp-12.4.0/zypp/ZYppFactory.cc --- old/libzypp-12.2.0/zypp/ZYppFactory.cc 2012-10-15 15:57:59.000000000 +0200 +++ new/libzypp-12.4.0/zypp/ZYppFactory.cc 2012-11-14 12:43:31.000000000 +0100 @@ -15,11 +15,13 @@ } #include <iostream> #include <fstream> +#include <signal.h> #include "zypp/base/Logger.h" #include "zypp/base/Gettext.h" #include "zypp/base/IOStream.h" #include "zypp/base/Functional.h" +#include "zypp/base/Backtrace.h" #include "zypp/PathInfo.h" #include "zypp/ZYppFactory.h" @@ -40,6 +42,19 @@ namespace zypp { ///////////////////////////////////////////////////////////////// + namespace + { + void sigsegvHandler( int sig ); + ::sighandler_t lastSigsegvHandler = ::signal( SIGSEGV, sigsegvHandler ); + + /** SIGSEGV handler to log stack trace */ + void sigsegvHandler( int sig ) + { + INT << "Error: signal " << sig << endl << dumpBacktrace << endl; + ::signal( SIGSEGV, lastSigsegvHandler ); + } + } + namespace env { /** Hack to circumvent the currently poor --root support. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/zypp/base/Backtrace.cc new/libzypp-12.4.0/zypp/base/Backtrace.cc --- old/libzypp-12.2.0/zypp/base/Backtrace.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/libzypp-12.4.0/zypp/base/Backtrace.cc 2012-11-14 12:43:31.000000000 +0100 @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp/base/Backtrace.cc + */ +#include <execinfo.h> +#include <cxxabi.h> + +#include <iostream> +#include "zypp/base/LogTools.h" +#include "zypp/base/String.h" +#include "zypp/base/Backtrace.h" + +using std::endl; + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ + std::ostream & dumpBacktrace( std::ostream & stream_r ) + { + // get void*'s for all entries on the stack + static const size_t arraySize = 50; + void *array[arraySize]; + size_t size = ::backtrace( array, arraySize ); + + // print out all the frames to stderr + char ** messages = ::backtrace_symbols( array, size ); + if ( messages ) + { + static const size_t first = 1; + for ( size_t i = first; i < size; ++i ) + { + char * mangled_name = 0; + char * offset_begin = 0; + char * offset_end = 0; + + // find parantheses and +address offset surrounding mangled name + for ( char * p = messages[i]; *p; ++p ) + { + if ( *p == '(' ) + { + mangled_name = p; + } + else if ( *p == '+' ) + { + offset_begin = p; + } + else if ( *p == ')' ) + { + offset_end = p; + break; + } + } + + if ( i > first ) + stream_r << endl; + + // if the line could be processed, attempt to demangle the symbol + if ( mangled_name && offset_begin && offset_end && mangled_name < offset_begin ) + { + *mangled_name++ = '\0'; + *offset_begin++ = '\0'; + *offset_end++ = '\0'; + + int status; + char * real_name = ::abi::__cxa_demangle( mangled_name, 0, 0, &status ); + + // if demangling is successful, output the demangled function name + if ( status == 0 ) + { + stream_r << "[bt]: (" << i << ") " << messages[i] << " : " + << real_name << "+" << offset_begin << offset_end; + + } + // otherwise, output the mangled function name + else + { + stream_r << "[bt]: (" << i << ") " << messages[i] << " : " + << mangled_name << "+" << offset_begin << offset_end; + } + ::free( real_name ); + } + else + { + // otherwise, print the whole line + stream_r << "[bt]: (" << i << ") " << messages[i]; + } + } + ::free( messages ); + } + return stream_r; + } + +} // namespace zypp +/////////////////////////////////////////////////////////////////// diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/zypp/base/Backtrace.h new/libzypp-12.4.0/zypp/base/Backtrace.h --- old/libzypp-12.2.0/zypp/base/Backtrace.h 1970-01-01 01:00:00.000000000 +0100 +++ new/libzypp-12.4.0/zypp/base/Backtrace.h 2012-11-14 12:43:31.000000000 +0100 @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp/base/Backtrace.h + */ +#ifndef ZYPP_BASE_BACKTRACE_H +#define ZYPP_BASE_BACKTRACE_H + +#include <iosfwd> +#include <string> + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ + + /** Dump current stack trace to a stream. + * Thanks to http://stackoverflow.com/questions/77005. + * \code + * #include <iostream> + * std::cerr << zypp::dumpBacktrace << std::endl; + * \endcode + * \code + * #include <zypp/base/String.h> + * std::string trace( str::Str() << zypp::dumpBacktrace ); + * \endcode + */ + std::ostream & dumpBacktrace( std::ostream & stream_r ); + +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_BASE_BACKTRACE_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/zypp/base/Sysconfig.cc new/libzypp-12.4.0/zypp/base/Sysconfig.cc --- old/libzypp-12.2.0/zypp/base/Sysconfig.cc 2012-10-15 15:57:59.000000000 +0200 +++ new/libzypp-12.4.0/zypp/base/Sysconfig.cc 2012-11-14 12:43:31.000000000 +0100 @@ -15,7 +15,12 @@ #include "zypp/base/Logger.h" #include "zypp/base/String.h" +#include "zypp/base/StrMatcher.h" +#include "zypp/base/IOStream.h" +#include "zypp/base/InputStream.h" #include "zypp/Pathname.h" +#include "zypp/PathInfo.h" +#include "zypp/TmpPath.h" #include "zypp/base/Sysconfig.h" @@ -24,13 +29,13 @@ namespace zypp { namespace base { - namespace sysconfig { + map<string,string> read( const Pathname & _path ) { DBG << "Load '" << _path << "'" << endl; map<string,string> ret; - + string line; ifstream in( _path.asString().c_str() ); if ( in.fail() ) { @@ -68,10 +73,83 @@ } // not comment } // while getline - MIL << "done reading '" << _path << "'" << endl; + MIL << "done reading '" << _path << "'" << endl; return ret; } + bool write( const Pathname & path_r, const std::string & key_r, const std::string & val_r, const std::string & newcomment_r ) + { + if ( key_r.empty() ) + { + WAR << "Empty key in write " << path_r << endl; + return false; + } + + PathInfo pi( path_r ); + if ( ! pi.isFile() ) + ZYPP_THROW( Exception( str::Str() << path_r << ": " << Errno(ENOENT) ) ); + if ( ! pi.userMayRW() ) + ZYPP_THROW( Exception( str::Str() << path_r << ": " << Errno(EACCES) ) ); + + bool found = false; + filesystem::TmpFile tmpf( filesystem::TmpFile::makeSibling( path_r ) ); + { + StrMatcher matches( "^[ \t]*"+key_r+"[ \t]*=", Match::REGEX ); + std::ofstream o( tmpf.path().c_str() ); + iostr::forEachLine( InputStream( path_r ), + [&]( int num_r, std::string line_r )->bool + { + if ( !found && matches( line_r ) ) + { + o << key_r << '=' << val_r << endl; + found = true; + MIL << path_r << ": " << key_r << '=' << val_r << " changed on line " << num_r << endl; + } + else + o << line_r << endl; + return true; + } ); + if ( !found ) + { + if ( newcomment_r.empty() ) + { + WAR << path_r << ": " << key_r << '=' << val_r << " can not be added (no comment provided)." << endl; + } + else + { + std::vector<std::string> lines; + str::split( newcomment_r, std::back_inserter(lines), "\r\n" ); + o << endl; + for ( auto line : lines ) + { + if ( line[0] != '#' ) + o << "# "; + o << line << endl; + } + o << key_r << '=' << val_r << endl; + found = true; + MIL << path_r << ": " << key_r << '=' << val_r << " appended. " << endl; + } + } + + if ( ! o ) + ZYPP_THROW( Exception( str::Str() << tmpf.path() << ": " << Errno(EIO) ) ); + } + + // If everything is fine, exchange the files: + int res = exchange( tmpf.path(), path_r ); + if ( res ) + { + ZYPP_THROW( Exception( str::Str() << tmpf.path() << ": " << Errno(res) ) ); + } + return found; + } + + bool writeStringVal( const Pathname & path_r, const std::string & key_r, const std::string & val_r, const std::string & newcomment_r ) + { + return write( path_r, key_r, str::Str() << '"' << str::escape( val_r, '"' )<< '"', newcomment_r ); + } + } // namespace sysconfig } // namespace base } // namespace zypp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/zypp/base/Sysconfig.h new/libzypp-12.4.0/zypp/base/Sysconfig.h --- old/libzypp-12.2.0/zypp/base/Sysconfig.h 2012-10-15 15:57:59.000000000 +0200 +++ new/libzypp-12.4.0/zypp/base/Sysconfig.h 2012-11-14 12:43:31.000000000 +0100 @@ -20,8 +20,51 @@ namespace base { namespace sysconfig { + /** Read sysconfig file \a path_r and return <tt>(key,valye)</tt> pairs. */ std::map<std::string,std::string> read( const Pathname & _path ); + /** Add or change a value in sysconfig file \a path_r. + * + * If \a key_r already exists, only the \a val_r is changed accordingly. + * + * In case \a key_r is not yet present in the file, a new entry may be created + * at the end of the file, using the lines in \a newcomment_r as comment + * block. If \a newcomment_r is not provided or empty, a new value is not + * created and \c false is returned. + * + * \returns \c TRUE if an entry was changed or created. + * + * \throws Exception if \a path_r can not be read or written. + * + * \note \a val_r is written as it is. The caller is responsible for escaping and + * enclosing in '"', in case this is needed (\see \ref writeStringVal and \ref str::escape). + * + * \note Lines in \a newcomment_r which do not already start with a '#', + * are prefixes with "# ". + * + * \code + * ## Type: string + * ## Default: "" + * # + * # A multiline description of + * # the options purpose. + * # + * KEY="value" + * \endcode + */ + bool write( const Pathname & path_r, const std::string & key_r, const std::string & val_r, + const std::string & newcomment_r = std::string() ); + + /** Convenience to add or change a string-value in sysconfig file \a path_r. + * + * \a val_r is expected to be a plain string value, so it is propery escaped and enclosed in + * double quotes before it is written to the sysconfig file \a path_r. + * + * \see \ref write + */ + bool writeStringVal( const Pathname & path_r, const std::string & key_r, const std::string & val_r, + const std::string & newcomment_r = std::string() ); + } // namespace sysconfig } // namespace base } // namespace zypp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-12.2.0/zypp/target/TargetImpl.cc new/libzypp-12.4.0/zypp/target/TargetImpl.cc --- old/libzypp-12.2.0/zypp/target/TargetImpl.cc 2012-10-15 15:57:59.000000000 +0200 +++ new/libzypp-12.4.0/zypp/target/TargetImpl.cc 2012-11-14 12:43:31.000000000 +0100 @@ -145,9 +145,13 @@ { MIL << "Load plugin: " << pi_r << endl; try { + PluginFrame frame( "PLUGINBEGIN" ); + if ( ZConfig::instance().hasUserData() ) + frame.setHeader( "userdata", ZConfig::instance().userData() ); + PluginScript plugin( pi_r.path() ); plugin.open(); - plugin.send( PluginFrame( "PLUGINBEGIN" ) ); + plugin.send( frame ); PluginFrame ret( plugin.receive() ); if ( ret.isAckCommand() ) { @@ -978,7 +982,7 @@ bool newCache = buildCache(); MIL << "New cache built: " << (newCache?"true":"false") << ", force loading: " << (force?"true":"false") << endl; - + // now add the repos to the pool sat::Pool satpool( sat::Pool::instance() ); Pathname rpmsolv( solvfilesPath() / "solv" ); @@ -998,7 +1002,7 @@ return; // nothing to do } } - + if ( ! system ) { system = satpool.systemRepo(); -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
