Mailinglist Archive: zypp-commit (268 mails)

< Previous Next >
[zypp-commit] r7920 - in /branches/use-solv/libzypp/zypp: ./ pool/ solver/detail/ target/store/
  • From: matz@xxxxxxxxxxxxxxxx
  • Date: Mon, 26 Nov 2007 01:07:38 -0000
  • Message-id: <20071126010739.5184C24488@xxxxxxxxxxxxxxxx>
Author: matz
Date: Mon Nov 26 02:07:38 2007
New Revision: 7920

URL: http://svn.opensuse.org/viewcvs/zypp?rev=7920&view=rev
Log:
Introduce a SlowCapSet, currently the same as CapSet. The goal is to
have a slow implementation which you can append to, and a fast one using
directly the data from the SOLV files. Make use of SlowCapSet in places
where we need to insert things.
While we are at it, also replace some ::iterator uses by
::const_iterator, and calls to "size() > 0" by "empty()".

Modified:
branches/use-solv/libzypp/zypp/CapSetFwd.h
branches/use-solv/libzypp/zypp/pool/GetResolvablesToInsDel.cc
branches/use-solv/libzypp/zypp/pool/PoolImpl.cc
branches/use-solv/libzypp/zypp/solver/detail/InstallOrder.cc
branches/use-solv/libzypp/zypp/solver/detail/QueueItemEstablish.cc
branches/use-solv/libzypp/zypp/solver/detail/Resolver.cc
branches/use-solv/libzypp/zypp/solver/detail/Resolver.h
branches/use-solv/libzypp/zypp/solver/detail/ResolverContext.cc
branches/use-solv/libzypp/zypp/solver/detail/ResolverUpgrade.cc
branches/use-solv/libzypp/zypp/solver/detail/Testcase.cc
branches/use-solv/libzypp/zypp/solver/detail/Testcase.h
branches/use-solv/libzypp/zypp/target/store/serialize.cc

Modified: branches/use-solv/libzypp/zypp/CapSetFwd.h
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/CapSetFwd.h?rev=7920&r1=7919&r2=7920&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/CapSetFwd.h (original)
+++ branches/use-solv/libzypp/zypp/CapSetFwd.h Mon Nov 26 02:07:38 2007
@@ -21,6 +21,7 @@
class Capability;
class CapOrder;
typedef std::set<Capability,CapOrder> CapSet;
+ typedef std::set<Capability,CapOrder> SlowCapSet;

/////////////////////////////////////////////////////////////////
} // namespace zypp

Modified: branches/use-solv/libzypp/zypp/pool/GetResolvablesToInsDel.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/pool/GetResolvablesToInsDel.cc?rev=7920&r1=7919&r2=7920&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/pool/GetResolvablesToInsDel.cc (original)
+++ branches/use-solv/libzypp/zypp/pool/GetResolvablesToInsDel.cc Mon Nov 26
02:07:38 2007
@@ -41,7 +41,6 @@
** to_install (i.e. delay deletion in case the
** obsoleting package likes to save whatever...
*/
-
static void
strip_obsoleted_to_delete( GetResolvablesToInsDel::PoolItemList &
deleteList_r,
const GetResolvablesToInsDel::PoolItemList &
instlist_r )
@@ -50,7 +49,7 @@
return; // ---> nothing to do

// build obsoletes from instlist_r
- CapSet obsoletes;
+ SlowCapSet obsoletes;
for ( GetResolvablesToInsDel::PoolItemList::const_iterator it =
instlist_r.begin();
it != instlist_r.end(); ++it )
{
@@ -69,7 +68,7 @@
PoolItem_Ref ipkg( *it );
bool delayPkg = false;
// ...check whether an obsoletes....
- for ( CapSet::iterator obs = obsoletes.begin();
+ for ( SlowCapSet::iterator obs = obsoletes.begin();
! delayPkg && obs != obsoletes.end(); ++obs )
{
// ...matches anything provided by the package?

Modified: branches/use-solv/libzypp/zypp/pool/PoolImpl.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/pool/PoolImpl.cc?rev=7920&r1=7919&r2=7920&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/pool/PoolImpl.cc (original)
+++ branches/use-solv/libzypp/zypp/pool/PoolImpl.cc Mon Nov 26 02:07:38 2007
@@ -60,7 +60,7 @@
NameHash::erase( const PoolItem & item_r )
{
PoolTraits::ItemContainerT & items = _store[item_r->name()];
- for ( PoolTraits::iterator nit = items.begin(); nit != items.end(); /**/
)
+ for ( PoolTraits::const_iterator nit = items.begin(); nit !=
items.end(); /**/ )
{
if ( *nit == item_r )
items.erase( nit++ ); // postfix! Incrementing before erase
@@ -109,7 +109,7 @@
storeInsert( CapHash::ContainerT & store_r, const PoolItem & item_r, Dep
cap_r )
{
CapSet caps = item_r->dep( cap_r );
- for (CapSet::iterator ic = caps.begin(); ic != caps.end(); ++ic) {
+ for (CapSet::const_iterator ic = caps.begin(); ic != caps.end(); ++ic) {
store_r[cap_r][ic->index()].push_back( CapAndItem( *ic, item_r ) );
}
}
@@ -132,7 +132,7 @@
{
CapSet caps = item_r->dep( cap_r );
//XXX << "storeDelete(" << item_r << ")" << endl;
- for ( CapSet::iterator ic = caps.begin(); ic != caps.end(); ++ic )
+ for ( CapSet::const_iterator ic = caps.begin(); ic != caps.end(); ++ic )
{
PoolTraits::CapItemContainerT & capitems =
store_r[cap_r][ic->index()];
for ( PoolTraits::CapItemContainerT::iterator pos =
capitems.begin(); pos != capitems.end(); /**/ )

Modified: branches/use-solv/libzypp/zypp/solver/detail/InstallOrder.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/solver/detail/InstallOrder.cc?rev=7920&r1=7919&r2=7920&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/solver/detail/InstallOrder.cc (original)
+++ branches/use-solv/libzypp/zypp/solver/detail/InstallOrder.cc Mon Nov 26
02:07:38 2007
@@ -227,7 +227,8 @@
_rdfstime++;

// items prereq
- CapSet prq( item->dep(Dep::PREREQUIRES) );
+ SlowCapSet prq;
+ prq.insert( item->dep(Dep::PREREQUIRES).begin(),
item->dep(Dep::PREREQUIRES).end() );
// an installed items prereq (in case they are reqired for uninstall
scripts)
NameKindProxy nkp( _pool, item->name(), item->kind() );
if ( ! nkp.installedEmpty() )
@@ -235,9 +236,10 @@
prq.insert( (*nkp.installedBegin())->dep(Dep::PREREQUIRES).begin(),
(*nkp.installedBegin())->dep(Dep::PREREQUIRES).end() );
}
+
// put prerequires first and requires last on list to ensure
// that prerequires are processed first
- for (CapSet::const_iterator it = prq.begin(); it != prq.end(); ++it)
+ for (SlowCapSet::const_iterator it = prq.begin(); it != prq.end(); ++it)
{
requires.push_back(*it);
}

Modified: branches/use-solv/libzypp/zypp/solver/detail/QueueItemEstablish.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/solver/detail/QueueItemEstablish.cc?rev=7920&r1=7919&r2=7920&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/solver/detail/QueueItemEstablish.cc
(original)
+++ branches/use-solv/libzypp/zypp/solver/detail/QueueItemEstablish.cc Mon Nov
26 02:07:38 2007
@@ -125,8 +125,8 @@

/* Loop through all freshen dependencies. If one is satisfied, queue the
_item for installation. */

- CapSet::const_iterator iter;
- for (iter = freshens.begin(); iter != freshens.end(); iter++) {
+ CapSet::const_iterator iter = freshens.begin();
+ for (; iter != freshens.end(); iter++) {
const Capability cap = *iter;
bool dummy1, dummy2;
if (context->requirementIsMet (cap, _item, Dep::FRESHENS, &dummy1,
&dummy2, true)) { //true =installInfoFlag
@@ -141,7 +141,7 @@
//
// else we look at its requires to set it to satisfied or incomplete

- if (freshens.size() > 0 // have freshens !
+ if (!freshens.empty() // have freshens !
&& iter == freshens.end()) // but none matched
{
_XDEBUG(_item << " freshens nothing -> unneeded");
@@ -151,9 +151,9 @@
else { // installed or
no freshens or triggered freshens

CapSet supplements = _item->dep(Dep::SUPPLEMENTS);
- if (supplements.size() != 0) { // if
we have supplements, they must _also_ trigger
- CapSet::const_iterator iter;
- for (iter = supplements.begin(); iter != supplements.end(); iter++)
{
+ if (!supplements.empty()) { // if
we have supplements, they must _also_ trigger
+ CapSet::const_iterator iter = supplements.begin();
+ for (; iter != supplements.end(); iter++) {
const Capability cap = *iter;
bool dummy1, dummy2;
if (context->requirementIsMet (cap, _item, Dep::SUPPLEMENTS,
&dummy1, &dummy2, true)) { //true =installInfoFlag

Modified: branches/use-solv/libzypp/zypp/solver/detail/Resolver.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/solver/detail/Resolver.cc?rev=7920&r1=7919&r2=7920&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/solver/detail/Resolver.cc (original)
+++ branches/use-solv/libzypp/zypp/solver/detail/Resolver.cc Mon Nov 26
02:07:38 2007
@@ -1009,7 +1009,7 @@
initial_queue->addPoolItemToEstablish (*iter);
}

- for (CapSet::const_iterator iter = _extra_caps.begin(); iter !=
_extra_caps.end(); iter++) {
+ for (SlowCapSet::const_iterator iter = _extra_caps.begin(); iter !=
_extra_caps.end(); iter++) {
initial_queue->addExtraCapability (*iter);
}

@@ -1023,7 +1023,7 @@
}
}

- for (CapSet::const_iterator iter = _extra_conflicts.begin(); iter !=
_extra_conflicts.end(); iter++) {
+ for (SlowCapSet::const_iterator iter = _extra_conflicts.begin(); iter !=
_extra_conflicts.end(); iter++) {
initial_queue->addExtraConflict (*iter);
}


Modified: branches/use-solv/libzypp/zypp/solver/detail/Resolver.h
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/solver/detail/Resolver.h?rev=7920&r1=7919&r2=7920&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/solver/detail/Resolver.h (original)
+++ branches/use-solv/libzypp/zypp/solver/detail/Resolver.h Mon Nov 26 02:07:38
2007
@@ -122,8 +122,8 @@
ItemCapKindMap _isInstalledBy;
ItemCapKindMap _installs;

- CapSet _extra_caps;
- CapSet _extra_conflicts;
+ SlowCapSet _extra_caps;
+ SlowCapSet _extra_conflicts;

//typedef std::multimap<PoolItem_Ref,Capability> IgnoreMap;

@@ -231,8 +231,8 @@
void removeExtraCapability (const Capability & capability);
void addExtraConflict (const Capability & capability);

- const CapSet extraCapability () { return _extra_caps; }
- const CapSet extraConflicts () { return _extra_conflicts; }
+ const SlowCapSet extraCapability () { return _extra_caps; }
+ const SlowCapSet extraConflicts () { return _extra_conflicts; }

void addIgnoreConflict (const PoolItem_Ref item,
const Capability & capability);

Modified: branches/use-solv/libzypp/zypp/solver/detail/ResolverContext.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/solver/detail/ResolverContext.cc?rev=7920&r1=7919&r2=7920&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/solver/detail/ResolverContext.cc (original)
+++ branches/use-solv/libzypp/zypp/solver/detail/ResolverContext.cc Mon Nov 26
02:07:38 2007
@@ -1578,7 +1578,7 @@
pool().byCapabilityIndexEnd( capability.index(), dep ),
resfilter::ByCapMatch( capability ),
functor::functorRef<bool,CapAndItem>(info) );
-_XDEBUG( "ResolverContext::requirementIsMet(" << capability << ") " <<
(info.flag?"Y":"N") );
+_XDEBUG( "ResolverContext::requirementIsMet(" << capability << ") " <<
(info.flag?"Y":"N") << (!installed ? "" : *installed ? " installed" : "
uninst") );
if (unneeded) *unneeded = info.unneeded;

return info.flag && info.allAtomsSatisfied;
@@ -1599,6 +1599,7 @@
ResObject::Kind kind = who->kind();
bool fulfilled = false;

+ /* ??? this condition is always true. */
if (kind != ResTraits<Package>::kind
|| kind != ResTraits<Script>::kind
|| kind != ResTraits<Message>::kind)
@@ -1686,7 +1687,7 @@
ResolverContext::itemIsPossible( PoolItem_Ref item, Capability & failed )
{
CapSet requires = item->dep (Dep::REQUIRES);
- for (CapSet::iterator iter = requires.begin(); iter != requires.end();
iter++) {
+ for (CapSet::const_iterator iter = requires.begin(); iter !=
requires.end(); iter++) {
if (! requirementIsPossible (*iter)) {
failed = *iter;
return false;

Modified: branches/use-solv/libzypp/zypp/solver/detail/ResolverUpgrade.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/solver/detail/ResolverUpgrade.cc?rev=7920&r1=7919&r2=7920&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/solver/detail/ResolverUpgrade.cc (original)
+++ branches/use-solv/libzypp/zypp/solver/detail/ResolverUpgrade.cc Mon Nov 26
02:07:38 2007
@@ -454,7 +454,7 @@

// remember any splitprovides to packages actually installed.
CapSet caps = candidate->dep (Dep::PROVIDES);
- for (CapSet::iterator cit = caps.begin(); cit != caps.end(); ++cit ) {
+ for (CapSet::const_iterator cit = caps.begin(); cit != caps.end(); ++cit )
{
if (isKind<capability::SplitCap>( *cit ) ) {

capability::CapabilityImpl::SplitInfo splitinfo =
capability::CapabilityImpl::getSplitInfo( *cit );

Modified: branches/use-solv/libzypp/zypp/solver/detail/Testcase.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/solver/detail/Testcase.cc?rev=7920&r1=7919&r2=7920&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/solver/detail/Testcase.cc (original)
+++ branches/use-solv/libzypp/zypp/solver/detail/Testcase.cc Mon Nov 26
02:07:38 2007
@@ -126,7 +126,7 @@
std::string helixXML( const CapSet &caps )
{
stringstream str;
- CapSet::iterator it = caps.begin();
+ CapSet::const_iterator it = caps.begin();
str << endl;
for ( ; it != caps.end(); ++it)
{
@@ -140,23 +140,23 @@
std::string helixXML( const Dependencies &dep )
{
stringstream str;
- if ( dep[Dep::PROVIDES].size() > 0 )
+ if ( ! dep[Dep::PROVIDES].empty() )
str << TAB << xml_tag_enclose(helixXML(dep[Dep::PROVIDES]), "provides")
<< endl;
- if ( dep[Dep::CONFLICTS].size() > 0 )
+ if ( ! dep[Dep::CONFLICTS].empty() )
str << TAB << xml_tag_enclose(helixXML(dep[Dep::CONFLICTS]),
"conflicts") << endl;
- if ( dep[Dep::OBSOLETES].size() > 0 )
+ if ( ! dep[Dep::OBSOLETES].empty() )
str << TAB << xml_tag_enclose(helixXML(dep[Dep::OBSOLETES]),
"obsoletes") << endl;
- if ( dep[Dep::FRESHENS].size() > 0 )
+ if ( ! dep[Dep::FRESHENS].empty() )
str << TAB << xml_tag_enclose(helixXML(dep[Dep::FRESHENS]), "freshens")
<< endl;
- if ( dep[Dep::REQUIRES].size() > 0 )
+ if ( ! dep[Dep::REQUIRES].empty() )
str << TAB << xml_tag_enclose(helixXML(dep[Dep::REQUIRES]), "requires")
<< endl;
- if ( dep[Dep::RECOMMENDS].size() > 0 )
+ if ( ! dep[Dep::RECOMMENDS].empty() )
str << TAB << xml_tag_enclose(helixXML(dep[Dep::RECOMMENDS]),
"recommends") << endl;
- if ( dep[Dep::ENHANCES].size() > 0 )
+ if ( ! dep[Dep::ENHANCES].empty() )
str << TAB << xml_tag_enclose(helixXML(dep[Dep::ENHANCES]), "enhances")
<< endl;
- if ( dep[Dep::SUPPLEMENTS].size() > 0 )
+ if ( ! dep[Dep::SUPPLEMENTS].empty() )
str << TAB << xml_tag_enclose(helixXML(dep[Dep::SUPPLEMENTS]),
"supplements") << endl;
- if ( dep[Dep::SUGGESTS].size() > 0 )
+ if ( ! dep[Dep::SUGGESTS].empty() )
str << TAB << xml_tag_enclose(helixXML(dep[Dep::SUGGESTS]), "suggests")
<< endl;
return str.str();
}
@@ -435,13 +435,13 @@
<< " name=\"" << resObject->name() << "\"" << "/>" << endl;
}

-void HelixControl::addDependencies (const CapSet & capRequire, const CapSet &
capConflict)
+void HelixControl::addDependencies (const SlowCapSet & capRequire, const
SlowCapSet & capConflict)
{
- for (CapSet::const_iterator iter = capRequire.begin(); iter !=
capRequire.end(); iter++) {
+ for (SlowCapSet::const_iterator iter = capRequire.begin(); iter !=
capRequire.end(); iter++) {
*file << "<addRequire " << " kind=\"" << toLower
(iter->kind().asString()) << "\""
<< " name=\"" << iter->asString() << "\"" << "/>" << endl;
}
- for (CapSet::const_iterator iter = capConflict.begin(); iter !=
capConflict.end(); iter++) {
+ for (SlowCapSet::const_iterator iter = capConflict.begin(); iter !=
capConflict.end(); iter++) {
*file << "<addConflict " << " kind=\"" << toLower
(iter->kind().asString()) << "\""
<< " name=\"" << iter->asString() << "\"" << "/>" << endl;
}

Modified: branches/use-solv/libzypp/zypp/solver/detail/Testcase.h
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/solver/detail/Testcase.h?rev=7920&r1=7919&r2=7920&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/solver/detail/Testcase.h (original)
+++ branches/use-solv/libzypp/zypp/solver/detail/Testcase.h Mon Nov 26 02:07:38
2007
@@ -105,7 +105,7 @@
void lockResolvable (const ResObject::constPtr &resObject);
void keepResolvable (const ResObject::constPtr &resObject);
void deleteResolvable (const ResObject::constPtr &resObject);
- void addDependencies (const CapSet &capRequire, const CapSet &capConflict);
+ void addDependencies (const SlowCapSet &capRequire, const SlowCapSet
&capConflict);
std::string filename () { return dumpFile; }
};


Modified: branches/use-solv/libzypp/zypp/target/store/serialize.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/target/store/serialize.cc?rev=7920&r1=7919&r2=7920&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/target/store/serialize.cc (original)
+++ branches/use-solv/libzypp/zypp/target/store/serialize.cc Mon Nov 26
02:07:38 2007
@@ -138,7 +138,7 @@
string toXML( const CapSet &caps )
{
stringstream out;
- CapSet::iterator it = caps.begin();
+ CapSet::const_iterator it = caps.begin();
for ( ; it != caps.end(); ++it)
{
out << toXML((*it));
@@ -150,26 +150,26 @@
string toXML( const Dependencies &dep )
{
stringstream out;
- if ( dep[Dep::PROVIDES].size() > 0 )
+ if ( ! dep[Dep::PROVIDES].empty() )
out << " " << xml_tag_enclose(toXML(dep[Dep::PROVIDES]), "provides") <<
endl;
- if ( dep[Dep::PREREQUIRES].size() > 0 )
+ if ( ! dep[Dep::PREREQUIRES].empty() )
out << " " << xml_tag_enclose(toXML(dep[Dep::PREREQUIRES]),
"prerequires") << endl;
- if ( dep[Dep::CONFLICTS].size() > 0 )
+ if ( ! dep[Dep::CONFLICTS].empty() )
out << " " << xml_tag_enclose(toXML(dep[Dep::CONFLICTS]), "conflicts")
<< endl;
- if ( dep[Dep::OBSOLETES].size() > 0 )
+ if ( ! dep[Dep::OBSOLETES].empty() )
out << " " << xml_tag_enclose(toXML(dep[Dep::OBSOLETES]), "obsoletes")
<< endl;
// why the YUM tag is freshen without s????
- if ( dep[Dep::FRESHENS].size() > 0 )
+ if ( ! dep[Dep::FRESHENS].empty() )
out << " " << xml_tag_enclose(toXML(dep[Dep::FRESHENS]), "freshens") <<
endl;
- if ( dep[Dep::REQUIRES].size() > 0 )
+ if ( ! dep[Dep::REQUIRES].empty() )
out << " " << xml_tag_enclose(toXML(dep[Dep::REQUIRES]), "requires") <<
endl;
- if ( dep[Dep::RECOMMENDS].size() > 0 )
+ if ( ! dep[Dep::RECOMMENDS].empty() )
out << " " << xml_tag_enclose(toXML(dep[Dep::RECOMMENDS]),
"recommends") << endl;
- if ( dep[Dep::ENHANCES].size() > 0 )
+ if ( ! dep[Dep::ENHANCES].empty() )
out << " " << xml_tag_enclose(toXML(dep[Dep::ENHANCES]), "enhances") <<
endl;
- if ( dep[Dep::SUPPLEMENTS].size() > 0 )
+ if ( ! dep[Dep::SUPPLEMENTS].empty() )
out << " " << xml_tag_enclose(toXML(dep[Dep::SUPPLEMENTS]),
"supplements") << endl;
- if ( dep[Dep::SUGGESTS].size() > 0 )
+ if ( ! dep[Dep::SUGGESTS].empty() )
out << " " << xml_tag_enclose(toXML(dep[Dep::SUGGESTS]), "suggests") <<
endl;
return out.str();

@@ -446,7 +446,7 @@

Patch::AtomList at = obj->atoms();
out << " <atoms>" << endl;
- for (Patch::AtomList::iterator it = at.begin(); it != at.end(); it++)
+ for (Patch::AtomList::const_iterator it = at.begin(); it != at.end(); it++)
{
Resolvable::Ptr one_atom = *it;
out << castedToXML(one_atom) << endl;

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages