From: Stefan Schubert Date: Tue, 3 Jan 2006 15:10:27 +0000 (+0000) Subject: removed arch from the Capabilities; changed logging; removed matches functions in... X-Git-Tag: BASE-SuSE-SLE-10-SP2-Branch~3523 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=83073e37d43208fafd2f9c6c64f662e822a06ad8;p=platform%2Fupstream%2Flibzypp.git removed arch from the Capabilities; changed logging; removed matches functions in the solver --- diff --git a/zypp/Capability.cc b/zypp/Capability.cc index cb45bea..6c68956 100644 --- a/zypp/Capability.cc +++ b/zypp/Capability.cc @@ -54,7 +54,9 @@ namespace zypp { return _pimpl->asString(); } - + std::string Capability::name() const + { return "CapabilityName"; }//return _pimpl->name(); } + /****************************************************************** ** ** FUNCTION NAME : operator<< diff --git a/zypp/Capability.h b/zypp/Capability.h index 91f81cf..647f70c 100644 --- a/zypp/Capability.h +++ b/zypp/Capability.h @@ -103,7 +103,8 @@ namespace zypp /** More or less human readable representation as string. */ std::string asString() const; - /** */ + /** More or less humal readable name of the dependency */ + std::string name() const; private: diff --git a/zypp/solver/detail/Channel.cc b/zypp/solver/detail/Channel.cc index 0c62c1e..22b99f1 100644 --- a/zypp/solver/detail/Channel.cc +++ b/zypp/solver/detail/Channel.cc @@ -25,6 +25,7 @@ #include #include +#include ///////////////////////////////////////////////////////////////////////// namespace zypp @@ -180,7 +181,7 @@ namespace zypp _priority = -1; _priority_unsubscribed = -1; - // if (getenv ("RC_SPEW")) fprintf (stderr, "Channel() [%p] (%s)\n", this, asString().c_str()); + _DBG("RC_SPEW") << "Channel() [" << this << "] (" << asString() << ")" << endl ; } @@ -220,7 +221,7 @@ namespace zypp free ((void *)priority_str); free ((void *)priority_unsubscribed_str); - // if (getenv ("RC_SPEW")) fprintf (stderr, "Channel(xml) [%p] (%s)\n", this, asString().c_str()); + _DBG("RC_SPEW") << "Channel(xml) [" << this << "] (" << asString() << ")" << endl; } diff --git a/zypp/solver/detail/Match.cc b/zypp/solver/detail/Match.cc index bd94a13..4fb03be 100644 --- a/zypp/solver/detail/Match.cc +++ b/zypp/solver/detail/Match.cc @@ -166,14 +166,13 @@ namespace zypp /* } */ CapFactory factory; Capability dependency; - bool check; + bool check = false; dependency = factory.parse ( resItem->kind(), resItem->name(), Rel::EQ, - resItem->edition(), - resItem->arch()); - check = _dependency.matches (dependency); + resItem->edition()); +// check = _dependency.matches (dependency); return check; } diff --git a/zypp/solver/detail/Package.cc b/zypp/solver/detail/Package.cc index bf38745..046c0d8 100644 --- a/zypp/solver/detail/Package.cc +++ b/zypp/solver/detail/Package.cc @@ -26,7 +26,7 @@ #include #include #include - +#include #include #include @@ -89,8 +89,7 @@ namespace zypp return factory.parse ( ResTraits::kind, name, relation, - Edition (version, release, epoch), - arch); + Edition (version, release, epoch)); } static void @@ -431,8 +430,7 @@ namespace zypp Capability selfdep = factory.parse ( ResTraits::kind, name, Rel::EQ, - Edition( version, release, zypp::str::numstring(epoch)), - arch); + Edition( version, release, zypp::str::numstring(epoch))); CapSet::const_iterator piter; @@ -443,7 +441,7 @@ namespace zypp } } if (piter == dep_table.provides.end()) { // no self provide found, construct one - if (getenv ("RC_SPEW")) fprintf (stderr, "Adding self-provide [%s]\n", selfdep.asString().c_str()); + _DBG("RC_SPEW") << "Adding self-provide [" << selfdep.asString() << "]" << endl; dep_table.provides.insert (selfdep); } diff --git a/zypp/solver/detail/QueueItemBranch.cc b/zypp/solver/detail/QueueItemBranch.cc index 52fd669..5f42845 100644 --- a/zypp/solver/detail/QueueItemBranch.cc +++ b/zypp/solver/detail/QueueItemBranch.cc @@ -22,6 +22,7 @@ #include #include #include +#include ///////////////////////////////////////////////////////////////////////// namespace zypp @@ -152,7 +153,7 @@ namespace zypp bool QueueItemBranch::process (ResolverContextPtr context, QueueItemList & qil) { - if (getenv ("RC_SPEW")) fprintf (stderr, "QueueItemBranch::process(%s)\n", asString().c_str()); + _DBG("RC_SPEW") << "QueueItemBranch::process(" << asString() << ")" << endl; QueueItemList live_branches; unsigned int branch_count; diff --git a/zypp/solver/detail/QueueItemConflict.cc b/zypp/solver/detail/QueueItemConflict.cc index c3b4ea8..f5ae7e1 100644 --- a/zypp/solver/detail/QueueItemConflict.cc +++ b/zypp/solver/detail/QueueItemConflict.cc @@ -33,7 +33,7 @@ #include #include #include - +#include ///////////////////////////////////////////////////////////////////////// namespace zypp @@ -153,8 +153,9 @@ namespace zypp ResolverInfoPtr log_info; CapFactory factory; - if (getenv ("RC_SPEW")) fprintf (stderr, "conflict_process_cb (resolvable[%s], cap[%s], info [%s]\n", resItem->asString().c_str(), cap.asString().c_str(), info->conflicting_resItem->asString().c_str()); - if (getenv ("RC_SPEW")) fprintf (stderr, "conflict_process_cb (info->dep [%s]\n", info->dep.asString().c_str()); + _DBG("RC_SPEW") << "conflict_process_cb (resolvable[" << resItem->asString() <<"], cap[" << cap.asString() << "], info [" << + info->conflicting_resItem->asString() << "]" << endl; + _DBG("RC_SPEW") << "conflict_process_cb (info->dep [" << info->dep.asString() << "]" << endl; /* We conflict with ourself. For the purpose of installing ourself, we * just ignore it, but it's Debian's way of saying that one and only one @@ -174,8 +175,7 @@ namespace zypp Capability capTest = factory.parse ( resItem->kind(), resItem->name(), Rel::EQ, - resItem->edition(), - resItem->arch()); + resItem->edition()); if (info->actually_an_obsolete && capTest != cap) @@ -188,7 +188,7 @@ namespace zypp status = info->context->getStatus (resItem); - if (getenv ("RC_SPEW")) fprintf (stderr, "conflict_process_cb (resolvable[%s]<%s>\n", resItem->asString().c_str(), ResolverContext::toString(status).c_str()); + _DBG("RC_SPEW") << "conflict_process_cb (resolvable[" << resItem->asString() << "]<" << ResolverContext::toString(status) << ">" << endl; switch (status) { @@ -209,8 +209,7 @@ namespace zypp Capability maybe_upgrade_dep = factory.parse ( resItem->kind(), resItem->name(), Rel::ANY, - Edition::noepoch, - resItem->arch()); + Edition::noepoch); info->world->foreachProvidingResItem (maybe_upgrade_dep, upgrade_candidates_cb, (void *)&upgrade_info); @@ -306,7 +305,7 @@ namespace zypp bool QueueItemConflict::process (ResolverContextPtr context, QueueItemList & new_items) { - if (getenv ("RC_SPEW")) fprintf (stderr, "QueueItemConflict::process(%s)\n", this->asString().c_str()); + _DBG("RC_SPEW") << "QueueItemConflict::process(" << this->asString() << ")" << endl; ConflictProcessInfo info = { world(), _conflicting_resItem, _dep, context, new_items, "", "", _actually_an_obsolete }; diff --git a/zypp/solver/detail/QueueItemGroup.cc b/zypp/solver/detail/QueueItemGroup.cc index 9b45923..3d3cdfc 100644 --- a/zypp/solver/detail/QueueItemGroup.cc +++ b/zypp/solver/detail/QueueItemGroup.cc @@ -21,6 +21,7 @@ #include #include +#include ///////////////////////////////////////////////////////////////////////// namespace zypp @@ -86,7 +87,7 @@ namespace zypp bool QueueItemGroup::process (ResolverContextPtr context, QueueItemList & new_items) { - if (getenv ("RC_SPEW")) fprintf (stderr, "QueueItemGroup::process\n"); + _DBG("RC_SPEW") << "QueueItemGroup::process" << endl; bool did_something = false; diff --git a/zypp/solver/detail/QueueItemInstall.cc b/zypp/solver/detail/QueueItemInstall.cc index 90a271f..4c1f049 100644 --- a/zypp/solver/detail/QueueItemInstall.cc +++ b/zypp/solver/detail/QueueItemInstall.cc @@ -34,6 +34,7 @@ #include #include #include +#include ///////////////////////////////////////////////////////////////////////// namespace zypp @@ -110,7 +111,15 @@ namespace zypp , _explicitly_requested (false) { constResItemPtr upgrades = world->findInstalledResItem (resItem); - if (getenv("RC_SPEW")) fprintf (stderr, "QueueItemInstall::QueueItemInstall(%s) upgrades %s\n", resItem->asString().c_str(), upgrades!=NULL?upgrades->asString().c_str():"nothing"); + _DBG("RC_SPEW") << "QueueItemInstall::QueueItemInstall(" << resItem->asString() << ") upgrades "; + if (upgrades!=NULL) + { + _DBG("RC_SPEW") << upgrades->asString() << endl; + } + else + { + _DBG("RC_SPEW") << "nothing" << endl; + } if (upgrades && ! (upgrades->equals (resItem))) { setUpgrades(upgrades); @@ -146,7 +155,7 @@ namespace zypp bool QueueItemInstall::process (ResolverContextPtr context, QueueItemList & qil) { - if (getenv ("RC_SPEW")) fprintf (stderr, "QueueItemInstall::process(%s)\n", this->asString().c_str()); + _DBG("RC_SPEW") << "QueueItemInstall::process(" << this->asString() << ")" << endl; constResItemPtr resItem = _resItem; string res_name = resItem->asString(); @@ -161,7 +170,7 @@ namespace zypp && _resItem->equals (_upgrades)) { ResolverInfoPtr info; - if (getenv ("RC_SPEW")) fprintf (stderr, "upgrades equal resItem, skipping\n"); + _DBG("RC_SPEW") << "upgrades equal resItem, skipping" << endl; msg = string("Skipping ") + res_name + (": already installed"); info = new ResolverInfoMisc (_resItem, RESOLVER_INFO_PRIORITY_VERBOSE, msg); @@ -175,11 +184,11 @@ namespace zypp if (!_needed_by.empty()) { bool still_needed = false; - if (getenv ("RC_SPEW")) fprintf (stderr, "still needed "); + _DBG("RC_SPEW") << "still needed " << endl; for (CResItemList::const_iterator iter = _needed_by.begin(); iter != _needed_by.end() && !still_needed; iter++) { ResItemStatus status = context->getStatus (*iter); - if (getenv ("RC_SPEW")) fprintf (stderr, "by: [status: %s] %s\n", ResolverContext::toString(status).c_str(), (*iter)->asString().c_str()); + _DBG("RC_SPEW") << "by: [status: " << ResolverContext::toString(status) << "] " << (*iter)->asString() << endl; if (! resItem_status_is_to_be_uninstalled (status)) { still_needed = true; } @@ -212,7 +221,7 @@ namespace zypp if (_upgrades == NULL) { - if (getenv ("RC_SPEW")) fprintf (stderr, "simple install of %s\n", resItem->asString(true).c_str()); + _DBG("RC_SPEW") << "simple install of " << resItem->asString(true) << endl; context->installResItem (resItem, context->verifying(), /* is_soft */ _other_penalty); @@ -220,7 +229,7 @@ namespace zypp QueueItemUninstallPtr uninstall_item; - if (getenv ("RC_SPEW")) fprintf (stderr, "upgrade install of %s\n", resItem->asString().c_str()); + _DBG("RC_SPEW") << "upgrade install of " << resItem->asString() << endl; context->upgradeResItem (resItem, _upgrades, context->verifying(), /* is_soft */ _other_penalty); @@ -268,7 +277,7 @@ namespace zypp for (CapSet::const_iterator iter = deps.begin(); iter != deps.end(); iter++) { const Capability dep = *iter; if (!context->requirementIsMet (dep, false)) { - if (getenv("RC_SPEW")) fprintf (stderr, "this requires %s\n", dep.asString().c_str()); + _DBG("RC_SPEW") << "this requires " << dep.asString() << endl; QueueItemRequirePtr req_item = new QueueItemRequire (world(), dep); req_item->addResItem (resItem); qil.push_front (req_item); @@ -280,7 +289,7 @@ namespace zypp deps = resItem->conflicts(); for (CapSet::const_iterator iter = deps.begin(); iter != deps.end(); iter++) { const Capability dep = *iter; - if (getenv("RC_SPEW")) fprintf (stderr, "this conflicts with '%s'\n", dep.asString().c_str()); + _DBG("RC_SPEW") << "this conflicts with '" << dep.asString() << "'" << endl; QueueItemConflictPtr conflict_item = new QueueItemConflict (world(), dep, resItem); qil.push_front (conflict_item); } @@ -290,7 +299,7 @@ namespace zypp deps = resItem->obsoletes(); for (CapSet::const_iterator iter = deps.begin(); iter != deps.end(); iter++) { const Capability dep = *iter; - if (getenv("RC_SPEW")) fprintf (stderr, "this obsoletes %s\n", dep.asString().c_str()); + _DBG("RC_SPEW") << "this obsoletes " << dep.asString() << endl; QueueItemConflictPtr conflict_item = new QueueItemConflict (world(), dep, resItem); conflict_item->setActuallyAnObsolete(); qil.push_front (conflict_item); @@ -319,7 +328,7 @@ namespace zypp continue; } - if (getenv("RC_SPEW")) fprintf (stderr, "because: '%s'\n", conflicting_resItem->asString(true).c_str()); + _DBG("RC_SPEW") << "because: '" << conflicting_resItem->asString(true) << "'" << endl; uninstall_item = new QueueItemUninstall (world(), conflicting_resItem, "conflict"); uninstall_item->setDueToConflict (); diff --git a/zypp/solver/detail/ResItemAndDependency.cc b/zypp/solver/detail/ResItemAndDependency.cc index a8fd01a..1bbfbb0 100644 --- a/zypp/solver/detail/ResItemAndDependency.cc +++ b/zypp/solver/detail/ResItemAndDependency.cc @@ -91,6 +91,7 @@ namespace zypp bool ResItemAndDependency::verifyRelation (const Capability & dep) const { +#if 0 #if PHI // don't check the channel, thereby honoring conflicts from installed resItems to to-be-installed resItems return dep.matches (_dependency); @@ -98,6 +99,7 @@ namespace zypp if (!dep.matches (_dependency)) { return false; } +#endif #if 0 if (getenv ("SPEW_DEP")) fprintf (stderr, "ResItemAndDependency::verifyRelation _resItem->channel() %s, dep->channel() %s\n", _resItem->channel()->asString().c_str(), dep->channel()->asString().c_str()); return _resItem->channel()->equals (dep->channel()); diff --git a/zypp/solver/detail/StoreWorld.cc b/zypp/solver/detail/StoreWorld.cc index ca6a026..422be2c 100644 --- a/zypp/solver/detail/StoreWorld.cc +++ b/zypp/solver/detail/StoreWorld.cc @@ -540,7 +540,7 @@ namespace zypp for (ResItemAndDependencyTable::const_iterator iter = _requires_by_name.lower_bound(dep.name()); iter != _requires_by_name.upper_bound(dep.name()); iter++) { constResItemAndDependencyPtr r_and_d = iter->second; - if (r_and_d && r_and_d->dependency().matches (dep)) { + if (r_and_d ) {//&& r_and_d->dependency().matches (dep)) { /* Skip dups if one of them in installed. */ if (r_and_d->resItem()->isInstalled() diff --git a/zypp/solver/detail/XmlParser.cc b/zypp/solver/detail/XmlParser.cc index 0ec3185..d0df8ff 100644 --- a/zypp/solver/detail/XmlParser.cc +++ b/zypp/solver/detail/XmlParser.cc @@ -82,22 +82,10 @@ namespace zypp /* FIXME: should get Channel from XML */ /* FIXME: should get Kind from XML */ - if ( std::strlen(arch.c_str()) > 0) - { - return factory.parse ( ResTraits::kind, - name, - relation, - Edition (version, release, epoch), - Arch(arch)); - } - else - { - return factory.parse ( ResTraits::kind, - name, - relation, - Edition (version, release, epoch), - Arch_noarch); - } + return factory.parse ( ResTraits::kind, + name, + relation, + Edition (version, release, epoch)); } @@ -602,8 +590,7 @@ namespace zypp Capability selfdep = factory.parse ( ResTraits::kind, _current_package_name, Rel::EQ, - _current_package_edition, - _current_package_arch); + _current_package_edition); CapSet::const_iterator piter; for (piter = _current_provides.begin(); piter != _current_provides.end(); piter++) { if ((*piter) == selfdep) diff --git a/zypp/solver/detail/extract.cc b/zypp/solver/detail/extract.cc index cf96bb9..f646120 100644 --- a/zypp/solver/detail/extract.cc +++ b/zypp/solver/detail/extract.cc @@ -26,7 +26,7 @@ #include #include #include - +#include #include ///////////////////////////////////////////////////////////////////////// @@ -48,7 +48,7 @@ namespace zypp PackagePtr package; int count = 0; - if (getenv ("RC_SPEW_XML")) fprintf (stderr, "extract_packages_from_xml_node ()\n"); + _DBG("RC_SPEW_XML") << "extract_packages_from_xml_node ()" << endl; // search the 'package' node while (node && !node->equals("package")) { @@ -66,7 +66,7 @@ namespace zypp if (node->equals("package")) { package = new Package (node, channel); if (package) { - if (getenv ("RC_SPEW")) fprintf (stderr, "%s\n", package->asString(true).c_str()); + _DBG("RC_SPEW") << package->asString(true) << endl; bool ok = true; if (callback) ok = callback (package, data); @@ -88,7 +88,7 @@ namespace zypp unsigned int count = 0; PackageList packages; - if (getenv ("RC_SPEW_XML")) fprintf (stderr, "extract_packages_from_helix_buffer(%.32s...,%ld,...)\n", buf, (long)len); + _DBG("RC_SPEW_XML") << "extract_packages_from_helix_buffer(" << buf << "...," << (long)len << ",...)" << endl; if (buf == NULL || len == 0) return 0; @@ -102,7 +102,7 @@ namespace zypp count = packages.size(); - if (getenv ("RC_SPEW_XML")) fprintf (stderr, "extract_packages_from_helix_buffer: parsed %d packages\n", count); + _DBG("RC_SPEW_XML") << "extract_packages_from_helix_buffer: parsed " << count << "packages" << endl; if (callback != NULL) { for (PackageList::iterator iter = packages.begin(); iter != packages.end(); iter++) {