From 6d1fbe71110cc9e0a585ce728e710b59589b40c1 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Mon, 2 Sep 2019 16:12:37 +0900 Subject: [PATCH 1/1] Imported Upstream version 16.6.1 --- VERSION.cmake | 4 ++-- package/libzypp.changes | 8 ++++++++ zypp/RepoInfo.cc | 28 +++++++++++++++++++++------- zypp/base/LogTools.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ zypp/media/MediaManager.cc | 27 ++++++++------------------- 5 files changed, 84 insertions(+), 28 deletions(-) diff --git a/VERSION.cmake b/VERSION.cmake index fb81279..5cff7d7 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -61,8 +61,8 @@ SET(LIBZYPP_MAJOR "16") SET(LIBZYPP_COMPATMINOR "0") SET(LIBZYPP_MINOR "6") -SET(LIBZYPP_PATCH "0") +SET(LIBZYPP_PATCH "1") # -# LAST RELEASED: 16.6.0 (0) +# LAST RELEASED: 16.6.1 (0) # (The number in parenthesis is LIBZYPP_COMPATMINOR) #======= diff --git a/package/libzypp.changes b/package/libzypp.changes index 72d7623..1855e77 100644 --- a/package/libzypp.changes +++ b/package/libzypp.changes @@ -1,4 +1,12 @@ ------------------------------------------------------------------- +Thu Mar 30 15:00:30 CEST 2017 - ma@suse.de + +- Recognize license tarball in rpmmd repos (FATE#316159) +- Fix media verification to properly propagate media access errors + (bsc#1031093) +- version 16.6.1 (0) + +------------------------------------------------------------------- Mon Mar 27 17:10:52 CEST 2017 - ma@suse.de - Fix invalidation of PoolItems if Pool IDs are reused (bsc#1028661) diff --git a/zypp/RepoInfo.cc b/zypp/RepoInfo.cc index a91e9f5..a0f0d60 100644 --- a/zypp/RepoInfo.cc +++ b/zypp/RepoInfo.cc @@ -17,6 +17,7 @@ #include "zypp/parser/xml/XmlEscape.h" #include "zypp/RepoInfo.h" +#include "zypp/Glob.h" #include "zypp/TriBool.h" #include "zypp/Pathname.h" #include "zypp/ZConfig.h" @@ -71,8 +72,22 @@ namespace zypp } public: + /** Path to a license tarball in case it exists in the repo. */ Pathname licenseTgz() const - { return metadatapath.empty() ? Pathname() : metadatapath / path / "license.tar.gz"; } + { + Pathname ret; + if ( !metadatapath.empty() ) + { + filesystem::Glob g; + g.add( metadatapath / path / "repodata/*license.tar.gz" ); + if ( g.empty() ) + g.add( metadatapath / path / "license.tar.gz" ); + + if ( !g.empty() ) + ret = *g.begin(); + } + return ret; + } const RepoVariablesReplacedUrlList & baseUrls() const { @@ -474,8 +489,7 @@ namespace zypp bool RepoInfo::hasLicense() const { - Pathname licenseTgz( _pimpl->licenseTgz() ); - return ! licenseTgz.empty() && PathInfo(licenseTgz).isFile(); + return !_pimpl->licenseTgz().empty(); } bool RepoInfo::needToAcceptLicense() const @@ -483,8 +497,8 @@ namespace zypp static const std::string noAcceptanceFile = "no-acceptance-needed\n"; bool accept = true; - Pathname licenseTgz( _pimpl->licenseTgz() ); - if ( licenseTgz.empty() || ! PathInfo( licenseTgz ).isFile() ) + const Pathname & licenseTgz( _pimpl->licenseTgz() ); + if ( licenseTgz.empty() ) return false; // no licenses at all ExternalProgram::Arguments cmd; @@ -551,8 +565,8 @@ namespace zypp LocaleSet RepoInfo::getLicenseLocales() const { - Pathname licenseTgz( _pimpl->licenseTgz() ); - if ( licenseTgz.empty() || ! PathInfo( licenseTgz ).isFile() ) + const Pathname & licenseTgz( _pimpl->licenseTgz() ); + if ( licenseTgz.empty() ) return LocaleSet(); ExternalProgram::Arguments cmd; diff --git a/zypp/base/LogTools.h b/zypp/base/LogTools.h index 18f8f61..fcbaf80 100644 --- a/zypp/base/LogTools.h +++ b/zypp/base/LogTools.h @@ -114,8 +114,53 @@ namespace zypp std::ostream & dumpRangeLine( std::ostream & str, TIterator begin, TIterator end ) { return dumpRange( str, begin, end, "(", "", ", ", "", ")" ); } + /** \overload for container */ + template + std::ostream & dumpRangeLine( std::ostream & str, const TContainer & cont ) + { return dumpRangeLine( str, cont.begin(), cont.end() ); } + /////////////////////////////////////////////////////////////////// + namespace iomanip + { + /////////////////////////////////////////////////////////////////// + /// \class RangeLine + /// \brief Iomanip helper printing dumpRangeLine style + /////////////////////////////////////////////////////////////////// + template + struct RangeLine + { + RangeLine( TIterator begin, TIterator end ) + : _begin( begin ) + , _end( end ) + {} + TIterator _begin; + TIterator _end; + }; + + /** \relates RangeLine */ + template + std::ostream & operator<<( std::ostream & str, const RangeLine & obj ) + { return dumpRangeLine( str, obj._begin, obj._end ); } + + } // namespce iomanip + /////////////////////////////////////////////////////////////////// + + /** Iomanip printing dumpRangeLine style + * \code + * std::vector c( { 1, 1, 2, 3, 5, 8 } ); + * std::cout << rangeLine(c) << std::endl; + * -> (1, 1, 2, 3, 5, 8) + * \endcode + */ + template + iomanip::RangeLine rangeLine( TIterator begin, TIterator end ) + { return iomanip::RangeLine( begin, end ); } + /** \overload for container */ + template + auto rangeLine( const TContainer & cont ) -> decltype( rangeLine( cont.begin(), cont.end() ) ) + { return rangeLine( cont.begin(), cont.end() ); } + template std::ostream & operator<<( std::ostream & str, const std::vector & obj ) { return dumpRange( str, obj.begin(), obj.end() ); } diff --git a/zypp/media/MediaManager.cc b/zypp/media/MediaManager.cc index 7295132..b753b51 100644 --- a/zypp/media/MediaManager.cc +++ b/zypp/media/MediaManager.cc @@ -82,32 +82,21 @@ namespace zypp } } - inline void - checkDesired(MediaAccessId id) + inline void checkDesired( MediaAccessId id ) { - checkAttached(id); + checkAttached( id ); - if( !desired) + if ( !desired ) { - try { - desired = verifier->isDesiredMedia(handler); - } - catch(const zypp::Exception &e) { - ZYPP_CAUGHT(e); - desired = false; - } + desired = verifier->isDesiredMedia(handler); - if( !desired) + if( !desired ) { - DBG << "checkDesired(" << id << "): not desired (report by " - << verifier->info() << ")" << std::endl; - ZYPP_THROW(MediaNotDesiredException( - handler->url() - )); + DBG << "checkDesired(" << id << "): not desired (report by " << verifier->info() << ")" << std::endl; + ZYPP_THROW( MediaNotDesiredException( handler->url() ) ); } - DBG << "checkDesired(" << id << "): desired (report by " - << verifier->info() << ")" << std::endl; + DBG << "checkDesired(" << id << "): desired (report by " << verifier->info() << ")" << std::endl; } else { DBG << "checkDesired(" << id << "): desired (cached)" << std::endl; } -- 2.7.4