</package>
<package>
<name>candidate</name>
- <vendor>unkown</vendor>
+ <vendor>unknown</vendor>
+ <history><update>
+ <arch>i586</arch>
+ <version>4</version>
+ <release>1</release>
+ </update></history>
+</package>
+
+<package>
+ <name>candidatenoarch</name>
+ <vendor>unknown</vendor>
+ <history><update>
+ <arch>noarch</arch>
+ <version>5</version>
+ <release>1</release>
+ </update></history>
+</package>
+<package>
+ <name>candidatenoarch</name>
+ <vendor>unknown</vendor>
+ <history><update>
+ <arch>x86_64</arch>
+ <version>4</version>
+ <release>1</release>
+ </update></history>
+</package>
+<package>
+ <name>candidatenoarch</name>
+ <vendor>unknown</vendor>
<history><update>
<arch>i586</arch>
<version>4</version>
<release>1</release>
</update></history>
</package>
+<package>
+ <name>candidatenoarch</name>
+ <vendor>unknown</vendor>
+ <history><update>
+ <arch>noarch</arch>
+ <version>4</version>
+ <release>1</release>
+ </update></history>
+</package>
</subchannel></channel>
<release>1</release>
</update></history>
</package>
+
+<package>
+ <name>candidatenoarch</name>
+ <vendor>openSUSE</vendor>
+ <history><update>
+ <arch>noarch</arch>
+ <version>0</version>
+ <release>2</release>
+ </update></history>
+</package>
+<package>
+ <name>candidatenoarch</name>
+ <vendor>openSUSE</vendor>
+ <history><update>
+ <arch>x86_64</arch>
+ <version>0</version>
+ <release>1</release>
+ </update></history>
+</package>
+<package>
+ <name>candidatenoarch</name>
+ <vendor>openSUSE</vendor>
+ <history><update>
+ <arch>i586</arch>
+ <version>0</version>
+ <release>1</release>
+ </update></history>
+</package>
+<package>
+ <name>candidatenoarch</name>
+ <vendor>openSUSE</vendor>
+ <history><update>
+ <arch>noarch</arch>
+ <version>0</version>
+ <release>1</release>
+ </update></history>
+</package>
</subchannel></channel>
<release>1</release>
</update></history>
</package>
+<package>
+ <name>candidatenoarch</name>
+ <vendor>unknown</vendor>
+ <history><update>
+ <arch>i586</arch>
+ <version>1</version>
+ <release>1</release>
+ </update></history>
+</package>
</subchannel></channel>
// U__s_(2)candidate-4-1.x86_64(RepoHIGH)(unkown)
// U__s_(3)candidate-4-1.i586(RepoHIGH)(unkown)
// U__s_(6)candidate-0-1.x86_64(RepoMID)(SUSE)
- // U__s_(7)candidate-0-1.i586(RepoMID)(SUSE) <- candidate (highrst prio matching arch and vendor)
+ // U__s_(7)candidate-0-1.i586(RepoMID)(SUSE) <- candidate (highest prio matching arch and vendor)
// U__s_(4)candidate-2-1.x86_64(RepoLOW)(openSUSE)
// U__s_(5)candidate-2-1.i586(RepoLOW)(openSUSE)
// }
// no updateCandidate due to low version
BOOST_CHECK_EQUAL( s->updateCandidateObj(), PoolItem() );
}
+
+BOOST_AUTO_TEST_CASE(candiadatenoarch)
+{
+ ResPoolProxy poolProxy( test.poolProxy() );
+ ui::Selectable::Ptr s( poolProxy.lookup( ResKind::package, "candidatenoarch" ) );
+/*[package]candidatenoarch: S_KeepInstalled
+ (I 1) {
+ I__s_(17)candidatenoarch-1-1.i586(@System)
+} (A 8) {
+ C U__s_(4)candidatenoarch-5-1.noarch(RepoHIGH) <- candidate (arch/noarch change)
+ U__s_(5)candidatenoarch-4-1.x86_64(RepoHIGH)
+ U__s_(6)candidatenoarch-4-1.i586(RepoHIGH)
+ U__s_(7)candidatenoarch-4-1.noarch(RepoHIGH)
+ U__s_(12)candidatenoarch-0-2.noarch(RepoMID)
+ U__s_(13)candidatenoarch-0-1.x86_64(RepoMID)
+ U__s_(14)candidatenoarch-0-1.i586(RepoMID)
+ U__s_(15)candidatenoarch-0-1.noarch(RepoMID)
+} */
+ std::cout << dump(s) << endl;
+ BOOST_CHECK_EQUAL( s->candidateObj()->repoInfo().alias(), "RepoHIGH" );
+ BOOST_CHECK_EQUAL( s->candidateObj()->edition(), Edition("5-1") );
+ BOOST_CHECK_EQUAL( s->candidateObj()->arch(), Arch_noarch );
+ // no updateCandidate due to low version
+ BOOST_CHECK_EQUAL( s->updateCandidateObj(), s->candidateObj() );
+}
|| VendorAttr::instance().equivalent( _defaultCandidate->vendor(), installed->vendor() ) ) )
return PoolItem();
- // check arch change
- if ( _defaultCandidate->arch() != installed->arch() )
+ // check arch change (arch noarch changes are allowed)
+ if ( _defaultCandidate->arch() != installed->arch()
+ && ! ( _defaultCandidate->arch() == Arch_noarch || installed->arch() == Arch_noarch ) )
return PoolItem();
// check greater edition
for ( installed_const_iterator iit = installedBegin();
iit != installedEnd(); ++iit )
{
- PoolItem sameArch; // in case there's no same vendor at least stay with same arch
+ PoolItem sameArch; // in case there's no same vendor at least stay with same arch.
for ( available_const_iterator it = availableBegin();
it != availableEnd(); ++it )
{
- if ( (*iit)->arch() == (*it)->arch() )
+ // 'same arch' includes allowed changes to/from noarch.
+ if ( (*iit)->arch() == (*it)->arch() || (*iit)->arch() == Arch_noarch || (*it)->arch() == Arch_noarch )
{
if ( ! solver_allowVendorChange )
{
inline std::ostream & dumpOn( std::ostream & str, const Selectable::Impl & obj )
{
str << '[' << obj.kind() << ']' << obj.name() << ": " << obj.status() << endl;
- if ( obj.candidateObj() )
- str << "(C " << obj.candidateObj() << ")" << endl;
- else
- str << "(C NONE )" << endl;
- dumpRange( str << " (I " << obj.installedSize() << ") ", obj.installedBegin(), obj.installedEnd() );
+
if ( obj.installedEmpty() )
- str << endl << " ";
- dumpRange( str << " (A " << obj.availableSize() << ") ", obj.availableBegin(), obj.availableEnd() ) << endl;
+ str << " (I 0) {}" << endl << " ";
+ else
+ {
+ str << " (I " << obj.installedSize() << ") {" << endl;
+ for_( it, obj.installedBegin(), obj.installedEnd() )
+ {
+ str << " " << *it << endl;
+ }
+ str << "} ";
+ }
+
+ if ( obj.availableEmpty() )
+ {
+ str << "(A 0) {}";
+ }
+ else
+ {
+ PoolItem cand( obj.candidateObj() );
+ PoolItem up( obj.updateCandidateObj() );
+ str << "(A " << obj.availableSize() << ") {" << endl;
+ for_( it, obj.availableBegin(), obj.availableEnd() )
+ {
+ char t = ' ';
+ if ( *it == cand )
+ {
+ t = *it == up ? 'C' : 'c';
+ }
+ else if ( *it == up )
+ {
+ t = 'u';
+ }
+ str << " " << t << " " << *it << endl;
+ }
+ str << "} ";
+ }
return str;
}
{
/** Oder on AvailableItemSet.
* \li repository priority
- * \li best Arch
+ * \li best Arch (arch/noarch changes are ok)
* \li best Edition
* \li ResObject::constPtr as fallback.
*/
//
bool operator()( const PoolItem & lhs, const PoolItem & rhs ) const
{
- unsigned lprio = lhs->satSolvable().repository().info().priority();
- unsigned rprio = rhs->satSolvable().repository().info().priority();
+ int lprio = lhs->satSolvable().repository().satInternalPriority();
+ int rprio = rhs->satSolvable().repository().satInternalPriority();
if ( lprio != rprio )
- return( lprio < rprio ); // lower value meands higher priority :(
- int res = lhs->arch().compare( rhs->arch() );
- if ( res )
- return res > 0;
- res = lhs->edition().compare( rhs->edition() );
+ return( lprio > rprio );
+
+ // arch/noarch changes are ok.
+ if ( lhs->arch() != Arch_noarch && rhs->arch() != Arch_noarch )
+ {
+ int res = lhs->arch().compare( rhs->arch() );
+ if ( res )
+ return res > 0;
+ }
+
+ int res = lhs->edition().compare( rhs->edition() );
if ( res )
return res > 0;
- // no more criteria, still equal:
- // use the ResObject::constPtr (the poiner value)
- // (here it's arbitrary whether < or > )
- return lhs.resolvable() < rhs.resolvable();
+ lprio = lhs->satSolvable().repository().satInternalSubPriority();
+ rprio = rhs->satSolvable().repository().satInternalSubPriority();
+ if ( lprio != rprio )
+ return( lprio > rprio );
+
+ // no more criteria, still equal: sort by id
+ return lhs.satSolvable().id() < rhs.satSolvable().id();
}
};
if ( ldate != rdate )
return( ldate > rdate );
- // no more criteria, still equal:
- // use the ResObject::constPtr (the poiner value)
- // (here it's arbitrary whether < or > )
- return lhs.resolvable() < rhs.resolvable();
+ // no more criteria, still equal: sort by id
+ return lhs.satSolvable().id() < rhs.satSolvable().id();
}
};