Imported Upstream version 17.16.0
[platform/upstream/libzypp.git] / zypp / sat / Solvable.cc
index 01e12b7..e47c9f8 100644 (file)
 #include "zypp/base/Exception.h"
 #include "zypp/base/Functional.h"
 #include "zypp/base/Collector.h"
+#include "zypp/base/Xml.h"
 
 #include "zypp/sat/detail/PoolImpl.h"
 #include "zypp/sat/Solvable.h"
 #include "zypp/sat/Pool.h"
+#include "zypp/sat/LookupAttr.h"
+
 #include "zypp/Repository.h"
 #include "zypp/OnMediaLocation.h"
+#include "zypp/ZConfig.h"
+
+#include "zypp/ui/Selectable.h"
 
 using std::endl;
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
-{ /////////////////////////////////////////////////////////////////
+{
   ///////////////////////////////////////////////////////////////////
   namespace sat
-  { /////////////////////////////////////////////////////////////////
+  {
+    ///////////////////////////////////////////////////////////////////
+    namespace
+    {
+      void _doSplit( IdString & _ident, ResKind & _kind, IdString & _name )
+      {
+        if ( ! _ident )
+          return;
+
+       ResKind explicitKind = ResKind::explicitBuiltin( _ident.c_str() );
+       // NOTE: kind package and srcpackage do not have namespaced ident!
+       if ( ! explicitKind  )
+       {
+          _name = _ident;
+         // No kind defaults to package
+         if ( !_kind )
+           _kind = ResKind::package;
+         else if ( ! ( _kind == ResKind::package || _kind == ResKind::srcpackage ) )
+           _ident = IdString( str::form( "%s:%s", _kind.c_str(), _ident.c_str() ) );
+       }
+       else
+       {
+         // strip kind spec from name
+         _name = IdString( ::strchr( _ident.c_str(), ':' )+1 );
+         _kind = explicitKind;
+         if ( _kind == ResKind::package || _kind == ResKind::srcpackage )
+           _ident = _name;
+       }
+       return;
+      }
+    } // namespace
+    ///////////////////////////////////////////////////////////////////
 
     Solvable::SplitIdent::SplitIdent( IdString ident_r )
-    {
-      if ( ! ident_r )
-        return;
+    : _ident( ident_r )
+    { _doSplit( _ident, _kind, _name ); }
 
-      const char * ident = ident_r.c_str();
-      const char * sep = ::strchr( ident, ':' );
+    Solvable::SplitIdent::SplitIdent( const char * ident_r )
+    : _ident( ident_r )
+    { _doSplit( _ident, _kind, _name ); }
 
-      // no ':' in package names (hopefully)
-      if ( ! sep )
-      {
-        _kind = ResKind::package;
-        _name = ident_r.asString();
-        return;
-      }
+    Solvable::SplitIdent::SplitIdent( const std::string & ident_r )
+    : _ident( ident_r )
+    { _doSplit( _ident, _kind, _name ); }
 
-      // save name
-      _name = sep+1;
-      // quick check for well known kinds
-      if ( sep-ident >= 4 )
-      {
-        switch ( ident[3] )
-        {
-#define OUTS(K,S) if ( !::strncmp( ident, ResKind::K.c_str(), S ) ) _kind = ResKind::K
-          //             ----v
-          case 'c': OUTS( patch, 5 );       return; break;
-          case 'd': OUTS( product, 7 );     return; break;
-          case 'i': OUTS( script, 6 );      return; break;
-          case 'k': OUTS( package, 7 );     return; break;
-          case 'm': OUTS( atom, 4 );        return; break;
-          case 'p': OUTS( srcpackage, 10 ); return; break;
-          case 's': OUTS( message, 7 );     return; break;
-          case 't': OUTS( pattern, 7 );     return; break;
-#undef OUTS
-        }
-      }
+    Solvable::SplitIdent::SplitIdent( ResKind kind_r, IdString name_r )
+    : _ident( name_r )
+    , _kind( kind_r )
+    { _doSplit( _ident, _kind, _name ); }
 
-      // an unknown kind
-      _kind = ResKind( std::string( ident, sep-ident ) );
-    }
+    Solvable::SplitIdent::SplitIdent( ResKind kind_r, const C_Str & name_r )
+    : _ident( name_r )
+    , _kind( kind_r )
+    { _doSplit( _ident, _kind, _name ); }
 
     /////////////////////////////////////////////////////////////////
+    // class Solvable
+    /////////////////////////////////////////////////////////////////
 
     const Solvable Solvable::noSolvable;
 
     /////////////////////////////////////////////////////////////////
 
-    ::_Solvable * Solvable::get() const
+    detail::CSolvable * Solvable::get() const
     { return myPool().getSolvable( _id ); }
 
 #define NO_SOLVABLE_RETURN( VAL ) \
-    ::_Solvable * _solvable( get() ); \
+    detail::CSolvable * _solvable( get() ); \
     if ( ! _solvable ) return VAL
 
     Solvable Solvable::nextInPool() const
@@ -94,7 +114,7 @@ namespace zypp
       NO_SOLVABLE_RETURN( noSolvable );
       for ( detail::SolvableIdType next = _id+1; next < unsigned(_solvable->repo->end); ++next )
       {
-        ::_Solvable * nextS( myPool().getSolvable( next ) );
+        detail::CSolvable * nextS( myPool().getSolvable( next ) );
         if ( nextS && nextS->repo == _solvable->repo )
         {
           return Solvable( next );
@@ -103,24 +123,6 @@ namespace zypp
       return noSolvable;
     }
 
-    Repository Solvable::repository() const
-    {
-      NO_SOLVABLE_RETURN( Repository::noRepository );
-      return Repository( _solvable->repo );
-    }
-
-    bool Solvable::isSystem() const
-    {
-      NO_SOLVABLE_RETURN( _id == detail::systemSolvableId );
-      return Repository( _solvable->repo ).isSystemRepo();
-    }
-
-    IdString Solvable::ident() const
-    {
-      NO_SOLVABLE_RETURN( IdString() );
-      return IdString( _solvable->name );
-    }
-
     std::string Solvable::lookupStrAttribute( const SolvAttr & attr ) const
     {
       NO_SOLVABLE_RETURN( std::string() );
@@ -132,23 +134,35 @@ namespace zypp
     {
       NO_SOLVABLE_RETURN( std::string() );
       const char * s = 0;
-      if ( lang_r == Locale::noCode )
+      if ( !lang_r )
       {
         s = ::solvable_lookup_str_poollang( _solvable, attr.id() );
       }
       else
       {
-        s = ::solvable_lookup_str_lang( _solvable, attr.id(), lang_r.code().c_str() );
+       for ( Locale l( lang_r ); l; l = l.fallback() )
+       {
+         if ( (s = ::solvable_lookup_str_lang( _solvable, attr.id(), l.c_str(), 0 )) )
+           return s;
+       }
+       // here: no matching locale, so use default
+       s = ::solvable_lookup_str_lang( _solvable, attr.id(), 0, 0 );
       }
       return s ? s : std::string();
    }
 
-    unsigned Solvable::lookupNumAttribute( const SolvAttr & attr ) const
+    unsigned long long Solvable::lookupNumAttribute( const SolvAttr & attr ) const
     {
       NO_SOLVABLE_RETURN( 0 );
       return ::solvable_lookup_num( _solvable, attr.id(), 0 );
     }
 
+    unsigned long long Solvable::lookupNumAttribute( const SolvAttr & attr, unsigned long long notfound_r ) const
+    {
+      NO_SOLVABLE_RETURN( notfound_r );
+      return ::solvable_lookup_num( _solvable, attr.id(), notfound_r );
+    }
+
     bool Solvable::lookupBoolAttribute( const SolvAttr & attr ) const
     {
       NO_SOLVABLE_RETURN( false );
@@ -172,41 +186,89 @@ namespace zypp
       {
         case REPOKEY_TYPE_MD5:    return CheckSum::md5( s );
         case REPOKEY_TYPE_SHA1:   return CheckSum::sha1( s );
+        case REPOKEY_TYPE_SHA224: return CheckSum::sha224( s );
         case REPOKEY_TYPE_SHA256: return CheckSum::sha256( s );
+        case REPOKEY_TYPE_SHA384: return CheckSum::sha384( s );
+        case REPOKEY_TYPE_SHA512: return CheckSum::sha512( s );
       }
       return CheckSum( std::string(), s ); // try to autodetect
     }
 
+    ///////////////////////////////////////////////////////////////////
+    namespace
+    {
+      inline Pathname lookupDatadirIn( Repository repor_r )
+      {
+        static const SolvAttr susetagsDatadir( "susetags:datadir" );
+        Pathname ret;
+        // First look for repo attribute "susetags:datadir". If not found,
+        // look into the solvables as Code11 libsolv placed it there.
+        LookupRepoAttr datadir( susetagsDatadir, repor_r );
+        if ( ! datadir.empty() )
+          ret = datadir.begin().asString();
+        else
+        {
+          LookupAttr datadir( susetagsDatadir, repor_r );
+          if ( ! datadir.empty() )
+            ret = datadir.begin().asString();
+        }
+        return ret;
+      }
+    } // namespace
+    ///////////////////////////////////////////////////////////////////
+
     OnMediaLocation Solvable::lookupLocation() const
-    //std::string Solvable::lookupLocation( unsigned & medianr ) const
     {
       NO_SOLVABLE_RETURN( OnMediaLocation() );
       // medianumber and path
       unsigned medianr;
-      char * file = ::solvable_get_location( _solvable, &medianr );
+      const char * file = ::solvable_lookup_location( _solvable, &medianr );
       if ( ! file )
         return OnMediaLocation();
+      if ( ! medianr )
+       medianr = 1;
 
       OnMediaLocation ret;
 
       Pathname path;
-      if ( repository().info().type().toEnum() == repo::RepoType::YAST2_e )
+      switch ( repository().info().type().toEnum() )
       {
-#warning STILL HARDCODED /suse PREFIX in location
-        // (ma@) loading a susetags repo search for a solvable with attribute
-        // susetags:datadir. this is the prefix. store it in RepoInfo(?).
-        path = "suse";
+        case repo::RepoType::NONE_e:
+        {
+          path = lookupDatadirIn( repository() );
+          if ( ! path.empty() )
+            repository().info().setProbedType( repo::RepoType::YAST2_e );
+        }
+        break;
+
+        case repo::RepoType::YAST2_e:
+        {
+          path = lookupDatadirIn( repository() );
+          if ( path.empty() )
+            path = "suse";
+        }
+        break;
+
+        default:
+          break;
       }
       ret.setLocation    ( path/file, medianr );
-      ret.setDownloadSize( ByteCount( lookupNumAttribute( SolvAttr::downloadsize ), ByteCount::K ) );
+      ret.setDownloadSize( ByteCount( lookupNumAttribute( SolvAttr::downloadsize ) ) );
       ret.setChecksum    ( lookupCheckSumAttribute( SolvAttr::checksum ) );
       // Not needed/available for solvables?
-      //ret.setOpenSize    ( ByteCount( lookupNumAttribute( SolvAttr::opensize ), ByteCount::K ) );
+      //ret.setOpenSize    ( ByteCount( lookupNumAttribute( SolvAttr::opensize ) ) );
       //ret.setOpenChecksum( lookupCheckSumAttribute( SolvAttr::openchecksum ) );
       return ret;
     }
 
-    ResKind Solvable::kind() const
+
+    IdString Solvable::ident() const
+    {
+      NO_SOLVABLE_RETURN( IdString() );
+      return IdString( _solvable->name );
+    }
+
+     ResKind Solvable::kind() const
     {
       NO_SOLVABLE_RETURN( ResKind() );
       // detect srcpackages by 'arch'
@@ -218,33 +280,18 @@ namespace zypp
           break;
       }
 
+      // either explicitly prefixed...
       const char * ident = IdString( _solvable->name ).c_str();
-      const char * sep = ::strchr( ident, ':' );
+      ResKind knownKind( ResKind::explicitBuiltin( ident ) );
+      if ( knownKind )
+       return knownKind;
 
-      // no ':' in package names (hopefully)
+      // ...or no ':' in package names (hopefully)...
+      const char * sep = ::strchr( ident, ':' );
       if ( ! sep )
-        return ResKind::package;
+       return ResKind::package;
 
-      // quick check for well known kinds
-      if ( sep-ident >= 4 )
-      {
-        switch ( ident[3] )
-        {
-#define OUTS(K,S) if ( !::strncmp( ident, ResKind::K.c_str(), S ) ) return ResKind::K
-          //             ----v
-          case 'c': OUTS( patch, 5 );       break;
-          case 'd': OUTS( product, 7 );     break;
-          case 'i': OUTS( script, 6 );      break;
-          case 'k': OUTS( package, 7 );     break;
-          case 'm': OUTS( atom, 4 );        break;
-          case 'p': OUTS( srcpackage, 10 ); break;
-          case 's': OUTS( message, 7 );     break;
-          case 't': OUTS( pattern, 7 );     break;
-#undef OUTS
-        }
-      }
-
-      // an unknown kind
+      // ...or something unknown.
       return ResKind( std::string( ident, sep-ident ) );
     }
 
@@ -253,9 +300,12 @@ namespace zypp
       NO_SOLVABLE_RETURN( false );
 
       // detect srcpackages by 'arch'
-      if ( kind_r == ResKind::srcpackage )
+      switch ( _solvable->arch )
       {
-        return( _solvable->arch == ARCH_SRC || _solvable->arch == ARCH_NOSRC );
+        case ARCH_SRC:
+        case ARCH_NOSRC:
+          return( kind_r == ResKind::srcpackage );
+          break;
       }
 
       // no ':' in package names (hopefully)
@@ -306,28 +356,97 @@ namespace zypp
       return IdString( _solvable->vendor );
     }
 
-    Capabilities Solvable::operator[]( Dep which_r ) const
+   Repository Solvable::repository() const
     {
-      switch( which_r.inSwitch() )
-      {
-        case Dep::PROVIDES_e:    return provides();    break;
-        case Dep::REQUIRES_e:    return requires();    break;
-        case Dep::CONFLICTS_e:   return conflicts();   break;
-        case Dep::OBSOLETES_e:   return obsoletes();   break;
-        case Dep::RECOMMENDS_e:  return recommends();  break;
-        case Dep::SUGGESTS_e:    return suggests();    break;
-        case Dep::FRESHENS_e:    return freshens();    break;
-        case Dep::ENHANCES_e:    return enhances();    break;
-        case Dep::SUPPLEMENTS_e: return supplements(); break;
-        case Dep::PREREQUIRES_e: return prerequires(); break;
-      }
-      return Capabilities();
+      NO_SOLVABLE_RETURN( Repository::noRepository );
+      return Repository( _solvable->repo );
+    }
+
+    RepoInfo Solvable::repoInfo() const
+    { return repository().info(); }
+
+
+    bool Solvable::isSystem() const
+    {
+      NO_SOLVABLE_RETURN( _id == detail::systemSolvableId );
+      return myPool().isSystemRepo( _solvable->repo );
+    }
+
+    bool Solvable::onSystemByUser() const
+    {
+      return isSystem() && myPool().isOnSystemByUser( ident() );
+    }
+
+    bool Solvable::onSystemByAuto() const
+    {
+      return isSystem() && myPool().isOnSystemByAuto( ident() );
+    }
+
+    bool Solvable::identIsAutoInstalled( const IdString & ident_r )
+    {
+      return myPool().isOnSystemByAuto( ident_r );
+    }
+
+    bool Solvable::isNeedreboot() const
+    {
+      NO_SOLVABLE_RETURN( false );
+      return myPool().isNeedreboot( *this );
+    }
+
+    bool Solvable::multiversionInstall() const
+    {
+      NO_SOLVABLE_RETURN( false );
+      return myPool().isMultiversion( *this );
+    }
+
+    Date Solvable::buildtime() const
+    {
+      NO_SOLVABLE_RETURN( Date() );
+      return Date( lookupNumAttribute( SolvAttr::buildtime ) );
+    }
+
+    Date Solvable::installtime() const
+    {
+      NO_SOLVABLE_RETURN( Date() );
+      return Date( lookupNumAttribute( SolvAttr::installtime ) );
+    }
+
+    std::string Solvable::asString() const
+    {
+      NO_SOLVABLE_RETURN( (_id == detail::systemSolvableId ? "systemSolvable" : "noSolvable") );
+      return str::form( "%s-%s.%s",
+                        IdString( _solvable->name ).c_str(),
+                        IdString( _solvable->evr ).c_str(),
+                        IdString( _solvable->arch ).c_str() );
+    }
+
+    std::string Solvable::asUserString() const\
+    {
+      NO_SOLVABLE_RETURN( (_id == detail::systemSolvableId ? "systemSolvable" : "noSolvable") );
+      return str::form( "%s-%s.%s (%s)",
+                        IdString( _solvable->name ).c_str(),
+                        IdString( _solvable->evr ).c_str(),
+                        IdString( _solvable->arch ).c_str(),
+                        repository().asUserString().c_str() );
     }
 
-    inline Capabilities _getCapabilities( detail::IdType * idarraydata_r, ::Offset offs_r )
+    bool Solvable::identical( const Solvable & rhs ) const
     {
-      return offs_r ? Capabilities( idarraydata_r + offs_r ) : Capabilities();
+      NO_SOLVABLE_RETURN( ! rhs.get() );
+      detail::CSolvable * rhssolvable( rhs.get() );
+      return rhssolvable && ( _solvable == rhssolvable || ::solvable_identical( _solvable, rhssolvable ) );
     }
+
+    ///////////////////////////////////////////////////////////////////
+    namespace
+    {
+      inline Capabilities _getCapabilities( detail::IdType * idarraydata_r, ::Offset offs_r )
+      {
+       return offs_r ? Capabilities( idarraydata_r + offs_r ) : Capabilities();
+      }
+    } // namespace
+    ///////////////////////////////////////////////////////////////////
+
     Capabilities Solvable::provides() const
     {
       NO_SOLVABLE_RETURN( Capabilities() );
@@ -358,11 +477,6 @@ namespace zypp
       NO_SOLVABLE_RETURN( Capabilities() );
       return _getCapabilities( _solvable->repo->idarraydata, _solvable->suggests );
     }
-    Capabilities Solvable::freshens() const
-    {
-      NO_SOLVABLE_RETURN( Capabilities() );
-      return _getCapabilities( _solvable->repo->idarraydata, _solvable->freshens );
-    }
     Capabilities Solvable::enhances() const
     {
       NO_SOLVABLE_RETURN( Capabilities() );
@@ -382,21 +496,54 @@ namespace zypp
                    : Capabilities();
     }
 
-    ///////////////////////////////////////////////////////////////////
+    CapabilitySet Solvable::providesNamespace( const std::string & namespace_r ) const
+    {
+      NO_SOLVABLE_RETURN( CapabilitySet() );
+      CapabilitySet ret;
+      Capabilities caps( provides() );
+      for_( it, caps.begin(), caps.end() )
+      {
+        CapDetail caprep( it->detail() );
+        if ( str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) == '(' )
+          ret.insert( *it );
+      }
+      return ret;
+    }
 
-    bool Solvable::isSatisfied() const
+    CapabilitySet Solvable::valuesOfNamespace( const std::string & namespace_r ) const
     {
-       NO_SOLVABLE_RETURN( false );
-       if (solvable_trivial_installable (_solvable, Pool::instance().systemRepo().get()) == 1)
-           return true;
-       else
-           return false;
+      NO_SOLVABLE_RETURN( CapabilitySet() );
+      CapabilitySet ret;
+      Capabilities caps( provides() );
+      for_( it, caps.begin(), caps.end() )
+      {
+        CapDetail caprep( it->detail() );
+        if ( str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) == '(' )
+        {
+          std::string value( caprep.name().c_str()+namespace_r.size()+1 );
+          value[value.size()-1] = '\0'; // erase the trailing ')'
+          ret.insert( Capability( value, caprep.op(), caprep.ed() ) );
+        }
+      }
+      return ret;
+    }
+
+    std::pair<bool, CapabilitySet> Solvable::matchesSolvable(const SolvAttr &attr, const Solvable &solv) const
+    {
+      sat::Queue capQueue;
+      int res = solvable_matchessolvable( get(), attr.id(), static_cast<Id>( solv.id() ), capQueue, 0 );
+
+      CapabilitySet caps;
+      if ( capQueue.size() )
+        std::for_each( capQueue.begin(), capQueue.end(), [ &caps ]( auto cap ){ caps.insert( Capability(cap) );});
+
+      return std::make_pair( res == 1, std::move(caps) );
     }
 
     ///////////////////////////////////////////////////////////////////
     namespace
-    { /////////////////////////////////////////////////////////////////
-      /** Expand \ref Capability and call \c fnc_r for each namescpace:language
+    {
+      /** Expand \ref Capability and call \c fnc_r for each namespace:language
        * dependency. Return #invocations of fnc_r, negative if fnc_r returned
        * false to indicate abort.
        */
@@ -410,16 +557,16 @@ namespace zypp
             case CapDetail::CAP_AND:
             case CapDetail::CAP_OR:
                 // expand
-            {
-              int res = invokeOnEachSupportedLocale( detail.lhs(), fnc_r );
-              if ( res < 0 )
-                return res; // negative on abort.
-              int res2 = invokeOnEachSupportedLocale( detail.rhs(), fnc_r );
-              if ( res2 < 0 )
-                return -res + res2; // negative on abort.
-              return res + res2;
-            }
-            break;
+              {
+                int res = invokeOnEachSupportedLocale( detail.lhs(), fnc_r );
+                if ( res < 0 )
+                  return res; // negative on abort.
+                int res2 = invokeOnEachSupportedLocale( detail.rhs(), fnc_r );
+                if ( res2 < 0 )
+                  return -res + res2; // negative on abort.
+                return res + res2;
+              }
+              break;
 
             case CapDetail::CAP_NAMESPACE:
               if ( detail.lhs().id() == NAMESPACE_LANGUAGE )
@@ -430,17 +577,18 @@ namespace zypp
 
             case CapDetail::REL_NONE:
             case CapDetail::CAP_WITH:
+            case CapDetail::CAP_ARCH:
               break; // unwanted
           }
         }
         return 0;
       }
 
-       /** Expand \ref Capability and call \c fnc_r for each namescpace:language
+       /** Expand \ref Capability and call \c fnc_r for each namespace:language
        * dependency. Return #invocations of fnc_r, negative if fnc_r returned
        * false to indicate abort.
        */
-      inline int invokeOnEachSupportedLocale( Capabilities cap_r, function<bool (const Locale &)> fnc_r )
+      inline int invokeOnEachSupportedLocale( Capabilities cap_r, function<bool (Locale)> fnc_r )
       {
         int cnt = 0;
         for_( cit, cap_r.begin(), cap_r.end() )
@@ -466,8 +614,8 @@ namespace zypp
 
         const LocaleSet & _locales;
       };
-
-    /////////////////////////////////////////////////////////////////
+    } // namespace
+    ///////////////////////////////////////////////////////////////////
 
     bool Solvable::supportsLocales() const
     {
@@ -492,17 +640,107 @@ namespace zypp
     bool Solvable::supportsRequestedLocales() const
     { return supportsLocale( myPool().getRequestedLocales() ); }
 
-    void Solvable::getSupportedLocales( LocaleSet & locales_r ) const
+    LocaleSet Solvable::getSupportedLocales() const
+    {
+      LocaleSet ret;
+      invokeOnEachSupportedLocale( supplements(), functor::collector( std::inserter( ret, ret.begin() ) ) );
+      return ret;
+    }
+
+    CpeId Solvable::cpeId() const
+    {
+      NO_SOLVABLE_RETURN( CpeId() );
+      return CpeId( lookupStrAttribute( SolvAttr::cpeid ), CpeId::noThrow );
+    }
+
+    unsigned Solvable::mediaNr() const
+    {
+      NO_SOLVABLE_RETURN( 0U );
+      // medianumber and path
+      unsigned medianr = 0U;
+      const char * file = ::solvable_lookup_location( _solvable, &medianr );
+      if ( ! file )
+        medianr = 0U;
+      else if ( ! medianr )
+       medianr = 1U;
+      return medianr;
+    }
+
+    ByteCount Solvable::installSize() const
+    {
+      NO_SOLVABLE_RETURN( ByteCount() );
+      return ByteCount( lookupNumAttribute( SolvAttr::installsize ) );
+    }
+
+    ByteCount Solvable::downloadSize() const
+    {
+      NO_SOLVABLE_RETURN( ByteCount() );
+      return ByteCount( lookupNumAttribute( SolvAttr::downloadsize ) );
+    }
+
+    std::string Solvable::distribution() const
+    {
+      NO_SOLVABLE_RETURN( std::string() );
+      return lookupStrAttribute( SolvAttr::distribution );
+    }
+
+    std::string        Solvable::summary( const Locale & lang_r ) const
+    {
+      NO_SOLVABLE_RETURN( std::string() );
+      return lookupStrAttribute( SolvAttr::summary, lang_r );
+    }
+
+    std::string        Solvable::description( const Locale & lang_r ) const
+    {
+      NO_SOLVABLE_RETURN( std::string() );
+      return lookupStrAttribute( SolvAttr::description, lang_r );
+    }
+
+    std::string        Solvable::insnotify( const Locale & lang_r ) const
+    {
+      NO_SOLVABLE_RETURN( std::string() );
+      return lookupStrAttribute( SolvAttr::insnotify, lang_r );
+    }
+
+    std::string        Solvable::delnotify( const Locale & lang_r ) const
+    {
+      NO_SOLVABLE_RETURN( std::string() );
+      return lookupStrAttribute( SolvAttr::delnotify, lang_r );
+    }
+
+    std::string        Solvable::licenseToConfirm( const Locale & lang_r ) const
+    {
+      NO_SOLVABLE_RETURN( std::string() );
+      std::string ret = lookupStrAttribute( SolvAttr::eula, lang_r );
+      if ( ret.empty() && isKind<Product>() )
+      {
+       const RepoInfo & ri( repoInfo() );
+       std::string riname( name() );   // "license-"+name with fallback "license"
+       if ( ! ri.hasLicense( riname ) )
+         riname.clear();
+
+       if ( ri.needToAcceptLicense( riname ) || ! ui::Selectable::get( *this )->hasInstalledObj() )
+         ret = ri.getLicense( riname, lang_r ); // bnc#908976: suppress informal license upon update
+      }
+      return ret;
+    }
+
+    bool Solvable::needToAcceptLicense() const
     {
-      invokeOnEachSupportedLocale( supplements(),
-                                   functor::Collector( std::inserter( locales_r, locales_r.begin() ) ) );
+      NO_SOLVABLE_RETURN( false );
+      if ( isKind<Product>() )
+      {
+       const RepoInfo & ri( repoInfo() );
+       std::string riname( name() );   // "license-"+name with fallback "license"
+       if ( ! ri.hasLicense( riname ) )
+         riname.clear();
+
+       return ri.needToAcceptLicense( riname );
+      }
+      return true;
     }
 
-    /******************************************************************
-    **
-    ** FUNCTION NAME : operator<<
-    ** FUNCTION TYPE : std::ostream &
-    */
+
     std::ostream & operator<<( std::ostream & str, const Solvable & obj )
     {
       if ( ! obj )
@@ -511,14 +749,9 @@ namespace zypp
       return str << "(" << obj.id() << ")"
           << ( obj.isKind( ResKind::srcpackage ) ? "srcpackage:" : "" ) << obj.ident()
           << '-' << obj.edition() << '.' << obj.arch() << "("
-          << obj.repository().name() << ")";
+          << obj.repository().alias() << ")";
     }
 
-    /******************************************************************
-    **
-    ** FUNCTION NAME : dumpOn
-    ** FUNCTION TYPE : std::ostream &
-    */
     std::ostream & dumpOn( std::ostream & str, const Solvable & obj )
     {
       str << obj;
@@ -532,7 +765,6 @@ namespace zypp
         OUTS(OBSOLETES);
         OUTS(RECOMMENDS);
         OUTS(SUGGESTS);
-        OUTS(FRESHENS);
         OUTS(ENHANCES);
         OUTS(SUPPLEMENTS);
 #undef OUTS
@@ -540,9 +772,19 @@ namespace zypp
       return str;
     }
 
-    /////////////////////////////////////////////////////////////////
+    std::ostream & dumpAsXmlOn( std::ostream & str, const Solvable & obj )
+    {
+      xmlout::Node guard( str, "solvable" );
+
+      dumpAsXmlOn( *guard, obj.kind() );
+      *xmlout::Node( *guard, "name" ) << obj.name();
+      dumpAsXmlOn( *guard, obj.edition() );
+      dumpAsXmlOn( *guard, obj.arch() );
+      dumpAsXmlOn( *guard, obj.repository() );
+      return str;
+    }
+
   } // namespace sat
   ///////////////////////////////////////////////////////////////////
-  /////////////////////////////////////////////////////////////////
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////