#include <map>
#include <algorithm>
-#include <solv/solvversion.h>
-
#include "zypp/base/InputStream.h"
#include "zypp/base/LogTools.h"
#include "zypp/base/Gettext.h"
// Cleanup orphanded service repos:
if ( ! orphanedRepos.empty() )
{
- for ( const auto & repoInfo : orphanedRepos )
+ for ( auto & repoInfo : orphanedRepos )
{
MIL << "Delete orphaned service repo " << repoInfo.alias() << endl;
// translators: Cleanup a repository previously owned by a meanwhile unknown (deleted) service.
assert_urls(info);
// we will throw this later if no URL checks out fine
- RepoException rexception( info, PL_("Valid metadata not found at specified URL",
+ RepoException rexception( info, _PL("Valid metadata not found at specified URL",
"Valid metadata not found at specified URLs",
info.baseUrlsSize() ) );
if ( cache_status == raw_metadata_status )
{
MIL << info.alias() << " cache is up to date with metadata." << endl;
- if ( policy == BuildIfNeeded )
- {
- // On the fly add missing solv.idx files for bash completion.
- const Pathname & base = solv_path_for_repoinfo( _options, info);
- if ( ! PathInfo(base/"solv.idx").isExist() )
- sat::updateSolvFileIndex( base/"solv" );
-
- return;
+ if ( policy == BuildIfNeeded ) {
+ return;
}
else {
MIL << info.alias() << " cache rebuild is forced" << endl;
// We keep it.
guard.resetDispose();
- sat::updateSolvFileIndex( solvfile ); // content digest for zypper bash completion
}
break;
default:
{
Repository repo = sat::Pool::instance().addRepoSolv( solvfile, info );
// test toolversion in order to rebuild solv file in case
- // it was written by a different libsolv-tool parser.
- const std::string & toolversion( sat::LookupRepoAttr( sat::SolvAttr::repositoryToolVersion, repo ).begin().asString() );
- if ( toolversion != LIBSOLV_TOOLVERSION )
+ // it was written by an old libsolv-tool parser.
+ //
+ // Known version strings used:
+ // - <no string>
+ // - "1.0"
+ //
+ sat::LookupRepoAttr toolversion( sat::SolvAttr::repositoryToolVersion, repo );
+ if ( toolversion.begin().asString().empty() )
{
repo.eraseFromPool();
- ZYPP_THROW(Exception(str::Str() << "Solv-file was created by '"<<toolversion<<"'-parser (want "<<LIBSOLV_TOOLVERSION<<")."));
+ ZYPP_THROW(Exception("Solv-file was created by old parser."));
}
+ // else: up-to-date (or even newer).
}
catch ( const Exception & exp )
{
newinfo.dumpAsIniOn(file);
}
- if ( toedit.enabled() && !newinfo.enabled() )
- {
- // On the fly remove solv.idx files for bash completion if a repo gets disabled.
- const Pathname & solvidx = solv_path_for_repoinfo(_options, newinfo)/"solv.idx";
- if ( PathInfo(solvidx).isExist() )
- filesystem::unlink( solvidx );
- }
-
newinfo.setFilepath(toedit.filepath());
reposManip().erase(toedit);
reposManip().insert(newinfo);
ServiceInfo service( getService( alias ) );
assert_alias( service );
assert_url( service );
- MIL << "Going to refresh service '" << service.alias() << "', url: " << service.url() << ", opts: " << options_r << endl;
-
- if ( service.ttl() && !( options_r.testFlag( RefreshService_forceRefresh) || options_r.testFlag( RefreshService_restoreStatus ) ) )
- {
- // Service defines a TTL; maybe we can re-use existing data without refresh.
- Date lrf = service.lrf();
- if ( lrf )
- {
- Date now( Date::now() );
- if ( lrf <= now )
- {
- if ( (lrf+=service.ttl()) > now ) // lrf+= !
- {
- MIL << "Skip: '" << service.alias() << "' metadata valid until " << lrf << endl;
- return;
- }
- }
- else
- WAR << "Force: '" << service.alias() << "' metadata last refresh in the future: " << lrf << endl;
- }
- }
-
// NOTE: It might be necessary to modify and rewrite the service info.
// Either when probing the type, or when adjusting the repositories
// enable/disable state.:
bool serviceModified = false;
+ MIL << "Going to refresh service '" << service.alias() << "', url: "<< service.url() << ", opts: " << options_r << endl;
- //! \todo add callbacks for apps (start, end, repo removed, repo added, repo changed)?
+ //! \todo add callbacks for apps (start, end, repo removed, repo added, repo changed)
// if the type is unknown, try probing.
if ( service.type() == repo::ServiceType::NONE )
DBG << "ServicesTargetDistro: " << servicesTargetDistro << endl;
// parse it
- Date::Duration origTtl = service.ttl(); // FIXME Ugly hack: const service.ttl modified when parsing
RepoCollector collector(servicesTargetDistro);
// FIXME Ugly hack: ServiceRepos may throw ServicePluginInformalException
// which is actually a notification. Using an exception for this
// and in zypper.
std::pair<DefaultIntegral<bool,false>, repo::ServicePluginInformalException> uglyHack;
try {
- ServiceRepos( service, bind( &RepoCollector::collect, &collector, _1 ) );
+ ServiceRepos repos(service, bind( &RepoCollector::collect, &collector, _1 ));
}
catch ( const repo::ServicePluginInformalException & e )
{
uglyHack.first = true;
uglyHack.second = e;
}
- if ( service.ttl() != origTtl ) // repoindex.xml changed ttl
- {
- if ( !service.ttl() )
- service.setLrf( Date() ); // don't need lrf when zero ttl
- serviceModified = true;
- }
+
////////////////////////////////////////////////////////////////////////////
// On the fly remember the new repo states as defined the reopoindex.xml.
// Move into ServiceInfo later.
////////////////////////////////////////////////////////////////////////////
// save service if modified: (unless a plugin service)
- if ( service.type() != ServiceType::PLUGIN )
+ if ( serviceModified && service.type() != ServiceType::PLUGIN )
{
- if ( service.ttl() )
- {
- service.setLrf( Date::now() ); // remember last refresh
- serviceModified = true; // or use a cookie file
- }
-
- if ( serviceModified )
- {
- // write out modified service file.
- modifyService( service.alias(), service );
- }
+ // write out modified service file.
+ modifyService( service.alias(), service );
}
if ( uglyHack.first )