#include <zypp/solver/detail/ResolverInfoNeededBy.h>
#include <zypp/solver/detail/World.h>
#include <zypp/CapSet.h>
+#include <zypp/base/Logger.h>
/////////////////////////////////////////////////////////////////////////
namespace zypp
bool
QueueItemRequire::process (ResolverContext_Ptr context, QueueItemList & new_items)
{
- if (getenv ("RC_SPEW")) fprintf (stderr, "QueueItemRequire::process(%s)\n", this->asString().c_str());
+ _DBG("RC_SPEW") << "QueueItemRequire::process(" << this->asString() << ")" << endl;
if (context->requirementIsMet (_dep, _is_child)) {
- if (getenv ("RC_SPEW")) fprintf (stderr, "requirement is already met in current context\n");
+ _DBG("RC_SPEW") << "requirement is already met in current context" << endl;
// rc_queue_item_free (item);
return true;
}
num_providers = info.providers.size();
- if (getenv ("RC_SPEW")) fprintf (stderr, "requirement is met by %d resolvable\n", num_providers);
+ _DBG("RC_SPEW") << "requirement is met by " << num_providers << " resolvable";
}
std::string msg;
if (num_providers == 0) {
- if (getenv ("RC_SPEW")) fprintf (stderr, "Unfulfilled requirement, try different solution\n");
+ _DBG("RC_SPEW") << "Unfulfilled requirement, try different solution" << endl;
QueueItemUninstall_Ptr uninstall_item = NULL;
QueueItemBranch_Ptr branch_item = NULL;
} else if (num_providers == 1) {
- if (getenv ("RC_SPEW")) fprintf (stderr, "Found exactly one resolvable, installing it.\n");
+ _DBG("RC_SPEW") << "Found exactly one resolvable, installing it." << endl;
QueueItemInstall_Ptr install_item = new QueueItemInstall (world(), info.providers.front());
install_item->addDependency (_dep);
} else if (num_providers > 1) {
- if (getenv ("RC_SPEW")) fprintf (stderr, "Found more than one resolvable, branching.\n");
+ _DBG("RC_SPEW") << "Found more than one resolvable, branching." << endl;
//fprintf (stderr, "Found more than one resItem, branching.\n");
QueueItemBranch_Ptr branch_item = new QueueItemBranch (world());
#include <zypp/solver/detail/ResolverInfoMissingReq.h>
#include <zypp/solver/detail/World.h>
#include <zypp/CapSet.h>
+#include <zypp/base/Logger.h>
/////////////////////////////////////////////////////////////////////////
namespace zypp
status = context->getStatus (_resItem);
- if (getenv ("RC_SPEW")) fprintf (stderr, "QueueItemUninstall::process(<%s>%s)%s\n", ResolverContext::toString(status).c_str(), _resItem->asString().c_str(), _unlink ? "[unlink]" : "");
+ _DBG("RC_SPEW") << "QueueItemUninstall::process(<" << ResolverContext::toString(status) << ">" << _resItem->asString() << ")";
+ if (_unlink)
+ _DBG("RC_SPEW") << "[unlink]";
+ _DBG("RC_SPEW") << endl;
/* In the case of an unlink, we only want to uninstall the resItem if it is
being used by something else. We can't really determine this with 100%
#include <zypp/solver/detail/ResItemAndDependency.h>
#include <zypp/solver/detail/debug.h>
+#include <zypp/base/Logger.h>
/////////////////////////////////////////////////////////////////////////
namespace zypp
//if (!dep.matches (_dependency)) {
return false;
//}
- 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());
+ _DBG("SPEW_DEP") << "ResItemAndDependency::verifyRelation _resItem->channel() " << _resItem->channel()->asString() << ", dep->channel()" << dep->channel()->asString() << endl;
return _resItem->channel()->equals (dep->channel());
#endif
#else
#include <zypp/solver/detail/World.h>
#include <zypp/solver/detail/StoreWorld.h>
#include <zypp/solver/detail/MultiWorld.h>
+#include <zypp/base/Logger.h>
/////////////////////////////////////////////////////////////////////////
namespace zypp
void
Resolver::verifySystem (void)
{
- if (getenv ("RC_SPEW")) fprintf (stderr, "Resolver::verifySystem()\n");
+ _XXX("RC_SPEW") << "Resolver::verifySystem()" << endl;
world()->foreachResItem (new Channel(CHANNEL_TYPE_SYSTEM), verify_system_cb, this);
_verifying = true;
{
time_t t_start, t_now;
- bool extremely_noisy = getenv ("RC_SPEW") != NULL;
bool have_local_resItems = false;
- if (extremely_noisy) fprintf (stderr, "Resolver::resolveDependencies()\n");
+ _XXX("RC_SPEW") << "Resolver::resolveDependencies()" << endl;
/* Walk through are list of to-be-installed packages and see if any of them are local. */
initial_queue->addExtraConflict (*iter);
}
- if (extremely_noisy) fprintf (stderr, "Initial Queue: [%s]\n", initial_queue->asString().c_str());
+ _XXX("RC_SPEW") << "Initial Queue: [" << initial_queue->asString() << "]" << endl;
_pending_queues.push_front (initial_queue);
while (!_pending_queues.empty()) {
- if (extremely_noisy) {
- printf ("Pend %ld / Cmpl %ld / Prun %ld / Defr %ld / Invl %ld\n\n", (long) _pending_queues.size(), (long) _complete_queues.size(), (long) _pruned_queues.size(), (long) _deferred_queues.size(), (long) _invalid_queues.size());
- }
+ _XXX("RC_SPEW") << "Pend " << (long) _pending_queues.size()
+ << " / Cmpl " << (long) _complete_queues.size()
+ << " / Prun " << (long) _pruned_queues.size()
+ << " / Defr " << (long) _deferred_queues.size()
+ << " / Invl " << (long) _invalid_queues.size() << endl;
- if (_timeout_seconds > 0) {
- time (&t_now);
- if (difftime (t_now, t_start) > _timeout_seconds) {
- _timed_out = true;
- break;
- }
- }
+ if (_timeout_seconds > 0) {
+ time (&t_now);
+ if (difftime (t_now, t_start) > _timeout_seconds) {
+ _timed_out = true;
+ break;
+ }
+ }
- ResolverQueue_Ptr queue = _pending_queues.front();
- _pending_queues.pop_front();
- ResolverContext_Ptr context = queue->context();
+ ResolverQueue_Ptr queue = _pending_queues.front();
+ _pending_queues.pop_front();
+ ResolverContext_Ptr context = queue->context();
- queue->process();
+ queue->process();
- if (queue->isInvalid ()) {
- if (extremely_noisy) printf ("Invalid Queue\n");
- _invalid_queues.push_front (queue);
+ if (queue->isInvalid ()) {
+ _XXX("RC_SPEW") << "Invalid Queue\n" << endl;;
+ _invalid_queues.push_front (queue);
- } else if (queue->isEmpty ()) {
- if (extremely_noisy) printf ("Empty Queue\n");
+ } else if (queue->isEmpty ()) {
+ _XXX("RC_SPEW") <<"Empty Queue\n" << endl;
_complete_queues.push_front (queue);
/* If we aren't currently as good as our previous best complete solution,
this solution gets pruned. */
- if (extremely_noisy) printf ("PRUNED!\n");
+ _XXX("RC_SPEW") << "PRUNED!" << endl;
_pruned_queues.push_front(queue);
&& !_deferred_queues.empty()) {
_pending_queues.push_front (_deferred_queues.front());
}
- }
-
- if (extremely_noisy) {
- printf ("Pend %ld / Cmpl %ld / Prun %ld / Defr %ld / Invl %ld\n--------\n", (long) _pending_queues.size(), (long) _complete_queues.size(), (long) _pruned_queues.size(), (long) _deferred_queues.size(), (long) _invalid_queues.size());
- }
-
+ }
+ _XXX("RC_SPEW") << "Pend " << (long) _pending_queues.size()
+ << " / Cmpl " << (long) _complete_queues.size()
+ << " / Prun " << (long) _pruned_queues.size()
+ << " / Defr " << (long) _deferred_queues.size()
+ << " / Invl " << (long) _invalid_queues.size() << endl;
return;
}
#include <values.h>
-#include <zypp/base/String.h>
-#include <zypp/solver/detail/ResolverContext.h>
-#include <zypp/solver/detail/ResolverInfoMisc.h>
-#include <zypp/solver/detail/MultiWorld.h>
-#include <zypp/solver/detail/World.h>
-#include <zypp/CapSet.h>
+#include "zypp/base/String.h"
+#include "zypp/solver/detail/ResolverContext.h"
+#include "zypp/solver/detail/ResolverInfoMisc.h"
+#include "zypp/solver/detail/MultiWorld.h"
+#include "zypp/solver/detail/World.h"
+#include "zypp/CapSet.h"
+#include "zypp/base/Logger.h"
/////////////////////////////////////////////////////////////////////////
namespace zypp
std::string msg;
status = getStatus (resItem);
- if (getenv ("RC_SPEW")) fprintf (stderr, "ResolverContext[%p]::installResItem(<%s>%s)\n", this, ResolverContext::toString(status).c_str(), resItem->asString().c_str());
+ _DBG("RC_SPEW") << "ResolverContext[" << this << "]::installResItem(<" << ResolverContext::toString(status)
+ << "> " << resItem->asString() << ")" << endl;
if (resItem_status_is_to_be_uninstalled (status)
&& status != RESOLVABLE_STATUS_TO_BE_UNINSTALLED_DUE_TO_UNLINK) {
ResItemStatus status;
int priority;
- if (getenv ("RC_SPEW")) fprintf (stderr, "ResolverContext[%p]::upgradeResItem(%s upgrades %s)\n", this, resItem->asString().c_str(), old_resItem->asString().c_str());
+ _DBG("RC_SPEW") << "ResolverContext[" << this << "]::upgradeResItem(" << resItem->asString() << " upgrades "
+ << old_resItem->asString() << ")" << endl;
status = getStatus (resItem);
ResItemStatus status, new_status;
std::string msg;
- if (getenv ("RC_SPEW")) fprintf (stderr, "ResolverContext[%p]::uninstallResItem(%s %s %s %s)\n", this, resItem->asString().c_str(), part_of_upgrade ? "part_of_upgrade" : "", due_to_obsolete ? "due_to_obsolete": "", due_to_unlink ? "due_to_unlink" : "");
+ _DBG("RC_SPEW") << "ResolverContext[" << this << "]::uninstallResItem("
+ << resItem->asString() << " " << (part_of_upgrade ? "part_of_upgrade" : "") << " "
+ << (due_to_obsolete ? "due_to_obsolete": "") << " "
+ << (due_to_unlink ? "due_to_unlink" : "") << ")" << endl;
assert (! (due_to_obsolete && due_to_unlink));
void
ResolverContext::addInfo (ResolverInfo_Ptr info)
{
- if (getenv ("RC_SPEW")) fprintf (stderr, "ResolverContext[%p]::addInfo(%s)\n", this, info->asString().c_str());
+ _DBG("RC_SPEW") << "ResolverContext[" << this << "]::addInfo(" << info->asString() << ")" << endl;
_log.push_back (info);
// _propagated_importance = false;
void
ResolverContext::addInfoString (ResItem_constPtr resItem, int priority, string msg)
{
-// if (getenv ("RC_SPEW")) fprintf (stderr, "ResolverContext::addInfoString(%s) %s\n", resItem ? resItem->asString().c_str() : "", msg.c_str());
+ _XXX("RC_SPEW") << "ResolverContext::addInfoString(" << (resItem ? resItem->asString().c_str() : "") << ") " << msg << endl;
ResolverInfo_Ptr info = new ResolverInfoMisc (resItem, priority, msg);
addInfo (info);
}
void
ResolverContext::spewInfo (void)
{
- if (getenv ("RC_SPEW")) fprintf (stderr, "ResolverContext[%p]::spewInfo()\n", this);
+ _DBG("RC_SPEW") << "ResolverContext[" << this << "]::spewInfo" << endl;
foreachInfo (NULL, -1, spew_info_cb, NULL);
}
#include <zypp/solver/detail/QueueItemUninstall.h>
#include <zypp/solver/detail/ResolverContext.h>
#include <zypp/CapSet.h>
+#include <zypp/base/Logger.h>
/////////////////////////////////////////////////////////////////////////
namespace zypp
int max_priority;
bool did_something = false;
- if (getenv ("QUEUE_SPEW")) fprintf (stderr, "ResolverQueue::processOnce(%s), %d items\n", asString().c_str(), (int) _items.size());
+ _DBG("QUEUE_SPEW") << "ResolverQueue::processOnce(" << asString() <<", " << (int) _items.size() << " items" << endl;
while ( (max_priority = itemlist_max_priority (_items)) >= 0
&& _context->isValid () ) {
bool did_something_recently = false;
- if (getenv ("QUEUE_SPEW")) fprintf (stderr, "ResolverQueue::processOnce() inside loop\n");
+ _DBG("QUEUE_SPEW") << "ResolverQueue::processOnce() inside loop" << endl;
for (QueueItemList::iterator iter = _items.begin(); iter != _items.end() && _context->isValid();) {
QueueItem_Ptr item = *iter;
- if (getenv ("QUEUE_SPEW")) fprintf (stderr, "=====> 1st pass: [%s]\n", item->asString().c_str());
+ _DBG("QUEUE_SPEW") << "=====> 1st pass: [" << item->asString() << "]" << endl;
QueueItemList::iterator next = iter; next++;
if (item && item->priority() == max_priority) {
if (item->process (_context, new_items)) {
}
_items = new_items;
- if (getenv ("QUEUE_SPEW")) fprintf (stderr, "%d items after first pass\n", (int) _items.size());
+ _DBG("QUEUE_SPEW") << (int) _items.size() << " items after first pass" << endl;
/*
Now make a second pass over the queue, removing any super-branches.
the larger branch can be dropped.
*/
- // if (getenv ("QUEUE_SPEW")) fprintf (stderr, "ResolverQueue::processOnce() second pass\n");
+ _XXX("QUEUE_SPEW") << "ResolverQueue::processOnce() second pass" << endl;
for (QueueItemList::iterator iter = _items.begin(); iter != _items.end();) {
QueueItemList::iterator next = iter; next++;
QueueItem_Ptr item = *iter;
- if (getenv ("QUEUE_SPEW")) fprintf (stderr, "=====> 2nd pass: [%s]\n", item->asString().c_str());
+ _DBG("QUEUE_SPEW") << "=====> 2nd pass: [" << item->asString() << "]" << endl;
if (item->isBranch()) {
- if (getenv ("QUEUE_SPEW")) fprintf (stderr, "ResolverQueue::processOnce() is branch\n");
+ _DBG("QUEUE_SPEW") << "ResolverQueue::processOnce() is branch" << endl;
QueueItemBranch_Ptr branch = dynamic_pointer_cast<QueueItemBranch>(item);
for (QueueItemList::const_iterator iter2 = _items.begin(); iter2 != _items.end(); iter2++) {
- if (getenv ("QUEUE_SPEW")) fprintf (stderr, "Compare branch with [%s]\n", (*iter2)->asString().c_str());
+ _DBG("QUEUE_SPEW") << "Compare branch with [" << (*iter2)->asString() << "]" << endl;
if (iter != iter2
&& branch->contains (*iter2)) {
- if (getenv ("QUEUE_SPEW")) fprintf (stderr, "Contained within, removing\n");
+ _DBG("QUEUE_SPEW") << "Contained within, removing" << endl;
_items.erase (iter);
break;
}
}
iter = next;
}
- if (getenv ("QUEUE_SPEW")) fprintf (stderr, "did %sthing: %d items\n", did_something ? "some" : "no", (int)_items.size());
+ if (did_something)
+ _DBG("QUEUE_SPEW") << "did somesthing: " << (int)_items.size() << " items" << endl;
+ else
+ _DBG("QUEUE_SPEW") << "did nothing: " << (int)_items.size() << " items" << endl;
return did_something;
}
void
ResolverQueue::process ()
{
- bool very_noisy;
-
- very_noisy = getenv ("RC_SPEW") != NULL;
-
- if (very_noisy) {
- printf ("----- Processing -----\n");
- spew ();
- }
+ _DBG("RC_SPEW") << "----- Processing -----" << endl;
+ spew ();
while (_context->isValid ()
- && ! isEmpty ()
- && processOnce ()) {
- /* all of the work is in the conditional! */
- if (very_noisy) {
- spew ();
- }
+ && ! isEmpty ()
+ && processOnce ()) {
+ /* all of the work is in the conditional! */
+ spew ();
}
}
void
ResolverQueue::spew ()
{
- printf ("Resolver Queue: %s\n", _context->isInvalid() ? "INVALID" : "");
+ _DBG("RC_SPEW") << "Resolver Queue: " << (_context->isInvalid() ? "INVALID" : "") << endl;
if (_items.empty()) {
- printf (" (empty)\n");
+ _DBG("RC_SPEW") << " (empty)" << endl;
} else {
-
- for (QueueItemList::const_iterator iter = _items.begin(); iter != _items.end(); iter++) {
- printf (" %s\n", (*iter)->asString().c_str());
- }
+ for (QueueItemList::const_iterator iter = _items.begin(); iter != _items.end(); iter++) {
+ _DBG("RC_SPEW") << " " << (*iter)->asString() << endl;
+ }
}
- printf ("\n");
+ _DBG("RC_SPEW") << endl;
fflush (stdout);
}
#include <zypp/solver/detail/debug.h>
#include <zypp/Arch.h>
#include <zypp/CapSet.h>
+#include <zypp/base/Logger.h>
/////////////////////////////////////////////////////////////////////////
namespace zypp
void
StoreWorld::removeResItem (ResItem_constPtr resItem)
{
- if (getenv("RC_SPEW")) fprintf (stderr, "StoreWorld::removeResItem (%s)\n", resItem->asString().c_str());
+ _DBG("RC_SPEW") << "StoreWorld::removeResItem ("
+ << resItem->asString() << ")" << endl;
Channel_constPtr channel = resItem->channel ();
if (r_and_d)
//fprintf (stderr, "==> %s verify %s ? %s\n", r_and_d->asString().c_str(), dep->asString().c_str(), r_and_d->verifyRelation (dep) ? "Y" : "N");
- 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()
|| installed.find(r_and_d->resItem()) == installed.end()) {
#include <zypp/solver/detail/UndumpWorld.h>
#include <zypp/solver/detail/extract.h>
+#include <zypp/base/Logger.h>
/////////////////////////////////////////////////////////////////////////
namespace zypp
void
UndumpWorld::setSubscription (Channel_constPtr channel, bool subscribe)
{
- // if (getenv("RC_SPEW")) fprintf (stderr, "UndumpWorld::setSubscription (%s, %s)\n", channel->asString().c_str(), subscribe?"subscribe":"unsubscribe");
+ _XXX("RC_SPEW") << "UndumpWorld::setSubscription (" << channel->asString() << " , " << (subscribe?"subscribe":"unsubscribe")
+ << ")" << endl;
for (ChannelSubscriptions::iterator i = _subscriptions.begin(); i != _subscriptions.end(); i++) {
if (*i == channel) {
if (!subscribe) {
{
for (ChannelSubscriptions::const_iterator i = _subscriptions.begin(); i != _subscriptions.end(); i++) {
if (*i == channel) {
- if (getenv("RC_SPEW")) fprintf (stderr, "UndumpWorld::isSubscribed (%s) YES\n", channel->asString().c_str());
+ _DBG("RC_SPEW") << "UndumpWorld::isSubscribed (" << channel->asString() <<") YES" << endl;
return true;
}
}
- if (getenv("RC_SPEW")) fprintf (stderr, "UndumpWorld::isSubscribed (%s) NO\n", channel->asString().c_str());
+ _DBG("RC_SPEW") << "UndumpWorld::isSubscribed (" << channel->asString() << ") NO" << endl;
return false;
}
#include <zypp/solver/detail/MultiWorld.h>
#include <zypp/solver/detail/Subscription.h>
+#include "zypp/base/Logger.h"
/////////////////////////////////////////////////////////////////////////
namespace zypp
if (channel == NULL) return;
- // if (getenv("RC_SPEW")) fprintf (stderr, "World::setSubscription (%s, %s)\n", channel->asString().c_str(), is_subscribed?"subscribe":"unsubscribe");
+ _XXX("RC_SPEW") << "World::setSubscription (" << channel->asString() << ", " <<
+ (is_subscribed?"subscribe":"unsubscribe") << ")" << endl;
if (channel->system ()) {
fprintf (stderr, "Can't subscribe to system channel '%s'\n", channel->name ());
World::isSubscribed (Channel_constPtr channel) const
{
if (channel == NULL) return false;
- // if (getenv("RC_SPEW")) fprintf (stderr, "World::isSubscribed (%s)\n", channel->asString().c_str());
+ _XXX("RC_SPEW") << "World::isSubscribed (" << channel->asString() << ")" << endl;
if (channel->system ())
return false;
*/
#include <zypp/solver/detail/XmlNode.h>
+#include <zypp/base/Logger.h>
/////////////////////////////////////////////////////////////////////////
namespace zypp
xmlNode *child;
xml_s = xmlGetProp(_node, (const xmlChar *)name);
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlNode::getValue(%s) xmlGetProp '%s'\n", name, (char *)xml_s);
+ _XXX("RC_SPEW_XML") << "XmlNode::getValue(" << name << ") xmlGetProp '" << (char *)xml_s << "'" << endl;
if (xml_s) {
ret = strdup ((const char *)xml_s);
child = _node->xmlChildrenNode;
while (child) {
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlNode::getValue(%s) child '%s'\n", name, (const char *)(child->name));
+ _XXX("RC_SPEW_XML") << "XmlNode::getValue(" << name << ") child '" << (const char *)(child->name) << "'"
+ << endl;
if (strcasecmp((const char *)(child->name), name) == 0) {
xml_s = xmlNodeGetContent(child);
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlNode::getValue(%s) xmlNodeGetContent '%s'\n", name, (char *)xml_s);
+ _XXX("RC_SPEW_XML") << "XmlNode::getValue(" << name << ") xmlNodeGetContent '" << (char *)xml_s << "'"
+ << endl;
if (xml_s) {
ret = strdup ((const char *)xml_s);
xmlFree (xml_s);
child = child->next;
}
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlNode::getValue(%s) NULL\n", name);
+ _XXX("RC_SPEW_XML") << "XmlNode::getValue(" << name << ") NULL" << endl;
return deflt;
}
char *gs;
ret = xmlGetProp (_node, (const xmlChar *)name);
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlNode::getProp(%s) xmlGetProp '%s'\n", name, (char *)ret);
+ _XXX("RC_SPEW_XML") << "XmlNode::getProp(" << name << ") xmlGetProp '" << (char *)ret << "'"
+ << endl;
if (ret) {
gs = strdup ((const char *)ret);
xmlFree (ret);
#define _XmlNode_h
#include <list>
-
+#include <iostream>
#include <iosfwd>
#include <string>
#include <libxml/parser.h>
#include <config.h>
#include <ctype.h>
#include <assert.h>
-#include <zypp/solver/detail/XmlParser.h>
-#include <zypp/solver/detail/PackageUpdate.h>
-#include <zypp/solver/detail/utils.h>
-
-#include <zypp/solver/detail/debug.h>
-#include <zypp/ResObject.h>
-
-#include <zypp/CapFactory.h>
-#include <zypp/CapSet.h>
-#include <zypp/Dependencies.h>
+#include "zypp/solver/detail/XmlParser.h"
+#include "zypp/solver/detail/PackageUpdate.h"
+#include "zypp/solver/detail/utils.h"
+#include "zypp/solver/detail/debug.h"
+#include "zypp/ResObject.h"
+#include "zypp/CapFactory.h"
+#include "zypp/CapSet.h"
+#include "zypp/Dependencies.h"
+#include "zypp/base/Logger.h"
/////////////////////////////////////////////////////////////////////////
namespace zypp
else if (!strcasecmp(attr, "arch")) arch = value;
else if (!strcasecmp (attr, "obsoletes")) *is_obsolete = true;
else {
- if (getenv ("RC_SPEW_XML")) rc_debug (RC_DEBUG_LEVEL_ALWAYS, "! Unknown attribute: %s = %s", attr, value);
+ _DBG("RC_SPEW_XML") << "! Unknown attribute: " << attr << " = " << value << endl;
}
}
XmlParser *ctx = (XmlParser *)ptr;
if (ctx->processing()) return;
- // if (getenv ("RC_SPEW_XML")) rc_debug (RC_DEBUG_LEVEL_ALWAYS, "* Start document");
+ _XXX("RC_SPEW_XML") << "* Start document" << endl;
ctx->setProcessing (true);
}
XmlParser *ctx = (XmlParser *)ptr;
if (!ctx->processing()) return;
- // if (getenv ("RC_SPEW_XML")) rc_debug (RC_DEBUG_LEVEL_ALWAYS, "* End document");
+ _XXX("RC_SPEW_XML") << "* End document" << endl;
ctx->setProcessing (false);
}
ctx->releaseBuffer();
#if 0
- // if (getenv ("RC_SPEW_XML")) rc_debug (RC_DEBUG_LEVEL_ALWAYS, "* Start element (%s)", (const char *)name);
+ _XXX("RC_SPEW_XML") << "* Start element (" << (const char *)name << ")";
if (attrs) {
for (int i = 0; attrs[i]; i += 2) {
- if (getenv ("RC_SPEW_XML")) rc_debug (RC_DEBUG_LEVEL_ALWAYS, " - Attribute (%s=%s)", (const char *)attrs[i], (const char *)attrs[i+1]);
+ _DBG("RC_SPEW_XML") << " - Attribute (" << (const char *)attrs[i] << "=" << (const char *)attrs[i+1] << ")" << endl;
}
}
#endif
{
XmlParser *ctx = (XmlParser *)ptr;
- // if (getenv ("RC_SPEW_XML")) rc_debug (RC_DEBUG_LEVEL_ALWAYS, "* End element (%s)", (const char *)name);
+ _XXX("RC_SPEW_XML") << "* End element (" << (const char *)name << ")" << endl;
if (!strcmp((const char *)name, "channel") || !strcmp((const char *)name, "subchannel")) {
/* Unneeded container tags. Ignore */
, _text_buffer (NULL)
, _text_buffer_size (0)
{
- // if (getenv ("RC_SPEW_XML")) rc_debug (RC_DEBUG_LEVEL_ALWAYS, "* Context created (%p)", this);
+ _XXX("RC_SPEW_XML") << "* Context created (" << this << ")" << endl;
}
_text_buffer_size += size;
_text_buffer[_text_buffer_size] = 0;
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlParser[%p]::toBuffer(%.32s...,%ld)\n", this, data, (long)size);
+ _XXX("RC_SPEW_XML") << "XmlParser[" << this << "]::toBuffer(" << data << "...," << (long)size << ")" << endl;
}
free (_text_buffer);
_text_buffer = NULL;
_text_buffer_size = 0;
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlParser[%p]::releaseBuffer()\n", this);
+ _XXX("RC_SPEW_XML") << "XmlParser[" << this << "]::releaseBuffer()" << endl;
}
void
XmlParser::parseChunk(const char *xmlbuf, size_t size)
{
- if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlParser::parseChunk(%.32s...,%ld)\n", xmlbuf, (long)size);
+ _DBG("RC_SPEW_XML") << "XmlParser::parseChunk(" << xmlbuf << "...," << (long)size << ")" << endl;
xmlSubstituteEntitiesDefault(true);
PackageList
XmlParser::done()
{
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlParser::done()\n");
+ _XXX("RC_SPEW_XML") << "XmlParser::done()" << endl;
if (_processing)
xmlParseChunk(_xml_context, NULL, 0, 1);
void
XmlParser::startElement(const char *name, const xmlChar **attrs)
{
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlParser::startElement(%s)\n", name);
+ _XXX("RC_SPEW_XML") << "XmlParser::startElement(" << name << ")" << endl;
switch (_state) {
case PARSER_TOPLEVEL:
void
XmlParser::endElement(const char *name)
{
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlParser::endElement(%s)\n", name);
+ _XXX("RC_SPEW_XML") << "XmlParser::endElement(" << name << ")" << endl;
if (name != NULL) { // sax_end_element might set name to NULL
switch (_state) {
void
XmlParser::toplevelStart(const char * name, const xmlChar **attrs)
{
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlParser::toplevelStart(%s)\n", name);
+ _XXX("RC_SPEW_XML") << "XmlParser::toplevelStart(" << name << ")" << endl;
if (!strcmp(name, "package")) {
}
else {
- if (getenv ("RC_SPEW_XML")) rc_debug (RC_DEBUG_LEVEL_ALWAYS, "! Not handling %s at toplevel", (const char *)name);
+ _DBG("RC_SPEW_XML") << "! Not handling " << (const char *)name << " at toplevel" << endl;
}
}
void
XmlParser::packageStart(const char * name, const xmlChar **attrs)
{
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlParser::packageStart(%s)\n", name);
+ _XXX("RC_SPEW_XML") << "XmlParser::packageStart(" << name << ")" << endl;
/* Only care about the containers here */
if (!strcmp((const char *)name, "history")) {
_current_dep_list = _toplevel_dep_list = &_current_children;
}
else {
- // if (getenv ("RC_SPEW_XML")) rc_debug (RC_DEBUG_LEVEL_ALWAYS, "! Not handling %s in package start", name);
+ _XXX("RC_SPEW_XML") << "! Not handling " << name << " in package start" << endl;
}
}
void
XmlParser::historyStart(const char * name, const xmlChar **attrs)
{
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlParser::historyStart(%s)\n", name);
+ _XXX("RC_SPEW_XML") << "XmlParser::historyStart(" << name << ")" << endl;
if (!strcmp(name, "update")) {
assert(_current_update == NULL);
_state = PARSER_UPDATE;
}
else {
- if (getenv ("RC_SPEW_XML")) rc_debug (RC_DEBUG_LEVEL_ALWAYS, "! Not handling %s in history", name);
+ _XXX("RC_SPEW_XML") << "! Not handling " << name << " in history" << endl;
}
}
void
XmlParser::dependencyStart(const char *name, const xmlChar **attrs)
{
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlParser::dependencyStart(%s)\n", name);
+ _XXX("RC_SPEW_XML") << "XmlParser::dependencyStart(" << name << ")" << endl;
if (!strcmp(name, "dep")) {
Capability dep;
else if (!strcmp(name, "or"))
_current_dep_list->clear();
else {
- if (getenv ("RC_SPEW_XML")) rc_debug (RC_DEBUG_LEVEL_ALWAYS, "! Not handling %s in dependency", name);
+ _DBG("RC_SPEW_XML") << "! Not handling " << name << " in dependency" << endl;
}
}
void
XmlParser::packageEnd(const char *name)
{
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlParser::packageEnd(%s)\n", name);
+ _XXX("RC_SPEW_XML") << "XmlParser::packageEnd(" << name << ")" << endl;
if (!strcmp(name, "package")) {
PackageUpdate_Ptr update = NULL;
}
if (piter == _current_provides.end()) { // no self provide found, construct one
- //if (getenv ("RC_SPEW")) fprintf (stderr, "Adding self-provide [%s]\n", selfdep->asString().c_str());
+ _XXX("RC_SPEW") << "Adding self-provide [" << selfdep.asString() << "]" << endl;
_current_provides.insert (selfdep);
}
}
_all_packages.push_back (package);
- if (getenv ("RC_SPEW")) fprintf (stderr, "%s\n", package->asString(true).c_str());
- if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlParser::packageEnd done: '%s'\n", package->asString(true).c_str());
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlParser::packageEnd now %ld packages\n", _all_packages.size());
+ _DBG("RC_SPEW") << package->asString(true) << endl;
+ _DBG("RC_SPEW_XML") << "XmlParser::packageEnd done: '" << package->asString(true) << "'" << endl;
+ _XXX("RC_SPEW_XML") << "XmlParser::packageEnd now " << _all_packages.size() << " packages" << endl;
_current_package_stored = true;
_state = PARSER_TOPLEVEL;
}
} else if (!strcmp(name, "install_only")) { _current_package_installOnly = true;
} else if (!strcmp(name, "package_set")) { _current_package_packageSet = true;
} else {
- if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlParser::packageEnd(%s) unknown\n", name);
+ _DBG("RC_SPEW_XML") << "XmlParser::packageEnd(" << name << ") unknown" << endl;
}
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlParser::packageEnd(%s) done\n", name);
+ _XXX("RC_SPEW_XML") << "XmlParser::packageEnd(" << name << ") done" << endl;
releaseBuffer();
}
void
XmlParser::historyEnd(const char *name)
{
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlParser::historyEnd(%s)\n", name);
+ _XXX("RC_SPEW_XML") << "XmlParser::historyEnd(" << name << ")" << endl;
if (!strcmp(name, "history")) {
assert(_current_update == NULL);
void
XmlParser::updateEnd(const char *name)
{
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlParser::updateEnd(%s)\n", name);
+ _XXX("RC_SPEW_XML") << "XmlParser::updateEnd(" << name << ")" << endl;
Channel_constPtr channel;
const char *url_prefix = NULL;
fprintf (stderr, "XmlParser::updateEnd(%s) unknown\n", name);
}
- // if (_current_update != NULL && getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlParser::updateEnd(%s) => '%s'\n", name, _current_update->asString().c_str());
+ if (_current_update != NULL )
+ _DBG("RC_SPEW_XML") << "XmlParser::updateEnd(" << name << ") => '" << _current_update->asString() << "'" << endl;
releaseBuffer();
void
XmlParser::dependencyEnd(const char *name)
{
- // if (getenv ("RC_SPEW_XML")) fprintf (stderr, "XmlParser::dependencyEnd(%s)\n", name);
+ _XXX("RC_SPEW_XML") << "XmlParser::dependencyEnd(" << name << ")" << endl;
if (!strcmp(name, "or")) {
#if 0
* USA.
*/
-#include <zypp/solver/detail/extract.h>
-#include <zypp/solver/detail/XmlParser.h>
-#include <zypp/solver/detail/utils.h>
-#include <zypp/base/Logger.h>
-#include <zypp/solver/detail/debug.h>
+#include "zypp/solver/detail/extract.h"
+#include "zypp/solver/detail/XmlParser.h"
+#include "zypp/solver/detail/utils.h"
+#include "zypp/base/Logger.h"
/////////////////////////////////////////////////////////////////////////
namespace zypp
return -1;
if (!dump_node->equals("world")) {
- debug (DEBUG_LEVEL_WARNING, "Unrecognized top-level node for undump: '%s'", dump_node->name());
+ WAR << "Unrecognized top-level node for undump: '" << dump_node->name() << "'" << endl;
return -1;
}
{
#ifndef ENABLE_RPM
/* We can't support yum without rpm support */
- debug (RC_DEBUG_LEVEL_ERROR, "RPM support is not enabled");
+ ERR << "RPM support is not enabled" << endl;
return NULL;
#else
RCRpmman *rpmman;
g_return_val_if_fail (packman != NULL, NULL);
if (!g_type_is_a (G_TYPE_FROM_INSTANCE (packman), RC_TYPE_RPMMAN)) {
- debug (RC_DEBUG_LEVEL_ERROR,
- "yum support is not available on non-RPM systems");
+ DBG << "yum support is not available on non-RPM systems" << endl;
return NULL;
}
h = rpmman->headerLoad (data);
if (h == NULL) {
- debug (RC_DEBUG_LEVEL_ERROR,
- "Unable to get header from headerCopyLoad!");
+ DBG << "Unable to get header from headerCopyLoad!" << endl;
return NULL;
}
{
#ifndef ENABLE_RPM
/* We can't support apt-rpm without rpm support */
- debug (RC_DEBUG_LEVEL_ERROR, "RPM support is not enabled");
+ ERR << "RPM support is not enabled" << endl;
return -1;
#else
RCRpmman *rpmman;
g_return_val_if_fail (packman != NULL, -1);
if (!g_type_is_a (G_TYPE_FROM_INSTANCE (packman), RC_TYPE_RPMMAN)) {
- debug (RC_DEBUG_LEVEL_ERROR,
- "apt-rpm support is not available on non-RPM systems");
+ ERR << "apt-rpm support is not available on non-RPM systems" << endl;
return -1;
}
rpmman = RC_RPMMAN (packman);
if (len < hdrmagic_len) {
- debug (RC_DEBUG_LEVEL_ERROR,
- "Data is too small to possibly be correct");
+ ERR << "Data is too small to possibly be correct" << endl;
return 0;
}
h = rpmman->headerLoad (cur_ptr);
if (h == NULL) {
- debug (RC_DEBUG_LEVEL_ERROR,
- "Unable to get header from headerCopyLoad!");
+ ERR << "Unable to get header from headerCopyLoad!" << endl;
return 0;
}
if (n && typ == RPM_STRING_TYPE)
archstr = tmpc;
else {
- debug (RC_DEBUG_LEVEL_WARNING, "No arch available!");
+ WAR << "No arch available!" << endl;
goto cleanup;
}