namespace zypp
{ /////////////////////////////////////////////////////////////////
+ namespace
+ {
+ repo::RepoType probeCache( const Pathname & path_r )
+ {
+ repo::RepoType ret = repo::RepoType::NONE;
+ if ( PathInfo(path_r).isDir() )
+ {
+ if ( PathInfo(path_r/"/repodata/repomd.xml").isFile() )
+ { ret = repo::RepoType::RPMMD; }
+ else if ( PathInfo(path_r/"/content").isFile() )
+ { ret = repo::RepoType::YAST2; }
+ else if ( PathInfo(path_r/"/cookie").isFile() )
+ { ret = repo::RepoType::RPMPLAINDIR; }
+ }
+ DBG << "Probed cached type " << ret << " at " << path_r << endl;
+ return ret;
+ }
+ } // namespace
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : RepoInfo::Impl
, _rawRepoGpgCheck( indeterminate )
, _rawPkgGpgCheck( indeterminate )
, _validRepoSignature( indeterminate )
+ , _type(repo::RepoType::NONE_e)
, keeppackages(indeterminate)
, _mirrorListForceMetalink(false)
- , type(repo::RepoType::NONE_e)
, emptybaseurls(false)
{}
static const unsigned defaultPriority = 99;
static const unsigned noPriority = unsigned(-1);
+ void setType( const repo::RepoType & t )
+ { _type = t; }
+
void setProbedType( const repo::RepoType & t ) const
{
- if ( type == repo::RepoType::NONE
- && t != repo::RepoType::NONE )
- {
- // lazy init!
- const_cast<Impl*>(this)->type = t;
- }
+ if ( _type == repo::RepoType::NONE && t != repo::RepoType::NONE )
+ { const_cast<Impl*>(this)->_type = t; }
+ }
+
+ repo::RepoType type() const
+ {
+ if ( _type == repo::RepoType::NONE )
+ setProbedType( probeCache( metadataPath() / path ) );
+ return _type;
}
public:
{ return indeterminate(_rawGpgCheck) && indeterminate(_rawPkgGpgCheck) ? ZConfig::instance().pkgGpgCheck() : _rawPkgGpgCheck; }
private:
- TriBool _validRepoSignature;///< have signed and valid repo metadata
+ TriBool _validRepoSignature; ///< have signed and valid repo metadata
+ repo::RepoType _type;
public:
TriBool keeppackages;
RepoVariablesReplacedUrl _mirrorListUrl;
bool _mirrorListForceMetalink;
- repo::RepoType type;
Pathname path;
std::string service;
std::string targetDistro;
{ _pimpl->path = path; }
void RepoInfo::setType( const repo::RepoType &t )
- { _pimpl->type = t; }
+ { _pimpl->setType( t ); }
void RepoInfo::setProbedType( const repo::RepoType &t ) const
{ _pimpl->setProbedType( t ); }
{ return _pimpl->usesAutoMethadataPaths(); }
repo::RepoType RepoInfo::type() const
- { return _pimpl->type; }
+ { return _pimpl->type(); }
Url RepoInfo::mirrorListUrl() const // Variables replaced!
{ return _pimpl->_mirrorListUrl.transformed(); }
std::string indent;
for ( const auto & url : _pimpl->baseUrls().raw() )
{
- str << indent << url << endl;
+ str << indent << hotfix1050625::asString( url ) << endl;
if ( indent.empty() ) indent = " "; // "baseurl="
}
}
str << "path="<< path() << endl;
if ( ! (rawMirrorListUrl().asString().empty()) )
- str << (_pimpl->_mirrorListForceMetalink ? "metalink=" : "mirrorlist=") << rawMirrorListUrl() << endl;
+ str << (_pimpl->_mirrorListForceMetalink ? "metalink=" : "mirrorlist=") << hotfix1050625::asString( rawMirrorListUrl() ) << endl;
- str << "type=" << type().asString() << endl;
+ if ( type() != repo::RepoType::NONE )
+ str << "type=" << type().asString() << endl;
if ( priority() != defaultPriority() )
str << "priority=" << priority() << endl;