Can be used in 'zypper' to reload the cache if rpm database
has changed (bnc #767880)
+-------------------------------------------------------------------
+Wed Sep 5 11:56:54 CEST 2012 - gs@suse.de
+
+- Provide Target::reload()
+
-------------------------------------------------------------------
Sun Aug 26 01:13:31 CEST 2012 - ma@suse.de
-------------------------------------------------------------------
Sun Aug 26 01:13:31 CEST 2012 - ma@suse.de
void Target::load()
{ _pimpl->load(); }
void Target::load()
{ _pimpl->load(); }
+ void Target::reload()
+ { _pimpl->reload(); }
+
void Target::unload()
{ _pimpl->unload(); }
void Target::unload()
{ _pimpl->unload(); }
/**
* unload target resolvables from the
* pool
/**
* unload target resolvables from the
* pool
filesystem::recursive_rmdir( base );
}
filesystem::recursive_rmdir( base );
}
- void TargetImpl::buildCache()
+ bool TargetImpl::buildCache()
{
Pathname base = solvfilesPath();
Pathname rpmsolv = base/"solv";
{
Pathname base = solvfilesPath();
Pathname rpmsolv = base/"solv";
+ return build_rpm_solv;
+ }
+
+ void TargetImpl::reload()
+ {
+ load( false );
}
void TargetImpl::unload()
}
void TargetImpl::unload()
system.eraseFromPool();
}
system.eraseFromPool();
}
-
- void TargetImpl::load()
+ void TargetImpl::load( bool force )
+ 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" );
// now add the repos to the pool
sat::Pool satpool( sat::Pool::instance() );
Pathname rpmsolv( solvfilesPath() / "solv" );
// Providing an empty system repo, unload any old content
Repository system( sat::Pool::instance().findSystemRepo() );
// Providing an empty system repo, unload any old content
Repository system( sat::Pool::instance().findSystemRepo() );
if ( system && ! system.solvablesEmpty() )
{
if ( system && ! system.solvablesEmpty() )
{
- system.eraseFromPool(); // invalidates system
+ if ( newCache || force )
+ {
+ system.eraseFromPool(); // invalidates system
+ }
+ else
+ {
+ return; // nothing to do
+ }
if ( ! system )
{
system = satpool.systemRepo();
if ( ! system )
{
system = satpool.systemRepo();
+ MIL << "adding " << rpmsolv << " to system" << endl;
system.addSolv( rpmsolv );
}
catch ( const Exception & exp )
system.addSolv( rpmsolv );
}
catch ( const Exception & exp )
Pathname _tmpSolvfilesPath;
public:
Pathname _tmpSolvfilesPath;
public:
+ void load( bool force = true );