From 7712e542ed2aa56b223bbba1bb87d50b96560946 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Tue, 1 Nov 2016 10:44:29 +0900 Subject: [PATCH] Imported Upstream version 15.5.0 Change-Id: I7692601d42d6c22641682b2970c02c8d772cbd02 Signed-off-by: DongHun Kwak --- VERSION.cmake | 8 +++---- doc/locks.5 | 6 +++--- doc/locks.5.txt | 4 ++-- doc/zypp-CheckAccessDeleted.1 | 8 +++---- doc/zypp-CheckAccessDeleted.1.txt | 4 ++-- doc/zypp-NameReqPrv.1 | 8 +++---- doc/zypp-NameReqPrv.1.txt | 4 ++-- package/libzypp.changes | 6 ++++++ tests/zypp/Flags_test.cc | 3 ++- zypp/FileChecker.cc | 1 + zypp/Package.cc | 12 +++++++---- zypp/Patch.cc | 10 ++++++++- zypp/Patch.h | 44 +++++++++++++++++++++++++++++---------- zypp/base/Flags.h | 4 ++-- zypp/base/String.h | 8 +++++-- 15 files changed, 88 insertions(+), 42 deletions(-) diff --git a/VERSION.cmake b/VERSION.cmake index cb0dd81..4c008b2 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -59,10 +59,10 @@ # See './mkChangelog -h' for help. # SET(LIBZYPP_MAJOR "15") -SET(LIBZYPP_COMPATMINOR "3") -SET(LIBZYPP_MINOR "4") -SET(LIBZYPP_PATCH "1") +SET(LIBZYPP_COMPATMINOR "5") +SET(LIBZYPP_MINOR "5") +SET(LIBZYPP_PATCH "0") # -# LAST RELEASED: 15.4.1 (3) +# LAST RELEASED: 15.5.0 (5) # (The number in parenthesis is LIBZYPP_COMPATMINOR) #======= diff --git a/doc/locks.5 b/doc/locks.5 index d446c7a..26ac90e 100644 --- a/doc/locks.5 +++ b/doc/locks.5 @@ -2,12 +2,12 @@ .\" Title: locks .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 10/02/2014 +.\" Date: 06/12/2015 .\" Manual: LIBZYPP -.\" Source: libzypp +.\" Source: SUSE Linux .\" Language: English .\" -.TH "LOCKS" "5" "10/02/2014" "libzypp" "LIBZYPP" +.TH "LOCKS" "5" "06/12/2015" "SUSE Linux" "LIBZYPP" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/locks.5.txt b/doc/locks.5.txt index 4428ccf..cfd94d0 100644 --- a/doc/locks.5.txt +++ b/doc/locks.5.txt @@ -1,7 +1,7 @@ -locks(5) +LOCKS(5) ======== :man manual: LIBZYPP -:man source: libzypp +:man source: SUSE Linux NAME diff --git a/doc/zypp-CheckAccessDeleted.1 b/doc/zypp-CheckAccessDeleted.1 index ddb4d43..d8a3be7 100644 --- a/doc/zypp-CheckAccessDeleted.1 +++ b/doc/zypp-CheckAccessDeleted.1 @@ -1,13 +1,13 @@ '\" t -.\" Title: zypp-CheckAccessDeleted +.\" Title: zypp-checkaccessdeleted .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 10/02/2014 +.\" Date: 06/12/2015 .\" Manual: LIBZYPP -.\" Source: libzypp +.\" Source: SUSE Linux .\" Language: English .\" -.TH "ZYPP\-CHECKACCESSDEL" "1" "10/02/2014" "libzypp" "LIBZYPP" +.TH "ZYPP\-CHECKACCESSDEL" "1" "06/12/2015" "SUSE Linux" "LIBZYPP" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zypp-CheckAccessDeleted.1.txt b/doc/zypp-CheckAccessDeleted.1.txt index c418f62..6e3a17b 100644 --- a/doc/zypp-CheckAccessDeleted.1.txt +++ b/doc/zypp-CheckAccessDeleted.1.txt @@ -1,7 +1,7 @@ -zypp-CheckAccessDeleted(1) +ZYPP-CHECKACCESSDELETED(1) ========================== :man manual: LIBZYPP -:man source: libzypp +:man source: SUSE Linux NAME diff --git a/doc/zypp-NameReqPrv.1 b/doc/zypp-NameReqPrv.1 index 8a7907d..0cf4fa8 100644 --- a/doc/zypp-NameReqPrv.1 +++ b/doc/zypp-NameReqPrv.1 @@ -1,13 +1,13 @@ '\" t -.\" Title: zypp-NameReqPrv +.\" Title: zypp-namereqprv .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 10/02/2014 +.\" Date: 06/12/2015 .\" Manual: LIBZYPP -.\" Source: libzypp +.\" Source: SUSE Linux .\" Language: English .\" -.TH "ZYPP\-NAMEREQPRV" "1" "10/02/2014" "libzypp" "LIBZYPP" +.TH "ZYPP\-NAMEREQPRV" "1" "06/12/2015" "SUSE Linux" "LIBZYPP" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/zypp-NameReqPrv.1.txt b/doc/zypp-NameReqPrv.1.txt index 9135a44..cc1708f 100644 --- a/doc/zypp-NameReqPrv.1.txt +++ b/doc/zypp-NameReqPrv.1.txt @@ -1,7 +1,7 @@ -zypp-NameReqPrv(1) +ZYPP-NAMEREQPRV(1) ================== :man manual: LIBZYPP -:man source: libzypp +:man source: SUSE Linux NAME diff --git a/package/libzypp.changes b/package/libzypp.changes index 9dd9912..22e5a72 100644 --- a/package/libzypp.changes +++ b/package/libzypp.changes @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Sat Jun 27 17:07:32 CEST 2015 - ma@suse.de + +- Patch: fixup testing Category and Severity flags (FATE#318760) +- version 15.5.0 (5) + +------------------------------------------------------------------- Fri Jun 12 12:14:04 CEST 2015 - ma@suse.de - Add details to the default signature verification problem report diff --git a/tests/zypp/Flags_test.cc b/tests/zypp/Flags_test.cc index 95dee3c..e30eabd 100644 --- a/tests/zypp/Flags_test.cc +++ b/tests/zypp/Flags_test.cc @@ -75,10 +75,11 @@ BOOST_AUTO_TEST_CASE(flags) t = T_3; + BOOST_CHECK( ! t.testFlag( T_0 ) ); // fails as T_3 != 0 BOOST_CHECK( t.testFlag( T_1 ) ); BOOST_CHECK( t.testFlag( T_2 ) ); BOOST_CHECK( t.testFlag( T_3 ) ); t.unsetFlag( T_2 ); BOOST_CHECK( t.testFlag( T_1 ) ); - t.setFlag( T_1, false ); BOOST_CHECK( t.testFlag( T_0 ) ); + t.setFlag( T_1, false ); BOOST_CHECK( t.testFlag( T_0 ) ); // succeed as T_3 == 0 t.setFlag( T_3, true ); BOOST_CHECK( t.testFlag( T_3 ) ); } diff --git a/zypp/FileChecker.cc b/zypp/FileChecker.cc index 1d21137..e9a8a38 100644 --- a/zypp/FileChecker.cc +++ b/zypp/FileChecker.cc @@ -52,6 +52,7 @@ namespace zypp CheckSum real_checksum( _checksum.type(), filesystem::checksum( file, _checksum.type() )); if ( (real_checksum != _checksum) ) { + WAR << "File " << file << " has wrong checksum " << real_checksum << " (expected " << _checksum << ")" << endl; if ( report->askUserToAcceptWrongDigest( file, _checksum.checksum(), real_checksum.checksum() ) ) { WAR << "User accepted " << file << " with WRONG CHECKSUM." << std::endl; diff --git a/zypp/Package.cc b/zypp/Package.cc index db58620..5916f4b 100644 --- a/zypp/Package.cc +++ b/zypp/Package.cc @@ -86,10 +86,14 @@ namespace zypp bool Package::maybeUnsupported() const { - static const VendorSupportOptions unsupportedOpts( VendorSupportUnknown - | VendorSupportUnsupported - | VendorSupportACC ); - return unsupportedOpts.testFlag( vendorSupport() ); + switch ( vendorSupport() ) + { + case VendorSupportUnknown: + case VendorSupportUnsupported: + case VendorSupportACC: + return true; + } + return false; } Changelog Package::changelog() const diff --git a/zypp/Patch.cc b/zypp/Patch.cc index a7d81dc..1ee504f 100644 --- a/zypp/Patch.cc +++ b/zypp/Patch.cc @@ -52,6 +52,9 @@ namespace zypp bool Patch::isCategory( const std::string & category_r ) const { return( str::compareCI( category_r, category() ) == 0 ); } + bool Patch::isCategory( Categories category_r ) const + { return category_r.testFlag( categoryEnum() ); } + Patch::Category Patch::categoryEnum( const std::string & category_r ) { switch ( category_r[0] ) @@ -107,6 +110,7 @@ namespace zypp break; } // default: + INT << "Unrecognized Patch::Category string '" << category_r << "'" << endl; return CAT_OTHER; } @@ -121,6 +125,9 @@ namespace zypp bool Patch::isSeverity( const std::string & severity_r ) const { return( str::compareCI( severity_r, severity() ) == 0 ); } + bool Patch::isSeverity( SeverityFlags severity_r ) const + { return severity_r.testFlag( severityFlag() ); } + Patch::SeverityFlag Patch::severityFlag( const std::string & severity_r ) { switch ( severity_r[0] ) @@ -160,6 +167,7 @@ namespace zypp break; } // default: + INT << "Unrecognized Patch::Severity string '" << severity_r << "'" << endl; return SEV_OTHER; } @@ -167,8 +175,8 @@ namespace zypp { switch ( obj ) { - case Patch::SEV_NONE: return std::string( "unspecified" ); break; case Patch::SEV_OTHER: return std::string( "unknown" ); break; + case Patch::SEV_NONE: return std::string( "unspecified" ); break; case Patch::SEV_LOW: return std::string( "low" ); break; case Patch::SEV_MODERATE: return std::string( "moderate" ); break; case Patch::SEV_IMPORTANT:return std::string( "important" ); break; diff --git a/zypp/Patch.h b/zypp/Patch.h index 31782a8..8025878 100644 --- a/zypp/Patch.h +++ b/zypp/Patch.h @@ -45,13 +45,14 @@ namespace zypp typedef sat::SolvableSet Contents; enum Category { - CAT_OTHER, - CAT_YAST, - CAT_SECURITY, - CAT_RECOMMENDED, - CAT_OPTIONAL, - CAT_DOCUMENT + CAT_OTHER = 1, //!< unknown value specified + CAT_YAST = 1<<1, //!< + CAT_SECURITY = 1<<2, //!< + CAT_RECOMMENDED = 1<<3, //!< + CAT_OPTIONAL = 1<<4, //!< + CAT_DOCUMENT = 1<<5 //!< }; + ZYPP_DECLARE_FLAGS(Categories, Category); /** * Flags defining if and why this @@ -72,12 +73,12 @@ namespace zypp * \ref asSring( const Patch::SeverityFlag & ). */ enum SeverityFlag { - SEV_NONE = 0, //!< no value specified SEV_OTHER = 1, //!< unknown value specified - SEV_LOW = 1<<1, //!< Low - SEV_MODERATE = 1<<2, //!< Moderate - SEV_IMPORTANT = 1<<3, //!< Important - SEV_CRITICAL = 1<<4 //!< Critical + SEV_NONE = 1<<1, //!< no value specified + SEV_LOW = 1<<2, //!< Low + SEV_MODERATE = 1<<3, //!< Moderate + SEV_IMPORTANT = 1<<4, //!< Important + SEV_CRITICAL = 1<<5 //!< Critical }; ZYPP_DECLARE_FLAGS(SeverityFlags, SeverityFlag); @@ -103,6 +104,16 @@ namespace zypp /** Whether this patch's category matches \a category_r */ bool isCategory( const std::string & category_r ) const; + /** \overload taking OR'ed \ref Categories */ + bool isCategory( Categories category_r ) const; + /** \overload taking container of category strings */ + template + bool isCategory( const _Container & categories_r ) const + { + for ( const std::string & el : categories_r ) + { if ( isCategory( el ) ) return true; } + return false; + } /** Patch category as enum of wellknown categories. * Unknown values are mapped to \ref CAT_OTHER. @@ -126,6 +137,16 @@ namespace zypp /** Whether this patch's severity matches \a severity_r */ bool isSeverity( const std::string & severity_r ) const; + /** \overload taking OR'ed \ref SeverityFlags */ + bool isSeverity( SeverityFlags severity_r ) const; + /** \overload taking container of severity strings */ + template + bool isSeverity( const _Container & severities_r ) const + { + for ( const std::string & el : severities_r ) + { if ( isSeverity( el ) ) return true; } + return false; + } /** Severity string mapped to an enum. * Unknown string values are mapped to \ref SEV_OTHER @@ -205,6 +226,7 @@ namespace zypp /** Dtor */ virtual ~Patch(); }; + ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Patch::Categories); ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Patch::InteractiveFlags); ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Patch::SeverityFlags); diff --git a/zypp/base/Flags.h b/zypp/base/Flags.h index 6bf7f10..8a7742a 100644 --- a/zypp/base/Flags.h +++ b/zypp/base/Flags.h @@ -99,8 +99,8 @@ namespace zypp Flags & unsetFlag( Flags flag_r ) { _val &= ~flag_r; return *this; } Flags & unsetFlag( Enum flag_r ) { _val &= ~flag_r; return *this; } - bool testFlag( Flags flag_r ) const { return ( _val & flag_r ) == flag_r; } - bool testFlag( Enum flag_r ) const { return ( _val & flag_r ) == flag_r; } + bool testFlag( Flags flag_r ) const { return flag_r ? ( _val & flag_r ) == flag_r : !_val; } + bool testFlag( Enum flag_r ) const { return flag_r ? ( _val & flag_r ) == flag_r : !_val; } private: Integral _val; diff --git a/zypp/base/String.h b/zypp/base/String.h index c496554..1b56e90 100644 --- a/zypp/base/String.h +++ b/zypp/base/String.h @@ -19,6 +19,7 @@ #include #include #include +#include #include "zypp/base/Easy.h" #include "zypp/base/PtrTypes.h" @@ -111,6 +112,8 @@ namespace zypp * bool hasPrefix( const C_Str & str_r, const C_Str & prefix_r ) * { return( ::strncmp( str_r, prefix_r, prefix_r.size() ) == 0 ); } * \endcode + * + * \todo Check whether to replace by boost::string_ref */ class C_Str { @@ -122,6 +125,7 @@ namespace zypp C_Str( char * c_str_r ) : _val( c_str_r ), _sze( std::string::npos ) {} C_Str( const char * c_str_r ) : _val( c_str_r ), _sze( std::string::npos ) {} C_Str( const std::string & str_r ) : _val( str_r.c_str() ), _sze( str_r.size() ) {} + C_Str( const boost::string_ref & str_r ) : _val( str_r.data() ), _sze( str_r.size() ) {} public: bool isNull() const { return !_val; } @@ -157,11 +161,11 @@ namespace zypp /** * Global asString() that works with std::string too */ - inline std::string asString( const std::string &t ) + inline const std::string & asString( const std::string & t ) { return t; } #ifndef SWIG // Swig treats it as syntax error - inline std::string asString( std::string && t ) + inline std::string && asString( std::string && t ) { return std::move(t); } #endif -- 2.7.4