Author: mlandres Date: Fri Aug 15 14:30:44 2008 New Revision: 10871 URL: http://svn.opensuse.org/viewcvs/zypp?rev=10871&view=rev Log: - Add method ZYpp::getTarget that returns the Target or a NULL pointer, if it is not yet initialized. This is to avoid try/catch blocks just to test whether the Target is initialized. (bnc #417556) - Add method Target::assertRootPrefix. Pass a pathname and get back the path prefixed with the tragets root, unless it already had that prefix. Modified: trunk/libzypp/VERSION.cmake trunk/libzypp/package/libzypp.changes trunk/libzypp/zypp/Target.h trunk/libzypp/zypp/ZYpp.cc trunk/libzypp/zypp/ZYpp.h trunk/libzypp/zypp/solver/detail/SystemCheck.cc trunk/libzypp/zypp/zypp_detail/ZYppImpl.h Modified: trunk/libzypp/VERSION.cmake URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/VERSION.cmake?rev=10871&r1=10870&r2=10871&view=diff ============================================================================== --- trunk/libzypp/VERSION.cmake (original) +++ trunk/libzypp/VERSION.cmake Fri Aug 15 14:30:44 2008 @@ -60,8 +60,8 @@ # SET(LIBZYPP_MAJOR "5") SET(LIBZYPP_COMPATMINOR "5") -SET(LIBZYPP_MINOR "5") -SET(LIBZYPP_PATCH "2") +SET(LIBZYPP_MINOR "6") +SET(LIBZYPP_PATCH "0") # # LAST RELEASED: 5.5.1 (5) # (The number in parenthesis is LIBZYPP_COMPATMINOR) Modified: trunk/libzypp/package/libzypp.changes URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=10871&r1=10870&r2=10871&view=diff ============================================================================== --- trunk/libzypp/package/libzypp.changes (original) +++ trunk/libzypp/package/libzypp.changes Fri Aug 15 14:30:44 2008 @@ -1,4 +1,14 @@ ------------------------------------------------------------------- +Fri Aug 15 14:23:02 CEST 2008 - ma@suse.de + +- Add method ZYpp::getTarget that returns the Target or a NULL pointer, + if it is not yet initialized. This is to avoid try/catch blocks just + to test whether the Target is initialized. (bnc #417556) +- Add method Target::assertRootPrefix. Pass a pathname and get back the + path prefixed with the tragets root, unless it already had that prefix. +- revision 10870 + +------------------------------------------------------------------- Thu Aug 14 18:44:45 CEST 2008 - schubi@suse.de - Regarding error messages for Products correctly (FATE #304502) Modified: trunk/libzypp/zypp/Target.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Target.h?rev=10871&r1=10870&r2=10871&view=diff ============================================================================== --- trunk/libzypp/zypp/Target.h (original) +++ trunk/libzypp/zypp/Target.h Fri Aug 15 14:30:44 2008 @@ -100,6 +100,10 @@ /** Return the root set for this target */ Pathname root() const; + /** Return the path prefixed by the target root, unless it already is prefixed. */ + Pathname assertRootPrefix( const Pathname & path_r ) const + { return Pathname::assertprefix( root(), path_r ); } + /** return the last modification date of the target */ Date timestamp() const; @@ -119,7 +123,7 @@ * */ std::string anonymousUniqueId() const; - + public: /** Ctor. If \c doRebuild_r is \c true, an already existing * database is rebuilt (rpm --rebuilddb ). Modified: trunk/libzypp/zypp/ZYpp.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZYpp.cc?rev=10871&r1=10870&r2=10871&view=diff ============================================================================== --- trunk/libzypp/zypp/ZYpp.cc (original) +++ trunk/libzypp/zypp/ZYpp.cc Fri Aug 15 14:30:44 2008 @@ -85,6 +85,9 @@ Target_Ptr ZYpp::target() const { return _pimpl->target(); } + Target_Ptr ZYpp::getTarget() const + { return _pimpl->getTarget(); } + void ZYpp::initializeTarget( const Pathname & root, bool doRebuild_r ) { _pimpl->initializeTarget( root, doRebuild_r ); } Modified: trunk/libzypp/zypp/ZYpp.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZYpp.h?rev=10871&r1=10870&r2=10871&view=diff ============================================================================== --- trunk/libzypp/zypp/ZYpp.h (original) +++ trunk/libzypp/zypp/ZYpp.h Fri Aug 15 14:30:44 2008 @@ -84,6 +84,11 @@ */ Target_Ptr target() const; + /** Same as \ref target but returns NULL if target is not + * initialized, instead of throwing. + */ + Target_Ptr getTarget() const; + /** * \throws Exception * Just init the target, dont populate store or pool. Modified: trunk/libzypp/zypp/solver/detail/SystemCheck.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/SystemCheck.cc?rev=10871&r1=10870&r2=10871&view=diff ============================================================================== --- trunk/libzypp/zypp/solver/detail/SystemCheck.cc (original) +++ trunk/libzypp/zypp/solver/detail/SystemCheck.cc Fri Aug 15 14:30:44 2008 @@ -40,8 +40,8 @@ static SystemCheck _val; return _val; } - - + + SystemCheck::SystemCheck() { if (_file.empty()) { _file = ZConfig::instance().solver_checkSystemFile(); @@ -69,26 +69,19 @@ } bool SystemCheck::loadFile() const{ - try - { - Target_Ptr trg( getZYpp()->target() ); - if ( trg ) - _file = trg->root() / _file; - } - catch ( ... ) - { - // noop: Someone decided to let target() throw if the ptr is NULL ;( - } + Target_Ptr trg( getZYpp()->getTarget() ); + if ( trg ) + _file = trg->assertRootPrefix( _file ); PathInfo pi( _file ); if ( ! pi.isFile() ) { WAR << "Can't read " << _file << " " << pi << endl; return false; } - + _require.clear(); _conflict.clear(); - + std::ifstream infile( _file.c_str() ); for( iostr::EachLine in( infile ); in; in.next() ) { std::string l( str::trim(*in) ); @@ -113,7 +106,7 @@ MIL << "Read " << pi << endl; return true; } - + /****************************************************************** ** Modified: trunk/libzypp/zypp/zypp_detail/ZYppImpl.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/zypp_detail/ZYppImpl.h?rev=10871&r1=10870&r2=10871&view=diff ============================================================================== --- trunk/libzypp/zypp/zypp_detail/ZYppImpl.h (original) +++ trunk/libzypp/zypp/zypp_detail/ZYppImpl.h Fri Aug 15 14:30:44 2008 @@ -69,6 +69,12 @@ */ Target_Ptr target() const; + /** Same as \ref target but returns NULL if target is not + * initialized, instead of throwing. + */ + Target_Ptr getTarget() const + { return _target; } + /** * \throws Exception * true, just init the target, dont populate store or pool -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org