--- /dev/null
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* XmlNode.cc wrapper for xmlNodePtr from libxml2
+ *
+ * Copyright (C) 2000-2002 Ximian, Inc.
+ * Copyright (C) 2005 SUSE Linux Products GmbH
+ *
+ * Definition of 'edition'
+ * contains epoch-version-release-arch
+ * and comparision functions
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include "XmlNode.h"
+#include "zypp/base/Logger.h"
+
+/////////////////////////////////////////////////////////////////////////
+namespace zypp
+{ ///////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////
+ namespace solver
+ { /////////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////
+ namespace detail
+ { ///////////////////////////////////////////////////////////////////
+
+using namespace std;
+
+IMPL_PTR_TYPE(XmlNode);
+
+//---------------------------------------------------------------------------
+
+XmlNode::XmlNode (const xmlNodePtr node)
+ : _node(node)
+{
+}
+
+XmlNode::XmlNode (const string & name)
+ : _node(xmlNewNode (NULL, (const xmlChar *)name.c_str()))
+{
+}
+
+XmlNode::~XmlNode ()
+{
+}
+
+//---------------------------------------------------------------------------
+
+string
+XmlNode::asString ( void ) const
+{
+ return toString (*this);
+}
+
+
+string
+XmlNode::toString ( const XmlNode & node )
+{
+ return "<xmlnode/>";
+}
+
+
+ostream &
+XmlNode::dumpOn( ostream & str ) const
+{
+ str << asString();
+ return str;
+}
+
+
+ostream&
+operator<<( ostream& os, const XmlNode& node)
+{
+ return os << node.asString();
+}
+
+//---------------------------------------------------------------------------
+
+string
+XmlNode::getValue (const string & name, const string & deflt) const
+{
+ string ret;
+ xmlChar *xml_s;
+ xmlNode *child;
+
+ xml_s = xmlGetProp(_node, (const xmlChar *)name.c_str());
+// _XXX("RC_SPEW_XML") << "XmlNode::getValue(" << name << ") xmlGetProp '" << (char *)xml_s << "'" << endl;
+
+ if (xml_s) {
+ ret = string ((const char *)xml_s);
+ xmlFree (xml_s);
+ return ret;
+ }
+
+ child = _node->xmlChildrenNode;
+
+ while (child) {
+ _XXX("RC_SPEW_XML") << "XmlNode::getValue(" << name << ") child '" << (child->name) << "'" << endl;
+ if (strcasecmp((const char *)(child->name), name.c_str()) == 0) {
+ xml_s = xmlNodeGetContent(child);
+ _XXX("RC_SPEW_XML") << "XmlNode::getValue(" << name << ") xmlNodeGetContent '" << (char *)xml_s << "'" << endl;
+ if (xml_s) {
+ ret = string ((const char *)xml_s);
+ xmlFree (xml_s);
+ return ret;
+ }
+ }
+ child = child->next;
+ }
+
+ _XXX("RC_SPEW_XML") << "XmlNode::getValue(" << name << ") deflt" << endl;
+ return deflt;
+}
+
+
+bool
+XmlNode::hasProp (const std::string & name) const
+{
+ xmlChar *ret;
+
+ ret = xmlGetProp (_node, (const xmlChar *)name.c_str());
+ if (ret) {
+ return true;
+ }
+ return false;
+}
+
+
+string
+XmlNode::getProp (const std::string & name, const std::string & deflt) const
+{
+ xmlChar *ret;
+ string gs;
+
+ ret = xmlGetProp (_node, (const xmlChar *)name.c_str());
+
+ if (ret) {
+ _XXX("RC_SPEW_XML") << "XmlNode::getProp(" << name << ") xmlGetProp '" << (char *)ret << "'" << endl;
+
+ gs = string ((const char *)ret);
+ xmlFree (ret);
+ return gs;
+ }
+ return deflt;
+}
+
+
+bool
+XmlNode::getIntValue (const std::string & name, int *value) const
+{
+ string strval;
+ char *ret;
+ long z;
+
+ strval = this->getValue (name);
+ if (strval.empty()) {
+ return false;
+ }
+
+ z = strtol (strval.c_str(), &ret, 10);
+ if (*ret != '\0') {
+ return false;
+ }
+
+ *value = z;
+ return true;
+}
+
+
+int
+XmlNode::getIntValueDefault (const std::string & name, int def) const
+{
+ int z;
+ if (this->getIntValue (name, &z))
+ return z;
+ else
+ return def;
+}
+
+
+unsigned int
+XmlNode::getUnsignedIntValueDefault (const std::string & name, unsigned int def) const
+{
+ unsigned int z;
+ if (this->getUnsignedIntValue (name, &z))
+ return z;
+ else
+ return def;
+}
+
+
+bool
+XmlNode::getUnsignedIntValue (const std::string & name, unsigned int *value) const
+{
+ string strval;
+ char *ret;
+ int z;
+
+ strval = this->getValue (name);
+ if (strval.empty()) {
+ return false;
+ }
+
+ z = strtoul (strval.c_str(), &ret, 10);
+ if (*ret != '\0') {
+ return false;
+ }
+
+ *value = z;
+ return true;
+}
+
+
+unsigned int
+XmlNode::getUnsignedIntPropDefault (const std::string & name, unsigned int def) const
+{
+ xmlChar *buf;
+ unsigned int ret;
+
+ buf = xmlGetProp (_node, (const xmlChar *)name.c_str());
+
+ if (buf) {
+ ret = strtol ((const char *)buf, NULL, 10);
+ xmlFree (buf);
+ return (ret);
+ }
+ return (def);
+}
+
+
+string
+XmlNode::getContent (void) const
+{
+ xmlChar *buf;
+ string ret;
+
+ buf = xmlNodeGetContent (_node);
+
+ ret = string ((const char *)buf);
+
+ xmlFree (buf);
+
+ return (ret);
+}
+
+
+unsigned int
+XmlNode::getUnsignedIntContentDefault (unsigned int def) const
+{
+ xmlChar *buf;
+ unsigned int ret;
+
+ buf = xmlNodeGetContent (_node);
+
+ if (buf) {
+ ret = strtol ((const char *)buf, NULL, 10);
+ xmlFree (buf);
+ return (ret);
+ }
+ return (def);
+}
+
+
+const XmlNode_Ptr
+XmlNode::getNode (const std::string & name) const
+{
+ xmlNodePtr iter;
+
+ for (iter = _node->xmlChildrenNode; iter; iter = iter->next) {
+ if (strcasecmp ((const char *)(iter->name), name.c_str()) == 0) {
+ return new XmlNode (iter);
+ }
+ }
+
+ return NULL;
+}
+
+
+//---------------------------------------------------------------------------
+
+
+void
+XmlNode::addTextChild (const std::string & name, const std::string & content)
+{
+ xmlNewTextChild (_node, NULL, (const xmlChar *)name.c_str(), (const xmlChar *)content.c_str());
+}
+
+///////////////////////////////////////////////////////////////////
+ };// namespace detail
+ /////////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////
+ };// namespace solver
+ ///////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////
+};// namespace zypp
+/////////////////////////////////////////////////////////////////////////
+
--- /dev/null
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* XmlNode.h wrapper for xmlNode* from libxml2
+ *
+ * Copyright (C) 2000-2003 Ximian, Inc.
+ * Copyright (C) 2005 SUSE Linux Products GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef ZYPP_SOLVER_TEMPORARY_XMLNODE_H
+#define ZYPP_SOLVER_TEMPORARY_XMLNODE_H
+
+#include <list>
+#include <iostream>
+#include <iosfwd>
+#include <string>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
+#include "zypp/base/ReferenceCounted.h"
+#include "zypp/base/NonCopyable.h"
+#include "zypp/base/PtrTypes.h"
+
+/////////////////////////////////////////////////////////////////////////
+namespace zypp
+{ ///////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////
+ namespace solver
+ { /////////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////
+ namespace detail
+ { ///////////////////////////////////////////////////////////////////
+
+DEFINE_PTR_TYPE(XmlNode);
+
+///////////////////////////////////////////////////////////////////
+//
+// CLASS NAME : XmlNode
+
+class XmlNode : public base::ReferenceCounted, private base::NonCopyable
+{
+
+ private:
+ const xmlNodePtr _node;
+
+ public:
+ XmlNode (const xmlNodePtr node);
+ XmlNode (const std::string & name);
+ virtual ~XmlNode ();
+
+ // ---------------------------------- I/O
+
+ static std::string toString ( const XmlNode & node );
+
+ virtual std::ostream & dumpOn( std::ostream & str ) const;
+
+ friend std::ostream& operator<<( std::ostream&, const XmlNode & );
+
+ std::string asString ( void ) const;
+
+ // ---------------------------------- accessors
+
+ const std::string name() const { return (std::string((const char *)_node->name)); }
+ xmlNodePtr node() const { return (_node); }
+ XmlNode_Ptr next() const { return (_node->next == NULL ? NULL : new XmlNode (_node->next)); }
+ XmlNode_Ptr children() const { return (_node->xmlChildrenNode == NULL ? NULL : new XmlNode (_node->xmlChildrenNode)); }
+ xmlElementType type() const { return (_node->type); }
+
+ // ---------------------------------- methods
+
+ bool hasProp (const std::string & name) const;
+ std::string getProp (const std::string & name, const std::string & deflt = "") const;
+ std::string getValue (const std::string & name, const std::string & deflt = "") const;
+ std::string getContent (void) const;
+
+ bool equals (const std::string & n) const { return (strcasecmp (name().c_str(), n.c_str()) == 0); }
+ bool isElement (void) const { return (type() == XML_ELEMENT_NODE); }
+
+ const XmlNode_Ptr getNode (const std::string & name) const;
+
+ // The former will get either a property or a tag, whereas the latter will
+ // get only a property
+
+ bool getIntValue (const std::string & name, int *value) const;
+ int getIntValueDefault (const std::string & name, int def) const;
+
+ bool getUnsignedIntValue (const std::string & name, unsigned int *value) const;
+ unsigned int getUnsignedIntValueDefault (const std::string & name, unsigned int def) const;
+
+ unsigned int getUnsignedIntPropDefault (const std::string & name, unsigned int def) const;
+
+ unsigned int getUnsignedIntContentDefault (unsigned int def) const;
+
+ void addTextChild (const std::string & name, const std::string & content);
+};
+
+ ///////////////////////////////////////////////////////////////////
+ };// namespace detail
+ /////////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////
+ };// namespace solver
+ ///////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////
+};// namespace zypp
+/////////////////////////////////////////////////////////////////////////
+
+
+
+#endif // ZYPP_SOLVER_TEMPORARY_XMLNODE_H
*/
-#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <sys/types.h>
#include <libxml/xmlmemory.h>
#include <zypp/Resolvable.h>
#include <zypp/ResTraits.h>
+#include <zypp/ResPool.h>
+#include <zypp/PoolItem.h>
#include <zypp/Capability.h>
#include <zypp/CapSet.h>
#include <zypp/CapFactory.h>
#include <zypp/solver/libzypp_solver.h>
+#include <sstream>
+#include <iostream>
+#include <zypp/base/String.h>
+
+using namespace std;
+using namespace zypp;
+using namespace zypp::solver::detail;
+
int assertOutput( const char* output)
{
- printf( "Assertion in %s, %d : %s --> exit\n", __FILE__, __LINE__,
- output );
+ cout << "Assertion in " << __FILE__ << ", " << __LINE__ << " : " << output << " --> exit" << endl;
exit (0);
}
(__ASSERT_VOID_CAST ((expr) ? 0 : \
(assertOutput (__STRING(expr)))))
-using namespace std;
-using zypp::Resolvable;
-using zypp::ResTraits;
-using zypp::Capability;
-using zypp::CapSet;
-using zypp::CapFactory;
-using namespace zypp::solver::detail;
-
static string globalPath;
static ResPool *globalPool;
-
typedef list<unsigned int> ChecksumList;
#define RESULT cout << ">!> "
kind = ResTraits<zypp::Product>::kind;
}
else {
- fprintf (stderr, "get_poolItem unknown kind '%s'\n", str.c_str());
+ cerr << "get_poolItem unknown kind '" << str << "'" << endl;
}
}
return kind;
static void
assemble_install_cb (PoolItem_Ref poolItem,
- ResStatus status,
void *data)
{
StringList *slist = (StringList *)data;
- char buf[10];
- snprintf (buf, 10, "%-7s ", poolItem->isInstalled() ? "|flag" : "install");
- string str (buf);
- str += poolItem->asString();
+ ostringstream s;
+ s << str::form ("%-7s ", poolItem.status().isInstalled() ? "|flag" : "install");
+ s << poolItem.resolvable();
- slist->push_back (str);
+ slist->push_back (s.str());
}
static void
assemble_uninstall_cb (PoolItem_Ref poolItem,
- ResStatus status,
void *data)
{
StringList *slist = (StringList *)data;
- char buf[10];
- snprintf (buf, 10, "%-7s ", poolItem->isInstalled() ? "remove" : "|unflag");
- string str (buf);
- str += poolItem->asString();
+ ostringstream s;
+ s << str::form ("%-7s ", poolItem.status().isInstalled() ? "remove" : "|unflag");
+ s << poolItem.resolvable();
- slist->push_back (str);
+ slist->push_back (s.str());
}
static void
assemble_upgrade_cb (PoolItem_Ref res1,
- ResStatus status1,
PoolItem_Ref res2,
- ResStatus status2,
void *data)
{
StringList *slist = (StringList *)data;
- string str = "upgrade ";
+ ostringstream s;
+
+ s << "upgrade ";
- str += res2->asString();
- str += " => ";
- str += res1->asString();
+ s << res2.resolvable();
+ s << " => ";
+ s << res1.resolvable();
- slist->push_back (str);
+ slist->push_back (s.str());
}
static void
assemble_incomplete_cb (PoolItem_Ref poolItem,
- ResStatus status,
void *data)
{
StringList *slist = (StringList *)data;
- char buf[13];
- snprintf (buf, 13, "%-11s ", poolItem->isInstalled() ? "incomplete" : "|incomplete");
- string str (buf);
- str += poolItem->asString();
+ ostringstream s;
+ s << str::form ("%-11s ", poolItem.status().isInstalled() ? "incomplete" : "|incomplete");
+ s << poolItem.resolvable();
- slist->push_back (str);
+ slist->push_back (s.str());
}
static void
assemble_satisfy_cb (PoolItem_Ref poolItem,
- ResStatus status,
void *data)
{
StringList *slist = (StringList *)data;
- char buf[13];
- snprintf (buf, 13, "%-10s ", poolItem->isInstalled() ? "SATISFIED" : "|satisfied");
- string str (buf);
- str += poolItem->asString();
+ ostringstream s;
+ s << str::form ("%-10s ", poolItem.status().isInstalled() ? "SATISFIED" : "|satisfied");
+ s << poolItem.resolvable();
- slist->push_back (str);
+ slist->push_back (s.str());
}
-
-
static void
print_sep (void)
{
- printf ("\n------------------------------------------------\n\n");
+ cout << endl << "------------------------------------------------" << endl << endl;
}
++c;
}
}
- printf ("Checksum = %x\n", checksum);
+ cout << str::form ("Checksum = %x", checksum) << endl;
for (ChecksumList::const_iterator iter = checksum_list.begin(); iter != checksum_list.end() && !is_dup; iter++) {
if (*iter == checksum) {
int satisfied = context->satisfyCount();
if (satisfied > 0) cout << ", satisfied=" << satisfied;
cout << endl;
- printf ("download size=%.1fk, install size=%.1fk\n", context->downloadSize() / 1024.0, context->installSize() / 1024.0);
- printf ("total priority=%d, min priority=%d, max priority=%d\n", context->totalPriority(), context->minPriority(), context->maxPriority());
- printf ("other penalties=%d\n", context->otherPenalties());
- printf ("- - - - - - - - - -\n");
+ cout << str::form ("download size=%.1fk, install size=%.1fk\n", context->downloadSize() / 1024.0, context->installSize() / 1024.0);
+ cout << str::form ("total priority=%d, min priority=%d, max priority=%d\n", context->totalPriority(), context->minPriority(), context->maxPriority());
+ cout << str::form ("other penalties=%d\n", context->otherPenalties());
+ cout << "- - - - - - - - - -" << endl;
if (instorder) {
cout << endl;
RESULT << "Installation Order:" << endl << endl;
- PoolItemList installs = context->getMarkeds(1);
+ PoolItemList installs = context->getMarked(1);
PoolItemList dummy;
InstallOrder order( globalPool, installs, dummy ); // sort according top prereq
order.init();
const PoolItemList & installorder ( order.getTopSorted() );
for (PoolItemList::const_iterator iter = installorder.begin(); iter != installorder.end(); iter++) {
- RESULT << (*iter)->asString() << endl;
+ RESULT << (*iter) << endl;
}
- printf ("- - - - - - - - - -\n");
+ cout << "- - - - - - - - - -" << endl;
}
fflush (stdout);
context->spewInfo ();
- if (getenv ("RC_SPEW")) printf ("%s\n", context->asString().c_str());
- fflush (stdout);
+ if (getenv ("RC_SPEW")) cout << context << endl;
}
+#if 0
//---------------------------------------------------------------------------------------------------------------------
#if 0
channel = get_channel (channel_name);
if (channel == NULL) {
- fprintf (stderr, "Can't find resolvable '%s': channel '%s' not defined\n", package_name.c_str(), channel_name.c_str());
+ cerr << "Can't find resolvable '" << package_name << "': channel '" << channel_name << "' not defined" << endl;
return NULL;
}
poolItem = world->findResItem (channel, package_name, kind);
if (poolItem == NULL) {
- fprintf (stderr, "Can't find resolvable '%s' in channel '%s': no such name/kind\n", package_name.c_str(), channel_name.c_str());
+ cerr << "Can't find resolvable '" << package_name << "' in channel '" << channel_name << "': no such name/kind" << endl;
return NULL;
}
WhatDependsOnInfo *info = (WhatDependsOnInfo *)data;
if (info->rs->insert (poolItem).second) {
if (info->first) {
- printf ("\t%s provides %s required by\n", info->poolItem->asString().c_str(), info->cap.asString().c_str());
+ cout << "\t" << info->poolItem.resolvable() << " provides " << info->cap << " required by" << endl;
info->first = false;
}
- printf ("\t\t%s for %s\n", poolItem->asString().c_str(), cap.asString().c_str());
+ cout << "\t\t" << poolItem.resolvable() << " for " << cap << endl;
}
return true;
}
{
PoolItemSet rs;
- printf ("\n\nWhat depends on '%s'\n", poolItem->asString().c_str());
+ cout << endl << endl << "What depends on '" << poolItem.resolvable() << "'" << endl;
WhatDependsOnInfo info;
info.rs = &rs;
{
string pathname = globalPath + filename;
- if (getenv ("RC_SPEW")) fprintf (stderr, "load_channel(%s,%s,%s,%s)\n", name.c_str(), pathname.c_str(), type.c_str(), system_packages?"system":"non-system");
-
ChannelType chan_type = system_packages ? CHANNEL_TYPE_SYSTEM : CHANNEL_TYPE_UNKNOWN;
Channel_Ptr channel;
unsigned int count;
chan_type = CHANNEL_TYPE_HELIX;
else if (type == "debian")
chan_type = CHANNEL_TYPE_DEBIAN;
-#if 0
- else
- printf ("Unknown channel type '%s', defaulting to helix\n", type.c_str());
-#endif
+
if (chan_type == CHANNEL_TYPE_UNKNOWN) { /* default to helix */
chan_type = CHANNEL_TYPE_HELIX;
}
if (chan_type == CHANNEL_TYPE_HELIX) {
count = extract_packages_from_helix_file (pathname, channel, add_to_world_cb, (void *)&store);
} else if (chan_type == CHANNEL_TYPE_DEBIAN) {
- fprintf (stderr, "Unsupported channel 'debian'\n");
+ cerr << "Unsupported channel 'debian'" << endl;
exit (1);
// count = extract_packages_from_debian_file (pathname, channel, add_to_world_cb, (void *)&store);
} else {
- fprintf (stderr, "Unsupported channel type\n");
+ cerr << "Unsupported channel type" << endl;
return;
}
- printf ("Loaded %d package%s from %s\n", count, count == 1 ? "" : "s", pathname.c_str()); fflush (stdout);
+ cout << "Loaded " << count << " package(s) from " << pathname << endl;
}
assertExit (node->equals("setup"));
if (done_setup) {
- fprintf (stderr, "Multiple <setup>..</setup> sections not allowed!\n");
+ cerr << "Multiple <setup>..</setup> sections not allowed!" << endl;
exit (0);
}
done_setup = true;
system_channel = world->getChannelById ("@system");
if (!system_channel)
- fprintf (stderr, "No system channel available!\n");
+ cerr << "No system channel available!" << endl;
PoolItem_Ref r = boost::const_pointer_cast<ResItem>(poolItem);
r->setChannel (system_channel);
r->setInstalled (true);
} else {
- fprintf (stderr, "Unknown package %s::%s\n", channel_name.c_str(), package_name.c_str());
+ cerr << "Unknown package %s::%s\n", channel_name.c_str(), package_name.c_str());
}
} else if (node->equals ("force-uninstall")) {
poolItem = get_poolItem ("@system", package_name, kind_name);
if (! poolItem) {
- fprintf (stderr, "Can't force-uninstall installed package '%s'\n", package_name.c_str());
+ cerr << "Can't force-uninstall installed package '%s'\n", package_name.c_str());
} else {
RESULT << "Force-uninstalling " << package_name << endl;
globalPool->remove (poolItem);
r->setLocked (true);
#endif
} else {
- fprintf (stderr, "Unknown package %s::%s\n", channel_name.c_str(), package_name.c_str());
+ cerr << "Unknown package %s::%s\n", channel_name.c_str(), package_name.c_str());
}
} else {
- fprintf (stderr, "Unrecognized tag '%s' in setup\n", node->name().c_str());
+ cerr << "Unrecognized tag '%s' in setup\n", node->name().c_str());
}
node = node->next();
int count = 1;
ChecksumList checksum_list;
- printf ("\n");
+ printf ("" << endl;
if (!resolver.completeQueues().empty()) {
printf ("Completed solutions: %ld\n", (long) resolver.completeQueues().size());
}
if (resolver.bestContext()) {
- printf ("\nBest Solution:\n\n");
+ printf ("\nBest Solution:\n" << endl;
print_solution (resolver.bestContext(), &count, checksum_list, instorder);
ResolverQueueList complete = resolver.completeQueues();
if (complete.size() > 1)
- printf ("\nOther Valid Solutions:\n\n");
+ printf ("\nOther Valid Solutions:\n" << endl;
if (complete.size() < 20) {
for (ResolverQueueList::const_iterator iter = complete.begin(); iter != complete.end(); iter++) {
ResolverQueueList invalid = resolver.invalidQueues();
if (invalid.size() < 20) {
- printf ("\n");
+ printf ("" << endl;
for (ResolverQueueList::const_iterator iter = invalid.begin(); iter != invalid.end(); iter++) {
ResolverQueue_Ptr queue = (*iter);
printf ("Failed Solution: \n%s\n", queue->context()->asString().c_str());
- printf ("- - - - - - - - - -\n");
+ printf ("- - - - - - - - - -" << endl;
queue->context()->spewInfo ();
fflush (stdout);
}
} else {
- printf ("(Not displaying more than 20 invalid solutions)\n");
+ printf ("(Not displaying more than 20 invalid solutions)" << endl;
}
fflush (stdout);
}
assertExit (node->equals ("trial"));
- if (getenv ("RC_SPEW_XML")) fprintf (stderr, "parse_xml_setup()\n");
+ if (getenv ("RC_SPEW_XML")) cerr << "parse_xml_setup()" << endl;
if (! done_setup) {
- fprintf (stderr, "Any trials must be preceeded by the setup!\n");
+ cerr << "Any trials must be preceeded by the setup!" << endl;
exit (0);
}
if (channel != NULL) {
resolver.setCurrentChannel (channel);
} else {
- fprintf (stderr, "Unknown channel '%s' (current)\n", channel_name.c_str());
+ cerr << "Unknown channel '%s' (current)\n", channel_name.c_str());
}
} else if (node->equals ("subscribe")) {
if (channel != NULL) {
channel->setSubscription (true);
} else {
- fprintf (stderr, "Unknown channel '%s' (subscribe)\n", channel_name.c_str());
+ cerr << "Unknown channel '%s' (subscribe)\n", channel_name.c_str());
}
} else if (node->equals ("install")) {
RESULT << "Installing " << package_name << " from channel " << channel_name << endl;;
resolver.addPoolItemToInstall (poolItem);
} else {
- fprintf (stderr, "Unknown package %s::%s\n", channel_name.c_str(), package_name.c_str());
+ cerr << "Unknown package %s::%s\n", channel_name.c_str(), package_name.c_str());
}
} else if (node->equals ("uninstall")) {
RESULT << "Uninstalling " << package_name << endl;
resolver.addPoolItemToRemove (poolItem);
} else {
- fprintf (stderr, "Unknown system package %s\n", package_name.c_str());
+ cerr << "Unknown system package %s\n", package_name.c_str());
}
} else if (node->equals ("upgrade")) {
poolItems = get_providing_poolItems (prov_name, kind_name);
if (poolItems.empty()) {
- fprintf (stderr, "None found\n");
+ cerr << "None found" << endl;
} else {
for (PoolItemSet::const_iterator iter = poolItems.begin(); iter != poolItems.end(); ++iter) {
printf ("%s\n", (*iter)->asString().c_str());
if (!prov_name.empty()) {
if (!package_name.empty()) {
- fprintf (stderr, "<whatdependson ...> can't have both package and provides.\n");
+ cerr << "<whatdependson ...> can't have both package and provides." << endl;
exit (1);
}
poolItems = get_providing_poolItems (prov_name, kind_name);
if (poolItem) poolItems.insert (poolItem);
}
if (poolItems.empty()) {
- fprintf (stderr, "Can't find matching package\n");
+ cerr << "Can't find matching package" << endl;
} else {
for (PoolItemSet::const_iterator iter = poolItems.begin(); iter != poolItems.end(); ++iter) {
PoolItemSet dependants = whatdependson (*iter);
}
} else {
- fprintf (stderr, "Unknown tag '%s' in trial\n", node->name().c_str());
+ cerr << "Unknown tag '%s' in trial\n", node->name().c_str());
}
node = node->next();
} else if (node->equals ("trial")) {
parse_xml_trial (node);
} else {
- fprintf (stderr, "Unknown tag '%s' in test\n", node->name().c_str());
+ cerr << "Unknown tag '%s' in test\n", node->name().c_str());
}
}
xml_doc = xmlParseFile (filename.c_str());
if (xml_doc == NULL) {
- fprintf (stderr, "Can't parse test file '%s'\n", filename.c_str());
+ cerr << "Can't parse test file '%s'\n", filename.c_str());
exit (0);
}
root = new XmlNode (xmlDocGetRootElement (xml_doc));
- if (getenv ("RC_SPEW_XML")) fprintf (stderr, "Parsing file '%s'\n", filename.c_str());
+ if (getenv ("RC_SPEW_XML")) cerr << "Parsing file '%s'\n", filename.c_str());
parse_xml_test (root);
//---------------------------------------------------------------------------------------------------------------------
+#endif
+
static void
init_libzypp (void)
{
// rc_version_set_global (rc_version_rpm_new()); // rpm is the default for GVersion
- World::setGlobalWorld (new MultiWorld());
+// World::setGlobalWorld (new MultiWorld());
}
int
setenv("ZYPP_NOLOG","1",1); // no logging
if (argc != 2) {
- fprintf (stderr, "Usage: deptestomatic testfile.xml\n");
+ cerr << "Usage: deptestomatic testfile.xml" << endl;
exit (0);
}
globalPath = argv[1];
globalPath = globalPath.substr (0, globalPath.find_last_of ("/") +1);
- world = World::globalWorld();
-
- if (getenv ("RC_SPEW_XML")) fprintf (stderr, "init_libzypp() done\n");
+ if (getenv ("RC_SPEW_XML")) cerr << "init_libzypp() done" << endl;
- process_xml_test_file (string (argv[1]));
+// process_xml_test_file (string (argv[1]));
return 0;
}