else
{
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 );
+ }
+ // here: no matching locale, so use default
+ s = ::solvable_lookup_str_lang( _solvable, attr.id(), 0, 0 );
}
return s ? s : std::string();
}
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 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.
*/
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.
*/
unsigned Solvable::mediaNr() const
{
NO_SOLVABLE_RETURN( 0U );
- return lookupNumAttribute( SolvAttr::medianr );
+ // 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
if ( ret.empty() && isKind<Product>() )
{
const RepoInfo & ri( repoInfo() );
- if ( ri.needToAcceptLicense() || ! ui::Selectable::get( *this )->hasInstalledObj() )
- ret = ri.getLicense( lang_r ); // bnc#908976: suppress informal license upon update
+ 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
{
NO_SOLVABLE_RETURN( false );
- return ( isKind<Product>() ? repoInfo().needToAcceptLicense() : true );
+ 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;
}