commit libzypp for openSUSE:Factory
Hello community, here is the log from the commit of package libzypp for openSUSE:Factory checked in at Fri Feb 27 16:14:27 CET 2009. -------- --- libzypp/libzypp.changes 2009-02-23 17:20:40.000000000 +0100 +++ /mounts/work_src_done/STABLE/libzypp/libzypp.changes 2009-02-26 14:48:11.000000000 +0100 @@ -1,0 +2,10 @@ +Thu Feb 26 13:49:56 CET 2009 - ma@suse.de + +- Use correct default for zconfig(solver.checkSystemFile) (bnc# 475144) + +------------------------------------------------------------------- +Thu Feb 26 01:25:33 CET 2009 - ma@suse.de + +- Prevent ResStatus from overriding user locks. (bnc #475230) + +------------------------------------------------------------------- calling whatdependson for head-i586 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libzypp.spec ++++++ --- /var/tmp/diff_new_pack.h23378/_old 2009-02-27 16:14:12.000000000 +0100 +++ /var/tmp/diff_new_pack.h23378/_new 2009-02-27 16:14:12.000000000 +0100 @@ -25,7 +25,7 @@ AutoReqProv: on Summary: Package, Patch, Pattern, and Product Management Version: 6.1.0 -Release: 1 +Release: 2 Source: libzypp-6.1.0.tar.bz2 Source1: libzypp-rpmlintrc Prefix: /usr @@ -120,6 +120,12 @@ make %{?jobs:-j %jobs} VERBOSE=1 make -C doc/autodoc %{?jobs:-j %jobs} make -C po %{?jobs:-j %jobs} translations +%if 0%{?run_testsuite} + make -C tests %{?jobs:-j %jobs} + pushd tests + ctest -A + popd +%endif #make check %install @@ -239,6 +245,10 @@ %{_libdir}/pkgconfig/libzypp.pc %changelog +* Thu Feb 26 2009 ma@suse.de +- Use correct default for zconfig(solver.checkSystemFile) (bnc# 475144) +* Thu Feb 26 2009 ma@suse.de +- Prevent ResStatus from overriding user locks. (bnc #475230) * Sun Feb 22 2009 ma@suse.de - Never refresh repositories from CD/DVD, once they are created. (bnc #476429) * Sat Feb 21 2009 dmacvicar@suse.de ++++++ libzypp-6.1.0.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/devel/devel.ma/CMakeLists.txt new/libzypp-6.1.0/devel/devel.ma/CMakeLists.txt --- old/libzypp-6.1.0/devel/devel.ma/CMakeLists.txt 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/devel/devel.ma/CMakeLists.txt 2009-02-27 01:50:42.000000000 +0100 @@ -15,31 +15,26 @@ #) ENDIF( NOT QT_FOUND ) +SET(THREAD_LIBRARY boost_thread-mt) + ## ############################################################ -ADD_CUSTOM_TARGET( ma_test +ADD_CUSTOM_TARGET( ma_test ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ma_test COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/ma_test ${CMAKE_CURRENT_BINARY_DIR}/ma_test ) ## ############################################################ -FOREACH( loop_var MaTest NewPool DumpSolv Iorder Xml Ex Main FakePool AOUT Parse Test Basic Sat TransList) - ADD_EXECUTABLE( ${loop_var} - ${loop_var}.cc - ) - TARGET_LINK_LIBRARIES( ${loop_var} - zypp - ) -ENDFOREACH( loop_var ) - - -FOREACH( loop_var ToolScanRepos ToolProvideSignedDir) +FILE( GLOB ALLCC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc" ) +STRING( REPLACE ".cc" ";" APLLPROG ${ALLCC} ) +FOREACH( loop_var ${APLLPROG} ) ADD_EXECUTABLE( ${loop_var} ${loop_var}.cc ) TARGET_LINK_LIBRARIES( ${loop_var} - zypp + boost_signals +#zypp ${THREAD_LIBRARY} ) ENDFOREACH( loop_var ) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/devel/devel.ma/DumpSolv.cc new/libzypp-6.1.0/devel/devel.ma/DumpSolv.cc --- old/libzypp-6.1.0/devel/devel.ma/DumpSolv.cc 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/devel/devel.ma/DumpSolv.cc 2009-02-27 01:50:42.000000000 +0100 @@ -1,38 +1,325 @@ -#include <iostream> -#include <zypp/base/LogTools.h> -#include <zypp/base/Easy.h> -#include <zypp/sat/Pool.h> - -using std::endl; -using std::cout; -using namespace zypp; +#include "Tools.h" +#include <zypp/ResObjects.h> +#include <zypp/ProgressData.h> +#include <zypp/sat/WhatObsoletes.h> +#include "zypp/pool/GetResolvablesToInsDel.h" + +/////////////////////////////////////////////////////////////////// +#include "zypp/parser/xml/ParseDef.h" +#include "zypp/parser/xml/ParseDefConsume.h" +#include "zypp/parser/xml/Reader.h" +namespace zypp +{ + namespace xml + { + namespace parsedefassign + { + template <class _Type> struct Assigner; + + /** Common interface to all Assigner. */ + template <> + struct Assigner<void> + { + virtual ~Assigner() + {} + virtual void assign( const char * text_r ) + {} + }; + + /** Assigner assigns text to types constructible from \c char*. */ + template <class _Type> + struct Assigner : public Assigner<void> + { + Assigner(_Type & value_r ) + : _value( &value_r ) + {} + + virtual void assign( const char * text_r ) + { *_value = _Type( text_r ); } + + private: + _Type * _value; + }; + + /** \name Assigner specialisation for numeric and boolean values. + * \relates Assigner + */ + //@{ + template <> + inline void Assigner<short>::assign( const char * text_r ) { str::strtonum( text_r, *_value ); } + template <> + inline void Assigner<int>::assign( const char * text_r ) { str::strtonum( text_r, *_value ); } + template <> + inline void Assigner<long>::assign( const char * text_r ) { str::strtonum( text_r, *_value ); } + template <> + inline void Assigner<long long>::assign( const char * text_r ) { str::strtonum( text_r, *_value ); } + template <> + inline void Assigner<unsigned short>::assign( const char * text_r ) { str::strtonum( text_r, *_value ); } + template <> + inline void Assigner<unsigned>::assign( const char * text_r ) { str::strtonum( text_r, *_value ); } + template <> + inline void Assigner<unsigned long>::assign( const char * text_r ) { str::strtonum( text_r, *_value ); } + template <> + inline void Assigner<unsigned long long>::assign( const char * text_r ) { str::strtonum( text_r, *_value ); } + template <> + inline void Assigner<bool>::assign( const char * text_r ) { str::strToBoolNodefault( text_r, *_value ); } + //@} + } + + struct ParseDefAssignConsumer : public ParseDefConsume + { + virtual void start( const Node & node_r ) + {} + + virtual void text( const Node & node_r ) + {} + }; + + struct ParseDefAssign + { + template <class _Type> + ParseDefAssign( _Type & value_r ) + {} + + operator const shared_ptr<ParseDefAssignConsumer> &() const + { return _ptr; } + + private: + shared_ptr<ParseDefAssignConsumer> _ptr; + }; + + } + + /** Parse \c input_r and store data in \c data_r. + * + * \c _Data must be defaultconstructible and assignable. + * + * \c _Data::RootNode must be a \ref xml::ParseDef constructible + * from \c _Data&. + * + * \throws ParseDefException on parse errors. + * + * To parse a xml file like this: + * \code + * <test><setup>value</setup></test> + * \endcode + * + * You need something like this: + * \code + * struct XmlData + * { + * std::string value; + + * public: + * // Convenience parsing to *this. + * void parse( const Pathname & path_r ) + * { rnParse( path_r, *this ); } + + * public: + * // Parser description + * struct RootNode : public xml::ParseDef, public xml::ParseDefConsume + * { + * RootNode( XmlData & data ) + * : ParseDef( "test", MANDTAORY ) + * { + * (*this) + * ("setup", MANDTAORY, xml::parseDefAssignText( data.value ) ) + * ; + * } + * }; + * }; + * + * XmlData xmlData; + * xmlData.parse( "/tmp/mytest.xml" ); + * \endcode + */ + template<class _Data> + inline void rnParse( const InputStream & input_r, _Data & data_r ) + { + typedef typename _Data::RootNode RootNode; + MIL << "+++ " << input_r << endl; + _Data pdata; + try + { + xml::Reader reader( input_r ); + RootNode rootNode( pdata ); + rootNode.take( reader ); + } + catch ( const Exception & err ) + { + // parse error + ERR << err << endl; + ERR << "--- " << input_r << endl; + ZYPP_RETHROW( err ); + } + MIL << "--- " << input_r << endl; + data_r = pdata; + } + + struct SolverTestXml + { + public: + struct Chanel + { + Chanel() : priority( RepoInfo::defaultPriority() ) {} + std::string file; + std::string alias; + unsigned priority; + }; + + Arch systemArch; + Locale systemLocale; + std::string systemFile; + std::list<Chanel> chanelList; + + public: + /** Convenience parsing to \c this, appending \c "solver-test.xml" to directories. */ + void parse( const Pathname & path_r ) + { rnParse( (PathInfo(path_r).isDir() ? path_r/"solver-test.xml" : path_r ), *this ); } + + public: + struct RootNode : public xml::ParseDef, public xml::ParseDefConsume + { + RootNode( SolverTestXml & data ) + : ParseDef( "test", MANDTAORY, xml::parseDefAssignText( data.systemFile ) ) + { + (*this) + ("setup", MANDTAORY, xml::parseDefAssign( data.systemArch ) ) + ; + } + }; + }; +} +/////////////////////////////////////////////////////////////////// + +static std::string appname( __FILE__ ); + +void message( const std::string & msg_r ) +{ + cerr << "*** " << msg_r << endl; +} + +int usage( const std::string & msg_r = std::string(), int exit_r = 100 ) +{ + if ( ! msg_r.empty() ) + { + cerr << endl; + message( msg_r ); + cerr << endl; + } + cerr << "Usage: " << appname << " TESTCASE" << endl; + cerr << " Load and process testcase." << endl; + return exit_r; +} + +/////////////////////////////////////////////////////////////////// + +bool progressReceiver( const ProgressData & v ) +{ + DBG << "...->" << v << endl; + return true; +} + +/////////////////////////////////////////////////////////////////// + +bool upgrade() +{ + bool rres = false; + { + zypp::base::LogControl::TmpLineWriter shutUp; + UpgradeStatistics u; + rres = getZYpp()->resolver()->doUpgrade( u ); + } + if ( ! rres ) + { + ERR << "upgrade " << rres << endl; + getZYpp()->resolver()->problems(); + return false; + } + MIL << "upgrade " << rres << endl; + return true; +} + +bool solve() +{ + static unsigned run = 0; + USR << "Solve " << run++ << endl; + bool rres = false; + { + zypp::base::LogControl::TmpLineWriter shutUp; + rres = getZYpp()->resolver()->resolvePool(); + } + if ( ! rres ) + { + ERR << "resolve " << rres << endl; + getZYpp()->resolver()->problems(); + return false; + } + + return true; +} + +/////////////////////////////////////////////////////////////////// /****************************************************************** ** ** FUNCTION NAME : main ** FUNCTION TYPE : int */ -int main( int argc, const char * argv[] ) +int main( int argc, char * argv[] ) { - --argc; ++argv; // skip arg 0 - sat::Pool satpool( sat::Pool::instance() ); + INT << "===[START]==========================================" << endl; + appname = Pathname::basename( argv[0] ); + --argc; + ++argv; + + /////////////////////////////////////////////////////////////////// - for ( ; argc; --argc, ++argv ) + Pathname mtest( "/suse/ma/BUGS/472099/zypper.solverTestCase" ); + Arch march( Arch_i686 ); + + while ( argc ) { - cout << "Read: " << argv[0] << endl; - satpool.addRepoSolv( argv[0] ); + --argc; + ++argv; } - cout << "Done: " << satpool << endl; + if ( mtest.empty() ) + { + return usage( "Missing Testcase", 102 ); + } + + /////////////////////////////////////////////////////////////////// + + //xml::ParseDef::_debug = true; + SolverTestXml solvertest; + solvertest.parse( mtest ); + USR << solvertest.systemFile << endl; + USR << solvertest.systemArch << endl; + + INT << "===[END]============================================" << endl << endl; + return 0; + + TestSetup test( march ); + ResPool pool( test.pool() ); + sat::Pool satpool( test.satpool() ); - if ( true || getenv("VERBOSE") ) { - for_( it, satpool.solvablesBegin(), satpool.solvablesEnd() ) - { - cout << dump(*it) << endl; - } + //zypp::base::LogControl::TmpLineWriter shutUp; + test.loadTarget(); + test.loadTestcaseRepos( mtest ); // <<< repos } + test.poolProxy().saveState(); + { + //zypp::base::LogControl::TmpLineWriter shutUp; + upgrade(); + } + vdumpPoolStats( USR << "Transacting:"<< endl, + make_filter_begin<resfilter::ByTransact>(pool), + make_filter_end<resfilter::ByTransact>(pool) ) << endl; + + INT << "===[END]============================================" << endl << endl; + zypp::base::LogControl::TmpLineWriter shutUp; return 0; } - diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/devel/devel.ma/ma_test new/libzypp-6.1.0/devel/devel.ma/ma_test --- old/libzypp-6.1.0/devel/devel.ma/ma_test 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/devel/devel.ma/ma_test 2009-02-27 01:50:42.000000000 +0100 @@ -5,7 +5,7 @@ PRG=Main SUDO= if [ "$1" = -su ]; then - SUDO=sudo + SUDO="sudo -E" shift fi diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/devel/devel.ma/Sat.cc new/libzypp-6.1.0/devel/devel.ma/Sat.cc --- old/libzypp-6.1.0/devel/devel.ma/Sat.cc 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/devel/devel.ma/Sat.cc 2009-02-27 01:50:42.000000000 +0100 @@ -1,12 +1,17 @@ -extern "C" +#include <iostream> + +#include <boost/thread.hpp> +#include <boost/thread/thread_time.hpp> +namespace boost { -#include <stdio.h> -#include <satsolver/pool.h> -#include <satsolver/repo_solv.h> + namespace detail + { + inline std::ostream & operator<<( std::ostream & str, const thread_data_base & obj ) + { return str << &obj; } + } } -#include <cstdio> -#include <iostream> +#include "zypp/ByteCount.h" #include "zypp/Pathname.h" #include "zypp/base/Logger.h" #include "zypp/base/LogControl.h" @@ -14,36 +19,100 @@ using std::endl; using namespace zypp; +#undef MIL +#define MIL MilSync( _BASEFILE, __FUNCTION__, __LINE__ )._str + +#ifdef _REENTRANT +#warning _REENTRANT +#else +#warning NOT_REENTRANT +#endif + +template <class Derived> +struct ClassLevelLockable +{ + typedef boost::recursive_mutex Lockable; + + typedef boost::lock_guard<Lockable> Lock; + struct Lock + { + Lock( const Derived & obj ) + {} + ~Lock + }; + + Lockable _mutex; +}; + +template <class Derived> +struct ObjectLevelLockable +{ + typedef boost::recursive_mutex Lockable; + typedef boost::lock_guard<Lockable> Lock; + +}; + + +struct MilSync +{ + MilSync( const char * file_r, const char * func_r, const int line_r ) + : _guard( _mutex ) + , _str( zypp::base::logger::getStream( ZYPP_BASE_LOGGER_LOGGROUP, zypp::base::logger::E_MIL, file_r, func_r, line_r ) ) + {} + typedef boost::recursive_mutex Lockable; + static Lockable _mutex; + boost::lock_guard<Lockable> _guard; + std::ostream & _str; +}; +MilSync::Lockable MilSync::_mutex; + +struct ThreadExcl +{ + ThreadExcl() + { + MIL << "+TE" << boost::this_thread::get_id() << endl; + boost::this_thread::sleep( boost::posix_time::seconds(1) ); + } + + ~ThreadExcl() + { + MIL << "-TE" << boost::this_thread::get_id() << endl; + } +}; + +void t_exit() +{ + MIL << "---" << boost::this_thread::get_id() << endl; +} + +void t_main() +{ + MIL << "+++" << boost::this_thread::get_id() << " " << boost::this_thread::interruption_enabled() << endl; + boost::this_thread::at_thread_exit( t_exit ); + ThreadExcl a; + while( true ) + boost::this_thread::sleep( boost::posix_time::seconds(1) ); +} + int main( int argc, char * argv[] ) { //zypp::base::LogControl::instance().logfile( "log.restrict" ); INT << "===[START]==========================================" << endl; - ::_Pool * _pool = ::pool_create(); - - Pathname p; + MIL << "M+++" << boost::this_thread::get_id() << endl; + boost::thread_group mthreads; - p = "sl10.1-beta7-selections.solv"; - FILE * file = ::fopen( p.c_str(), "r" ); - ::pool_addrepo_solv( _pool, file, p.c_str() ); - ::fclose( file ); - - p = "1234567890.solv"; - file = ::fopen( p.c_str(), "r" ); - ::pool_addrepo_solv( _pool, file, p.c_str() ); - ::fclose( file ); - - p = "sl10.1-beta7-packages.solv"; - file = ::fopen( p.c_str(), "r" ); - ::pool_addrepo_solv( _pool, file, p.c_str() ); - ::fclose( file ); - - ::_Pool & pool( *_pool ); - - MIL << _pool->nrepos << endl; - MIL << (void*)(*pool.repos) << " " << (*pool.repos)->name << endl; - MIL << (void*)(*(pool.repos+1)) << " " << (*(pool.repos+1))->name << endl; - MIL << (void*)(*(pool.repos+2)) << " " << (*(pool.repos+2))->name << endl; + mthreads.create_thread( t_main ); + mthreads.create_thread( t_main ); + mthreads.create_thread( t_main ); + mthreads.create_thread( t_main ); + mthreads.create_thread( t_main ); + + MIL << "M???" << boost::this_thread::get_id() << endl; + //boost::this_thread::sleep( boost::posix_time::seconds(10) ); + mthreads.interrupt_all(); + mthreads.join_all(); + MIL << "M---" << boost::this_thread::get_id() << endl; /////////////////////////////////////////////////////////////////// INT << "===[END]============================================" << endl << endl; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/devel/devel.ma/SigTrackableFail.cc new/libzypp-6.1.0/devel/devel.ma/SigTrackableFail.cc --- old/libzypp-6.1.0/devel/devel.ma/SigTrackableFail.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/libzypp-6.1.0/devel/devel.ma/SigTrackableFail.cc 2009-02-27 01:50:42.000000000 +0100 @@ -0,0 +1,133 @@ +#include <iostream> +using std::endl; +using std::cout; + +#include <boost/signal.hpp> +#include <boost/bind.hpp> +using boost::signal; +using boost::signals::connection; +using boost::signals::scoped_connection; +using boost::signals::trackable; + +#define DBG std::cerr +#define MIL std::cerr +namespace boost +{ + template<class Tp> + std::ostream & operator<<( std::ostream & str, const signal<Tp> & obj ) + { + return str << "Connected slots: " << obj.num_slots(); + } + + namespace signals + { + std::ostream & operator<<( std::ostream & str, const connection & obj ) + { + return str << "Connection: " + << ( obj.connected() ? '*' : '_' ) + << ( obj.blocked() ? 'B' : '_' ) + ; + } + } +} + +struct Sender +{ + void ping() const + { + static unsigned i = 0; + ++i; + MIL << "Sending " << i << " -> " << _sigA << endl; + _sigA( i ); + _sigB(); + } + + typedef signal<void(unsigned)> SigA; + typedef signal<void(void)> SigB; + + SigA & siga() const { return _sigA; } + SigB & sigb() const { return _sigB; } + + mutable SigA _sigA; + mutable SigB _sigB; +}; + +struct Receiver : public trackable +{ + Receiver() {_s=++s;} + Receiver( const Receiver & rhs ) : trackable( rhs ) {_s=++s;} + Receiver& operator=( const Receiver & rhs ) { + trackable::operator=( rhs ); + return *this; + } + ~Receiver() {_s=-_s;} + static int s; + int _s; + + void fpong() + { + dumpOn( DBG << "Receiver " << _s << " <- " << 13 << " (" ) << ")" << endl; + } + + void operator()( unsigned i ) + { pong( i ); } + + void pong( unsigned i ) + { + dumpOn( DBG << "Receiver " << _s << " <- " << i << " (" ) << ")" << endl; + } + + std::ostream & dumpOn( std::ostream & str ) const + { + return str << "Receiver " << _s << " connected signals: " << _connected_signals().size(); + } +}; + +std::ostream & operator<<( std::ostream & str, const Receiver & obj ) +{ return obj.dumpOn( str ); } + +int Receiver::s; + +/****************************************************************** +** +** FUNCTION NAME : main +** FUNCTION TYPE : int +*/ +int main( int argc, const char * argv[] ) +{ + --argc; ++argv; // skip arg 0 + + Sender sender; + sender.ping(); + + Receiver rec; + sender.siga().connect( boost::bind( &Receiver::pong, &rec, _1 ) ); + sender.ping(); + + { + Receiver recw; + sender.siga().connect( boost::ref(recw) ); + sender.ping(); + + Receiver recx; + MIL << recx << endl; + sender.siga().connect( boost::bind( &Receiver::pong, &recx, _1 ) ); + sender.sigb().connect( boost::bind( &Receiver::fpong, &recx ) ); + MIL << recx << endl; + sender.ping(); + + Receiver recy; + connection cy( sender.siga().connect( boost::bind( &Receiver::pong, &recy, _1 ) ) ); + sender.ping(); + + Receiver recz; + scoped_connection cz( sender.siga().connect( boost::bind( &Receiver::pong, &recz, _1 ) ) ); + sender.ping(); + + cy.disconnect(); + } + + sender.ping(); + return 0; +} + diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/libzypp.spec.cmake new/libzypp-6.1.0/libzypp.spec.cmake --- old/libzypp-6.1.0/libzypp.spec.cmake 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/libzypp.spec.cmake 2009-02-27 01:50:42.000000000 +0100 @@ -119,6 +119,13 @@ make -C doc/autodoc %{?jobs:-j %jobs} make -C po %{?jobs:-j %jobs} translations +%if 0%{?run_testsuite} + make -C tests %{?jobs:-j %jobs} + pushd tests + ctest -A + popd +%endif + #make check %install diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/package/libzypp.changes new/libzypp-6.1.0/package/libzypp.changes --- old/libzypp-6.1.0/package/libzypp.changes 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/package/libzypp.changes 2009-02-27 01:50:42.000000000 +0100 @@ -1,4 +1,14 @@ ------------------------------------------------------------------- +Thu Feb 26 13:49:56 CET 2009 - ma@suse.de + +- Use correct default for zconfig(solver.checkSystemFile) (bnc# 475144) + +------------------------------------------------------------------- +Thu Feb 26 01:25:33 CET 2009 - ma@suse.de + +- Prevent ResStatus from overriding user locks. (bnc #475230) + +------------------------------------------------------------------- Sun Feb 22 15:27:11 CET 2009 - ma@suse.de - Never refresh repositories from CD/DVD, once they are created. (bnc #476429) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/tests/lib/TestSetup.h new/libzypp-6.1.0/tests/lib/TestSetup.h --- old/libzypp-6.1.0/tests/lib/TestSetup.h 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/tests/lib/TestSetup.h 2009-02-27 01:50:42.000000000 +0100 @@ -29,6 +29,8 @@ #define BOOST_CHECK_NE( L, R ) BOOST_CHECK( (L) != (R) ) #endif +#define LABELED(V) #V << ":\t" << V + enum TestSetupOptionBits { TSO_CLEANROOT = (1 << 0) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/tests/lib/WebServer.cc new/libzypp-6.1.0/tests/lib/WebServer.cc --- old/libzypp-6.1.0/tests/lib/WebServer.cc 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/tests/lib/WebServer.cc 2009-02-27 01:50:42.000000000 +0100 @@ -160,6 +160,12 @@ virtual void start() { + if ( ! _stopped ) + { + MIL << "mongoose server already running, stopping." << endl; + stop(); + } + MIL << "Starting shttpd (mongoose)" << endl; _log.clear(); _ctx = mg_start(); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/tests/parser/ProductFileReader_test.cc new/libzypp-6.1.0/tests/parser/ProductFileReader_test.cc --- old/libzypp-6.1.0/tests/parser/ProductFileReader_test.cc 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/tests/parser/ProductFileReader_test.cc 2009-02-27 01:50:42.000000000 +0100 @@ -1,8 +1,6 @@ #include "TestSetup.h" #include <zypp/parser/ProductFileReader.h> -#define LABELED(V) #V << ":\t" << V - //static TestSetup test( Arch_x86_64 ); // Must be the first test! diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/tests/sat/LookupAttr_test.cc new/libzypp-6.1.0/tests/sat/LookupAttr_test.cc --- old/libzypp-6.1.0/tests/sat/LookupAttr_test.cc 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/tests/sat/LookupAttr_test.cc 2009-02-27 01:50:42.000000000 +0100 @@ -2,8 +2,6 @@ #include <zypp/sat/LookupAttr.h> #include <zypp/ResObjects.h> -#define LABELED(V) #V << ":\t" << V - static TestSetup test( "/tmp/x", Arch_x86_64 ); // Must be the first test! diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/tests/sat/WhatObsoletes_test.cc new/libzypp-6.1.0/tests/sat/WhatObsoletes_test.cc --- old/libzypp-6.1.0/tests/sat/WhatObsoletes_test.cc 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/tests/sat/WhatObsoletes_test.cc 2009-02-27 01:50:42.000000000 +0100 @@ -1,8 +1,6 @@ #include "TestSetup.h" #include <zypp/sat/WhatObsoletes.h> -#define LABELED(V) #V << ":\t" << V - namespace zypp { namespace sat diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/tests/sat/WhatProvides_test.cc new/libzypp-6.1.0/tests/sat/WhatProvides_test.cc --- old/libzypp-6.1.0/tests/sat/WhatProvides_test.cc 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/tests/sat/WhatProvides_test.cc 2009-02-27 01:50:42.000000000 +0100 @@ -1,7 +1,5 @@ #include "TestSetup.h" -#define LABELED(V) #V << ":\t" << V - BOOST_AUTO_TEST_CASE(WhatProvides) { TestSetup test( Arch_x86_64 ); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/tests/zypp/ResStatus_test.cc new/libzypp-6.1.0/tests/zypp/ResStatus_test.cc --- old/libzypp-6.1.0/tests/zypp/ResStatus_test.cc 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/tests/zypp/ResStatus_test.cc 2009-02-27 01:50:42.000000000 +0100 @@ -3,75 +3,126 @@ #define BOOST_TEST_MODULE ResStatus -BOOST_AUTO_TEST_CASE(ResStatus_default) +template<class _Tp, int N> +inline _Tp * begin( _Tp (& _array)[N] ) { return _array; } + +template<class _Tp, int N> +inline _Tp * end( _Tp (& _array)[N] ) { return _array + (sizeof(_array)/sizeof(_Tp)); } + +ResStatus::TransactByValue transactByValues[] = { + ResStatus::USER, ResStatus::APPL_HIGH, ResStatus::APPL_LOW, ResStatus::SOLVER +}; + +ResStatus::TransactValue transactValues[] = { + ResStatus::TRANSACT, ResStatus::KEEP_STATE, ResStatus::LOCKED +}; + +bool transactTo[] = { true, false }; + +BOOST_AUTO_TEST_CASE(Default) { -#if 0 { ResStatus s; BOOST_CHECK( s.isUninstalled() ); BOOST_CHECK_EQUAL( s.isInstalled(), ! s.isUninstalled() ); - BOOST_CHECK_EQUAL( s.getTransactValue(), KEEP_STATE ); - BOOST_CHECK_EQUAL( s.getTransactByValue(), SOLVER ); + BOOST_CHECK_EQUAL( s.getTransactValue(), ResStatus::KEEP_STATE ); + BOOST_CHECK_EQUAL( s.getTransactByValue(), ResStatus::SOLVER ); } { ResStatus s( true ); - BOOST_CHECK( s.Installed() ); + BOOST_CHECK( s.isInstalled() ); BOOST_CHECK_EQUAL( s.isInstalled(), ! s.isUninstalled() ); - BOOST_CHECK_EQUAL( s.getTransactValue(), KEEP_STATE ); - BOOST_CHECK_EQUAL( s.getTransactByValue(), SOLVER ); + BOOST_CHECK_EQUAL( s.getTransactValue(), ResStatus::KEEP_STATE ); + BOOST_CHECK_EQUAL( s.getTransactByValue(), ResStatus::SOLVER ); } -#endif } -#if 0 - -// enum TransactValue -// { -// KEEP_STATE = bit::RangeValue<TransactField,0>::value, -// LOCKED = bit::RangeValue<TransactField,1>::value, // locked, must not transact -// TRANSACT = bit::RangeValue<TransactField,2>::value // transact according to state -// }; -// enum TransactByValue -// { -// SOLVER = bit::RangeValue<TransactByField,0>::value, -// APPL_LOW = bit::RangeValue<TransactByField,1>::value, -// APPL_HIGH = bit::RangeValue<TransactByField,2>::value, -// USER = bit::RangeValue<TransactByField,3>::value -// }; -ResStatus doTestSet( TransactValue tv, TransactByValue tb ) -{ - ResStatus s; - s.setTransactValue( tv, tb ); - BOOST_CHECK_EQUAL( getTransactValue( s ), tv ); - BOOST_CHECK_EQUAL( getTransactByValue( s ), tb ); -} +// Status transition like setTransact, setLock, setSoftTransact +typedef bool (ResStatus::* Transition)( bool, ResStatus::TransactByValue ); +// Result evaluation +typedef void (* Evaluate)( ResStatus::TransactValue, ResStatus::TransactByValue, /* fromState, fromBy */ + bool, ResStatus::TransactByValue, /* toState, toBy */ + bool, ResStatus ); /* done, result */ -BOOST_AUTO_TEST_CASE(ResStatus) +void testTable( Transition transition, Evaluate evaluate ) { - std::vector<TransactValue> TVs; - TVs.push_back( KEEP_STATE ); - TVs.push_back( LOCKED ); - TVs.push_back( TRANSACT ); - - std::vector<TransactByValue> TBs; - TBs.push_back( SOLVER ); - TBs.push_back( APPL_LOW ); - TBs.push_back( APPL_HIGH ); - TBs.push_back( USER ); - - for_( tv, TVs.begin(), TVs end() ) + // Table: For each causer combination (fromBy -> toBy) invoke transition: + // + // bool ok = ResStatus(fromState,fromBy).transition( toState, toBy ) + // + // And evaluate the result. + // + for ( ResStatus::TransactByValue * fromBy = begin( transactByValues ); fromBy != end( transactByValues ); ++fromBy ) { - for_( tb, TBs.begin(), TBs end() ) + for ( ResStatus::TransactByValue * toBy = begin( transactByValues ); toBy != end( transactByValues ); ++toBy ) { - doTestSet - + for ( ResStatus::TransactValue * fromState = begin( transactValues ); fromState != end( transactValues ); ++fromState ) + { + for ( bool * toState = begin( transactTo ); toState != end( transactTo ); ++toState ) + { + ResStatus from; + from.setTransactValue( *fromState, *fromBy ); // NEEDS FIX! + + ResStatus result( from ); + bool done = (result.*transition)( *toState, *toBy ); + + evaluate( *fromState, *fromBy, *toState, *toBy, done, result ); + } + } } } +} +// Transitions succeeds always: +#define CHECK_DONE_ALWAYS BOOST_CHECK_EQUAL( done, true ) +// Transitions succeeds if same or higher TransactByValue: +#define CHECK_DONE_IFCAUSER BOOST_CHECK_EQUAL( done, *toBy >= *fromBy ) + +void evaluateSetTransact( ResStatus::TransactValue fromState, ResStatus::TransactByValue fromBy, + bool toState, ResStatus::TransactByValue toBy, + bool done, ResStatus result ) +{ + ResStatus from; + from.setTransactValue( fromState, fromBy ); + MIL << from << " =setTransact("<<toState<<","<<toBy<<")=>\t" << done << ":" << result << endl; + switch ( fromState ) + { + case ResStatus::TRANSACT: + if ( toState ) + { + } + else + { + } + break; + case ResStatus::KEEP_STATE: + if ( toState ) + { + } + else + { + } + break; + case ResStatus::LOCKED: + if ( toState ) + { + } + else + { + } + break; + } +} +#if 0 +BOOST_AUTO_TEST_CASE(transition) +{ + base::LogControl::TmpLineWriter shutUp( new log::FileLineWriter( "/home/ma/zypp/BUILD/libzypp/devel/devel.ma/LOGFILE" ) ); + MIL << endl; + testTable( &ResStatus::setTransact, &evaluateSetTransact ); } #endif diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/zypp/Arch.cc new/libzypp-6.1.0/zypp/Arch.cc --- old/libzypp-6.1.0/zypp/Arch.cc 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/zypp/Arch.cc 2009-02-27 01:50:42.000000000 +0100 @@ -11,6 +11,7 @@ */ #include <iostream> #include <list> +#include <inttypes.h> #include "zypp/base/Logger.h" #include "zypp/base/Exception.h" diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/zypp/Fetcher.cc new/libzypp-6.1.0/zypp/Fetcher.cc --- old/libzypp-6.1.0/zypp/Fetcher.cc 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/zypp/Fetcher.cc 2009-02-27 01:50:42.000000000 +0100 @@ -555,7 +555,7 @@ // try to get the file from the net try { - Pathname tmp_file = media.provideFile(resource); + Pathname tmp_file = media.provideFile(resource, resource.optional() ? MediaSetAccess::PROVIDE_NON_INTERACTIVE : MediaSetAccess::PROVIDE_DEFAULT ); Pathname dest_full_path = dest_dir + resource.filename(); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/zypp/MediaSetAccess.cc new/libzypp-6.1.0/zypp/MediaSetAccess.cc --- old/libzypp-6.1.0/zypp/MediaSetAccess.cc 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/zypp/MediaSetAccess.cc 2009-02-27 01:50:42.000000000 +0100 @@ -226,7 +226,7 @@ try { - DBG << "Going to try to provide file " << file + DBG << "Going to try to provide " << (resource.optional() ? "optional" : "") << " file " << file << " from media number " << media_nr << endl; // try to attach the media if ( ! media_mgr.isAttached(media) ) @@ -281,6 +281,7 @@ // otherwise propagate the error if ( ( options & PROVIDE_NON_INTERACTIVE ) && reason != media::MediaChangeReport::WRONG) { + MIL << "Can't provide file. Non-Interactive mode." << endl; ZYPP_RETHROW(excp); } else diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/zypp/repo/susetags/Downloader.cc new/libzypp-6.1.0/zypp/repo/susetags/Downloader.cc --- old/libzypp-6.1.0/zypp/repo/susetags/Downloader.cc 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/zypp/repo/susetags/Downloader.cc 2009-02-27 01:50:42.000000000 +0100 @@ -52,7 +52,7 @@ Pathname sig = repoInfo().path() + "/content.asc"; - this->enqueue( OnMediaLocation( sig, 1 ) ); + this->enqueue( OnMediaLocation( sig, 1 ).setOptional(true) ); this->start( dest_dir, media ); // only if there is a signature in the destination directory if ( PathInfo(dest_dir / sig ).isExist() ) @@ -61,7 +61,7 @@ Pathname key = repoInfo().path() + "/content.key"; - this->enqueue( OnMediaLocation( key, 1 ) ); + this->enqueue( OnMediaLocation( key, 1 ).setOptional(true) ); this->start( dest_dir, media ); // only if there is a key in the destination directory if ( PathInfo(dest_dir / key).isExist() ) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/zypp/ResStatus.h new/libzypp-6.1.0/zypp/ResStatus.h --- old/libzypp-6.1.0/zypp/ResStatus.h 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/zypp/ResStatus.h 2009-02-27 01:50:42.000000000 +0100 @@ -12,6 +12,7 @@ #ifndef ZYPP_RESSTATUS_H #define ZYPP_RESSTATUS_H +#include <inttypes.h> #include <iosfwd> #include "zypp/Bit.h" @@ -366,9 +367,9 @@ } /** Apply a lock (prevent transaction). - * Currently by USER only, but who knows... Set LOCKED - * from KEEP_STATE to be shure all transaction details - * were reset properly. + * Currently by USER or APPL_HIGH only, but who knows... + * Set LOCKED from KEEP_STATE to be shure all transaction + * details were reset properly. */ bool setLock( bool toLock_r, TransactByValue causer_r ) { @@ -381,19 +382,23 @@ return true; } // Here: Lock status is to be changed: - if ( causer_r != USER && causer_r != APPL_HIGH) - return false; - // Setting no transact removes an existing lock, - // or brings this into KEEP_STATE, and we apply the lock. - if ( ! setTransact( false, causer_r ) ) + if ( causer_r != USER && causer_r != APPL_HIGH ) return false; if ( toLock_r ) { - fieldValueAssign<TransactField>( LOCKED ); - fieldValueAssign<TransactByField>( causer_r ); + // We're in unlocked state, which includes TRANSACT. + // Causer must be allowed to reset this. But from + // KEEP_STATE every causer is allowed to set the lock. + if ( ! setTransact( false, causer_r ) ) + return false; + fieldValueAssign<TransactField>( LOCKED ); + fieldValueAssign<TransactByField>( causer_r ); } else { - fieldValueAssign<TransactField>( KEEP_STATE ); - fieldValueAssign<TransactByField>( SOLVER ); // reset to lowest causer - // in order to distinguish from keep_state_by_user + // To leave Locked state it needs a superior causer. + if ( isGreaterThan<TransactByField>( causer_r ) ) + return false; + fieldValueAssign<TransactField>( KEEP_STATE ); + fieldValueAssign<TransactByField>( SOLVER ); // reset to lowest causer + // in order to distinguish from keep_state_by_user } return true; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/zypp/ZConfig.cc new/libzypp-6.1.0/zypp/ZConfig.cc --- old/libzypp-6.1.0/zypp/ZConfig.cc 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/zypp/ZConfig.cc 2009-02-27 01:50:42.000000000 +0100 @@ -581,7 +581,8 @@ { return _pimpl->solver_onlyRequires; } Pathname ZConfig::solver_checkSystemFile() const - { return _pimpl->solver_checkSystemFile; } + { return ( _pimpl->solver_checkSystemFile.empty() + ? (configPath()/"systemCheck") : _pimpl->solver_checkSystemFile ); } std::set<IdString> ZConfig::multiversion() const { return _pimpl->multiversion; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzypp-6.1.0/zypp.conf new/libzypp-6.1.0/zypp.conf --- old/libzypp-6.1.0/zypp.conf 2009-02-23 17:58:00.000000000 +0100 +++ new/libzypp-6.1.0/zypp.conf 2009-02-27 01:50:42.000000000 +0100 @@ -208,10 +208,11 @@ ## installed. ## So the user will be informed if these packages will be deleted. ## -## format: Each line represents one dependency: -## e.g. -## requires:kernel -## requires:glibc +## Format: Each line represents one dependency: +## e.g. +## requires:kernel +## requires:glibc +## Default value: {configdir}/systemCheck ## # solver.checkSystemFile = /etc/zypp/systemCheck ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de