return _val;
}
+ const Pathname & sysconfigStoragePath()
+ {
+ static const Pathname _val( "/etc/sysconfig/storage" );
+ return _val;
+ }
+
+
/////////////////////////////////////////////////////////////////
static void logSat( struct _Pool *, void *data, int type, const char *logString )
case NAMESPACE_FILESYSTEM:
{
- static const Pathname sysconfigStoragePath( "/etc/sysconfig/storage" );
- static WatchFile sysconfigFile( sysconfigStoragePath, WatchFile::NO_INIT );
- static std::set<std::string> requiredFilesystems;
- if ( sysconfigFile.hasChanged() )
- {
- requiredFilesystems.clear();
- str::split( base::sysconfig::read( sysconfigStoragePath )["USED_FS_LIST"],
- std::inserter( requiredFilesystems, requiredFilesystems.end() ) );
- }
+ const std::set<std::string> & requiredFilesystems( reinterpret_cast<PoolImpl*>(data)->requiredFilesystems() );
return requiredFilesystems.find( IdString(rhs).asString() ) != requiredFilesystems.end() ? RET_systemProperty : RET_unsupported;
}
break;
void PoolImpl::prepare() const
{
- if ( _watcher.remember( _serial ) )
+ if ( _watcher.remember( _serial ) )
{
// After repo/solvable add/remove:
// set pool architecture
if ( ! _pool->whatprovides )
{
MIL << "pool_createwhatprovides..." << endl;
+
::pool_addfileprovides( _pool );
::pool_createwhatprovides( _pool );
}
}
}
+ void PoolImpl::prepareForSolving() const
+ {
+ // additional /etc/sysconfig/storage check:
+ static WatchFile sysconfigFile( sysconfigStoragePath(), WatchFile::NO_INIT );
+ if ( sysconfigFile.hasChanged() )
+ {
+ _requiredFilesystemsPtr.reset(); // recreated on demand
+ const_cast<PoolImpl*>(this)->depSetDirty( "/etc/sysconfig/storage change" );
+ }
+ // finally prepare as usual:
+ prepare();
+ }
+
///////////////////////////////////////////////////////////////////
::_Repo * PoolImpl::_createRepo( const std::string & name_r )
MIL << "onSystemByUserList found: " << onSystemByUserList.size() << endl;
}
+ const std::set<std::string> & PoolImpl::requiredFilesystems() const
+ {
+ if ( ! _requiredFilesystemsPtr )
+ {
+ _requiredFilesystemsPtr.reset( new std::set<std::string> );
+ std::set<std::string> & requiredFilesystems( *_requiredFilesystemsPtr );
+ str::split( base::sysconfig::read( sysconfigStoragePath() )["USED_FS_LIST"],
+ std::inserter( requiredFilesystems, requiredFilesystems.end() ) );
+ }
+ return *_requiredFilesystemsPtr;
+ }
+
/////////////////////////////////////////////////////////////////
} // namespace detail
///////////////////////////////////////////////////////////////////
* \todo actually requires a watcher.
*/
void prepare() const;
+ /** \ref prepare plus some expensive checks done before solving only. */
+ void prepareForSolving() const;
private:
/** Invalidate housekeeping data (e.g. whatprovides) if the
}
//@}
+ public:
+ /** accessor for etc/sysconfig/storage reading file on demand */
+ const std::set<std::string> & requiredFilesystems() const;
+
private:
/** sat-pool. */
::_Pool * _pool;
/** */
void onSystemByUserListInit() const;
mutable scoped_ptr<OnSystemByUserList> _onSystemByUserListPtr;
+
+ /** filesystems mentioned in /etc/sysconfig/storage */
+ mutable scoped_ptr<std::set<std::string> > _requiredFilesystemsPtr;
};
///////////////////////////////////////////////////////////////////
_solv->distupgrade = _distupgrade;
_solv->distupgrade_removeunsupported = _distupgrade_removeunsupported;
- sat::Pool::instance().prepare();
+ sat::Pool::instance().prepareForSolving();
// Solve !
MIL << "Starting solving...." << endl;
_solv->distupgrade = _distupgrade;
_solv->distupgrade_removeunsupported = _distupgrade_removeunsupported;
- sat::Pool::instance().prepare();
+ sat::Pool::instance().prepareForSolving();
// Solve !
MIL << "Starting solving for update...." << endl;