Hello community, here is the log from the commit of package libzypp for openSUSE:Factory checked in at 2015-08-15 11:38:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libzypp (Old) and /work/SRC/openSUSE:Factory/.libzypp.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libzypp" Changes: -------- --- /work/SRC/openSUSE:Factory/libzypp/libzypp.changes 2015-08-12 15:11:43.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.libzypp.new/libzypp.changes 2015-08-15 11:38:12.000000000 +0200 @@ -1,0 +2,15 @@ +Thu Aug 13 18:16:52 CEST 2015 - [email protected] + +- Support caching of service metadata. A TTL for the service + metadata may be provided in the repoindex.xml itself. The + default is 'no caching'. (FATE#318136) +- Fix setting dup_allow* solver options (bnc#941463) +- Don't make zypper encode {} around repo vars (bnc#941453) +- version 15.13.0 (11) + +------------------------------------------------------------------- +Thu Aug 13 01:13:43 CEST 2015 - [email protected] + +- Update zypp-po.tar.bz2 + +------------------------------------------------------------------- Old: ---- libzypp-15.12.0.tar.bz2 New: ---- libzypp-15.13.0.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libzypp.spec ++++++ --- /var/tmp/diff_new_pack.ZIoADF/_old 2015-08-15 11:38:13.000000000 +0200 +++ /var/tmp/diff_new_pack.ZIoADF/_new 2015-08-15 11:38:13.000000000 +0200 @@ -19,7 +19,7 @@ %define force_gcc_46 0 Name: libzypp -Version: 15.12.0 +Version: 15.13.0 Release: 0 Url: git://gitorious.org/opensuse/libzypp.git Summary: Package, Patch, Pattern, and Product Management ++++++ libzypp-15.12.0.tar.bz2 -> libzypp-15.13.0.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-15.12.0/VERSION.cmake new/libzypp-15.13.0/VERSION.cmake --- old/libzypp-15.12.0/VERSION.cmake 2015-08-11 18:52:27.000000000 +0200 +++ new/libzypp-15.13.0/VERSION.cmake 2015-08-13 18:27:15.000000000 +0200 @@ -60,9 +60,9 @@ # SET(LIBZYPP_MAJOR "15") SET(LIBZYPP_COMPATMINOR "11") -SET(LIBZYPP_MINOR "12") +SET(LIBZYPP_MINOR "13") SET(LIBZYPP_PATCH "0") # -# LAST RELEASED: 15.12.0 (11) +# LAST RELEASED: 15.13.0 (11) # (The number in parenthesis is LIBZYPP_COMPATMINOR) #======= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-15.12.0/package/libzypp.changes new/libzypp-15.13.0/package/libzypp.changes --- old/libzypp-15.12.0/package/libzypp.changes 2015-08-11 18:52:27.000000000 +0200 +++ new/libzypp-15.13.0/package/libzypp.changes 2015-08-13 18:27:15.000000000 +0200 @@ -1,4 +1,19 @@ ------------------------------------------------------------------- +Thu Aug 13 18:16:52 CEST 2015 - [email protected] + +- Support caching of service metadata. A TTL for the service + metadata may be provided in the repoindex.xml itself. The + default is 'no caching'. (FATE#318136) +- Fix setting dup_allow* solver options (bnc#941463) +- Don't make zypper encode {} around repo vars (bnc#941453) +- version 15.13.0 (11) + +------------------------------------------------------------------- +Thu Aug 13 01:13:43 CEST 2015 - [email protected] + +- Update zypp-po.tar.bz2 + +------------------------------------------------------------------- Tue Aug 11 18:48:57 CEST 2015 - [email protected] - History: Add 'command' tag showing who triggered the commit. Files old/libzypp-15.12.0/po/zypp-po.tar.bz2 and new/libzypp-15.13.0/po/zypp-po.tar.bz2 differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-15.12.0/tests/zypp/Url_test.cc new/libzypp-15.13.0/tests/zypp/Url_test.cc --- old/libzypp-15.12.0/tests/zypp/Url_test.cc 2015-07-06 11:06:37.000000000 +0200 +++ new/libzypp-15.13.0/tests/zypp/Url_test.cc 2015-08-13 17:04:27.000000000 +0200 @@ -273,6 +273,13 @@ } } +BOOST_AUTO_TEST_CASE( test_url5) +{ + std::string str( "file:/some/${var:+path}/${var:-with}/${vars}" ); + BOOST_CHECK_EQUAL( Url(str).asString(), str ); + BOOST_CHECK_EQUAL( Url(zypp::url::encode( str, URL_SAFE_CHARS )).asString(), str ); +} + BOOST_AUTO_TEST_CASE(plugin_querystring_args) { // url querysting options without value must be possible diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-15.12.0/zypp/Date.h new/libzypp-15.13.0/zypp/Date.h --- old/libzypp-15.12.0/zypp/Date.h 2015-07-06 11:06:37.000000000 +0200 +++ new/libzypp-15.13.0/zypp/Date.h 2015-08-13 17:04:27.000000000 +0200 @@ -36,6 +36,7 @@ public: typedef time_t ValueType; + typedef time_t Duration; static const ValueType second = 1; static const ValueType minute = 60; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-15.12.0/zypp/RepoManager.cc new/libzypp-15.13.0/zypp/RepoManager.cc --- old/libzypp-15.12.0/zypp/RepoManager.cc 2015-07-06 11:06:37.000000000 +0200 +++ new/libzypp-15.13.0/zypp/RepoManager.cc 2015-08-13 17:04:27.000000000 +0200 @@ -1940,13 +1940,34 @@ 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 ) ) + { + // 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 ) @@ -1968,6 +1989,7 @@ 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 @@ -1975,7 +1997,7 @@ // and in zypper. std::pair<DefaultIntegral<bool,false>, repo::ServicePluginInformalException> uglyHack; try { - ServiceRepos repos(service, bind( &RepoCollector::collect, &collector, _1 )); + ServiceRepos( service, bind( &RepoCollector::collect, &collector, _1 ) ); } catch ( const repo::ServicePluginInformalException & e ) { @@ -1983,7 +2005,12 @@ 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. @@ -2214,10 +2241,19 @@ //////////////////////////////////////////////////////////////////////////// // save service if modified: (unless a plugin service) - if ( serviceModified && service.type() != ServiceType::PLUGIN ) + if ( service.type() != ServiceType::PLUGIN ) { - // write out modified service file. - modifyService( service.alias(), service ); + 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 ); + } } if ( uglyHack.first ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-15.12.0/zypp/RepoManager.h new/libzypp-15.13.0/zypp/RepoManager.h --- old/libzypp-15.12.0/zypp/RepoManager.h 2015-07-06 11:06:37.000000000 +0200 +++ new/libzypp-15.13.0/zypp/RepoManager.h 2015-08-13 17:04:27.000000000 +0200 @@ -141,7 +141,8 @@ /** Flags for tuning RefreshService */ enum RefreshServiceBit { - RefreshService_restoreStatus = (1<<0) ///< Force restoring repo enabled/disabled staus + RefreshService_restoreStatus = (1<<0), ///< Force restoring repo enabled/disabled status + RefreshService_forceRefresh = (1<<1), ///< Force refresh even if TTL is not reached }; ZYPP_DECLARE_FLAGS(RefreshServiceFlags,RefreshServiceBit); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-15.12.0/zypp/ServiceInfo.cc new/libzypp-15.13.0/zypp/ServiceInfo.cc --- old/libzypp-15.12.0/zypp/ServiceInfo.cc 2015-07-06 11:06:37.000000000 +0200 +++ new/libzypp-15.13.0/zypp/ServiceInfo.cc 2015-08-13 17:04:27.000000000 +0200 @@ -13,6 +13,7 @@ #include <iostream> #include "zypp/base/String.h" +#include "zypp/base/DefaultIntegral.h" #include "zypp/parser/xml/XmlEscape.h" #include "zypp/RepoInfo.h" @@ -35,33 +36,32 @@ typedef ServiceInfo::ReposToDisable ReposToDisable; public: - RepoVariablesReplacedUrl url; - repo::ServiceType type; - ReposToEnable reposToEnable; - ReposToDisable reposToDisable; - RepoStates repoStates; - + RepoVariablesReplacedUrl _url; + repo::ServiceType _type; + ReposToEnable _reposToEnable; + ReposToDisable _reposToDisable; + RepoStates _repoStates; + DefaultIntegral<Date::Duration,0> _ttl; + Date _lrf; public: Impl() - : type(repo::ServiceType::NONE_e) {} - Impl(const Url & url_) - : url(url_) - , type(repo::ServiceType::NONE_e) + Impl( const Url & url_r ) + : _url( url_r ) {} ~Impl() {} - void setProbedType( const repo::ServiceType & t ) const + void setProbedType( const repo::ServiceType & type_r ) const { - if ( type == repo::ServiceType::NONE - && t != repo::ServiceType::NONE ) + if ( _type == repo::ServiceType::NONE + && type_r != repo::ServiceType::NONE ) { // lazy init! - const_cast<Impl*>(this)->type = t; + const_cast<Impl*>(this)->_type = type_r; } } @@ -97,82 +97,70 @@ {} Url ServiceInfo::url() const // Variables replaced - { return _pimpl->url.transformed(); } + { return _pimpl->_url.transformed(); } Url ServiceInfo::rawUrl() const // Raw - { return _pimpl->url.raw(); } + { return _pimpl->_url.raw(); } void ServiceInfo::setUrl( const Url& url ) // Raw - { _pimpl->url.raw() = url; } - - repo::ServiceType ServiceInfo::type() const - { return _pimpl->type; } - void ServiceInfo::setType( const repo::ServiceType & type ) - { _pimpl->type = type; } - - void ServiceInfo::setProbedType( const repo::ServiceType &t ) const - { _pimpl->setProbedType( t ); } - - bool ServiceInfo::reposToEnableEmpty() const - { return _pimpl->reposToEnable.empty(); } - - ServiceInfo::ReposToEnable::size_type ServiceInfo::reposToEnableSize() const - { return _pimpl->reposToEnable.size(); } - - ServiceInfo::ReposToEnable::const_iterator ServiceInfo::reposToEnableBegin() const - { return _pimpl->reposToEnable.begin(); } + { _pimpl->_url.raw() = url; } - ServiceInfo::ReposToEnable::const_iterator ServiceInfo::reposToEnableEnd() const - { return _pimpl->reposToEnable.end(); } + repo::ServiceType ServiceInfo::type() const { return _pimpl->_type; } + void ServiceInfo::setType( const repo::ServiceType & type ) { _pimpl->_type = type; } + void ServiceInfo::setProbedType( const repo::ServiceType &t ) const { _pimpl->setProbedType( t ); } + + Date::Duration ServiceInfo::ttl() const { return _pimpl->_ttl; } + void ServiceInfo::setTtl( Date::Duration ttl_r ) { _pimpl->_ttl = ttl_r; } + void ServiceInfo::setProbedTtl( Date::Duration ttl_r ) const { const_cast<ServiceInfo*>(this)->setTtl( ttl_r ); } + + Date ServiceInfo::lrf() const { return _pimpl->_lrf; } + void ServiceInfo::setLrf( Date lrf_r ) { _pimpl->_lrf = lrf_r; } + + bool ServiceInfo::reposToEnableEmpty() const { return _pimpl->_reposToEnable.empty(); } + ServiceInfo::ReposToEnable::size_type ServiceInfo::reposToEnableSize() const { return _pimpl->_reposToEnable.size(); } + ServiceInfo::ReposToEnable::const_iterator ServiceInfo::reposToEnableBegin() const { return _pimpl->_reposToEnable.begin(); } + ServiceInfo::ReposToEnable::const_iterator ServiceInfo::reposToEnableEnd() const { return _pimpl->_reposToEnable.end(); } bool ServiceInfo::repoToEnableFind( const std::string & alias_r ) const - { return( _pimpl->reposToEnable.find( alias_r ) != _pimpl->reposToEnable.end() ); } + { return( _pimpl->_reposToEnable.find( alias_r ) != _pimpl->_reposToEnable.end() ); } void ServiceInfo::addRepoToEnable( const std::string & alias_r ) { - _pimpl->reposToEnable.insert( alias_r ); - _pimpl->reposToDisable.erase( alias_r ); + _pimpl->_reposToEnable.insert( alias_r ); + _pimpl->_reposToDisable.erase( alias_r ); } void ServiceInfo::delRepoToEnable( const std::string & alias_r ) - { _pimpl->reposToEnable.erase( alias_r ); } + { _pimpl->_reposToEnable.erase( alias_r ); } void ServiceInfo::clearReposToEnable() - { _pimpl->reposToEnable.clear(); } + { _pimpl->_reposToEnable.clear(); } - bool ServiceInfo::reposToDisableEmpty() const - { return _pimpl->reposToDisable.empty(); } - - ServiceInfo::ReposToDisable::size_type ServiceInfo::reposToDisableSize() const - { return _pimpl->reposToDisable.size(); } - - ServiceInfo::ReposToDisable::const_iterator ServiceInfo::reposToDisableBegin() const - { return _pimpl->reposToDisable.begin(); } - - ServiceInfo::ReposToDisable::const_iterator ServiceInfo::reposToDisableEnd() const - { return _pimpl->reposToDisable.end(); } + bool ServiceInfo::reposToDisableEmpty() const { return _pimpl->_reposToDisable.empty(); } + ServiceInfo::ReposToDisable::size_type ServiceInfo::reposToDisableSize() const { return _pimpl->_reposToDisable.size(); } + ServiceInfo::ReposToDisable::const_iterator ServiceInfo::reposToDisableBegin() const { return _pimpl->_reposToDisable.begin(); } + ServiceInfo::ReposToDisable::const_iterator ServiceInfo::reposToDisableEnd() const { return _pimpl->_reposToDisable.end(); } bool ServiceInfo::repoToDisableFind( const std::string & alias_r ) const - { return( _pimpl->reposToDisable.find( alias_r ) != _pimpl->reposToDisable.end() ); } + { return( _pimpl->_reposToDisable.find( alias_r ) != _pimpl->_reposToDisable.end() ); } void ServiceInfo::addRepoToDisable( const std::string & alias_r ) { - _pimpl->reposToDisable.insert( alias_r ); - _pimpl->reposToEnable.erase( alias_r ); + _pimpl->_reposToDisable.insert( alias_r ); + _pimpl->_reposToEnable.erase( alias_r ); } void ServiceInfo::delRepoToDisable( const std::string & alias_r ) - { _pimpl->reposToDisable.erase( alias_r ); } + { _pimpl->_reposToDisable.erase( alias_r ); } void ServiceInfo::clearReposToDisable() - { _pimpl->reposToDisable.clear(); } + { _pimpl->_reposToDisable.clear(); } - const ServiceInfo::RepoStates & ServiceInfo::repoStates() const - { return _pimpl->repoStates; } - void ServiceInfo::setRepoStates( RepoStates newStates_r ) - { swap( _pimpl->repoStates, newStates_r ); } + const ServiceInfo::RepoStates & ServiceInfo::repoStates() const { return _pimpl->_repoStates; } + void ServiceInfo::setRepoStates( RepoStates newStates_r ) { swap( _pimpl->_repoStates, newStates_r ); } + std::ostream & operator<<( std::ostream & str, const ServiceInfo::RepoState & obj ) { @@ -188,6 +176,12 @@ << "url = " << rawUrl() << endl << "type = " << type() << endl; + if ( ttl() ) + str << "ttl_sec = " << ttl() << endl; + + if ( lrf() ) + str << "lrf_dat = " << lrf().asSeconds() << endl; + if ( ! repoStates().empty() ) { unsigned cnt = 0U; @@ -222,7 +216,8 @@ << " enabled=\"" << enabled() << "\"" << " autorefresh=\"" << autorefresh() << "\"" << " url=\"" << escape(url().asString()) << "\"" - << " type=\"" << type().asString() << "\""; + << " type=\"" << type().asString() << "\"" + << " ttl_sec\"" << ttl() << "\""; if (content.empty()) str << "/>" << endl; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-15.12.0/zypp/ServiceInfo.h new/libzypp-15.13.0/zypp/ServiceInfo.h --- old/libzypp-15.12.0/zypp/ServiceInfo.h 2015-07-06 11:06:37.000000000 +0200 +++ new/libzypp-15.13.0/zypp/ServiceInfo.h 2015-08-13 17:04:27.000000000 +0200 @@ -17,9 +17,10 @@ #include "zypp/Url.h" +#include "zypp/base/Iterable.h" #include "zypp/repo/ServiceType.h" #include "zypp/RepoInfo.h" - +#include "zypp/Date.h" /////////////////////////////////////////////////////////////////// namespace zypp @@ -80,7 +81,29 @@ /** Lazy init service type */ void setProbedType( const repo::ServiceType & t ) const; + /** \name Housekeeping data + * You don't want to use the setters unless you are a \ref RepoManager. + */ + //@{ + /** Sugested TTL between two metadata auto-refreshs. + * The value (in seconds) may be provided in repoindex.xml:xpath:/repoindex@ttl. + * Default is \a 0 - perform each auto-refresh request. + */ + Date::Duration ttl() const; + + /** Set sugested TTL. */ + void setTtl( Date::Duration ttl_r ); + + /** Lazy init sugested TTL. */ + void setProbedTtl( Date::Duration ttl_r ) const; + /** Date of last refresh (if known). */ + Date lrf() const; + + /** Set date of last refresh. */ + void setLrf( Date lrf_r ); + //@} + // /** \name Set of repos (repository aliases) to enable on next refresh. * * Per default new repositories are created in disabled state. But repositories @@ -94,6 +117,8 @@ ReposToEnable::size_type reposToEnableSize() const; ReposToEnable::const_iterator reposToEnableBegin() const; ReposToEnable::const_iterator reposToEnableEnd() const; + Iterable<ReposToEnable::const_iterator> reposToEnable() const + { return makeIterable( reposToEnableBegin(), reposToEnableEnd() ); } /** Whether \c alias_r is mentioned in ReposToEnable. */ bool repoToEnableFind( const std::string & alias_r ) const; @@ -118,6 +143,8 @@ ReposToDisable::size_type reposToDisableSize() const; ReposToDisable::const_iterator reposToDisableBegin() const; ReposToDisable::const_iterator reposToDisableEnd() const; + Iterable<ReposToDisable::const_iterator> reposToDisable() const + { return makeIterable( reposToDisableBegin(), reposToDisableEnd() ); } /** Whether \c alias_r is mentioned in ReposToDisable. */ bool repoToDisableFind( const std::string & alias_r ) const; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-15.12.0/zypp/base/String.h new/libzypp-15.13.0/zypp/base/String.h --- old/libzypp-15.12.0/zypp/base/String.h 2015-07-06 11:06:37.000000000 +0200 +++ new/libzypp-15.13.0/zypp/base/String.h 2015-08-13 17:04:27.000000000 +0200 @@ -240,6 +240,9 @@ Str & operator<<( const _Tp & val ) { _str << val; return *this; } + Str & operator<<( std::ostream& (*iomanip)( std::ostream& ) ) + { _str << iomanip; return *this; } + operator std::string() const { return _str.str(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-15.12.0/zypp/parser/RepoindexFileReader.cc new/libzypp-15.13.0/zypp/parser/RepoindexFileReader.cc --- old/libzypp-15.12.0/zypp/parser/RepoindexFileReader.cc 2015-07-06 11:06:37.000000000 +0200 +++ new/libzypp-15.13.0/zypp/parser/RepoindexFileReader.cc 2015-08-13 17:04:27.000000000 +0200 @@ -16,6 +16,7 @@ #include "zypp/base/Logger.h" #include "zypp/base/Gettext.h" #include "zypp/base/InputStream.h" +#include "zypp/base/DefaultIntegral.h" #include "zypp/Pathname.h" @@ -48,9 +49,9 @@ /** */ void setVar( const std::string & key_r, const std::string & val_r ) { - MIL << "*** Inject " << key_r << " = " << val_r; + //MIL << "*** Inject " << key_r << " = " << val_r; _vars[key_r] = replace( val_r ); - MIL << " (" << _vars[key_r] << ")" << endl; + //MIL << " (" << _vars[key_r] << ")" << endl; } std::string replace( const std::string & val_r ) const @@ -112,6 +113,8 @@ */ bool consumeNode( Reader & reader_r ); + DefaultIntegral<Date::Duration,2> _ttl; + private: bool getAttrValue( const std::string & key_r, Reader & reader_r, std::string & value_r ) { @@ -162,7 +165,14 @@ if ( reader_r->name() == "repoindex" ) { while ( reader_r.nextNodeAttribute() ) - _replacer.setVar( reader_r->localName().asString(), reader_r->value().asString() ); + { + const std::string & name( reader_r->localName().asString() ); + const std::string & value( reader_r->value().asString() ); + _replacer.setVar( name, value ); + // xpath: /repoindex@ttl + if ( name == "ttl" ) + _ttl = str::strtonum<Date::Duration>(value); + } return true; } @@ -252,20 +262,18 @@ // /////////////////////////////////////////////////////////////////// - RepoindexFileReader::RepoindexFileReader( - const Pathname & repoindex_file, const ProcessResource & callback) - : - _pimpl(new Impl(InputStream(repoindex_file), callback)) + RepoindexFileReader::RepoindexFileReader( const Pathname & repoindex_file, const ProcessResource & callback ) + : _pimpl(new Impl(InputStream(repoindex_file), callback)) {} - RepoindexFileReader::RepoindexFileReader( - const InputStream &is, const ProcessResource & callback ) - : _pimpl(new Impl(is, callback)) + RepoindexFileReader::RepoindexFileReader( const InputStream &is, const ProcessResource & callback ) + : _pimpl(new Impl(is, callback)) {} RepoindexFileReader::~RepoindexFileReader() {} + Date::Duration RepoindexFileReader::ttl() const { return _pimpl->_ttl; } } // ns parser } // ns zypp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-15.12.0/zypp/parser/RepoindexFileReader.h new/libzypp-15.13.0/zypp/parser/RepoindexFileReader.h --- old/libzypp-15.12.0/zypp/parser/RepoindexFileReader.h 2015-07-06 11:06:37.000000000 +0200 +++ new/libzypp-15.13.0/zypp/parser/RepoindexFileReader.h 2015-08-13 17:04:27.000000000 +0200 @@ -17,6 +17,7 @@ #include "zypp/base/Function.h" #include "zypp/base/InputStream.h" #include "zypp/Pathname.h" +#include "zypp/Date.h" namespace zypp { @@ -48,9 +49,7 @@ * First parameter is a \ref RepoInfo object with the resource * FIXME return value is ignored */ - typedef function< bool( - const RepoInfo & )> - ProcessResource; + typedef function< bool( const RepoInfo & )> ProcessResource; /** * CTOR. Creates also \ref xml::Reader and starts reading. @@ -79,6 +78,9 @@ */ ~RepoindexFileReader(); + /** Metadata TTL (repoindex.xml:xpath:/repoindex@ttl or 0). */ + Date::Duration ttl() const; + private: class Impl; RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-15.12.0/zypp/parser/ServiceFileReader.cc new/libzypp-15.13.0/zypp/parser/ServiceFileReader.cc --- old/libzypp-15.12.0/zypp/parser/ServiceFileReader.cc 2015-07-06 11:06:37.000000000 +0200 +++ new/libzypp-15.13.0/zypp/parser/ServiceFileReader.cc 2015-08-13 17:04:27.000000000 +0200 @@ -72,6 +72,10 @@ service.setAutorefresh( str::strToTrue( it->second ) ); else if ( it->first == "type" ) service.setType( repo::ServiceType(it->second) ); + else if ( it->first == "ttl_sec" ) + service.setTtl( str::strtonum<Date::Duration>(it->second) ); + else if ( it->first == "lrf_dat" ) + service.setLrf( Date( it->second ) ); else if ( it->first == "repostoenable" ) { std::vector<std::string> aliases; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-15.12.0/zypp/repo/ServiceRepos.cc new/libzypp-15.13.0/zypp/repo/ServiceRepos.cc --- old/libzypp-15.12.0/zypp/repo/ServiceRepos.cc 2015-07-06 11:06:37.000000000 +0200 +++ new/libzypp-15.13.0/zypp/repo/ServiceRepos.cc 2015-08-13 18:16:27.000000000 +0200 @@ -12,104 +12,86 @@ using std::stringstream; using std::endl; +/////////////////////////////////////////////////////////////////// namespace zypp { -namespace repo -{ + /////////////////////////////////////////////////////////////////// + namespace repo + { + struct ServiceRepos::Impl + { virtual ~Impl() {} }; -class ServiceRepos::Impl -{ -public: - Impl() - { - } + /////////////////////////////////////////////////////////////////// - virtual ~Impl() + struct RIMServiceRepos : public ServiceRepos::Impl { - } -}; - -class RIMServiceRepos : public ServiceRepos::Impl -{ -public: - ServiceRepos::ProcessRepo _callback; - - RIMServiceRepos(const ServiceInfo &service, - const ServiceRepos::ProcessRepo & callback, - const ProgressData::ReceiverFnc &progress = ProgressData::ReceiverFnc() ) - : _callback(callback) - { - // repoindex.xml must be fetched always without using cookies (bnc #573897) - Url serviceUrl( service.url() ); - serviceUrl.setQueryParam( "cookies", "0" ); - - // download the repo index file - media::MediaManager mediamanager; - media::MediaAccessId mid = mediamanager.open( serviceUrl ); - mediamanager.attach( mid ); - mediamanager.provideFile( mid, "repo/repoindex.xml" ); - Pathname path = mediamanager.localPath(mid, "repo/repoindex.xml" ); - parser::RepoindexFileReader reader(path, _callback); - mediamanager.release( mid ); - mediamanager.close( mid ); - } - - ~RIMServiceRepos() - { - - } -}; + RIMServiceRepos( const ServiceInfo & service, + const ServiceRepos::ProcessRepo & callback, + const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() ) + { + // repoindex.xml must be fetched always without using cookies (bnc #573897) + Url serviceUrl( service.url() ); + serviceUrl.setQueryParam( "cookies", "0" ); + + // download the repo index file + media::MediaManager mediamanager; + media::MediaAccessId mid = mediamanager.open( serviceUrl ); + mediamanager.attach( mid ); + mediamanager.provideFile( mid, "repo/repoindex.xml" ); + Pathname path = mediamanager.localPath(mid, "repo/repoindex.xml" ); + parser::RepoindexFileReader reader(path, callback); + service.setProbedTtl( reader.ttl() ); // hack! Modifying the const Service to set parsed TTL + mediamanager.release( mid ); + mediamanager.close( mid ); + } + }; -class PluginServiceRepos : public ServiceRepos::Impl -{ -public: - ServiceRepos::ProcessRepo _callback; + /////////////////////////////////////////////////////////////////// - PluginServiceRepos(const ServiceInfo &service, - const ServiceRepos::ProcessRepo & callback, - const ProgressData::ReceiverFnc &progress = ProgressData::ReceiverFnc() ) - : _callback(callback) + struct PluginServiceRepos : public ServiceRepos::Impl { - Url serviceUrl( service.url() ); - stringstream buffer; - - ExternalProgram::Arguments args; - args.reserve( 3 ); - args.push_back( "/bin/sh" ); - args.push_back( "-c" ); - args.push_back( serviceUrl.getPathName() ); - ExternalProgramWithStderr prog( args ); - prog >> buffer; - - if ( prog.close() != 0 ) + PluginServiceRepos( const ServiceInfo & service, + const ServiceRepos::ProcessRepo & callback, + const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() ) { - // ServicePluginInformalException: - // Ignore this error but we'd like to report it somehow... - std::string errbuffer; - prog.stderrGetUpTo( errbuffer, '\0' ); - ERR << "Capture plugin error:[" << endl << errbuffer << endl << ']' << endl; - ZYPP_THROW( repo::ServicePluginInformalException( service, errbuffer ) ); + Url serviceUrl( service.url() ); + stringstream buffer; + + ExternalProgram::Arguments args; + args.reserve( 3 ); + args.push_back( "/bin/sh" ); + args.push_back( "-c" ); + args.push_back( serviceUrl.getPathName() ); + ExternalProgramWithStderr prog( args ); + prog >> buffer; + + if ( prog.close() != 0 ) + { + // ServicePluginInformalException: + // Ignore this error but we'd like to report it somehow... + std::string errbuffer; + prog.stderrGetUpTo( errbuffer, '\0' ); + ERR << "Capture plugin error:[" << endl << errbuffer << endl << ']' << endl; + ZYPP_THROW( repo::ServicePluginInformalException( service, errbuffer ) ); + } + parser::RepoFileReader parser( buffer, callback ); } + }; - parser::RepoFileReader parser(buffer, _callback); - } + /////////////////////////////////////////////////////////////////// - ~PluginServiceRepos() + ServiceRepos::ServiceRepos( const ServiceInfo & service, + const ServiceRepos::ProcessRepo & callback, + const ProgressData::ReceiverFnc &progress ) + : _impl( ( service.type() == ServiceType::PLUGIN ) + ? static_cast<ServiceRepos::Impl*>( new PluginServiceRepos( service, callback, progress ) ) + : static_cast<ServiceRepos::Impl*>( new RIMServiceRepos (service, callback, progress ) ) ) {} -}; - - -ServiceRepos::ServiceRepos(const ServiceInfo &service, - const ServiceRepos::ProcessRepo & callback, - const ProgressData::ReceiverFnc &progress) - : _impl( (service.type() == ServiceType::PLUGIN) ? (ServiceRepos::Impl *)(new PluginServiceRepos(service, callback, progress)) : (ServiceRepos::Impl *)(new RIMServiceRepos(service, callback, progress))) -{ -} - -ServiceRepos::~ServiceRepos() -{ -} + ServiceRepos::~ServiceRepos() + {} -} -} + } // namespace repo + /////////////////////////////////////////////////////////////////// +} //namespace zypp +/////////////////////////////////////////////////////////////////// diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-15.12.0/zypp/repo/ServiceRepos.h new/libzypp-15.13.0/zypp/repo/ServiceRepos.h --- old/libzypp-15.12.0/zypp/repo/ServiceRepos.h 2015-07-06 11:06:37.000000000 +0200 +++ new/libzypp-15.13.0/zypp/repo/ServiceRepos.h 2015-08-13 17:04:27.000000000 +0200 @@ -20,30 +20,24 @@ namespace repo { /** - * Retrieval of repository list for - * a service + * Retrieval of repository list for a service. */ class ServiceRepos : private base::NonCopyable { public: - /** - * Callback definition. - * First parameter is a \ref RepoInfo object with the resource - * second parameter is the resource type. - * * Return false from the callback to get a \ref AbortRequestException * to be thrown and the processing to be cancelled. */ typedef function< bool( const RepoInfo & )> ProcessRepo; - ServiceRepos(const ServiceInfo &service, - const ProcessRepo & callback, - const ProgressData::ReceiverFnc &progress = ProgressData::ReceiverFnc() ); + ServiceRepos( const ServiceInfo & service, + const ProcessRepo & callback, + const ProgressData::ReceiverFnc &progress = ProgressData::ReceiverFnc() ); ~ServiceRepos(); - /** Implementation */ - class Impl; + public: + class Impl; //!< Expose type only private: RW_pointer<Impl> _impl; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-15.12.0/zypp/solver/detail/SATResolver.cc new/libzypp-15.13.0/zypp/solver/detail/SATResolver.cc --- old/libzypp-15.12.0/zypp/solver/detail/SATResolver.cc 2015-08-10 16:28:29.000000000 +0200 +++ new/libzypp-15.13.0/zypp/solver/detail/SATResolver.cc 2015-08-13 17:04:27.000000000 +0200 @@ -493,15 +493,15 @@ solver_set_flag(_solv, SOLVER_FLAG_NO_UPDATEPROVIDE, _noupdateprovide); solver_set_flag(_solv, SOLVER_FLAG_IGNORE_RECOMMENDED, _onlyRequires); solver_set_flag(_solv, SOLVER_FLAG_DUP_ALLOW_DOWNGRADE, _dup_allowdowngrade ); - solver_set_flag(_solv, SOLVER_FLAG_DUP_ALLOW_ARCHCHANGE, _dup_allownamechange ); - solver_set_flag(_solv, SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE, _dup_allowarchchange ); - solver_set_flag(_solv, SOLVER_FLAG_DUP_ALLOW_NAMECHANGE, _dup_allowvendorchange ); + solver_set_flag(_solv, SOLVER_FLAG_DUP_ALLOW_NAMECHANGE, _dup_allownamechange ); + solver_set_flag(_solv, SOLVER_FLAG_DUP_ALLOW_ARCHCHANGE, _dup_allowarchchange ); + solver_set_flag(_solv, SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE, _dup_allowvendorchange ); #if 1 #define HACKENV(X,D) solver_set_flag(_solv, X, env::HACKENV( #X, D ) ); HACKENV( SOLVER_FLAG_DUP_ALLOW_DOWNGRADE, _dup_allowdowngrade ); - HACKENV( SOLVER_FLAG_DUP_ALLOW_ARCHCHANGE, _dup_allownamechange ); - HACKENV( SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE,_dup_allowarchchange ); - HACKENV( SOLVER_FLAG_DUP_ALLOW_NAMECHANGE, _dup_allowvendorchange ); + HACKENV( SOLVER_FLAG_DUP_ALLOW_NAMECHANGE, _dup_allownamechange ); + HACKENV( SOLVER_FLAG_DUP_ALLOW_ARCHCHANGE, _dup_allowarchchange ); + HACKENV( SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE,_dup_allowvendorchange ); #undef HACKENV #endif sat::Pool::instance().prepareForSolving(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-15.12.0/zypp/url/UrlUtils.h new/libzypp-15.13.0/zypp/url/UrlUtils.h --- old/libzypp-15.12.0/zypp/url/UrlUtils.h 2015-07-06 11:06:37.000000000 +0200 +++ new/libzypp-15.13.0/zypp/url/UrlUtils.h 2015-08-13 17:04:27.000000000 +0200 @@ -19,7 +19,7 @@ #include <map> /** Characters that are safe for URL without percent-encoding. */ -#define URL_SAFE_CHARS ":/?#[]@!$&'()*+,;=" +#define URL_SAFE_CHARS ":/?#[]@!$&'(){}*+,;=" ////////////////////////////////////////////////////////////////////// namespace zypp
