From: DongHun Kwak Date: Fri, 27 Nov 2020 06:46:00 +0000 (+0900) Subject: Imported Upstream version 17.21.0 X-Git-Tag: upstream/17.21.0^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be55b907da8b179dbdad2740a468162cd3c7d665;p=platform%2Fupstream%2Flibzypp.git Imported Upstream version 17.21.0 --- diff --git a/VERSION.cmake b/VERSION.cmake index 794a6aa..eef901d 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -60,9 +60,9 @@ # SET(LIBZYPP_MAJOR "17") SET(LIBZYPP_COMPATMINOR "20") -SET(LIBZYPP_MINOR "20") +SET(LIBZYPP_MINOR "21") SET(LIBZYPP_PATCH "0") # -# LAST RELEASED: 17.20.0 (20) +# LAST RELEASED: 17.21.0 (20) # (The number in parenthesis is LIBZYPP_COMPATMINOR) #======= diff --git a/package/libzypp.changes b/package/libzypp.changes index ae85e51..f7ddd22 100644 --- a/package/libzypp.changes +++ b/package/libzypp.changes @@ -1,4 +1,12 @@ ------------------------------------------------------------------- +Mon Jan 20 12:53:12 CET 2020 - ma@suse.de + +- Selectable: Fix highestAvailableVersionObj if only retracted + packages are available. Avoid using retracted items as candidate + (jira#SLE-8905) +- version 17.21.0 (20) + +------------------------------------------------------------------- Thu Dec 19 13:28:00 CET 2019 - ma@suse.de - BuildRequires: libsolv-devel >= 0.7.10. diff --git a/po/fi.po b/po/fi.po index 13b6447..a7f6426 100644 --- a/po/fi.po +++ b/po/fi.po @@ -20,7 +20,7 @@ msgstr "" "Project-Id-Version: zypp.fi\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-12-05 14:22+0100\n" -"PO-Revision-Date: 2019-04-09 16:45+0000\n" +"PO-Revision-Date: 2020-01-13 19:59+0000\n" "Last-Translator: Tommi Nieminen \n" "Language-Team: Finnish \n" @@ -29,7 +29,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 3.3\n" +"X-Generator: Weblate 3.6.1\n" #. dubious: Throw on malformed known types, otherwise log a warning. #: zypp/CheckSum.cc:136 @@ -4812,19 +4812,19 @@ msgstr "Asennetaan %s poisjätetystä asennuslähteestä" #: zypp/solver/detail/SATResolver.cc:1386 #, boost-format msgid "install %1% although it has been retracted" -msgstr "" +msgstr "asenna %1%, vaikka se on vedetty takaisin" #. translator: %1% is a package name #: zypp/solver/detail/SATResolver.cc:1389 #, boost-format msgid "allow to install the PTF %1%" -msgstr "" +msgstr "salli asentaa PTF %1%" #. translator: %1% is a package name #: zypp/solver/detail/SATResolver.cc:1392 #, boost-format msgid "install %1% although it is blacklisted" -msgstr "" +msgstr "asenna %1%, vaikka se on mustalistattu" #: zypp/solver/detail/SATResolver.cc:1412 #, c-format, boost-format diff --git a/po/id.po b/po/id.po index a296a1a..a27af33 100644 --- a/po/id.po +++ b/po/id.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: YaST (@memory@)\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-12-05 14:22+0100\n" -"PO-Revision-Date: 2019-04-18 16:03+0000\n" +"PO-Revision-Date: 2020-01-16 14:53+0000\n" "Last-Translator: Kukuh Syafaat \n" "Language-Team: Indonesian \n" @@ -18,7 +18,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 3.3\n" +"X-Generator: Weblate 3.6.1\n" #. dubious: Throw on malformed known types, otherwise log a warning. #: zypp/CheckSum.cc:136 @@ -5047,19 +5047,19 @@ msgstr "pasang %s dari repositori pengecualian" #: zypp/solver/detail/SATResolver.cc:1386 #, boost-format msgid "install %1% although it has been retracted" -msgstr "" +msgstr "pasang %1% meskipun telah ditarik kembali" #. translator: %1% is a package name #: zypp/solver/detail/SATResolver.cc:1389 #, boost-format msgid "allow to install the PTF %1%" -msgstr "" +msgstr "memungkinkan untuk memasang PTF %1%" #. translator: %1% is a package name #: zypp/solver/detail/SATResolver.cc:1392 #, boost-format msgid "install %1% although it is blacklisted" -msgstr "" +msgstr "pasang %1% meskipun masuk daftar hitam" #: zypp/solver/detail/SATResolver.cc:1412 #, c-format, boost-format diff --git a/zypp/CheckSum.h b/zypp/CheckSum.h index fb73099..20f8078 100644 --- a/zypp/CheckSum.h +++ b/zypp/CheckSum.h @@ -54,12 +54,10 @@ namespace zypp */ CheckSum( const std::string & type, std::istream & input_r ); -#ifndef SWIG // Swig treats it as syntax error0 /** Ctor from temporary istream */ CheckSum( const std::string & type, std::istream && input_r ) : CheckSum( type, input_r ) {} -#endif public: static const std::string & md5Type(); @@ -90,7 +88,7 @@ namespace zypp static CheckSum sha256( std::istream & input_r ) { return CheckSum( sha256Type(), input_r ); } static CheckSum sha384( std::istream & input_r ) { return CheckSum( sha384Type(), input_r ); } static CheckSum sha512( std::istream & input_r ) { return CheckSum( sha512Type(), input_r ); } -#ifndef SWIG // Swig treats it as syntax error + static CheckSum md5( std::istream && input_r ) { return CheckSum( md5Type(), input_r ); } static CheckSum sha( std::istream && input_r ) { return CheckSum( sha1Type(), input_r ); } static CheckSum sha1( std::istream && input_r ) { return CheckSum( sha1Type(), input_r ); } @@ -98,7 +96,6 @@ namespace zypp static CheckSum sha256( std::istream && input_r ) { return CheckSum( sha256Type(), input_r ); } static CheckSum sha384( std::istream && input_r ) { return CheckSum( sha384Type(), input_r ); } static CheckSum sha512( std::istream && input_r ) { return CheckSum( sha512Type(), input_r ); } -#endif //@} /** \name Reads the content of \param input_r and computes the checksum. */ diff --git a/zypp/OnMediaLocation.cc b/zypp/OnMediaLocation.cc index 0f501aa..7b8f6c9 100644 --- a/zypp/OnMediaLocation.cc +++ b/zypp/OnMediaLocation.cc @@ -18,19 +18,139 @@ using std::endl; /////////////////////////////////////////////////////////////////// namespace zypp -{ ///////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////// - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const OnMediaLocation & obj ) +{ + /////////////////////////////////////////////////////////////////// + /// \class OnMediaLocation::Impl + /// \brief OnMediaLocation implementation. + /////////////////////////////////////////////////////////////////// + struct OnMediaLocation::Impl { - return str << "[" << obj.medianr() << "]" << obj.filename() - << "{" << obj.downloadSize() << "|" << obj.checksum() << "}"; - } + public: + Impl() + {} + + Impl( Pathname filename_r, unsigned medianr_r ) + : _filename { std::move(filename_r) } + , _medianr { medianr_r } + {} + + Pathname _filename; + unsigned _medianr = 0U; + + bool _optional = false; + + ByteCount _downloadSize; + CheckSum _checksum; + + ByteCount _openSize; + CheckSum _openChecksum; + + ByteCount _zchunkHeaderSize; + CheckSum _zchunkHeaderChecksum; + + public: + /** Offer default Impl. */ + static shared_ptr nullimpl() + { static shared_ptr _nullimpl( new Impl ); return _nullimpl; } + private: + friend Impl * rwcowClone( const Impl * rhs ); + /** clone for RWCOW_pointer */ + Impl * clone() const { return new Impl( *this ); } + }; + + /** \relates OnMediaLocation::Impl Stream output */ + inline std::ostream & operator<<( std::ostream & str, const OnMediaLocation::Impl & obj ) + { return str << "[" << obj._medianr << "]" << obj._filename << "{" << obj._downloadSize << "|" << obj._checksum << "}"; } + + /** \relates OnMediaLocation::Impl Verbose stream output */ + inline std::ostream & dumpOn( std::ostream & str, const OnMediaLocation::Impl & obj ) + { return str << obj; } + + /////////////////////////////////////////////////////////////////// + // CLASS NAME : OnMediaLocation + /////////////////////////////////////////////////////////////////// + + OnMediaLocation::OnMediaLocation() + : _pimpl( Impl::nullimpl() ) + {} + + OnMediaLocation::OnMediaLocation( Pathname filename_r, unsigned medianr_r ) + : _pimpl( new Impl( std::move(filename_r), medianr_r ) ) + {} + + OnMediaLocation::~OnMediaLocation() + {} + + + const Pathname & OnMediaLocation::filename() const + { return _pimpl->_filename; } + + unsigned OnMediaLocation::medianr() const + { return _pimpl->_medianr; } + + OnMediaLocation & OnMediaLocation::setLocation( Pathname filename_r, unsigned medianr_r ) + { _pimpl->_filename = std::move(filename_r); _pimpl->_medianr = medianr_r; return *this; } + + OnMediaLocation & OnMediaLocation::unsetLocation() + { _pimpl->_filename = Pathname(); _pimpl->_medianr = 0; return *this; } + + OnMediaLocation & OnMediaLocation::changeFilename( Pathname filename_r ) + { _pimpl->_filename = std::move(filename_r); return *this; } + + OnMediaLocation & OnMediaLocation::changeMedianr( unsigned medianr_r ) + { _pimpl->_medianr = medianr_r; return *this; } + + OnMediaLocation & OnMediaLocation::prependPath( const Pathname & prefix_r ) + { if ( ! prefix_r.emptyOrRoot() ) changeFilename( prefix_r / filename() ); return *this; } + + bool OnMediaLocation::optional() const + { return _pimpl->_optional; } + + OnMediaLocation & OnMediaLocation::setOptional( bool val_r ) + { _pimpl->_optional = val_r; return *this; } + + const ByteCount & OnMediaLocation::downloadSize() const + { return _pimpl->_downloadSize; } + + OnMediaLocation & OnMediaLocation::setDownloadSize( ByteCount val_r ) + { _pimpl->_downloadSize = val_r; return *this; } + + const CheckSum & OnMediaLocation::checksum() const + { return _pimpl->_checksum; } + + OnMediaLocation & OnMediaLocation::setChecksum( CheckSum val_r ) + { _pimpl->_checksum = val_r; return *this; } + + const ByteCount & OnMediaLocation::openSize() const + { return _pimpl->_openSize; } + + OnMediaLocation & OnMediaLocation::setOpenSize( ByteCount val_r ) + { _pimpl->_openSize = val_r; return *this; } + + const CheckSum & OnMediaLocation::openChecksum() const + { return _pimpl->_openChecksum; } + + OnMediaLocation & OnMediaLocation::setOpenChecksum( CheckSum val_r ) + { _pimpl->_openChecksum = val_r; return *this; } + + const ByteCount & OnMediaLocation::zchunkHeaderSize() const + { return _pimpl->_zchunkHeaderSize; } + + OnMediaLocation & OnMediaLocation::setZchunkHeaderSize( ByteCount val_r ) + { _pimpl->_zchunkHeaderSize = val_r; return *this; } + + const CheckSum & OnMediaLocation::zchunkHeaderChecksum() const + { return _pimpl->_zchunkHeaderChecksum; } + + OnMediaLocation & OnMediaLocation::setZchunkHeaderChecksum( CheckSum val_r ) + { _pimpl->_zchunkHeaderChecksum = val_r; return *this; } + + + std::ostream & operator<<( std::ostream & str, const OnMediaLocation & obj ) + { return str << *obj._pimpl; } + + std::ostream & dumpOn( std::ostream & str, const OnMediaLocation & obj ) + { return dumpOn( str, *obj._pimpl ); } -///////////////////////////////////////////////////////////////// } // namespace zypp /////////////////////////////////////////////////////////////////// diff --git a/zypp/OnMediaLocation.h b/zypp/OnMediaLocation.h index b6f17c2..3825f4f 100644 --- a/zypp/OnMediaLocation.h +++ b/zypp/OnMediaLocation.h @@ -7,13 +7,14 @@ | | \---------------------------------------------------------------------*/ /** \file zypp/source/OnMediaLocation.h - * -*/ + */ #ifndef ZYPP_SOURCE_ONMEDIALOCATION_H #define ZYPP_SOURCE_ONMEDIALOCATION_H #include +#include "zypp/base/PtrTypes.h" + #include "zypp/APIConfig.h" #include "zypp/Pathname.h" #include "zypp/ByteCount.h" @@ -21,153 +22,111 @@ /////////////////////////////////////////////////////////////////// namespace zypp -{ ///////////////////////////////////////////////////////////////// - +{ + /////////////////////////////////////////////////////////////////// + /// \class OnMediaLocation + /// \brief Describes a resource file located on a medium. + /// + /// Holds the path of a resource on a medium and contains additional + /// info required to retrieve and verify it (like media number, + /// checksum, size,...) + /// + /// It does not specify the \ref Url of the medium itself. + /// + /// Media number \c 0 usually indicates no media access. /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : OnMediaLocation - // - /** - * Describes a path on a certain media amongs as the information - * required to download it, like its media number, checksum and - * size. It does not specify the URI of the file. - * - * Media number \c 0 usually indicates no media access. - * - * \todo Implement cheap copy via COW. - */ class OnMediaLocation { friend std::ostream & operator<<( std::ostream & str, const OnMediaLocation & obj ); + friend std::ostream & dumpOn( std::ostream & str, const OnMediaLocation & obj ); public: - /** Default ctor indicating no media access. */ - OnMediaLocation() - : _medianr( 0 ) - , _optional(false) - {} - - /** Ctor taking a filename and media number (defaults to 1). */ - OnMediaLocation( const Pathname & filename_r, unsigned medianr_r = 1 ) - : _medianr( medianr_r ) - , _filename( filename_r ) - , _optional(false) // bnc #447010 - {} + /** Default Ctor indicating no media access. */ + OnMediaLocation(); - public: - /** - * media number where the resource is located. - * for a url cd:// this could be 1..N. - * for a url of type http://host/path/CD1, a media number 2 - * means looking on http://host/path/CD1/../CD2 - */ - unsigned medianr() const { return _medianr; } - /** - * The path to the resource relatve to the url and path. - * If the base is http://novell.com/download/repository, the - * resource filename could be "/repodata/repomd.xml" - */ - const Pathname & filename() const { return _filename; } - /** - * the checksum of the resource - */ - const CheckSum & checksum() const { return _checksum; } - /** - * The size of the resource on the server. Therefore - * the size of the download. - */ - const ByteCount & downloadSize() const { return _downloadsize; } - /** - * The size of the resource once it has been uncompressed - * or unpacked. - * If the file is file.txt.gz then this is the size of - * file.txt - */ - const ByteCount & openSize() const { return _opendownloadsize; } - /** - * The checksum of the resource once it has been uncompressed - * or unpacked. - * If the file is file.txt.gz then this is the checksum of - * file.txt - */ - const CheckSum & openChecksum() const { return _openchecksum; } - /** - * whether this is an optional resource. That is a file that - * may not be present. This is just a hint to the resource - * downloader to not error in case the not found resource is - * not found. - */ - const bool optional() const { return _optional; } + /** Ctor taking a \a filename_r and \a medianr_r (defaults to \c 1). */ + OnMediaLocation( Pathname filename_r, unsigned medianr_r = 1 ); + + /** Dtor */ + ~OnMediaLocation(); public: - /** Unset \c filename and set \c medianr to \c 0. */ - OnMediaLocation & unsetLocation() - { _filename = Pathname(); _medianr = 0; return *this; } + /** The path to the resource on the medium. */ + const Pathname & filename() const; - /** Set filename and media number (defaults to \c 1). */ - OnMediaLocation & setLocation( const Pathname & val_r, - unsigned mediaNumber_r = 1 ) - { _filename = val_r; _medianr = mediaNumber_r; return *this; } + /** The media number the resource is located on. */ + unsigned medianr() const; - /** Set the files size. */ - OnMediaLocation & setDownloadSize( const ByteCount & val_r ) - { _downloadsize = val_r; return *this; } - /** Set the files checksum. */ - OnMediaLocation & setChecksum( const CheckSum & val_r ) - { _checksum = val_r; return *this; } + /** Set \a filename_r and \a medianr_r (defaults to \c 1). */ + OnMediaLocation & setLocation( Pathname filename_r, unsigned medianr_r = 1 ); - /** Set the files open (uncompressed) size. */ - OnMediaLocation & setOpenSize( const ByteCount & val_r ) - { _opendownloadsize = val_r; return *this; } + /** Unset \c filename and set \c medianr to \c 0. */ + OnMediaLocation & unsetLocation(); - /** Set the files open (uncompressed) checksum. */ - OnMediaLocation & setOpenChecksum( const CheckSum & val_r ) - { _openchecksum = val_r; return *this; } - /** - * Set the whether the resource is optional or not - * \see optional - */ - OnMediaLocation & setOptional( bool val ) - { _optional = val; return *this; } + /** Individual manipulation of \c filename (prefer \ref setLocation). */ + OnMediaLocation & changeFilename( Pathname filename_r ); + + /** Individual manipulation of \c medianr (prefer \ref setLocation). */ + OnMediaLocation & changeMedianr( unsigned medianr_r ); + + /** Prepend the filename with \a prefix_r */ + OnMediaLocation & prependPath( const Pathname & prefix_r ); public: - /** - * Individual manipulation of \c medianr (prefer \ref setLocation). - * Using \ref setLocation is prefered as us usually have to adjust - * \c filename and \c medianr in sync. - */ - OnMediaLocation & changeMedianr( unsigned val_r ) - { _medianr = val_r; return *this; } - - /** - * Individual manipulation of \c filename (prefer \ref setLocation). - * Using \ref setLocation is preferedas us usually have to adjust - * \c filename and \c medianr in sync. + /** Whether this is an optional resource. + * This is a hint to the downloader not to report an error if + * the resource is not present on the server. */ - OnMediaLocation & changeFilename( const Pathname & val_r ) - { _filename = val_r; return *this; } + bool optional() const; + /** Set whether the resource is \ref optional. */ + OnMediaLocation & setOptional( bool val ); - /** Prepend the filename with \a prefix_r */ - OnMediaLocation & prependPath( const Pathname & prefix_r ) - { if ( !prefix_r.emptyOrRoot() ) changeFilename( prefix_r / filename() ); return *this; } + public: + /** The size of the resource on the server. */ + const ByteCount & downloadSize() const; + /** Set the \ref downloadSize. */ + OnMediaLocation & setDownloadSize( ByteCount val_r ); + + /** The checksum of the resource on the server. */ + const CheckSum & checksum() const; + /** Set the \ref checksum. */ + OnMediaLocation & setChecksum( CheckSum val_r ); + + /** The size of the resource once it has been uncompressed or unpacked. */ + const ByteCount & openSize() const; + /** Set the \ref openSize. */ + OnMediaLocation & setOpenSize( ByteCount val_r ); + + /** The checksum of the resource once it has been uncompressed or unpacked. */ + const CheckSum & openChecksum() const; + /** Set the \ref openChecksum. */ + OnMediaLocation & setOpenChecksum( CheckSum val_r ); + public: + /** zchunk: The size of the zchunk header prepending the resource. */ + const ByteCount & zchunkHeaderSize() const; + /** zchunk: Set the \ref zchunkHeaderSize. */ + OnMediaLocation & setZchunkHeaderSize( ByteCount val_r ); + + /** zchunk: The checksum of the zchunk header prepending the resource. */ + const CheckSum & zchunkHeaderChecksum() const; + /** zchunk: Set the \ref zchunkHeaderChecksum. */ + OnMediaLocation & setZchunkHeaderChecksum( CheckSum val_r ); + + public: + class Impl; ///< Implementation class. private: - unsigned _medianr; - Pathname _filename; - CheckSum _checksum; - ByteCount _downloadsize; - ByteCount _opendownloadsize; - CheckSum _openchecksum; - bool _optional; + RWCOW_pointer _pimpl; ///< Pointer to implementation. }; - /////////////////////////////////////////////////////////////////// /** \relates OnMediaLocation Stream output */ std::ostream & operator<<( std::ostream & str, const OnMediaLocation & obj ); - ///////////////////////////////////////////////////////////////// + /** \relates OnMediaLocation Verbose stream output */ + std::ostream & dumOn( std::ostream & str, const OnMediaLocation & obj ); + } // namespace zypp /////////////////////////////////////////////////////////////////// #endif // ZYPP_SOURCE_ONMEDIALOCATION_H diff --git a/zypp/Patch.h b/zypp/Patch.h index 14eb738..81a4e54 100644 --- a/zypp/Patch.h +++ b/zypp/Patch.h @@ -107,7 +107,7 @@ namespace zypp bool isCategory( const std::string & category_r ) const; /** \overload taking OR'ed \ref Categories */ bool isCategory( Categories category_r ) const; -#ifndef SWIG // Swig treats it as syntax error + /** \overload taking container of category strings * 2nd template arg just to prevent instantiation for Category */ @@ -118,7 +118,7 @@ namespace zypp { if ( isCategory( el ) ) return true; } return false; } -#endif + /** Patch category as enum of wellknown categories. * Unknown values are mapped to \ref CAT_OTHER. */ @@ -143,7 +143,7 @@ namespace zypp bool isSeverity( const std::string & severity_r ) const; /** \overload taking OR'ed \ref SeverityFlags */ bool isSeverity( SeverityFlags severity_r ) const; -#ifndef SWIG // Swig treats it as syntax error + /** \overload taking container of severity strings * 2nd template arg just to prevent instantiation for SeverityFlag */ @@ -154,7 +154,7 @@ namespace zypp { if ( isSeverity( el ) ) return true; } return false; } -#endif + /** Severity string mapped to an enum. * Unknown string values are mapped to \ref SEV_OTHER */ diff --git a/zypp/Pathname.h b/zypp/Pathname.h index 09d37d0..d387807 100644 --- a/zypp/Pathname.h +++ b/zypp/Pathname.h @@ -1,3 +1,4 @@ + /*---------------------------------------------------------------------\ | ____ _ __ __ ___ | | |__ / \ / / . \ . \ | @@ -66,12 +67,12 @@ namespace zypp using std::swap; swap( lhs._name, rhs._name ); } -#ifndef SWIG // Swig treats it as syntax error + /** Move Ctor */ Pathname( Pathname && tmp ) : _name( std::move( tmp._name ) ) {} -#endif + /** Assign */ Pathname & operator=( Pathname rhs ) { swap( *this, rhs ); return *this; } diff --git a/zypp/base/Easy.h b/zypp/base/Easy.h index 9088901..0b1898d 100644 --- a/zypp/base/Easy.h +++ b/zypp/base/Easy.h @@ -65,7 +65,6 @@ CLASS( const CLASS & ) = default; \ CLASS & operator=( const CLASS & ) = default -#ifndef SWIG // Swig treats it as syntax error /** Delete move ctor and move assign */ #define NON_MOVABLE(CLASS) \ CLASS( CLASS && ) = delete; \ @@ -75,10 +74,6 @@ #define DEFAULT_MOVABLE(CLASS) \ CLASS( CLASS && ) = default; \ CLASS & operator=( CLASS && ) = default -#else -#define NON_MOVABLE(CLASS) -#define DEFAULT_MOVABLE(CLASS) -#endif /** Delete copy ctor and copy assign but enable default move */ #define NON_COPYABLE_BUT_MOVE( CLASS ) \ diff --git a/zypp/base/String.h b/zypp/base/String.h index 776c2fa..b50ee49 100644 --- a/zypp/base/String.h +++ b/zypp/base/String.h @@ -136,10 +136,8 @@ namespace zypp 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 ) { return std::move(t); } -#endif inline std::string asString( const char * t ) { return t == nullptr ? std::string() : t; } diff --git a/zypp/repo/RepoVariables.h b/zypp/repo/RepoVariables.h index 04cd353..6d903db 100644 --- a/zypp/repo/RepoVariables.h +++ b/zypp/repo/RepoVariables.h @@ -61,10 +61,9 @@ namespace zypp /** Return a copy of \a value_r with embedded variables expanded. */ std::string operator()( const std::string & value_r, VarRetriever varRetriever_r ) const; -#ifndef SWIG // Swig treats it as syntax error + /** \overload moving */ std::string operator()( std::string && value_r, VarRetriever varRetriever_r ) const; -#endif }; /** @@ -106,10 +105,9 @@ namespace zypp struct RepoVariablesStringReplacer : public std::unary_function { std::string operator()( const std::string & value_r ) const; -#ifndef SWIG // Swig treats it as syntax error + /** \overload moving */ std::string operator()( std::string && value_r ) const; -#endif }; /** diff --git a/zypp/sat/SolvableType.h b/zypp/sat/SolvableType.h index 86789a4..48d1bd9 100644 --- a/zypp/sat/SolvableType.h +++ b/zypp/sat/SolvableType.h @@ -147,10 +147,8 @@ namespace zypp SolvableType() {} SolvableType( const SolvableType & ) {} void operator=( const SolvableType & ) {} -#ifndef SWIG SolvableType( SolvableType && ) {} void operator=( SolvableType && ) {} -#endif ~SolvableType() {} }; diff --git a/zypp/ui/Selectable.cc b/zypp/ui/Selectable.cc index 46c0942..5bd20e2 100644 --- a/zypp/ui/Selectable.cc +++ b/zypp/ui/Selectable.cc @@ -172,6 +172,12 @@ namespace zypp //////////////////////////////////////////////////////////////////////// + bool Selectable::hasRetracted() const + { return _pimpl->hasRetracted(); } + + bool Selectable::hasRetractedInstalled() const + { return _pimpl->hasRetractedInstalled(); } + bool Selectable::isUnmaintained() const { return _pimpl->isUnmaintained(); } diff --git a/zypp/ui/Selectable.h b/zypp/ui/Selectable.h index 64a2224..4570dd0 100644 --- a/zypp/ui/Selectable.h +++ b/zypp/ui/Selectable.h @@ -125,6 +125,8 @@ namespace zypp /** The 'best' or 'most interesting' among all available objects. * One that is, or is likely to be, chosen for installation, unless * it violated any solver policy (see \ref updateCandidateObj). + * \note Might return a retracted item if explicitly set by \ref setCandidate + * or nothing else available. */ PoolItem candidateObj() const; @@ -132,6 +134,7 @@ namespace zypp * In contrary to \ref candidateObj, this may return no item even if * there are available objects. This simply means the \ref Repository * does not provide this object. + * \note Avoids to return retracted items. */ PoolItem candidateObjFrom( Repository repo_r ) const; @@ -140,6 +143,7 @@ namespace zypp * there are available objects. This simply means the best object is * already installed, and all available objects violate at least one * update policy. + * \note Avoids to return retracted items. */ PoolItem updateCandidateObj() const; @@ -147,6 +151,7 @@ namespace zypp * It's doubtful whether solely looking at the version makes a good * candidate, but apps ask for it. Beware that different vendors may * use different (uncomparable) version schemata. + * \note Avoids to return retracted items. */ PoolItem highestAvailableVersionObj() const; @@ -320,6 +325,12 @@ namespace zypp /** True if candidate object is present but no installed. */ bool hasCandidateObjOnly() const { return ( installedEmpty() ) && candidateObj(); } + + /** True if this Selectable contains a retracted item. */ + bool hasRetracted() const; + + /** True if this Selectable contains an installed retracted item. */ + bool hasRetractedInstalled() const; //@} /** diff --git a/zypp/ui/SelectableImpl.h b/zypp/ui/SelectableImpl.h index 29b3e91..01de374 100644 --- a/zypp/ui/SelectableImpl.h +++ b/zypp/ui/SelectableImpl.h @@ -109,9 +109,9 @@ namespace zypp PoolItem candidateObj() const { PoolItem ret( transactingCandidate() ); - if ( ret ) - return ret; - return _candidate ? _candidate : defaultCandidate(); + if ( ! ret ) + ret = _candidate ? _candidate : defaultCandidate(); + return ret; } /** Set a userCandidate (out of available objects). @@ -129,6 +129,8 @@ namespace zypp { for ( const PoolItem & pi : available() ) { + if ( pi.isRetracted() ) + continue; if ( pi.repository() == repo_r ) return pi; } @@ -148,7 +150,10 @@ namespace zypp // multiversionInstall: This returns the candidate for the last // instance installed. Actually we'd need a list here. - if ( installedEmpty() || ! defaultCand ) + if ( ! defaultCand || defaultCand.isRetracted() ) + return PoolItem(); + + if ( installedEmpty() ) return defaultCand; // Here: installed and defaultCand are non NULL and it's not a // multiversion install. @@ -175,8 +180,15 @@ namespace zypp PoolItem highestAvailableVersionObj() const { PoolItem ret; + bool retractedOk = false; for ( const PoolItem & pi : available() ) { + if ( !retractedOk && pi.isRetracted() ) + { + if ( ret ) + break; // prefer a not retracted candidate + retractedOk = true; + } if ( !ret || pi.edition() > ret.edition() ) ret = pi; } @@ -298,6 +310,32 @@ namespace zypp //////////////////////////////////////////////////////////////////////// + bool hasRetracted() const + { return !_availableItems.empty() && _availableItems.rbegin()->isRetracted(); } + + bool hasRetractedInstalled() const + { + bool ret = false; + if ( hasRetracted() ) + { + for ( const PoolItem & ipi : installed() ) + { + PoolItem pi { identicalAvailableObj( ipi ) }; + if ( pi && pi.isRetracted() ) + { + ret = true; + break; + } + } + } + return ret; +// later if pool index is available: +// for ( const PoolItem & pi : installed() ) +// if ( pi.isRetracted() ) +// return true; +// return false; + } + bool isUnmaintained() const { return availableEmpty(); } diff --git a/zypp/ui/SelectableTraits.h b/zypp/ui/SelectableTraits.h index 5014dbf..3ba04a9 100644 --- a/zypp/ui/SelectableTraits.h +++ b/zypp/ui/SelectableTraits.h @@ -34,6 +34,7 @@ namespace zypp struct SelectableTraits { /** Oder on AvailableItemSet. + * \li not retracted * \li repository priority * \li best Arch (arch/noarch changes are ok) * \li best Edition @@ -49,6 +50,9 @@ namespace zypp // bool operator()( const PoolItem & lhs, const PoolItem & rhs ) const { + if ( lhs.isRetracted() != rhs.isRetracted() ) + return rhs.isRetracted(); + int lprio = lhs->satSolvable().repository().satInternalPriority(); int rprio = rhs->satSolvable().repository().satInternalPriority(); if ( lprio != rprio )