#
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)
-------------------------------------------------------------------
+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)
/** 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;
*
*/
std::string anonymousUniqueId() const;
-
+
public:
/** Ctor. If \c doRebuild_r is \c true, an already existing
* database is rebuilt (rpm --rebuilddb ).
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 ); }
*/
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.
static SystemCheck _val;
return _val;
}
-
-
+
+
SystemCheck::SystemCheck() {
if (_file.empty()) {
_file = ZConfig::instance().solver_checkSystemFile();
}
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) );
MIL << "Read " << pi << endl;
return true;
}
-
+
/******************************************************************
**
*/
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