bool hasEqualId (const Channel & channel) const;
bool hasEqualId (constChannelPtr channel) const;
- //RCResolvableSList *rc_channel_get_resolvables (RCChannel *channel);
+ //RCResItemSList *rc_channel_get_resItems (RCChannel *channel);
// Distro target functions
#if 0
xmlNode *
-rc_resolvable_dep_or_slist_to_xml_node (RCResolvableDepSList *dep)
+rc_resItem_dep_or_slist_to_xml_node (RCResItemDepSList *dep)
{
xmlNode *or_node;
- const RCResolvableDepSList *dep_iter;
+ const RCResItemDepSList *dep_iter;
or_node = xmlNewNode (NULL, "or");
dep_iter = dep;
while (dep_iter) {
- RCResolvableDep *dep_item = (RCResolvableDep *)(dep_iter->data);
- xmlAddChild (or_node, rc_resolvable_dep_to_xml_node (dep_item));
+ RCResItemDep *dep_item = (RCResItemDep *)(dep_iter->data);
+ xmlAddChild (or_node, rc_resItem_dep_to_xml_node (dep_item));
dep_iter = dep_iter->next;
}
return or_node;
-} /* rc_resolvable_dep_or_slist_to_xml_node */
+} /* rc_resItem_dep_or_slist_to_xml_node */
xmlNode *
-rc_resolvable_dep_to_xml_node (RCResolvableDep *dep_item)
+rc_resItem_dep_to_xml_node (RCResItemDep *dep_item)
{
- RCResolvableSpec *spec = (RCResolvableSpec *) dep_item;
+ RCResItemSpec *spec = (RCResItemSpec *) dep_item;
xmlNode *dep_node;
- if (rc_resolvable_dep_is_or (dep_item)) {
- RCResolvableDepSList *dep_or_slist;
+ if (rc_resItem_dep_is_or (dep_item)) {
+ RCResItemDepSList *dep_or_slist;
dep_or_slist = rc_dep_string_to_or_dep_slist
- (rc_resolvable_spec_get_name (spec));
- dep_node = rc_resolvable_dep_or_slist_to_xml_node (dep_or_slist);
- rc_resolvable_dep_slist_free (dep_or_slist);
+ (rc_resItem_spec_get_name (spec));
+ dep_node = rc_resItem_dep_or_slist_to_xml_node (dep_or_slist);
+ rc_resItem_dep_slist_free (dep_or_slist);
return dep_node;
}
dep_node = xmlNewNode (NULL, "dep");
- xmlSetProp (dep_node, "name", rc_resolvable_spec_get_name (spec));
+ xmlSetProp (dep_node, "name", rc_resItem_spec_get_name (spec));
- if (rc_resolvable_dep_get_relation (dep_item) != Relation::Any) {
+ if (rc_resItem_dep_get_relation (dep_item) != Relation::Any) {
xmlSetProp (dep_node, "op",
- rc_resolvable_relation_to_string (
- rc_resolvable_dep_get_relation (dep_item), false));
+ rc_resItem_relation_to_string (
+ rc_resItem_dep_get_relation (dep_item), false));
- if (rc_resolvable_spec_has_epoch (spec)) {
+ if (rc_resItem_spec_has_epoch (spec)) {
gchar *tmp;
- tmp = g_strdup_printf ("%d", rc_resolvable_spec_get_epoch (spec));
+ tmp = g_strdup_printf ("%d", rc_resItem_spec_get_epoch (spec));
xmlSetProp (dep_node, "epoch", tmp);
g_free (tmp);
}
}
return (dep_node);
-} /* rc_resolvable_dep_to_xml_node */
+} /* rc_resItem_dep_to_xml_node */
#endif
bool or_dep = false,
bool pre_dep = false);
- Dependency (OrDependencyPtr or_dep); //RCResolvableDep *rc_dep_or_new_provide (RCDepOr *dor);
+ Dependency (OrDependencyPtr or_dep); //RCResItemDep *rc_dep_or_new_provide (RCDepOr *dor);
- Dependency (constXmlNodePtr node); //RCResolvableDep *rc_xml_node_to_resolvable_dep (const xmlNode *node);
+ Dependency (constXmlNodePtr node); //RCResItemDep *rc_xml_node_to_resItem_dep (const xmlNode *node);
virtual ~Dependency();
// ---------------------------------- I/O
- const xmlNodePtr asXmlNode (void) const; // xmlNode *rc_resolvable_dep_to_xml_node (RCResolvableDep *dep_item);
+ const xmlNodePtr asXmlNode (void) const; // xmlNode *rc_resItem_dep_to_xml_node (RCResItemDep *dep_item);
static std::string toString ( const Dependency & dep );
bool verifyRelation (constDependencyPtr prov) const;
};
-// xmlNode *rc_resolvable_dep_or_slist_to_xml_node (RCResolvableDepSList *dep);
+// xmlNode *rc_resItem_dep_or_slist_to_xml_node (RCResItemDepSList *dep);
///////////////////////////////////////////////////////////////////
}; // namespace ZYPP
Channel.h \
ChannelPtr.h \
Subscription.h \
- Resolvable.h \
- ResolvablePtr.h \
+ ResItem.h \
+ ResItemPtr.h \
Dependency.h \
DependencyPtr.h \
- ResolvableAndDependency.h \
- ResolvableAndDependencyPtr.h \
+ ResItemAndDependency.h \
+ ResItemAndDependencyPtr.h \
OrDependency.h \
OrDependencyPtr.h \
Package.h \
Spec.cc \
Channel.cc \
Subscription.cc \
- Resolvable.cc \
+ ResItem.cc \
Dependency.cc \
- ResolvableAndDependency.cc \
+ ResItemAndDependency.cc \
OrDependency.cc \
XmlNode.cc \
Importance.cc \
bool
-Match::test (constResolvablePtr resolvable, WorldPtr world) const
+Match::test (constResItemPtr resItem, WorldPtr world) const
{
string name;
- constChannelPtr channel = resolvable->channel ();
+ constChannelPtr channel = resItem->channel ();
if (channel != NULL && !_channel_id.empty()) {
if (! channel->hasEqualId (_channel_id)) {
}
}
- name = resolvable->name ();
+ name = resItem->name ();
// FIXME, implement regexp
#if 0
}
#endif
- /* FIXME: Resolvables don't have ResolvableUpdate right now */
+ /* FIXME: ResItems don't have ResItemUpdate right now */
/* if (match->importance != RC_IMPORTANCE_INVALID && */
-/* !rc_resolvable_is_installed (resolvable)) { */
-/* RCResolvableUpdate *up = rc_resolvable_get_latest_update (pkg); */
+/* !rc_resItem_is_installed (resItem)) { */
+/* RCResItemUpdate *up = rc_resItem_get_latest_update (pkg); */
/* if (up) { */
/* if (match->importance_gteq ? up->importance > match->importance */
/* : up->importance < match->importance) */
DependencyPtr dependency;
bool check;
- dependency = new Dependency (resolvable->name(), Relation::Equal, Kind::Package, resolvable->channel(), resolvable->edition());
+ dependency = new Dependency (resItem->name(), Relation::Equal, Kind::Package, resItem->channel(), resItem->edition());
check = _dependency->verifyRelation (dependency);
return check;
}
#include <zypp/solver/detail/MatchPtr.h>
#include <zypp/solver/detail/Channel.h>
#include <zypp/solver/detail/Importance.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItem.h>
#include <zypp/solver/detail/WorldPtr.h>
#include <zypp/solver/detail/XmlNode.h>
// equality
bool equals (const Match & match) const;
- bool test (constResolvablePtr resolvable, WorldPtr world) const;
+ bool test (constResItemPtr resItem, WorldPtr world) const;
};
///////////////////////////////////////////////////////////////////
bool _refreshed_ready;
- unsigned int _changed_resolvables_id;
+ unsigned int _changed_resItems_id;
unsigned int _changed_channels_id;
unsigned int _changed_subscriptions_id;
unsigned int _changed_locks_id;
SubWorldInfo::SubWorldInfo (WorldPtr subworld, MultiWorldPtr multiworld)
: _subworld (subworld)
- , _changed_resolvables_id (0)
+ , _changed_resItems_id (0)
, _changed_channels_id (0)
, _changed_subscriptions_id (0)
, _changed_locks_id (0)
{
#if 0
- _changed_resolvables_id =
+ _changed_resItems_id =
g_signal_connect (G_OBJECT (subworld),
- "changed_resolvables",
- (GCallback) changed_resolvables_cb,
+ "changed_resItems",
+ (GCallback) changed_resItems_cb,
world);
_changed_channels_id =
//---------------------------------------------------------------------------
-// Single resolvable queries
+// Single resItem queries
-constResolvablePtr
-MultiWorld::findInstalledResolvable (constResolvablePtr resolvable)
+constResItemPtr
+MultiWorld::findInstalledResItem (constResItemPtr resItem)
{
- constResolvablePtr installed;
+ constResItemPtr installed;
for (SubWorldInfoList::const_iterator iter = _subworlds.begin(); iter != _subworlds.end(); iter++) {
- installed = (*iter)->subworld()->findInstalledResolvable(resolvable);
+ installed = (*iter)->subworld()->findInstalledResItem(resItem);
if (installed != NULL)
return installed;
}
}
-constResolvablePtr
-MultiWorld::findResolvable (constChannelPtr channel, const char *name) const
+constResItemPtr
+MultiWorld::findResItem (constChannelPtr channel, const char *name) const
{
- constResolvablePtr resolvable;
+ constResItemPtr resItem;
for (SubWorldInfoList::const_iterator iter = _subworlds.begin(); iter != _subworlds.end(); iter++) {
- resolvable = (*iter)->subworld()->findResolvable(channel, name);
- if (resolvable != NULL)
- return resolvable;
+ resItem = (*iter)->subworld()->findResItem(channel, name);
+ if (resItem != NULL)
+ return resItem;
}
return NULL;
}
-constResolvablePtr
-MultiWorld::findResolvableWithConstraint (constChannelPtr channel, const char *name, constDependencyPtr constraint, bool is_and) const
+constResItemPtr
+MultiWorld::findResItemWithConstraint (constChannelPtr channel, const char *name, constDependencyPtr constraint, bool is_and) const
{
- constResolvablePtr resolvable;
+ constResItemPtr resItem;
for (SubWorldInfoList::const_iterator iter = _subworlds.begin(); iter != _subworlds.end(); iter++) {
- resolvable = (*iter)->subworld()->findResolvableWithConstraint(channel, name, constraint, is_and);
- if (resolvable != NULL)
- return resolvable;
+ resItem = (*iter)->subworld()->findResItemWithConstraint(channel, name, constraint, is_and);
+ if (resItem != NULL)
+ return resItem;
}
return NULL;
}
ChannelPtr
-MultiWorld::guessResolvableChannel (constResolvablePtr resolvable) const
+MultiWorld::guessResItemChannel (constResItemPtr resItem) const
{
ChannelPtr channel;
for (SubWorldInfoList::const_iterator iter = _subworlds.begin(); iter != _subworlds.end(); iter++) {
- channel = (*iter)->subworld()->guessResolvableChannel(resolvable);
+ channel = (*iter)->subworld()->guessResItemChannel(resItem);
if (channel != NULL)
return channel;
}
}
//---------------------------------------------------------------------------
-// iterate over resolvables
+// iterate over resItems
int
-MultiWorld::foreachResolvable (ChannelPtr channel, CResolvableFn fn, void *data)
+MultiWorld::foreachResItem (ChannelPtr channel, CResItemFn fn, void *data)
{
- return foreachResolvableByName ("", channel, fn, data);
+ return foreachResItemByName ("", channel, fn, data);
}
int
-MultiWorld::foreachResolvableByName (const std::string & name, ChannelPtr channel, CResolvableFn fn, void *data)
+MultiWorld::foreachResItemByName (const std::string & name, ChannelPtr channel, CResItemFn fn, void *data)
{
int count = 0;
for (SubWorldInfoList::const_iterator iter = _subworlds.begin(); iter != _subworlds.end(); iter++) {
int this_count;
- this_count = (*iter)->subworld()->foreachResolvableByName(name, channel, fn, data);
+ this_count = (*iter)->subworld()->foreachResItemByName(name, channel, fn, data);
if (this_count < 0)
return -1;
count += this_count;
int
-MultiWorld::foreachResolvableByMatch (constMatchPtr match, CResolvableFn fn, void *data)
+MultiWorld::foreachResItemByMatch (constMatchPtr match, CResItemFn fn, void *data)
{
- fprintf (stderr, "MultiWorld::foreachResolvableByMatch not implemented\n");
+ fprintf (stderr, "MultiWorld::foreachResItemByMatch not implemented\n");
return 0;
}
//-----------------------------------------------------------------------------
-// iterater over resolvables with dependency
+// iterater over resItems with dependency
int
-MultiWorld::foreachProvidingResolvable (constDependencyPtr dep, ResolvableAndSpecFn fn, void *data)
+MultiWorld::foreachProvidingResItem (constDependencyPtr dep, ResItemAndSpecFn fn, void *data)
{
int count = 0;
for (SubWorldInfoList::const_iterator iter = _subworlds.begin(); iter != _subworlds.end(); iter++) {
int this_count;
- this_count = (*iter)->subworld()->foreachProvidingResolvable (dep, fn, data);
+ this_count = (*iter)->subworld()->foreachProvidingResItem (dep, fn, data);
if (this_count < 0)
return -1;
count += this_count;
}
int
-MultiWorld::foreachRequiringResolvable (constDependencyPtr dep, ResolvableAndDepFn fn, void *data)
+MultiWorld::foreachRequiringResItem (constDependencyPtr dep, ResItemAndDepFn fn, void *data)
{
int count = 0;
for (SubWorldInfoList::const_iterator iter = _subworlds.begin(); iter != _subworlds.end(); iter++) {
int this_count;
- this_count = (*iter)->subworld()->foreachRequiringResolvable (dep, fn, data);
+ this_count = (*iter)->subworld()->foreachRequiringResItem (dep, fn, data);
if (this_count < 0)
return -1;
count += this_count;
}
int
-MultiWorld::foreachConflictingResolvable (constDependencyPtr dep, ResolvableAndDepFn fn, void *data)
+MultiWorld::foreachConflictingResItem (constDependencyPtr dep, ResItemAndDepFn fn, void *data)
{
int count = 0;
for (SubWorldInfoList::const_iterator iter = _subworlds.begin(); iter != _subworlds.end(); iter++) {
int this_count;
- this_count = (*iter)->subworld()->foreachConflictingResolvable (dep, fn, data);
+ this_count = (*iter)->subworld()->foreachConflictingResItem (dep, fn, data);
if (this_count < 0)
return -1;
count += this_count;
//-----------------------------------------------------------------------------
-// iterater over resolvables with locks
+// iterater over resItems with locks
int
MultiWorld::foreachLock (MatchFn fn, void *data) const
virtual ChannelPtr getChannelByName (const char *channel_name) const;
virtual ChannelPtr getChannelByAlias (const char *alias) const;
virtual ChannelPtr getChannelById (const char *channel_id) const;
- virtual ChannelPtr guessResolvableChannel (constResolvablePtr resolvable) const;
+ virtual ChannelPtr guessResItemChannel (constResItemPtr resItem) const;
virtual int foreachChannel (ChannelFn fn, void *data) const;
int foreachSubworld (WorldFn callback, void *user_data);
ServiceWorldPtr lookupServiceById (const char *id);
bool mountService (const char *url, void *error); // GError **error);
- // Single resolvable queries
+ // Single resItem queries
- virtual constResolvablePtr findInstalledResolvable (constResolvablePtr resolvable);
- virtual constResolvablePtr findResolvable (constChannelPtr channel, const char *name) const;
- virtual constResolvablePtr findResolvableWithConstraint (constChannelPtr channel, const char *name, constDependencyPtr constraint, bool is_and) const;
+ virtual constResItemPtr findInstalledResItem (constResItemPtr resItem);
+ virtual constResItemPtr findResItem (constChannelPtr channel, const char *name) const;
+ virtual constResItemPtr findResItemWithConstraint (constChannelPtr channel, const char *name, constDependencyPtr constraint, bool is_and) const;
- // Iterate over resolvables
+ // Iterate over resItems
- virtual int foreachResolvable (ChannelPtr channel, CResolvableFn fn, void *data);
- virtual int foreachResolvableByName (const std::string & name, ChannelPtr channel, CResolvableFn fn, void *data);
- virtual int foreachResolvableByMatch (constMatchPtr match, CResolvableFn fn, void *data);
+ virtual int foreachResItem (ChannelPtr channel, CResItemFn fn, void *data);
+ virtual int foreachResItemByName (const std::string & name, ChannelPtr channel, CResItemFn fn, void *data);
+ virtual int foreachResItemByMatch (constMatchPtr match, CResItemFn fn, void *data);
// Iterate across provides or requirement
- virtual int foreachProvidingResolvable (constDependencyPtr dep, ResolvableAndSpecFn fn, void *data);
- virtual int foreachRequiringResolvable (constDependencyPtr dep, ResolvableAndDepFn fn, void *data);
- virtual int foreachConflictingResolvable (constDependencyPtr dep, ResolvableAndDepFn fn, void *data);
+ virtual int foreachProvidingResItem (constDependencyPtr dep, ResItemAndSpecFn fn, void *data);
+ virtual int foreachRequiringResItem (constDependencyPtr dep, ResItemAndDepFn fn, void *data);
+ virtual int foreachConflictingResItem (constDependencyPtr dep, ResItemAndDepFn fn, void *data);
// locks
Package::toString ( const Package & package, bool full )
{
string ret;
- ret += Resolvable::toString(package, full);
+ ret += ResItem::toString(package, full);
if (full) {
// if (package._section != NULL) ret += (string ("<section '") + package._section->asString() + "'/>");
// if (!package._pretty_name.empty()) ret += (string ("<pretty_name '") + package._pretty_name + "'/>");
//---------------------------------------------------------------------------
Package::Package (constChannelPtr channel)
- : Resolvable (Kind::Package, "")
+ : ResItem (Kind::Package, "")
, _section (NULL)
, _pretty_name ("")
, _summary ("")
Package::Package (constXmlNodePtr node, constChannelPtr channel)
- : Resolvable (Kind::Package, "")
+ : ResItem (Kind::Package, "")
, _section (NULL)
, _pretty_name ("")
, _summary ("")
for (PackageUpdateList::const_iterator l = _history.begin(); l != _history.end(); l++) {
PackageUpdatePtr update = *l;
- constResolvablePtr installed;
+ constResItemPtr installed;
if (!update->equals (latest)) {
return NULL;
}
/* see if the required parent for this patch is installed */
- installed = world->findInstalledResolvable (update->parent());
+ installed = world->findInstalledResItem (update->parent());
if (installed != NULL &&
installed->equals(update->parent()))
xmlNode *package_node;
xmlNode *tmp_node;
xmlNode *deps_node;
- RCResolvable *r;
- RCResolvableSpec *spec;
+ RCResItem *r;
+ RCResItemSpec *spec;
RCPackageUpdateSList *history_iter;
int i;
char buffer[128];
char *tmp_str;
r = RC_RESOLVABLE (package);
- spec = rc_resolvable_get_spec (r);
+ spec = rc_resItem_get_spec (r);
package_node = xmlNewNode (NULL, "package");
- xmlNewTextChild (package_node, NULL, "name", rc_resolvable_get_name (r));
+ xmlNewTextChild (package_node, NULL, "name", rc_resItem_get_name (r));
if (spec->has_epoch) {
g_snprintf (buffer, 128, "%d", spec->epoch);
xmlNewTextChild (package_node, NULL, "section",
rc_package_section_to_string (package->section));
- g_snprintf (buffer, 128, "%u", rc_resolvable_get_file_size (r));
+ g_snprintf (buffer, 128, "%u", rc_resItem_get_file_size (r));
xmlNewTextChild (package_node, NULL, "filesize", buffer);
- g_snprintf (buffer, 128, "%u", rc_resolvable_get_installed_size (r));
+ g_snprintf (buffer, 128, "%u", rc_resItem_get_installed_size (r));
xmlNewTextChild (package_node, NULL, "installedsize", buffer);
if (package->install_only) {
if (r->requires_a) {
tmp_node = xmlNewChild (deps_node, NULL, "requires", NULL);
for (i = 0; i < r->requires_a->len; i++) {
- RCResolvableDep *dep = r->requires_a->data[i];
+ RCResItemDep *dep = r->requires_a->data[i];
- xmlAddChild (tmp_node, rc_resolvable_dep_to_xml_node (dep));
+ xmlAddChild (tmp_node, rc_resItem_dep_to_xml_node (dep));
}
}
if (r->recommends_a) {
tmp_node = xmlNewChild (deps_node, NULL, "recommends", NULL);
for (i = 0; i < r->recommends_a->len; i++) {
- RCResolvableDep *dep = r->recommends_a->data[i];
+ RCResItemDep *dep = r->recommends_a->data[i];
- xmlAddChild (tmp_node, rc_resolvable_dep_to_xml_node (dep));
+ xmlAddChild (tmp_node, rc_resItem_dep_to_xml_node (dep));
}
}
if (r->suggests_a) {
tmp_node = xmlNewChild (deps_node, NULL, "suggests", NULL);
for (i = 0; i < r->suggests_a->len; i++) {
- RCResolvableDep *dep = r->suggests_a->data[i];
+ RCResItemDep *dep = r->suggests_a->data[i];
- xmlAddChild (tmp_node, rc_resolvable_dep_to_xml_node (dep));
+ xmlAddChild (tmp_node, rc_resItem_dep_to_xml_node (dep));
}
}
if (r->conflicts_a) {
tmp_node = xmlNewChild (deps_node, NULL, "conflicts", NULL);
for (i = 0; i < r->conflicts_a->len; i++) {
- RCResolvableDep *dep = r->conflicts_a->data[i];
+ RCResItemDep *dep = r->conflicts_a->data[i];
- xmlAddChild (tmp_node, rc_resolvable_dep_to_xml_node (dep));
+ xmlAddChild (tmp_node, rc_resItem_dep_to_xml_node (dep));
}
}
if (r->obsoletes_a) {
tmp_node = xmlNewChild (deps_node, NULL, "obsoletes", NULL);
for (i = 0; i < r->obsoletes_a->len; i++) {
- RCResolvableDep *dep = r->obsoletes_a->data[i];
+ RCResItemDep *dep = r->obsoletes_a->data[i];
- xmlAddChild (tmp_node, rc_resolvable_dep_to_xml_node (dep));
+ xmlAddChild (tmp_node, rc_resItem_dep_to_xml_node (dep));
}
}
if (r->provides_a) {
tmp_node = xmlNewChild (deps_node, NULL, "provides", NULL);
for (i = 0; i < r->provides_a->len; i++) {
- RCResolvableDep *dep = r->provides_a->data[i];
+ RCResItemDep *dep = r->provides_a->data[i];
- xmlAddChild (tmp_node, rc_resolvable_dep_to_xml_node (dep));
+ xmlAddChild (tmp_node, rc_resItem_dep_to_xml_node (dep));
}
}
#include <zypp/solver/detail/PackagePtr.h>
#include <zypp/solver/detail/PackageUpdatePtr.h>
#include <zypp/solver/detail/Section.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItem.h>
#include <zypp/solver/detail/XmlNode.h>
///////////////////////////////////////////////////////////////////
*
**/
-class Package : public Resolvable {
+class Package : public ResItem {
REP_BODY(Package);
private:
#include <zypp/solver/detail/QueueItemPtr.h>
#include <zypp/solver/detail/ResolverContextPtr.h>
#include <zypp/solver/detail/ResolverInfo.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItem.h>
#include <zypp/solver/detail/Dependency.h>
#include <zypp/solver/detail/Channel.h>
#include <string.h>
#include <zypp/solver/detail/QueueItemBranchPtr.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItem.h>
#include <zypp/solver/detail/Dependency.h>
#include <zypp/solver/detail/Channel.h>
string res = "[Conflict: ";
res += item._dep->asString();
res += ", Triggered by ";
- res += item._conflicting_resolvable->asString();
+ res += item._conflicting_resItem->asString();
if (item._actually_an_obsolete) res += ", Obsolete !";
res += "]";
return res;
//---------------------------------------------------------------------------
-QueueItemConflict::QueueItemConflict (WorldPtr world, constDependencyPtr dep, constResolvablePtr resolvable)
+QueueItemConflict::QueueItemConflict (WorldPtr world, constDependencyPtr dep, constResItemPtr resItem)
: QueueItem (QUEUE_ITEM_TYPE_CONFLICT, world)
, _dep (dep)
- , _conflicting_resolvable (resolvable)
+ , _conflicting_resItem (resItem)
, _actually_an_obsolete (false)
{
}
#if PHI
-// on conflict, try to find upgrade candidates for the installed resolvable triggering the conflict
+// on conflict, try to find upgrade candidates for the installed resItem triggering the conflict
// there are cases where upgrading prevents the conflict
-// rc tends to uninstall the resolvable
-// phi tends to upgrade the resolvable
+// rc tends to uninstall the resItem
+// phi tends to upgrade the resItem
// testcases: exercise-02conflict-08-test.xml, exercise-02conflict-09-test.xml
typedef struct {
ResolverContextPtr context;
- CResolvableList upgrades;
+ CResItemList upgrades;
} UpgradeCandidateInfo;
static bool
-upgrade_candidates_cb (constResolvablePtr resolvable, constSpecPtr spec, void *data)
+upgrade_candidates_cb (constResItemPtr resItem, constSpecPtr spec, void *data)
{
-//fprintf (stderr, "upgrade_candidates_cb(%s,%s)\n", resolvable->asString().c_str(), spec->asString().c_str());
+//fprintf (stderr, "upgrade_candidates_cb(%s,%s)\n", resItem->asString().c_str(), spec->asString().c_str());
UpgradeCandidateInfo *info = (UpgradeCandidateInfo *)data;
- if (info->context->getStatus (resolvable) == RESOLVABLE_STATUS_UNINSTALLED) {
- info->upgrades.push_back (resolvable);
+ if (info->context->getStatus (resItem) == RESOLVABLE_STATUS_UNINSTALLED) {
+ info->upgrades.push_back (resItem);
}
return true;
}
typedef struct {
WorldPtr world;
- constResolvablePtr conflicting_resolvable;
+ constResItemPtr conflicting_resItem;
constDependencyPtr dep;
ResolverContextPtr context;
QueueItemList & new_items;
static bool
-conflict_process_cb (constResolvablePtr resolvable, constSpecPtr spec, void *data)
+conflict_process_cb (constResItemPtr resItem, constSpecPtr spec, void *data)
{
ConflictProcessInfo *info = (ConflictProcessInfo *)data;
- ResolvableStatus status;
+ ResItemStatus status;
string pkg_str, spec_str, msg;
ResolverInfoPtr log_info;
- if (getenv ("RC_SPEW")) fprintf (stderr, "conflict_process_cb (resolvable[%s], spec[%s], info [%s]\n", resolvable->asString().c_str(), spec->asString().c_str(), info->conflicting_resolvable->asString().c_str());
- if (getenv ("RC_SPEW")) fprintf (stderr, "conflict_process_cb (resolvable equals spec: %s, info->dep [%s]\n", resolvable->equals(spec) ? "YES" : "NO", info->dep->asString().c_str());
+ if (getenv ("RC_SPEW")) fprintf (stderr, "conflict_process_cb (resItem[%s], spec[%s], info [%s]\n", resItem->asString().c_str(), spec->asString().c_str(), info->conflicting_resItem->asString().c_str());
+ if (getenv ("RC_SPEW")) fprintf (stderr, "conflict_process_cb (resItem equals spec: %s, info->dep [%s]\n", resItem->equals(spec) ? "YES" : "NO", info->dep->asString().c_str());
/* 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
- * resolvable with this provide may exist on the system at a time. */
+ * resItem with this provide may exist on the system at a time. */
- if (info->conflicting_resolvable
- && resolvable->equals (info->conflicting_resolvable)) {
+ if (info->conflicting_resItem
+ && resItem->equals (info->conflicting_resItem)) {
return true;
}
/* FIXME: This should probably be a GVersion capability. */
- /* Obsoletes don't apply to virtual provides, only the resolvables
+ /* Obsoletes don't apply to virtual provides, only the resItems
* themselves. A provide is "virtual" if it's not the same spec
- * as the resolvable that's providing it. This, of course, only
+ * as the resItem that's providing it. This, of course, only
* applies to RPM, since it's the only one with obsoletes right
* now. */
if (info->actually_an_obsolete
- && !(resolvable->equals(spec)))
+ && !(resItem->equals(spec)))
{
return true;
}
- pkg_str = resolvable->asString();
+ pkg_str = resItem->asString();
spec_str = spec->asString();
- status = info->context->getStatus (resolvable);
+ status = info->context->getStatus (resItem);
- if (getenv ("RC_SPEW")) fprintf (stderr, "conflict_process_cb (resolvable[%s]<%s>\n", resolvable->asString().c_str(), ResolverContext::toString(status).c_str());
+ if (getenv ("RC_SPEW")) fprintf (stderr, "conflict_process_cb (resItem[%s]<%s>\n", resItem->asString().c_str(), ResolverContext::toString(status).c_str());
switch (status) {
#if PHI
// maybe an upgrade can resolve the conflict ?
- // check if other resolvable is available which upgrades
+ // check if other resItem is available which upgrades
// find non-installed packages which provide the conflicting name
UpgradeCandidateInfo upgrade_info;
upgrade_info.context = info->context;
- DependencyPtr maybe_upgrade_dep = new Dependency (resolvable->name(), Relation::Any, Kind::Package, new Channel (CHANNEL_TYPE_NONSYSTEM), -1);
- info->world->foreachProvidingResolvable (maybe_upgrade_dep, upgrade_candidates_cb, (void *)&upgrade_info);
+ DependencyPtr maybe_upgrade_dep = new Dependency (resItem->name(), Relation::Any, Kind::Package, new Channel (CHANNEL_TYPE_NONSYSTEM), -1);
+ info->world->foreachProvidingResItem (maybe_upgrade_dep, upgrade_candidates_cb, (void *)&upgrade_info);
#endif
- uninstall = new QueueItemUninstall (info->world, resolvable, "conflict");
+ uninstall = new QueueItemUninstall (info->world, resItem, "conflict");
uninstall->setDependency (info->dep);
if (info->actually_an_obsolete) {
uninstall->setDueToObsolete ();
- log_info = new ResolverInfoObsoletes (resolvable, info->conflicting_resolvable);
+ log_info = new ResolverInfoObsoletes (resItem, info->conflicting_resItem);
} else {
uninstall->setDueToConflict ();
- log_info = new ResolverInfoConflictsWith (resolvable, info->conflicting_resolvable);
+ log_info = new ResolverInfoConflictsWith (resItem, info->conflicting_resItem);
}
uninstall->addInfo (log_info);
#if PHI
}
else {
- // there are upgrade candidates for the conflicting resolvable
- // branch to: 1. uninstall, 2. upgrade (for each upgrading resolvable)
+ // there are upgrade candidates for the conflicting resItem
+ // branch to: 1. uninstall, 2. upgrade (for each upgrading resItem)
QueueItemBranchPtr branch = new QueueItemBranch (info->world);
branch->addItem (uninstall); // try uninstall
- for (CResolvableList::const_iterator iter = upgrade_info.upgrades.begin(); iter != upgrade_info.upgrades.end(); iter++) {
+ for (CResItemList::const_iterator iter = upgrade_info.upgrades.begin(); iter != upgrade_info.upgrades.end(); iter++) {
QueueItemInstallPtr upgrade = new QueueItemInstall (info->world, *iter);
- upgrade->setUpgrades (resolvable);
+ upgrade->setUpgrades (resItem);
branch->addItem (upgrade); // try upgrade
}
info->new_items.push_back (branch);
}
case RESOLVABLE_STATUS_TO_BE_INSTALLED: {
- msg = string ("A conflict over ") + info->dep_str + " (" + spec_str + ") requires the removal of the to-be-installed resolvable " + pkg_str;
+ msg = string ("A conflict over ") + info->dep_str + " (" + spec_str + ") requires the removal of the to-be-installed resItem " + pkg_str;
- ResolverInfoMiscPtr misc_info = new ResolverInfoMisc (resolvable,RESOLVER_INFO_PRIORITY_VERBOSE, msg);
+ ResolverInfoMiscPtr misc_info = new ResolverInfoMisc (resItem,RESOLVER_INFO_PRIORITY_VERBOSE, msg);
misc_info->flagAsError ();
- if (info->conflicting_resolvable) {
- misc_info->addRelatedResolvable (info->conflicting_resolvable);
+ if (info->conflicting_resItem) {
+ misc_info->addRelatedResItem (info->conflicting_resItem);
}
info->context->addInfo (misc_info);
}
case RESOLVABLE_STATUS_UNINSTALLED: {
- info->context->setStatus (resolvable, RESOLVABLE_STATUS_TO_BE_UNINSTALLED);
+ info->context->setStatus (resItem, RESOLVABLE_STATUS_TO_BE_UNINSTALLED);
msg = string ("Marking ") + pkg_str + " as uninstallable due to conflicts over " + info->dep_str + " (" + spec_str + ")";
if (!(info->pkg_str.empty())) {
msg += " from ";
ResolverInfoMiscPtr misc_info = new ResolverInfoMisc (NULL, RESOLVER_INFO_PRIORITY_VERBOSE, msg);
- misc_info->addRelatedResolvable (resolvable);
- if (info->conflicting_resolvable) {
- misc_info->addRelatedResolvable(info->conflicting_resolvable);
+ misc_info->addRelatedResItem (resItem);
+ if (info->conflicting_resItem) {
+ misc_info->addRelatedResItem(info->conflicting_resItem);
}
info->context->addInfo (misc_info);
{
if (getenv ("RC_SPEW")) fprintf (stderr, "QueueItemConflict::process(%s)\n", this->asString().c_str());
- ConflictProcessInfo info = { world(), _conflicting_resolvable, _dep, context, new_items, "", "", _actually_an_obsolete };
+ ConflictProcessInfo info = { world(), _conflicting_resItem, _dep, context, new_items, "", "", _actually_an_obsolete };
- if (_conflicting_resolvable) {
- info.pkg_str = _conflicting_resolvable->asString();
+ if (_conflicting_resItem) {
+ info.pkg_str = _conflicting_resItem->asString();
}
info.dep_str = _dep->relation().asString() + " " + ((constSpecPtr)_dep)->asString();
- world()->foreachProvidingResolvable (_dep, conflict_process_cb, (void *)&info);
+ world()->foreachProvidingResItem (_dep, conflict_process_cb, (void *)&info);
// FIXME: free self
QueueItemPtr
QueueItemConflict::copy (void) const
{
- QueueItemConflictPtr new_conflict = new QueueItemConflict (world(), _dep, _conflicting_resolvable);
+ QueueItemConflictPtr new_conflict = new QueueItemConflict (world(), _dep, _conflicting_resItem);
((QueueItemPtr)new_conflict)->copy((constQueueItemPtr)this);
// _actually_an_obsolete is not being copied !
#include <string.h>
#include <zypp/solver/detail/QueueItemConflictPtr.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItem.h>
#include <zypp/solver/detail/Dependency.h>
#include <zypp/solver/detail/Channel.h>
private:
constDependencyPtr _dep;
- constResolvablePtr _conflicting_resolvable;
+ constResItemPtr _conflicting_resItem;
bool _actually_an_obsolete;
public:
- QueueItemConflict (WorldPtr world, constDependencyPtr dep, constResolvablePtr resolvable);
+ QueueItemConflict (WorldPtr world, constDependencyPtr dep, constResItemPtr resItem);
virtual ~QueueItemConflict();
// ---------------------------------- I/O
#include <string.h>
#include <zypp/solver/detail/QueueItemGroupPtr.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItem.h>
#include <zypp/solver/detail/Dependency.h>
#include <zypp/solver/detail/Channel.h>
#include <zypp/solver/detail/ResolverInfoConflictsWith.h>
#include <zypp/solver/detail/ResolverInfoMisc.h>
#include <zypp/solver/detail/ResolverInfoNeededBy.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItem.h>
#include <zypp/solver/detail/Version.h>
#include <zypp/solver/detail/World.h>
-#include <zypp/solver/detail/ResolvableAndDependency.h>
+#include <zypp/solver/detail/ResItemAndDependency.h>
///////////////////////////////////////////////////////////////////
namespace ZYPP {
QueueItemInstall::toString ( const QueueItemInstall & item)
{
string ret = "[Install: ";
- ret += item._resolvable->asString();
+ ret += item._resItem->asString();
if (item._upgrades != NULL) {
ret += ", Upgrades ";
ret += item._upgrades->asString();
}
if (!item._needed_by.empty()) {
ret += ", Needed by ";
- ret += Resolvable::toString(item._needed_by);
+ ret += ResItem::toString(item._needed_by);
}
if (item._explicitly_requested) ret += ", Explicit !";
ret += "]";
//---------------------------------------------------------------------------
-QueueItemInstall::QueueItemInstall (WorldPtr world, constResolvablePtr resolvable)
+QueueItemInstall::QueueItemInstall (WorldPtr world, constResItemPtr resItem)
: QueueItem (QUEUE_ITEM_TYPE_INSTALL, world)
- , _resolvable (resolvable)
+ , _resItem (resItem)
, _channel_priority (0)
, _other_penalty (0)
, _explicitly_requested (false)
{
- constResolvablePtr upgrades = world->findInstalledResolvable (resolvable);
- if (getenv("RC_SPEW")) fprintf (stderr, "QueueItemInstall::QueueItemInstall(%s) upgrades %s\n", resolvable->asString().c_str(), upgrades!=NULL?upgrades->asString().c_str():"nothing");
+ 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");
if (upgrades
- && ! (((constSpecPtr)upgrades)->equals (resolvable))) {
+ && ! (((constSpecPtr)upgrades)->equals (resItem))) {
setUpgrades(upgrades);
}
}
bool
QueueItemInstall::isSatisfied (ResolverContextPtr context) const
{
- return context->resolvableIsPresent (_resolvable);
+ return context->resItemIsPresent (_resItem);
}
//---------------------------------------------------------------------------
-// Handle system resolvable's that conflict with us -> uninstall them
+// Handle system resItem's that conflict with us -> uninstall them
static bool
-build_conflict_list (constResolvablePtr resolvable, constDependencyPtr dep, void *data)
+build_conflict_list (constResItemPtr resItem, constDependencyPtr dep, void *data)
{
- CResolvableList *rl = (CResolvableList *)data;
- rl->push_front (resolvable);
+ CResItemList *rl = (CResItemList *)data;
+ rl->push_front (resItem);
return true;
}
{
if (getenv ("RC_SPEW")) fprintf (stderr, "QueueItemInstall::process(%s)\n", this->asString().c_str());
- constResolvablePtr resolvable = _resolvable;
- string pkg_name = resolvable->asString();
+ constResItemPtr resItem = _resItem;
+ string pkg_name = resItem->asString();
string msg;
- ResolvableStatus status = context->getStatus (resolvable);
+ ResItemStatus status = context->getStatus (resItem);
CDependencyList deps;
- CResolvableList conflicts;
+ CResItemList conflicts;
- /* If we are trying to upgrade resolvable A with resolvable B and they both have the
+ /* If we are trying to upgrade resItem A with resItem B and they both have the
same version number, do nothing. This shouldn't happen in general with
red-carpet, but can come up with the installer & autopull. */
if (_upgrades
- && ((constSpecPtr)_resolvable)->equals (_upgrades)) {
+ && ((constSpecPtr)_resItem)->equals (_upgrades)) {
ResolverInfoPtr info;
- if (getenv ("RC_SPEW")) fprintf (stderr, "upgrades equal resolvable, skipping\n");
+ if (getenv ("RC_SPEW")) fprintf (stderr, "upgrades equal resItem, skipping\n");
msg = string("Skipping ") + pkg_name + (": already installed");
- info = new ResolverInfoMisc (_resolvable, RESOLVER_INFO_PRIORITY_VERBOSE, msg);
+ info = new ResolverInfoMisc (_resItem, RESOLVER_INFO_PRIORITY_VERBOSE, msg);
context->addInfo (info);
goto finished;
}
if (getenv ("RC_SPEW")) fprintf (stderr, "still needed ");
- for (CResolvableList::const_iterator iter = _needed_by.begin(); iter != _needed_by.end() && !still_needed; iter++) {
- ResolvableStatus status = context->getStatus (*iter);
+ 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());
- if (! resolvable_status_is_to_be_uninstalled (status)) {
+ if (! resItem_status_is_to_be_uninstalled (status)) {
still_needed = true;
}
}
needed this. */
if (context->verifying()
- && resolvable_status_is_to_be_uninstalled (context->getStatus (resolvable))
+ && resItem_status_is_to_be_uninstalled (context->getStatus (resItem))
&& !_needed_by.empty()) {
QueueItemUninstallPtr uninstall_item;
- for (CResolvableList::const_iterator iter = _needed_by.begin(); iter != _needed_by.end(); iter++) {
- uninstall_item = new QueueItemUninstall (world(), *iter, "uninstallable resolvable");
+ for (CResItemList::const_iterator iter = _needed_by.begin(); iter != _needed_by.end(); iter++) {
+ uninstall_item = new QueueItemUninstall (world(), *iter, "uninstallable resItem");
qil.push_front (uninstall_item);
}
if (_upgrades == NULL) {
- if (getenv ("RC_SPEW")) fprintf (stderr, "simple install of %s\n", resolvable->asString(true).c_str());
+ if (getenv ("RC_SPEW")) fprintf (stderr, "simple install of %s\n", resItem->asString(true).c_str());
- context->installResolvable (resolvable, context->verifying(), /* is_soft */ _other_penalty);
+ context->installResItem (resItem, context->verifying(), /* is_soft */ _other_penalty);
} else {
QueueItemUninstallPtr uninstall_item;
- if (getenv ("RC_SPEW")) fprintf (stderr, "upgrade install of %s\n", resolvable->asString().c_str());
+ if (getenv ("RC_SPEW")) fprintf (stderr, "upgrade install of %s\n", resItem->asString().c_str());
- context->upgradeResolvable (resolvable, _upgrades, context->verifying(), /* is_soft */ _other_penalty);
+ context->upgradeResItem (resItem, _upgrades, context->verifying(), /* is_soft */ _other_penalty);
uninstall_item = new QueueItemUninstall (world(), _upgrades, "upgrade");
- uninstall_item->setUpgradedTo (resolvable);
+ uninstall_item->setUpgradedTo (resItem);
if (_explicitly_requested)
uninstall_item->setExplicitlyRequested ();
qil.push_front (uninstall_item);
}
- /* Log which resolvable need this install */
+ /* Log which resItem need this install */
if (!_needed_by.empty()) {
ResolverInfoNeededByPtr info;
- info = new ResolverInfoNeededBy (resolvable);
- info->addRelatedResolvableList (_needed_by);
+ info = new ResolverInfoNeededBy (resItem);
+ info->addRelatedResItemList (_needed_by);
context->addInfo (info);
}
msg = string ("Installing ") + pkg_name;
}
- context->addInfoString (resolvable, RESOLVER_INFO_PRIORITY_VERBOSE, msg);
+ context->addInfoString (resItem, RESOLVER_INFO_PRIORITY_VERBOSE, msg);
logInfo (context);
- /* Construct require items for each of the resolvable's requires that is still unsatisfied. */
+ /* Construct require items for each of the resItem's requires that is still unsatisfied. */
- deps = resolvable->requires();
+ deps = resItem->requires();
for (CDependencyList::const_iterator iter = deps.begin(); iter != deps.end(); iter++) {
constDependencyPtr dep = *iter;
if (!context->requirementIsMet (dep, false)) {
if (getenv("RC_SPEW")) fprintf (stderr, "this requires %s\n", dep->asString().c_str());
QueueItemRequirePtr req_item = new QueueItemRequire (world(), dep);
- req_item->addResolvable (resolvable);
+ req_item->addResItem (resItem);
qil.push_front (req_item);
}
}
- /* Construct conflict items for each of the resolvable's conflicts. */
+ /* Construct conflict items for each of the resItem's conflicts. */
- deps = resolvable->conflicts();
+ deps = resItem->conflicts();
for (CDependencyList::const_iterator iter = deps.begin(); iter != deps.end(); iter++) {
constDependencyPtr dep = *iter;
if (getenv("RC_SPEW")) fprintf (stderr, "this conflicts with '%s'\n", dep->asString().c_str());
- QueueItemConflictPtr conflict_item = new QueueItemConflict (world(), dep, resolvable);
+ QueueItemConflictPtr conflict_item = new QueueItemConflict (world(), dep, resItem);
qil.push_front (conflict_item);
}
- /* Construct conflict items for each of the resolvable's obsoletes. */
+ /* Construct conflict items for each of the resItem's obsoletes. */
- deps = resolvable->obsoletes();
+ deps = resItem->obsoletes();
for (CDependencyList::const_iterator iter = deps.begin(); iter != deps.end(); iter++) {
constDependencyPtr dep = *iter;
if (getenv("RC_SPEW")) fprintf (stderr, "this obsoletes %s\n", dep->asString().c_str());
- QueueItemConflictPtr conflict_item = new QueueItemConflict (world(), dep, resolvable);
+ QueueItemConflictPtr conflict_item = new QueueItemConflict (world(), dep, resItem);
conflict_item->setActuallyAnObsolete();
qil.push_front (conflict_item);
}
- /* Construct uninstall items for system resolvable's that conflict with us. */
+ /* Construct uninstall items for system resItem's that conflict with us. */
- deps = resolvable->provides();
+ deps = resItem->provides();
for (CDependencyList::const_iterator iter = deps.begin(); iter != deps.end(); iter++) {
constDependencyPtr dep = *iter;
- world()->foreachConflictingResolvable (dep, build_conflict_list, &conflicts);
+ world()->foreachConflictingResItem (dep, build_conflict_list, &conflicts);
}
- for (CResolvableList::const_iterator iter = conflicts.begin(); iter != conflicts.end(); iter++) {
- constResolvablePtr conflicting_resolvable = *iter;
+ for (CResItemList::const_iterator iter = conflicts.begin(); iter != conflicts.end(); iter++) {
+ constResItemPtr conflicting_resItem = *iter;
ResolverInfoPtr log_info;
QueueItemUninstallPtr uninstall_item;
/* Check to see if we conflict with ourself and don't create
* an uninstall item for it if we do. This is Debian's way of
- * saying that one and only one resolvable with this provide may
+ * saying that one and only one resItem with this provide may
* exist on the system at a time.
*/
- if (((constSpecPtr)conflicting_resolvable)->equals (resolvable)) {
+ if (((constSpecPtr)conflicting_resItem)->equals (resItem)) {
continue;
}
- if (getenv("RC_SPEW")) fprintf (stderr, "because: '%s'\n", conflicting_resolvable->asString(true).c_str());
+ if (getenv("RC_SPEW")) fprintf (stderr, "because: '%s'\n", conflicting_resItem->asString(true).c_str());
- uninstall_item = new QueueItemUninstall (world(), conflicting_resolvable, "conflict");
+ uninstall_item = new QueueItemUninstall (world(), conflicting_resItem, "conflict");
uninstall_item->setDueToConflict ();
- log_info = new ResolverInfoConflictsWith (conflicting_resolvable, resolvable);
+ log_info = new ResolverInfoConflictsWith (conflicting_resItem, resItem);
uninstall_item->addInfo (log_info);
qil.push_front (uninstall_item);
}
QueueItemPtr
QueueItemInstall::copy (void) const
{
- QueueItemInstallPtr new_install = new QueueItemInstall (world(), _resolvable);
+ QueueItemInstallPtr new_install = new QueueItemInstall (world(), _resItem);
((QueueItemPtr)new_install)->copy((constQueueItemPtr)this);
new_install->_upgrades = _upgrades;
new_install->_deps_satisfied_by_this_install = CDependencyList(_deps_satisfied_by_this_install.begin(), _deps_satisfied_by_this_install.end());
- new_install->_needed_by = CResolvableList (_needed_by.begin(), _needed_by.end());
+ new_install->_needed_by = CResItemList (_needed_by.begin(), _needed_by.end());
new_install->_channel_priority = _channel_priority;
new_install->_other_penalty = _other_penalty;
new_install->_explicitly_requested = _explicitly_requested;
if (cmp != 0)
return cmp;
constQueueItemInstallPtr install = item;
- return GVersion.compare (_resolvable, install->_resolvable);
+ return GVersion.compare (_resItem, install->_resItem);
}
//---------------------------------------------------------------------------
void
-QueueItemInstall::addNeededBy (constResolvablePtr resolvable)
+QueueItemInstall::addNeededBy (constResItemPtr resItem)
{
- _needed_by.push_front (resolvable);
+ _needed_by.push_front (resItem);
}
///////////////////////////////////////////////////////////////////
#include <string.h>
#include <zypp/solver/detail/QueueItemInstallPtr.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItem.h>
#include <zypp/solver/detail/Dependency.h>
#include <zypp/solver/detail/Channel.h>
REP_BODY(QueueItemInstall);
private:
- constResolvablePtr _resolvable;
- constResolvablePtr _upgrades;
+ constResItemPtr _resItem;
+ constResItemPtr _upgrades;
CDependencyList _deps_satisfied_by_this_install;
- CResolvableList _needed_by;
+ CResItemList _needed_by;
int _channel_priority;
int _other_penalty;
public:
- QueueItemInstall (WorldPtr world, constResolvablePtr resolvable);
+ QueueItemInstall (WorldPtr world, constResItemPtr resItem);
virtual ~QueueItemInstall();
// ---------------------------------- I/O
// ---------------------------------- accessors
- constResolvablePtr resolvable (void) const { return _resolvable; }
+ constResItemPtr resItem (void) const { return _resItem; }
- constResolvablePtr upgrades (void) const { return _upgrades; }
- void setUpgrades (constResolvablePtr upgrades) { _upgrades = upgrades; }
+ constResItemPtr upgrades (void) const { return _upgrades; }
+ void setUpgrades (constResItemPtr upgrades) { _upgrades = upgrades; }
int channelPriority (void) const { return _channel_priority; }
void setChannelPriority (int channel_priority) { _channel_priority = channel_priority; }
virtual bool isSatisfied (ResolverContextPtr context) const;
void addDependency (constDependencyPtr dep);
- void addNeededBy (constResolvablePtr resolvable);
+ void addNeededBy (constResItemPtr resItem);
};
{
string ret = "[Require: ";
ret += item._dep->asString();
- if (item._requiring_resolvable != NULL) {
+ if (item._requiring_resItem != NULL) {
ret += ", Required by ";
- ret += item._requiring_resolvable->asString();
+ ret += item._requiring_resItem->asString();
}
- if (item._upgraded_resolvable != NULL) {
+ if (item._upgraded_resItem != NULL) {
ret += ", Upgrades ";
- ret += item._upgraded_resolvable->asString();
+ ret += item._upgraded_resItem->asString();
}
- if (item._lost_resolvable != NULL) {
+ if (item._lost_resItem != NULL) {
ret += ", Lost ";
- ret += item._lost_resolvable->asString();
+ ret += item._lost_resItem->asString();
}
if (item._remove_only) ret += ", Remove Only";
if (item._is_child) ret += ", Child";
QueueItemRequire::QueueItemRequire (WorldPtr world, constDependencyPtr dep)
: QueueItem (QUEUE_ITEM_TYPE_REQUIRE, world)
, _dep (dep)
- , _requiring_resolvable (NULL)
- , _upgraded_resolvable (NULL)
- , _lost_resolvable (NULL)
+ , _requiring_resItem (NULL)
+ , _upgraded_resItem (NULL)
+ , _lost_resItem (NULL)
, _remove_only (false)
, _is_child (false)
{
//---------------------------------------------------------------------------
void
-QueueItemRequire::addResolvable (constResolvablePtr resolvable)
+QueueItemRequire::addResItem (constResItemPtr resItem)
{
- assert (_requiring_resolvable == NULL);
- _requiring_resolvable = resolvable;
+ assert (_requiring_resItem == NULL);
+ _requiring_resItem = resItem;
}
typedef std::map <constSpecPtr, bool> UniqTable;
typedef struct {
- constResolvablePtr resolvable;
+ constResItemPtr resItem;
constSpecPtr dep;
ResolverContextPtr context;
WorldPtr world;
- CResolvableList providers;
+ CResItemList providers;
UniqTable *uniq;
} RequireProcessInfo;
static bool
-require_process_cb (constResolvablePtr resolvable, constSpecPtr spec, void *data)
+require_process_cb (constResItemPtr resItem, constSpecPtr spec, void *data)
{
RequireProcessInfo *info = (RequireProcessInfo *)data;
- ResolvableStatus status;
+ ResItemStatus status;
- status = info->context->getStatus (resolvable);
-//fprintf (stderr, "require_process_cb(res: %s, spec %s, status %s)\n", resolvable->asString().c_str(), spec->asString().c_str(), ResolverContext::toString(status).c_str());
+ status = info->context->getStatus (resItem);
+//fprintf (stderr, "require_process_cb(res: %s, spec %s, status %s)\n", resItem->asString().c_str(), spec->asString().c_str(), ResolverContext::toString(status).c_str());
//fprintf (stderr, "require_process_cb(info->dep: %s)\n", info->dep ? info->dep->asString().c_str() : "(null)");
-//fprintf (stderr, "require_process_cb(resolvableIsPossible -> %d)\n", info->context->resolvableIsPossible (resolvable));
- /* info->dep is set for resolvable set childern only. If it is set
+//fprintf (stderr, "require_process_cb(resItemIsPossible -> %d)\n", info->context->resItemIsPossible (resItem));
+ /* info->dep is set for resItem set childern only. If it is set
allow only exactly required version */
if (info->dep != NULL
&& !info->dep->equals(spec)) {
return true;
}
- if ((! resolvable_status_is_to_be_uninstalled (status))
- && ! info->context->isParallelInstall (resolvable)
- && info->uniq->find((constSpecPtr)resolvable) == info->uniq->end()
- && info->context->resolvableIsPossible (resolvable)
- && ! info->world->resolvableIsLocked (resolvable)) {
+ if ((! resItem_status_is_to_be_uninstalled (status))
+ && ! info->context->isParallelInstall (resItem)
+ && info->uniq->find((constSpecPtr)resItem) == info->uniq->end()
+ && info->context->resItemIsPossible (resItem)
+ && ! info->world->resItemIsLocked (resItem)) {
- info->providers.push_front (resolvable);
- (*(info->uniq))[resolvable] = true;
+ info->providers.push_front (resItem);
+ (*(info->uniq))[resItem] = true;
}
return true;
static bool
-no_installable_providers_info_cb (constResolvablePtr resolvable, constSpecPtr spec, void *data)
+no_installable_providers_info_cb (constResItemPtr resItem, constSpecPtr spec, void *data)
{
RequireProcessInfo *info = (RequireProcessInfo *)data;
- ResolvableStatus status;
+ ResItemStatus status;
string msg_str;
- status = info->context->getStatus (resolvable);
+ status = info->context->getStatus (resItem);
- if (resolvable_status_is_to_be_uninstalled (status)) {
- msg_str = resolvable->name() + " provides " + spec->asString() + ", but is scheduled to be uninstalled.";
- } else if (info->context->isParallelInstall (resolvable)) {
- msg_str = resolvable->name() + " provides " + spec->asString() + ", but another version of that resolvable is already installed.";
- } else if (! info->context->resolvableIsPossible (resolvable)) {
- msg_str = resolvable->name() + " provides " + spec->asString() + ", but it is uninstallable. Try installing it on its own for more details.";
- } else if (info->world->resolvableIsLocked (resolvable)) {
- msg_str = resolvable->name() + " provides " + spec->asString() + ", but it is locked.";
+ if (resItem_status_is_to_be_uninstalled (status)) {
+ msg_str = resItem->name() + " provides " + spec->asString() + ", but is scheduled to be uninstalled.";
+ } else if (info->context->isParallelInstall (resItem)) {
+ msg_str = resItem->name() + " provides " + spec->asString() + ", but another version of that resItem is already installed.";
+ } else if (! info->context->resItemIsPossible (resItem)) {
+ msg_str = resItem->name() + " provides " + spec->asString() + ", but it is uninstallable. Try installing it on its own for more details.";
+ } else if (info->world->resItemIsLocked (resItem)) {
+ msg_str = resItem->name() + " provides " + spec->asString() + ", but it is locked.";
}
if (!msg_str.empty()) {
- info->context->addInfoString (info->resolvable, RESOLVER_INFO_PRIORITY_VERBOSE, msg_str);
+ info->context->addInfoString (info->resItem, RESOLVER_INFO_PRIORITY_VERBOSE, msg_str);
}
return true;
static bool
-look_for_upgrades_cb (constResolvablePtr resolvable, void *data)
+look_for_upgrades_cb (constResItemPtr resItem, void *data)
{
- CResolvableList *rl = (CResolvableList *)data;
- rl->push_front (resolvable);
+ CResItemList *rl = (CResItemList *)data;
+ rl->push_front (resItem);
return true;
}
static bool
-codependent_resolvables (constResolvablePtr r1, constResolvablePtr r2)
+codependent_resItems (constResItemPtr r1, constResItemPtr r2)
{
string name1 = r1->name();
string name2 = r2->name();
RequireProcessInfo info;
- info.resolvable = _requiring_resolvable;
+ info.resItem = _requiring_resItem;
info.dep = _is_child ? _dep : NULL;
info.context = context;
info.world = world();
- info.uniq = new UniqTable(); //FIXME: op: g_hash_table_new (rc_resolvable_spec_hash, rc_resolvable_spec_equal);
+ info.uniq = new UniqTable(); //FIXME: op: g_hash_table_new (rc_resItem_spec_hash, rc_resItem_spec_equal);
int num_providers = 0;
if (! _remove_only) {
- world()->foreachProvidingResolvable (_dep, require_process_cb, &info);
+ world()->foreachProvidingResItem (_dep, require_process_cb, &info);
num_providers = info.providers.size();
- if (getenv ("RC_SPEW")) fprintf (stderr, "requirement is met by %d resolvables\n", num_providers);
+ if (getenv ("RC_SPEW")) fprintf (stderr, "requirement is met by %d resItems\n", num_providers);
}
std::string msg;
QueueItemBranchPtr branch_item = NULL;
bool explore_uninstall_branch = true;
- if (_upgraded_resolvable == NULL) {
+ if (_upgraded_resItem == NULL) {
ResolverInfoPtr err_info;
msg = string ("There are no ") + (_remove_only ? "alternative installed" : "installable") + " providers of " + _dep->asString();
- if (_requiring_resolvable != NULL) {
+ if (_requiring_resItem != NULL) {
msg += " for ";
- msg += _requiring_resolvable->asString();
+ msg += _requiring_resItem->asString();
}
- err_info = new ResolverInfoMisc (_requiring_resolvable, RESOLVER_INFO_PRIORITY_VERBOSE, msg);
+ err_info = new ResolverInfoMisc (_requiring_resItem, RESOLVER_INFO_PRIORITY_VERBOSE, msg);
context->addInfo (err_info);
// Maybe we can add some extra info on why none of the providers are suitable.
- world()->foreachProvidingResolvable (_dep, no_installable_providers_info_cb, (void *)&info);
+ world()->foreachProvidingResItem (_dep, no_installable_providers_info_cb, (void *)&info);
}
// If this is an upgrade, we might be able to avoid removing stuff by upgrading it instead.
- if (_upgraded_resolvable != NULL
- && _requiring_resolvable != NULL) {
+ if (_upgraded_resItem != NULL
+ && _requiring_resItem != NULL) {
- CResolvableList upgrade_list;
+ CResItemList upgrade_list;
- world()->foreachUpgrade (_requiring_resolvable, new Channel(CHANNEL_TYPE_ANY), look_for_upgrades_cb, (void *)&upgrade_list);
+ world()->foreachUpgrade (_requiring_resItem, new Channel(CHANNEL_TYPE_ANY), look_for_upgrades_cb, (void *)&upgrade_list);
if (!upgrade_list.empty()) {
string label, req_str, up_str;
branch_item = new QueueItemBranch (world());
- req_str = _requiring_resolvable->asString();
- up_str = _upgraded_resolvable->asString();
+ req_str = _requiring_resItem->asString();
+ up_str = _upgraded_resItem->asString();
label = string ("for requiring ") + _dep->asString() + " for " + req_str + " when upgrading " + up_str;
branch_item->setLabel (label);
//fprintf (stderr, "Branching: %s\n", label.c_str());
- for (CResolvableList::const_iterator iter = upgrade_list.begin(); iter != upgrade_list.end(); iter++) {
- constResolvablePtr upgrade_resolvable = *iter;
+ for (CResItemList::const_iterator iter = upgrade_list.begin(); iter != upgrade_list.end(); iter++) {
+ constResItemPtr upgrade_resItem = *iter;
QueueItemInstallPtr install_item;
- if (context->resolvableIsPossible (upgrade_resolvable)) {
+ if (context->resItemIsPossible (upgrade_resItem)) {
- install_item = new QueueItemInstall (world(), upgrade_resolvable);
- install_item->setUpgrades (_requiring_resolvable);
+ install_item = new QueueItemInstall (world(), upgrade_resItem);
+ install_item->setUpgrades (_requiring_resItem);
branch_item->addItem (install_item);
- ResolverInfoNeededByPtr upgrade_info = new ResolverInfoNeededBy (upgrade_resolvable);
- upgrade_info->addRelatedResolvable (_upgraded_resolvable);
+ ResolverInfoNeededByPtr upgrade_info = new ResolverInfoNeededBy (upgrade_resItem);
+ upgrade_info->addRelatedResItem (_upgraded_resItem);
install_item->addInfo (upgrade_info);
- // If an upgrade resolvable has its requirements met, don't do the uninstall branch.
+ // If an upgrade resItem has its requirements met, don't do the uninstall branch.
// FIXME: should we also look at conflicts here?
if (explore_uninstall_branch) {
- CDependencyList requires = upgrade_resolvable->requires();
+ CDependencyList requires = upgrade_resItem->requires();
CDependencyList::const_iterator iter = requires.begin();
for (; iter != requires.end(); iter++) {
constDependencyPtr req = *iter;
}
}
- } /* if (context->resolvableIsPossible ( ... */
+ } /* if (context->resItemIsPossible ( ... */
} /* for (iter = upgrade_list; ... */
} /* if (upgrade_list) ... */
if (!upgrade_list.empty()
&& branch_item->isEmpty ()) {
- for (CResolvableList::const_iterator iter = upgrade_list.begin(); iter != upgrade_list.end(); iter++) {
+ for (CResItemList::const_iterator iter = upgrade_list.begin(); iter != upgrade_list.end(); iter++) {
string str;
string p1, p2;
- p1 = _requiring_resolvable->asString();
+ p1 = _requiring_resItem->asString();
p2 = (*iter)->asString();
str = string ("Upgrade to ") + p2 + " to avoid removing " + p1 + " is not possible.";
ResolverInfoMiscPtr misc_info = new ResolverInfoMisc (NULL, RESOLVER_INFO_PRIORITY_VERBOSE, str);
- misc_info->addRelatedResolvable (_requiring_resolvable);
- misc_info->addRelatedResolvable (*iter);
+ misc_info->addRelatedResItem (_requiring_resItem);
+ misc_info->addRelatedResItem (*iter);
context->addInfo (misc_info);
explore_uninstall_branch = true;
//
// The exception: we always want to consider uninstalling
- // when the requirement has resulted from a resolvable losing
+ // when the requirement has resulted from a resItem losing
// one of it's provides.
} else if (!upgrade_list.empty()
&& explore_uninstall_branch
- && codependent_resolvables (_requiring_resolvable, _upgraded_resolvable)
- && _lost_resolvable == NULL) {
+ && codependent_resItems (_requiring_resItem, _upgraded_resItem)
+ && _lost_resItem == NULL) {
explore_uninstall_branch = false;
}
- } /* if (_upgrade_resolvable && _requiring_resolvable) ... */
+ } /* if (_upgrade_resItem && _requiring_resItem) ... */
// We always consider uninstalling when in verification mode.
explore_uninstall_branch = true;
}
- if (explore_uninstall_branch && _requiring_resolvable) {
+ if (explore_uninstall_branch && _requiring_resItem) {
ResolverInfoPtr log_info;
- uninstall_item = new QueueItemUninstall (world(),_requiring_resolvable, "unsatisfied requirements");
+ uninstall_item = new QueueItemUninstall (world(),_requiring_resItem, "unsatisfied requirements");
uninstall_item->setDependency (_dep);
- if (_lost_resolvable) {
- log_info = new ResolverInfoDependsOn (_requiring_resolvable, _lost_resolvable);
+ if (_lost_resItem) {
+ log_info = new ResolverInfoDependsOn (_requiring_resItem, _lost_resItem);
uninstall_item->addInfo (log_info);
}
} else if (num_providers == 1) {
- if (getenv ("RC_SPEW")) fprintf (stderr, "Found exactly one resolvable, installing it.\n");
+ if (getenv ("RC_SPEW")) fprintf (stderr, "Found exactly one resItem, installing it.\n");
QueueItemInstallPtr install_item = new QueueItemInstall (world(), info.providers.front());
install_item->addDependency (_dep);
- // The requiring resolvable could be NULL if the requirement was added as an extra dependency.
- if (_requiring_resolvable) {
- install_item->addNeededBy (_requiring_resolvable);
+ // The requiring resItem could be NULL if the requirement was added as an extra dependency.
+ if (_requiring_resItem) {
+ install_item->addNeededBy (_requiring_resItem);
}
new_items.push_front (install_item);
} else if (num_providers > 1) {
- if (getenv ("RC_SPEW")) fprintf (stderr, "Found more than one resolvable, branching.\n");
+ if (getenv ("RC_SPEW")) fprintf (stderr, "Found more than one resItem, branching.\n");
-//fprintf (stderr, "Found more than one resolvable, branching.\n");
+//fprintf (stderr, "Found more than one resItem, branching.\n");
QueueItemBranchPtr branch_item = new QueueItemBranch (world());
- for (CResolvableList::const_iterator iter = info.providers.begin(); iter != info.providers.end(); iter++) {
+ for (CResItemList::const_iterator iter = info.providers.begin(); iter != info.providers.end(); iter++) {
QueueItemInstallPtr install_item = new QueueItemInstall (world(), *iter);
install_item->addDependency (_dep);
branch_item->addItem (install_item);
- // The requiring resolvable could be NULL if the requirement was added as an extra dependency.
- if (_requiring_resolvable) {
- install_item->addNeededBy (_requiring_resolvable);
+ // The requiring resItem could be NULL if the requirement was added as an extra dependency.
+ if (_requiring_resItem) {
+ install_item->addNeededBy (_requiring_resItem);
}
}
QueueItemRequirePtr new_require = new QueueItemRequire (world(), _dep);
((QueueItemPtr)new_require)->copy((constQueueItemPtr)this);
- new_require->_requiring_resolvable = _requiring_resolvable;
- new_require->_upgraded_resolvable = _upgraded_resolvable;
+ new_require->_requiring_resItem = _requiring_resItem;
+ new_require->_upgraded_resItem = _upgraded_resItem;
new_require->_remove_only = _remove_only;
return new_require;
#include <string.h>
#include <zypp/solver/detail/QueueItemRequirePtr.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItem.h>
#include <zypp/solver/detail/Dependency.h>
#include <zypp/solver/detail/Channel.h>
private:
constDependencyPtr _dep;
- constResolvablePtr _requiring_resolvable;
- constResolvablePtr _upgraded_resolvable;
- constResolvablePtr _lost_resolvable;
+ constResItemPtr _requiring_resItem;
+ constResItemPtr _upgraded_resItem;
+ constResItemPtr _lost_resItem;
bool _remove_only;
bool _is_child;
constDependencyPtr dependency (void) const { return _dep; }
void setRemoveOnly (void) { _remove_only = true; }
- void setUpgradedResolvable (constResolvablePtr upgraded_resolvable) { _upgraded_resolvable = upgraded_resolvable; }
- void setLostResolvable (constResolvablePtr lost_resolvable) { _lost_resolvable = lost_resolvable; }
+ void setUpgradedResItem (constResItemPtr upgraded_resItem) { _upgraded_resItem = upgraded_resItem; }
+ void setLostResItem (constResItemPtr lost_resItem) { _lost_resItem = lost_resItem; }
// ---------------------------------- methods
virtual bool isRedundant (ResolverContextPtr context) const { return false; }
virtual bool isSatisfied (ResolverContextPtr context) const { return false; }
- void addResolvable (constResolvablePtr resolvable);
+ void addResItem (constResItemPtr resItem);
};
{
string ret = "[Uninstall: ";
- ret += item._resolvable->asString();
+ ret += item._resItem->asString();
ret += " ("; ret += item._reason; ret += ")";
if (item._dep_leading_to_uninstall != NULL) {
ret += ", Triggered By ";
//---------------------------------------------------------------------------
-QueueItemUninstall::QueueItemUninstall (WorldPtr world, constResolvablePtr resolvable, const std::string & reason)
+QueueItemUninstall::QueueItemUninstall (WorldPtr world, constResItemPtr resItem, const std::string & reason)
: QueueItem (QUEUE_ITEM_TYPE_UNINSTALL, world)
- , _resolvable (resolvable)
+ , _resItem (resItem)
, _reason (reason)
, _dep_leading_to_uninstall (NULL)
, _upgraded_to (NULL)
static bool
-unlink_check_cb (constResolvablePtr resolvable, constDependencyPtr dep, void *data)
+unlink_check_cb (constResItemPtr resItem, constDependencyPtr dep, void *data)
{
UnlinkCheckInfo *info = (UnlinkCheckInfo *)data;
if (info->cancel_unlink)
return true;
- if (! info->context->resolvableIsPresent (resolvable))
+ if (! info->context->resItemIsPresent (resItem))
return true;
if (info->context->requirementIsMet (dep, false))
typedef struct {
WorldPtr world;
ResolverContextPtr context;
- constResolvablePtr uninstalled_resolvable;
- constResolvablePtr upgraded_resolvable;
+ constResItemPtr uninstalled_resItem;
+ constResItemPtr upgraded_resItem;
QueueItemList *require_items;
bool remove_only;
} UninstallProcessInfo;
static bool
-uninstall_process_cb (constResolvablePtr resolvable, constDependencyPtr dep, void *data)
+uninstall_process_cb (constResItemPtr resItem, constDependencyPtr dep, void *data)
{
UninstallProcessInfo *info = (UninstallProcessInfo *)data;
- if (! info->context->resolvableIsPresent (resolvable))
+ if (! info->context->resItemIsPresent (resItem))
return true;
if (info->context->requirementIsMet (dep, false))
return true;
QueueItemRequirePtr require_item = new QueueItemRequire (info->world, dep);
- require_item->addResolvable (resolvable);
+ require_item->addResItem (resItem);
if (info->remove_only) {
require_item->setRemoveOnly ();
}
- require_item->setUpgradedResolvable (info->upgraded_resolvable);
- require_item->setLostResolvable (info->uninstalled_resolvable);
+ require_item->setUpgradedResItem (info->upgraded_resItem);
+ require_item->setLostResItem (info->uninstalled_resItem);
info->require_items->push_front (require_item);
bool
QueueItemUninstall::process (ResolverContextPtr context, QueueItemList & qil)
{
- ResolvableStatus status;
+ ResItemStatus status;
string pkg_str;
- pkg_str = ((constSpecPtr)_resolvable)->asString();
+ pkg_str = ((constSpecPtr)_resItem)->asString();
- status = context->getStatus (_resolvable);
+ status = context->getStatus (_resItem);
- if (getenv ("RC_SPEW")) fprintf (stderr, "QueueItemUninstall::process(<%s>%s)%s\n", ResolverContext::toString(status).c_str(), _resolvable->asString().c_str(), _unlink ? "[unlink]" : "");
+ if (getenv ("RC_SPEW")) fprintf (stderr, "QueueItemUninstall::process(<%s>%s)%s\n", ResolverContext::toString(status).c_str(), _resItem->asString().c_str(), _unlink ? "[unlink]" : "");
- /* In the case of an unlink, we only want to uninstall the resolvable if it is
+ /* 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%
accuracy, since some later queue item could cause something that requires
- the resolvable to be uninstalled. The alternative is to try to do something
+ the resItem to be uninstalled. The alternative is to try to do something
really clever... but I'm not clever enough to think of an algorithm that
(1) Would do the right thing.
(2) Is guaranteed to terminate. (!)
if (_unlink) {
bool unlink_cancelled = false;
- /* If the resolvable is to-be-installed, obviously it is being use! */
+ /* If the resItem is to-be-installed, obviously it is being use! */
if (status == RESOLVABLE_STATUS_TO_BE_INSTALLED) {
unlink_cancelled = true;
} else if (status == RESOLVABLE_STATUS_INSTALLED) {
UnlinkCheckInfo info;
- /* Flag the resolvable as to-be-uninstalled so that it won't
- satisfy any other resolvable's deps during this check. */
- context->setStatus (_resolvable, RESOLVABLE_STATUS_TO_BE_UNINSTALLED);
+ /* Flag the resItem as to-be-uninstalled so that it won't
+ satisfy any other resItem's deps during this check. */
+ context->setStatus (_resItem, RESOLVABLE_STATUS_TO_BE_UNINSTALLED);
info.context = context;
info.cancel_unlink = false;
- CDependencyList provides = _resolvable->provides();
+ CDependencyList provides = _resItem->provides();
for (CDependencyList::const_iterator iter = provides.begin(); iter != provides.end() && ! info.cancel_unlink; iter++) {
- world()->foreachRequiringResolvable (*iter, unlink_check_cb, &info);
+ world()->foreachRequiringResItem (*iter, unlink_check_cb, &info);
}
/* Set the status back to normal. */
- context->setStatus (_resolvable, status);
+ context->setStatus (_resItem, status);
if (info.cancel_unlink)
unlink_cancelled = true;
}
if (unlink_cancelled) {
- string msg = pkg_str + " is required by other installed resolvables, so it won't be unlinked.";
- context->addInfoString (_resolvable, RESOLVER_INFO_PRIORITY_VERBOSE, msg);
+ string msg = pkg_str + " is required by other installed resItems, so it won't be unlinked.";
+ context->addInfoString (_resItem, RESOLVER_INFO_PRIORITY_VERBOSE, msg);
goto finished;
}
}
- context->uninstallResolvable (_resolvable, _upgraded_to != NULL, _due_to_obsolete, _unlink);
+ context->uninstallResItem (_resItem, _upgraded_to != NULL, _due_to_obsolete, _unlink);
if (status == RESOLVABLE_STATUS_INSTALLED) {
if (! _explicitly_requested
- && world()->resolvableIsLocked (_resolvable)) {
+ && world()->resItemIsLocked (_resItem)) {
string msg = pkg_str + " is locked, and cannot be uninstalled.";
- context->addErrorString (_resolvable, msg);
+ context->addErrorString (_resItem, msg);
goto finished;
}
&& !_due_to_conflict
&& !_due_to_obsolete)
{
- ResolverInfoPtr info = new ResolverInfoMissingReq (_resolvable, _dep_leading_to_uninstall);
+ ResolverInfoPtr info = new ResolverInfoMissingReq (_resItem, _dep_leading_to_uninstall);
context->addInfo (info);
}
- CDependencyList provides = _resolvable->provides();
+ CDependencyList provides = _resItem->provides();
for (CDependencyList::const_iterator iter = provides.begin(); iter != provides.end(); iter++) {
UninstallProcessInfo info;
info.world = world();
info.context = context;
- info.uninstalled_resolvable = _resolvable;
- info.upgraded_resolvable = _upgraded_to;
+ info.uninstalled_resItem = _resItem;
+ info.upgraded_resItem = _upgraded_to;
info.require_items = &qil;
info.remove_only = _remove_only;
- world()->foreachRequiringResolvable (*iter, uninstall_process_cb, &info);
+ world()->foreachRequiringResItem (*iter, uninstall_process_cb, &info);
}
}
return cmp;
constQueueItemUninstallPtr uninstall = item;
- return GVersion.compare (_resolvable, uninstall->_resolvable);
+ return GVersion.compare (_resItem, uninstall->_resItem);
}
QueueItemPtr
QueueItemUninstall::copy (void) const
{
- QueueItemUninstallPtr new_uninstall = new QueueItemUninstall (world(), _resolvable, _reason);
+ QueueItemUninstallPtr new_uninstall = new QueueItemUninstall (world(), _resItem, _reason);
((QueueItemPtr)new_uninstall)->copy((constQueueItemPtr)this);
- new_uninstall->_resolvable = _resolvable;
+ new_uninstall->_resItem = _resItem;
new_uninstall->_dep_leading_to_uninstall = _dep_leading_to_uninstall;
new_uninstall->_upgraded_to = _upgraded_to;
#include <string.h>
#include <zypp/solver/detail/QueueItemUninstallPtr.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItem.h>
#include <zypp/solver/detail/Dependency.h>
#include <zypp/solver/detail/Channel.h>
REP_BODY(QueueItemUninstall);
private:
- constResolvablePtr _resolvable;
+ constResItemPtr _resItem;
const std::string _reason;
constDependencyPtr _dep_leading_to_uninstall;
- constResolvablePtr _upgraded_to;
+ constResItemPtr _upgraded_to;
bool _explicitly_requested;
bool _remove_only;
public:
- QueueItemUninstall (WorldPtr world, constResolvablePtr resolvable, const std::string & reason);
+ QueueItemUninstall (WorldPtr world, constResItemPtr resItem, const std::string & reason);
virtual ~QueueItemUninstall();
// ---------------------------------- I/O
void setDependency (constDependencyPtr dep) { _dep_leading_to_uninstall = dep; }
void setExplicitlyRequested (void) { _explicitly_requested = true; }
void setRemoveOnly (void) { _remove_only = true; }
- void setUpgradedTo (constResolvablePtr resolvable) { _upgraded_to = resolvable; }
+ void setUpgradedTo (constResItemPtr resItem) { _upgraded_to = resItem; }
void setDueToConflict (void) { _due_to_conflict = true; }
void setDueToObsolete (void) { _due_to_obsolete = true; }
void setUnlink (void);
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* Resolvable.cc
+/* ResItem.cc
* Copyright (C) 2000-2002 Ximian, Inc.
* Copyright (C) 2005 SUSE Linux Products GmbH
*
- * Definition of 'resolvable'
+ * Definition of 'resItem'
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License,
#include <y2util/stringutil.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItem.h>
///////////////////////////////////////////////////////////////////
namespace ZYPP {
using namespace std;
-IMPL_DERIVED_POINTER(Resolvable,Spec);
+IMPL_DERIVED_POINTER(ResItem,Spec);
//---------------------------------------------------------------------------
string
-Resolvable::asString ( bool full ) const
+ResItem::asString ( bool full ) const
{
return toString (*this, full);
}
string
-Resolvable::toString ( const Resolvable & resolvable, bool full )
+ResItem::toString ( const ResItem & resItem, bool full )
{
string res;
- res += Spec::toString(resolvable);
- if (!resolvable.channel()->system()) {
+ res += Spec::toString(resItem);
+ if (!resItem.channel()->system()) {
res += "[";
- res += (resolvable.channel() == NULL) ? "(channel?)" : resolvable.channel()->name();
+ res += (resItem.channel() == NULL) ? "(channel?)" : resItem.channel()->name();
res += "]";
}
if (!full) return res;
- if (resolvable.isInstalled()) res += "<installed>";
- if (resolvable.local()) res += "<local>";
+ if (resItem.isInstalled()) res += "<installed>";
+ if (resItem.local()) res += "<local>";
res += "FileSize ";
- res += stringutil::numstring (resolvable.fileSize());
+ res += stringutil::numstring (resItem.fileSize());
res += ", InstalledSize ";
- res += stringutil::numstring (resolvable.installedSize());
+ res += stringutil::numstring (resItem.installedSize());
- if (!resolvable.requires().empty()) {
+ if (!resItem.requires().empty()) {
res += ", Requires: ";
- res += Dependency::toString(resolvable.requires());
+ res += Dependency::toString(resItem.requires());
}
- if (!resolvable.provides().empty()) {
+ if (!resItem.provides().empty()) {
res += ", Provides: ";
- res += Dependency::toString(resolvable.provides());
+ res += Dependency::toString(resItem.provides());
}
- if (!resolvable.conflicts().empty()) {
+ if (!resItem.conflicts().empty()) {
res += ", Conflicts: ";
- res += Dependency::toString(resolvable.conflicts());
+ res += Dependency::toString(resItem.conflicts());
}
- if (!resolvable.obsoletes().empty()) {
+ if (!resItem.obsoletes().empty()) {
res += ", Obsoletes: ";
- res += Dependency::toString(resolvable.obsoletes());
+ res += Dependency::toString(resItem.obsoletes());
}
- if (!resolvable.suggests().empty()) {
+ if (!resItem.suggests().empty()) {
res += ", Suggests: ";
- res += Dependency::toString(resolvable.suggests());
+ res += Dependency::toString(resItem.suggests());
}
- if (!resolvable.recommends().empty()) {
+ if (!resItem.recommends().empty()) {
res += ", Recommends: ";
- res += Dependency::toString(resolvable.recommends());
+ res += Dependency::toString(resItem.recommends());
}
- if (!resolvable.freshens().empty()) {
+ if (!resItem.freshens().empty()) {
res += ", Freshens: ";
- res += Dependency::toString(resolvable.freshens());
+ res += Dependency::toString(resItem.freshens());
}
return res;
}
string
-Resolvable::toString ( const CResolvableList & rl, bool full )
+ResItem::toString ( const CResItemList & rl, bool full )
{
string res("[");
- for (CResolvableList::const_iterator iter = rl.begin(); iter != rl.end(); iter++) {
+ for (CResItemList::const_iterator iter = rl.begin(); iter != rl.end(); iter++) {
if (iter != rl.begin()) res += ", ";
res += (*iter)->asString(full);
}
ostream &
-Resolvable::dumpOn( ostream & str ) const
+ResItem::dumpOn( ostream & str ) const
{
str << asString();
return str;
ostream&
-operator<<( ostream& os, const Resolvable& edition)
+operator<<( ostream& os, const ResItem& edition)
{
return os << edition.asString();
}
//---------------------------------------------------------------------------
-Resolvable::Resolvable (const Kind & kind, const string & name, int epoch, const string & version, const string & release, const Arch * arch)
+ResItem::ResItem (const Kind & kind, const string & name, int epoch, const string & version, const string & release, const Arch * arch)
:Spec (kind, name, epoch, version, release, arch)
, _channel (false)
, _installed (false)
}
-Resolvable::~Resolvable()
+ResItem::~ResItem()
{
}
//---------------------------------------------------------------------------
bool
-Resolvable::isInstalled () const
+ResItem::isInstalled () const
{
if (_channel != NULL
&& _channel->system()) {
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* Resolvable.h
+/* ResItem.h
* Copyright (C) 2000-2002 Ximian, Inc.
* Copyright (C) 2005 SUSE Linux Products GmbH
*
* 02111-1307, USA.
*/
-#ifndef _Resolvable_h
-#define _Resolvable_h
+#ifndef _ResItem_h
+#define _ResItem_h
#include <list>
#include <iosfwd>
#include <string.h>
#include <sys/types.h>
-#include <zypp/solver/detail/ResolvablePtr.h>
+#include <zypp/solver/detail/ResItemPtr.h>
#include <zypp/solver/detail/StoreWorldPtr.h>
#include <zypp/solver/detail/Dependency.h>
#include <zypp/solver/detail/Channel.h>
namespace ZYPP {
//////////////////////////////////////////////////////////////////
-typedef std::list<ResolvablePtr> ResolvableList;
-typedef std::list<constResolvablePtr> CResolvableList;
+typedef std::list<ResItemPtr> ResItemList;
+typedef std::list<constResItemPtr> CResItemList;
-typedef bool (*ResolvableFn) (ResolvablePtr r, void *data);
-typedef bool (*CResolvableFn) (constResolvablePtr r, void *data);
-typedef bool (*ResolvablePairFn) (constResolvablePtr r1, constResolvablePtr r2, void *data);
-typedef bool (*ResolvableAndSpecFn) (constResolvablePtr r, constSpecPtr spec, void *data);
-typedef bool (*ResolvableAndDepFn) (constResolvablePtr r, constDependencyPtr dep, void *data);
+typedef bool (*ResItemFn) (ResItemPtr r, void *data);
+typedef bool (*CResItemFn) (constResItemPtr r, void *data);
+typedef bool (*ResItemPairFn) (constResItemPtr r1, constResItemPtr r2, void *data);
+typedef bool (*ResItemAndSpecFn) (constResItemPtr r, constSpecPtr spec, void *data);
+typedef bool (*ResItemAndDepFn) (constResItemPtr r, constDependencyPtr dep, void *data);
///////////////////////////////////////////////////////////////////
//
-// CLASS NAME : Resolvable
+// CLASS NAME : ResItem
/**
*
**/
-class Resolvable : public Spec {
- REP_BODY(Resolvable);
+class ResItem : public Spec {
+ REP_BODY(ResItem);
private:
constChannelPtr _channel;
public:
- Resolvable(const Kind & kind, const std::string & name, int epoch = -1, const std::string & version = "", const std::string & release = "", const Arch * arch = Arch::Unknown);
+ ResItem(const Kind & kind, const std::string & name, int epoch = -1, const std::string & version = "", const std::string & release = "", const Arch * arch = Arch::Unknown);
- Resolvable(const XmlNodePtr node);
+ ResItem(const XmlNodePtr node);
- virtual ~Resolvable();
+ virtual ~ResItem();
// ---------------------------------- I/O
const XmlNodePtr asXmlNode (void) const;
- static std::string toString ( const Resolvable & res, bool full = false );
+ static std::string toString ( const ResItem & res, bool full = false );
- static std::string toString ( const CResolvableList & reslist, bool full = false );
+ static std::string toString ( const CResItemList & reslist, bool full = false );
virtual std::ostream & dumpOn( std::ostream & str ) const;
- friend std::ostream& operator<<( std::ostream & str, const Resolvable & str);
+ friend std::ostream& operator<<( std::ostream & str, const ResItem & str);
std::string asString ( bool full = false ) const;
}; // namespace ZYPP
///////////////////////////////////////////////////////////////////
-#endif // _Resolvable_h
+#endif // _ResItem_h
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ResolvableAndDependency.cc
+/* ResItemAndDependency.cc
*
* Copyright (C) 2000-2002 Ximian, Inc.
* Copyright (C) 2005 SUSE Linux Products GmbH
#include <y2util/stringutil.h>
-#include <zypp/solver/detail/ResolvableAndDependency.h>
+#include <zypp/solver/detail/ResItemAndDependency.h>
#include <zypp/solver/detail/debug.h>
///////////////////////////////////////////////////////////////////
using namespace std;
-IMPL_BASE_POINTER(ResolvableAndDependency);
+IMPL_BASE_POINTER(ResItemAndDependency);
//---------------------------------------------------------------------------
-ResolvableAndDependency::ResolvableAndDependency (constResolvablePtr resolvable, constDependencyPtr dependency)
- : _resolvable(resolvable)
+ResItemAndDependency::ResItemAndDependency (constResItemPtr resItem, constDependencyPtr dependency)
+ : _resItem(resItem)
, _dependency(dependency)
{
}
//---------------------------------------------------------------------------
string
-ResolvableAndDependency::asString (bool full) const
+ResItemAndDependency::asString (bool full) const
{
return toString (*this, full);
}
string
-ResolvableAndDependency::toString ( const ResolvableAndDependency & r_and_d, bool full )
+ResItemAndDependency::toString ( const ResItemAndDependency & r_and_d, bool full )
{
string res ("{");
- res += r_and_d._resolvable->asString(full);
+ res += r_and_d._resItem->asString(full);
res += ", ";
res += r_and_d._dependency->asString();
res += "}";
ostream &
-ResolvableAndDependency::dumpOn (ostream & str) const
+ResItemAndDependency::dumpOn (ostream & str) const
{
str << asString();
return str;
ostream &
-operator<< (ostream & os, const ResolvableAndDependency & r_and_d)
+operator<< (ostream & os, const ResItemAndDependency & r_and_d)
{
return os << r_and_d.asString();
}
//---------------------------------------------------------------------------
/* This function also checks channels in addition to just dep relations */
-/* FIXME: rc_resolvable_dep_verify_relation already checks the channel */
+/* FIXME: rc_resItem_dep_verify_relation already checks the channel */
bool
-ResolvableAndDependency::verifyRelation (constDependencyPtr dep) const
+ResItemAndDependency::verifyRelation (constDependencyPtr dep) const
{
#if PHI
- // don't check the channel, thereby honoring conflicts from installed resolvables to to-be-installed resolvables
+ // don't check the channel, thereby honoring conflicts from installed resItems to to-be-installed resItems
return dep->verifyRelation (_dependency);
#else
if (!dep->verifyRelation (_dependency)) {
return false;
}
- if (getenv ("SPEW_DEP")) fprintf (stderr, "ResolvableAndDependency::verifyRelation _resolvable->channel() %s, dep->channel() %s\n", _resolvable->channel()->asString().c_str(), dep->channel()->asString().c_str());
- return _resolvable->channel()->equals (dep->channel());
+ 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());
#endif
}
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ResolvableAndDependency.h
+/* ResItemAndDependency.h
*
* Copyright (C) 2000-2002 Ximian, Inc.
* Copyright (C) 2005 SUSE Linux Products GmbH
* 02111-1307, USA.
*/
-#ifndef _ResolvableAndDependency_h
-#define _ResolvableAndDependency_h
+#ifndef _ResItemAndDependency_h
+#define _ResItemAndDependency_h
#include <iosfwd>
#include <string>
#include <list>
#include <map>
-#include <zypp/solver/detail/ResolvableAndDependencyPtr.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItemAndDependencyPtr.h>
+#include <zypp/solver/detail/ResItem.h>
#include <zypp/solver/detail/Dependency.h>
///////////////////////////////////////////////////////////////////
namespace ZYPP {
//////////////////////////////////////////////////////////////////
-typedef std::multimap<const std::string, constResolvablePtr> ResolvableTable;
-typedef std::multimap<const std::string, constResolvableAndDependencyPtr> ResolvableAndDependencyTable;
+typedef std::multimap<const std::string, constResItemPtr> ResItemTable;
+typedef std::multimap<const std::string, constResItemAndDependencyPtr> ResItemAndDependencyTable;
#if PHI
-typedef std::list <constResolvableAndDependencyPtr> CResolvableAndDependencyList;
+typedef std::list <constResItemAndDependencyPtr> CResItemAndDependencyList;
#endif
///////////////////////////////////////////////////////////////////
//
-// CLASS NAME : ResolvableAndDependency
+// CLASS NAME : ResItemAndDependency
-class ResolvableAndDependency: public CountedRep {
- REP_BODY(ResolvableAndDependency);
+class ResItemAndDependency: public CountedRep {
+ REP_BODY(ResItemAndDependency);
private:
- constResolvablePtr _resolvable;
+ constResItemPtr _resItem;
constDependencyPtr _dependency;
public:
- ResolvableAndDependency (constResolvablePtr resolvable, constDependencyPtr dependency);
- ~ResolvableAndDependency () {}
+ ResItemAndDependency (constResItemPtr resItem, constDependencyPtr dependency);
+ ~ResItemAndDependency () {}
// ---------------------------------- I/O
- static std::string toString (const ResolvableAndDependency & r_and_d, bool full = false);
+ static std::string toString (const ResItemAndDependency & r_and_d, bool full = false);
virtual std::ostream & dumpOn(std::ostream & str ) const;
- friend std::ostream& operator<<(std::ostream&, const ResolvableAndDependency & r_and_d);
+ friend std::ostream& operator<<(std::ostream&, const ResItemAndDependency & r_and_d);
std::string asString (bool full = false) const;
// ---------------------------------- accessors
- constResolvablePtr resolvable() const { return _resolvable; }
+ constResItemPtr resItem() const { return _resItem; }
constDependencyPtr dependency() const { return _dependency; }
// ---------------------------------- methods
}; // namespace ZYPP
///////////////////////////////////////////////////////////////////
-#endif // _ResolvableAndDependency_h
+#endif // _ResItemAndDependency_h
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ResolvableAndDependencyPtr.h
+/* ResItemAndDependencyPtr.h
*
* Copyright (C) 2005 SUSE Linux Products GmbH
*
* 02111-1307, USA.
*/
-#ifndef _ResolvableAndDependencyPtr_h
-#define _ResolvableAndDependencyPtr_h
+#ifndef _ResItemAndDependencyPtr_h
+#define _ResItemAndDependencyPtr_h
#include <y2util/RepDef.h>
#include <zypp/solver/detail/WorldPtr.h>
//////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
-// CLASS NAME : ResolvableAndDependencyPtr
-// CLASS NAME : constResolvableAndDependencyPtr
+// CLASS NAME : ResItemAndDependencyPtr
+// CLASS NAME : constResItemAndDependencyPtr
///////////////////////////////////////////////////////////////////
-DEFINE_BASE_POINTER(ResolvableAndDependency);
+DEFINE_BASE_POINTER(ResItemAndDependency);
///////////////////////////////////////////////////////////////////
}; // namespace ZYPP
///////////////////////////////////////////////////////////////////
-#endif // _ResolvableAndDependencyPtr_h
+#endif // _ResItemAndDependencyPtr_h
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ResolvablePtr.h
+/* ResItemPtr.h
*
* Copyright (C) 2005 SUSE Linux Products GmbH
*
* 02111-1307, USA.
*/
-#ifndef _ResolvablePtr_h
-#define _ResolvablePtr_h
+#ifndef _ResItemPtr_h
+#define _ResItemPtr_h
#include <y2util/RepDef.h>
#include <zypp/solver/detail/SpecPtr.h>
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
-// CLASS NAME : ResolvablePtr
-// CLASS NAME : constResolvablePtr
+// CLASS NAME : ResItemPtr
+// CLASS NAME : constResItemPtr
///////////////////////////////////////////////////////////////////
-DEFINE_DERIVED_POINTER(Resolvable,Spec);
+DEFINE_DERIVED_POINTER(ResItem,Spec);
///////////////////////////////////////////////////////////////////
}; // namespace ZYPP
///////////////////////////////////////////////////////////////////
-#endif // _ResolvablePtr_h
+#endif // _ResItemPtr_h
#include <zypp/solver/detail/Resolver.h>
#include <zypp/solver/detail/ResolverContext.h>
#include <zypp/solver/detail/ResolverQueue.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItem.h>
#include <zypp/solver/detail/Version.h>
#include <zypp/solver/detail/World.h>
#include <zypp/solver/detail/StoreWorld.h>
}
void
-Resolver::addResolvableToInstall (constResolvablePtr resolvable)
+Resolver::addResItemToInstall (constResItemPtr resItem)
{
- _resolvables_to_install.push_front (resolvable);
+ _resItems_to_install.push_front (resItem);
}
void
-Resolver::addResolvablesToInstallFromList (CResolvableList & rl)
+Resolver::addResItemsToInstallFromList (CResItemList & rl)
{
- for (CResolvableList::const_iterator iter = rl.begin(); iter != rl.end(); iter++) {
- addResolvableToInstall (*iter);
+ for (CResItemList::const_iterator iter = rl.begin(); iter != rl.end(); iter++) {
+ addResItemToInstall (*iter);
}
}
void
-Resolver::addResolvableToRemove (constResolvablePtr resolvable)
+Resolver::addResItemToRemove (constResItemPtr resItem)
{
- _resolvables_to_remove.push_front (resolvable);
+ _resItems_to_remove.push_front (resItem);
}
void
-Resolver::addResolvablesToRemoveFromList (CResolvableList & rl)
+Resolver::addResItemsToRemoveFromList (CResItemList & rl)
{
- for (CResolvableList::const_iterator iter = rl.begin(); iter != rl.end(); iter++) {
- addResolvableToRemove (*iter);
+ for (CResItemList::const_iterator iter = rl.begin(); iter != rl.end(); iter++) {
+ addResItemToRemove (*iter);
}
}
void
-Resolver::addResolvableToVerify (constResolvablePtr resolvable)
+Resolver::addResItemToVerify (constResItemPtr resItem)
{
- _resolvables_to_verify.push_front (resolvable);
- _resolvables_to_verify.sort (); //(GCompareFunc) rc_resolvable_compare_name);
+ _resItems_to_verify.push_front (resItem);
+ _resItems_to_verify.sort (); //(GCompareFunc) rc_resItem_compare_name);
}
void
//---------------------------------------------------------------------------
static bool
-verify_system_cb (constResolvablePtr resolvable, void *data)
+verify_system_cb (constResItemPtr resItem, void *data)
{
Resolver *resolver = (Resolver *)data;
- resolver->addResolvableToVerify (resolvable);
+ resolver->addResItemToVerify (resItem);
return true;
}
Resolver::verifySystem (void)
{
if (getenv ("RC_SPEW")) fprintf (stderr, "Resolver::verifySystem()\n");
- world()->foreachResolvable (new Channel(CHANNEL_TYPE_SYSTEM), verify_system_cb, this);
+ world()->foreachResItem (new Channel(CHANNEL_TYPE_SYSTEM), verify_system_cb, this);
_verifying = true;
all but one of the duplicates.
*/
- for (CResolvableList::const_iterator i0 = _resolvables_to_verify.begin(); i0 != _resolvables_to_verify.end();) {
- CResolvableList::const_iterator i1 = i0;
+ for (CResItemList::const_iterator i0 = _resItems_to_verify.begin(); i0 != _resItems_to_verify.end();) {
+ CResItemList::const_iterator i1 = i0;
i1++;
- CResolvableList::const_iterator i2 = i1;
- for (; i1 != _resolvables_to_verify.end()&& ! (*i0)->compareName (*i1); i1++) {
+ CResItemList::const_iterator i2 = i1;
+ for (; i1 != _resItems_to_verify.end()&& ! (*i0)->compareName (*i1); i1++) {
//empty
}
branch_item = new QueueItemBranch(world());
- for (CResolvableList::const_iterator i = i0; i != i1; i++) {
+ for (CResItemList::const_iterator i = i0; i != i1; i++) {
QueueItemGroupPtr grp_item = new QueueItemGroup(world());
- for (CResolvableList::const_iterator j = i0; j != i1; j++) {
+ for (CResItemList::const_iterator j = i0; j != i1; j++) {
constPackagePtr dup_pkg = *j;
QueueItemUninstallPtr uninstall_item;
time_t t_start, t_now;
bool extremely_noisy = getenv ("RC_SPEW") != NULL;
- bool have_local_resolvables = false;
+ bool have_local_resItems = false;
if (extremely_noisy) fprintf (stderr, "Resolver::resolveDependencies()\n");
/* Walk through are list of to-be-installed packages and see if any of them are local. */
- for (CResolvableList::const_iterator iter = _resolvables_to_install.begin(); iter != _resolvables_to_install.end(); iter++) {
+ for (CResItemList::const_iterator iter = _resItems_to_install.begin(); iter != _resItems_to_install.end(); iter++) {
if ((*iter)->local()) {
- have_local_resolvables = true;
+ have_local_resItems = true;
break;
}
}
ChannelPtr local_channel = NULL;
- if (have_local_resolvables) {
+ if (have_local_resItems) {
local_multiworld = new MultiWorld();
local_world = new StoreWorld();
- local_channel = new Channel ("", "Local Resolvables", "@local", "");
+ local_channel = new Channel ("", "Local ResItems", "@local", "");
local_world->addChannel (local_channel);
}
_initial_items.clear();
- for (CResolvableList::const_iterator iter = _resolvables_to_install.begin(); iter != _resolvables_to_install.end(); iter++) {
- constResolvablePtr r = *iter;
+ for (CResItemList::const_iterator iter = _resItems_to_install.begin(); iter != _resItems_to_install.end(); iter++) {
+ constResItemPtr r = *iter;
/* Add local packages to our dummy channel. */
if (r->local()) {
assert (local_channel != NULL);
- ResolvablePtr r1 = ResolvablePtr::cast_away_const (r);
+ ResItemPtr r1 = ResItemPtr::cast_away_const (r);
r1->setChannel (local_channel);
- local_world->addResolvable (r);
+ local_world->addResItem (r);
}
- initial_queue->addResolvableToInstall (r);
+ initial_queue->addResItemToInstall (r);
}
- for (CResolvableList::const_iterator iter = _resolvables_to_remove.begin(); iter != _resolvables_to_remove.end(); iter++) {
- initial_queue->addResolvableToRemove (*iter, true /* remove-only mode */);
+ for (CResItemList::const_iterator iter = _resItems_to_remove.begin(); iter != _resItems_to_remove.end(); iter++) {
+ initial_queue->addResItemToRemove (*iter, true /* remove-only mode */);
}
- for (CResolvableList::const_iterator iter = _resolvables_to_verify.begin(); iter != _resolvables_to_verify.end(); iter++) {
- initial_queue->addResolvableToVerify (*iter);
+ for (CResItemList::const_iterator iter = _resItems_to_verify.begin(); iter != _resItems_to_verify.end(); iter++) {
+ initial_queue->addResItemToVerify (*iter);
}
for (CDependencyList::const_iterator iter = _extra_deps.begin(); iter != _extra_deps.end(); iter++) {
#include <zypp/solver/detail/ResolverPtr.h>
#include <zypp/solver/detail/ResolverQueue.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItem.h>
#include <zypp/solver/detail/Dependency.h>
#include <zypp/solver/detail/Channel.h>
bool _verifying;
QueueItemList _initial_items;
- CResolvableList _resolvables_to_install;
- CResolvableList _resolvables_to_remove;
- CResolvableList _resolvables_to_verify;
+ CResItemList _resItems_to_install;
+ CResItemList _resItems_to_remove;
+ CResItemList _resItems_to_verify;
CDependencyList _extra_deps;
CDependencyList _extra_conflicts;
void setCurrentChannel (constChannelPtr channel) { _current_channel = channel; }
void addSubscribedChannel (constChannelPtr channel);
- void addResolvableToInstall (constResolvablePtr resolvable);
- void addResolvablesToInstallFromList (CResolvableList & rl);
+ void addResItemToInstall (constResItemPtr resItem);
+ void addResItemsToInstallFromList (CResItemList & rl);
- void addResolvableToRemove (constResolvablePtr resolvable);
- void addResolvablesToRemoveFromList (CResolvableList & rl);
+ void addResItemToRemove (constResItemPtr resItem);
+ void addResItemsToRemoveFromList (CResItemList & rl);
- void addResolvableToVerify (constResolvablePtr resolvable);
+ void addResItemToVerify (constResItemPtr resItem);
void addExtraDependency (constDependencyPtr dependency);
void addExtraConflict (constDependencyPtr dependency);
//---------------------------------------------------------------------------
string
-ResolverContext::toString (const ResolvableStatus & status)
+ResolverContext::toString (const ResItemStatus & status)
{
string ret;
switch (status) {
: _parent (parent)
, _refs (0)
, _world (NULL)
- , _last_checked_resolvable (NULL)
+ , _last_checked_resItem (NULL)
, _last_checked_status (RESOLVABLE_STATUS_UNKNOWN)
, _download_size (0)
, _install_size (0)
void
-ResolverContext::setStatus (constResolvablePtr resolvable, ResolvableStatus status)
+ResolverContext::setStatus (constResItemPtr resItem, ResItemStatus status)
{
if (_invalid) return;
- ResolvableStatus old_status = getStatus (resolvable);
+ ResItemStatus old_status = getStatus (resItem);
if (status != old_status) {
- _status[resolvable] = status;
+ _status[resItem] = status;
}
- // Update our cache if we changed the status of the last checked resolvable.
+ // Update our cache if we changed the status of the last checked resItem.
- if (_last_checked_resolvable == resolvable)
+ if (_last_checked_resItem == resItem)
_last_checked_status = status;
}
-ResolvableStatus
-ResolverContext::getStatus (constResolvablePtr resolvable)
+ResItemStatus
+ResolverContext::getStatus (constResItemPtr resItem)
{
- ResolvableStatus status = RESOLVABLE_STATUS_UNKNOWN;
+ ResItemStatus status = RESOLVABLE_STATUS_UNKNOWN;
- // We often end up getting the status of the same resolvable several times
- // in a row. By caching the status of the last checked resolvable, we can
+ // We often end up getting the status of the same resItem several times
+ // in a row. By caching the status of the last checked resItem, we can
// in practice eliminate the need for any hash table lookups in about
// 50% of our calls to get_status.
- if (resolvable == _last_checked_resolvable)
+ if (resItem == _last_checked_resItem)
{
return _last_checked_status;
}
while (status == RESOLVABLE_STATUS_UNKNOWN
&& context != NULL) {
- StatusTable::const_iterator pos = context->_status.find (resolvable);
+ StatusTable::const_iterator pos = context->_status.find (resItem);
if (pos != context->_status.end()) {
status = (*pos).second;
}
}
if (status == RESOLVABLE_STATUS_UNKNOWN) {
- status = resolvable->isInstalled() ? RESOLVABLE_STATUS_INSTALLED : RESOLVABLE_STATUS_UNINSTALLED;
+ status = resItem->isInstalled() ? RESOLVABLE_STATUS_INSTALLED : RESOLVABLE_STATUS_UNINSTALLED;
}
- _last_checked_resolvable = resolvable;
+ _last_checked_resItem = resItem;
_last_checked_status = status;
return status;
bool
-ResolverContext::installResolvable (constResolvablePtr resolvable, bool is_soft, int other_penalty)
+ResolverContext::installResItem (constResItemPtr resItem, bool is_soft, int other_penalty)
{
- ResolvableStatus status, new_status;
+ ResItemStatus status, new_status;
int priority;
std::string msg;
- status = getStatus (resolvable);
- if (getenv ("RC_SPEW")) fprintf (stderr, "ResolverContext[%p]::installResolvable(<%s>%s)\n", this, ResolverContext::toString(status).c_str(), resolvable->asString().c_str());
+ 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());
- if (resolvable_status_is_to_be_uninstalled (status)
+ if (resItem_status_is_to_be_uninstalled (status)
&& status != RESOLVABLE_STATUS_TO_BE_UNINSTALLED_DUE_TO_UNLINK) {
- msg = string ("Can't install ") + ((constSpecPtr)resolvable)->asString() + " since it is already marked as needing to be uninstalled";
+ msg = string ("Can't install ") + ((constSpecPtr)resItem)->asString() + " since it is already marked as needing to be uninstalled";
- addErrorString (resolvable, msg);
+ addErrorString (resItem, msg);
return false;
}
- if (resolvable_status_is_to_be_installed (status)) {
+ if (resItem_status_is_to_be_installed (status)) {
return true;
}
- if (isParallelInstall (resolvable)) {
- msg = string ("Can't install ") + ((constSpecPtr)resolvable)->asString() + ", since a resolvable of the same name is already marked as needing to be installed";
- addErrorString (resolvable, msg);
+ if (isParallelInstall (resItem)) {
+ msg = string ("Can't install ") + ((constSpecPtr)resItem)->asString() + ", since a resItem of the same name is already marked as needing to be installed";
+ addErrorString (resItem, msg);
return false;
}
else
new_status = RESOLVABLE_STATUS_TO_BE_INSTALLED;
- setStatus (resolvable, new_status);
+ setStatus (resItem, new_status);
if (status == RESOLVABLE_STATUS_UNINSTALLED) {
/* FIXME: Incomplete */
- _download_size += resolvable->fileSize();
- _install_size += resolvable->installedSize();
+ _download_size += resItem->fileSize();
+ _install_size += resItem->installedSize();
- if (resolvable->local())
+ if (resItem->local())
priority = 0;
else {
- priority = getChannelPriority (resolvable->channel ());
+ priority = getChannelPriority (resItem->channel ());
}
if (priority < _min_priority) _min_priority = priority;
bool
-ResolverContext::upgradeResolvable (constResolvablePtr resolvable, constResolvablePtr old_resolvable, bool is_soft, int other_penalty)
+ResolverContext::upgradeResItem (constResItemPtr resItem, constResItemPtr old_resItem, bool is_soft, int other_penalty)
{
- ResolvableStatus status;
+ ResItemStatus status;
int priority;
- if (getenv ("RC_SPEW")) fprintf (stderr, "ResolverContext[%p]::upgradeResolvable(%s upgrades %s)\n", this, resolvable->asString().c_str(), old_resolvable->asString().c_str());
+ if (getenv ("RC_SPEW")) fprintf (stderr, "ResolverContext[%p]::upgradeResItem(%s upgrades %s)\n", this, resItem->asString().c_str(), old_resItem->asString().c_str());
- status = getStatus (resolvable);
+ status = getStatus (resItem);
- if (resolvable_status_is_to_be_uninstalled (status))
+ if (resItem_status_is_to_be_uninstalled (status))
return false;
- if (resolvable_status_is_to_be_installed (status))
+ if (resItem_status_is_to_be_installed (status))
return true;
- setStatus (resolvable, is_soft ? RESOLVABLE_STATUS_TO_BE_INSTALLED_SOFT : RESOLVABLE_STATUS_TO_BE_INSTALLED);
+ setStatus (resItem, is_soft ? RESOLVABLE_STATUS_TO_BE_INSTALLED_SOFT : RESOLVABLE_STATUS_TO_BE_INSTALLED);
if (status == RESOLVABLE_STATUS_UNINSTALLED) {
- _download_size += resolvable->fileSize();
+ _download_size += resItem->fileSize();
// FIXME: Incomplete
// We should change installed_size to reflect the difference in
// installed size between the old and new versions.
- if (resolvable->local())
+ if (resItem->local())
priority = 0;
else {
- priority = getChannelPriority (resolvable->channel());
+ priority = getChannelPriority (resItem->channel());
}
if (priority < _min_priority) _min_priority = priority;
bool
-ResolverContext::uninstallResolvable (constResolvablePtr resolvable, bool part_of_upgrade, bool due_to_obsolete, bool due_to_unlink)
+ResolverContext::uninstallResItem (constResItemPtr resItem, bool part_of_upgrade, bool due_to_obsolete, bool due_to_unlink)
{
- ResolvableStatus status, new_status;
+ ResItemStatus status, new_status;
std::string msg;
- if (getenv ("RC_SPEW")) fprintf (stderr, "ResolverContext[%p]::uninstallResolvable(%s %s %s %s)\n", this, resolvable->asString().c_str(), part_of_upgrade ? "part_of_upgrade" : "", due_to_obsolete ? "due_to_obsolete": "", due_to_unlink ? "due_to_unlink" : "");
+ 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" : "");
assert (! (due_to_obsolete && due_to_unlink));
- status = getStatus (resolvable);
+ status = getStatus (resItem);
if (status == RESOLVABLE_STATUS_TO_BE_INSTALLED) {
- msg = ((constSpecPtr)resolvable)->asString() + " is scheduled to be installed, but this is not possible because of dependency problems.";
- addErrorString (resolvable, msg);
+ msg = ((constSpecPtr)resItem)->asString() + " is scheduled to be installed, but this is not possible because of dependency problems.";
+ addErrorString (resItem, msg);
return false;
}
- if (resolvable_status_is_to_be_uninstalled (status)
+ if (resItem_status_is_to_be_uninstalled (status)
&& status != RESOLVABLE_STATUS_TO_BE_UNINSTALLED_DUE_TO_UNLINK) {
return true;
}
if (status == RESOLVABLE_STATUS_UNINSTALLED
|| status == RESOLVABLE_STATUS_TO_BE_UNINSTALLED_DUE_TO_UNLINK) {
- msg = string ("Marking resolvable ") + ((constSpecPtr)resolvable)->asString() + " as uninstallable";
- addInfoString (resolvable, RESOLVER_INFO_PRIORITY_VERBOSE, msg);
+ msg = string ("Marking resItem ") + ((constSpecPtr)resItem)->asString() + " as uninstallable";
+ addInfoString (resItem, RESOLVER_INFO_PRIORITY_VERBOSE, msg);
}
else if (due_to_unlink) new_status = RESOLVABLE_STATUS_TO_BE_UNINSTALLED_DUE_TO_UNLINK;
else new_status = RESOLVABLE_STATUS_TO_BE_UNINSTALLED;
- setStatus (resolvable, new_status);
+ setStatus (resItem, new_status);
if (status == RESOLVABLE_STATUS_INSTALLED) {
/* FIXME: incomplete */
bool
-ResolverContext::resolvableIsPresent (constResolvablePtr resolvable)
+ResolverContext::resItemIsPresent (constResItemPtr resItem)
{
- ResolvableStatus status;
+ ResItemStatus status;
- status = getStatus (resolvable);
-//fprintf (stderr, "ResolverContext::resolvableIsPresent(<%s>%s)\n", ResolverContext::toString(status).c_str(), resolvable->asString().c_str());
+ status = getStatus (resItem);
+//fprintf (stderr, "ResolverContext::resItemIsPresent(<%s>%s)\n", ResolverContext::toString(status).c_str(), resItem->asString().c_str());
if (status == RESOLVABLE_STATUS_UNKNOWN)
return false;
- return (status == RESOLVABLE_STATUS_INSTALLED) || resolvable_status_is_to_be_installed (status);
+ return (status == RESOLVABLE_STATUS_INSTALLED) || resItem_status_is_to_be_installed (status);
}
bool
-ResolverContext::resolvableIsAbsent (constResolvablePtr resolvable)
+ResolverContext::resItemIsAbsent (constResItemPtr resItem)
{
- ResolvableStatus status;
+ ResItemStatus status;
- status = getStatus (resolvable);
+ status = getStatus (resItem);
if (status == RESOLVABLE_STATUS_UNKNOWN)
return false;
- return status == RESOLVABLE_STATUS_UNINSTALLED || resolvable_status_is_to_be_uninstalled (status);
+ return status == RESOLVABLE_STATUS_UNINSTALLED || resItem_status_is_to_be_uninstalled (status);
}
// marked
void
-ResolverContext::foreachMarkedResolvable (MarkedResolvableFn fn, void *data) const
+ResolverContext::foreachMarkedResItem (MarkedResItemFn fn, void *data) const
{
constResolverContextPtr context = this;
while (context) {
// collect
static void
-marked_resolvable_collector (constResolvablePtr resolvable, ResolvableStatus status, void *data)
+marked_resItem_collector (constResItemPtr resItem, ResItemStatus status, void *data)
{
- CResolvableList *rl = (CResolvableList *)data;
- rl->push_back (resolvable);
+ CResItemList *rl = (CResItemList *)data;
+ rl->push_back (resItem);
}
-CResolvableList
-ResolverContext::getMarkedResolvables (void) const
+CResItemList
+ResolverContext::getMarkedResItems (void) const
{
- CResolvableList rl;
+ CResItemList rl;
- foreachMarkedResolvable (marked_resolvable_collector, &rl);
+ foreachMarkedResItem (marked_resItem_collector, &rl);
return rl;
}
typedef struct {
WorldPtr world;
- MarkedResolvableFn fn;
- CResolvableList *rl;
+ MarkedResItemFn fn;
+ CResItemList *rl;
int count;
} InstallInfo;
static void
-install_pkg_cb (constResolvablePtr resolvable, ResolvableStatus status, void *data)
+install_pkg_cb (constResItemPtr resItem, ResItemStatus status, void *data)
{
InstallInfo *info = (InstallInfo *)data;
- if (resolvable_status_is_to_be_installed (status)
- && ! resolvable->isInstalled ()
- && info->world->findInstalledResolvable (resolvable) == NULL) {
+ if (resItem_status_is_to_be_installed (status)
+ && ! resItem->isInstalled ()
+ && info->world->findInstalledResItem (resItem) == NULL) {
- if (info->fn) info->fn (resolvable, status, info->rl);
+ if (info->fn) info->fn (resItem, status, info->rl);
++info->count;
}
}
int
-ResolverContext::foreachInstall (MarkedResolvableFn fn, void *data) const
+ResolverContext::foreachInstall (MarkedResItemFn fn, void *data) const
{
- CResolvableList *rl = (CResolvableList *)data;
+ CResItemList *rl = (CResItemList *)data;
InstallInfo info = { world(), fn, rl, 0 };
- foreachMarkedResolvable (install_pkg_cb, (void *)&info);
+ foreachMarkedResItem (install_pkg_cb, (void *)&info);
return info.count;
}
static void
-context_resolvable_collector (constResolvablePtr resolvable, ResolvableStatus status, void *data)
+context_resItem_collector (constResItemPtr resItem, ResItemStatus status, void *data)
{
- CResolvableList *rl = (CResolvableList *)data;
- if (resolvable_status_is_to_be_installed (status)
- || (resolvable_status_is_to_be_uninstalled (status) && resolvable->isInstalled ())) {
- rl->push_front (resolvable);
+ CResItemList *rl = (CResItemList *)data;
+ if (resItem_status_is_to_be_installed (status)
+ || (resItem_status_is_to_be_uninstalled (status) && resItem->isInstalled ())) {
+ rl->push_front (resItem);
}
}
-CResolvableList
+CResItemList
ResolverContext::getInstalls (void) const
{
- CResolvableList rl;
+ CResItemList rl;
- foreachInstall (context_resolvable_collector, (void *)&rl);
+ foreachInstall (context_resItem_collector, (void *)&rl);
return rl;
}
typedef struct {
WorldPtr world;
- MarkedResolvablePairFn fn;
+ MarkedResItemPairFn fn;
void *data;
ResolverContextPtr context;
int count;
} UpgradeInfo;
static void
-upgrade_pkg_cb (constResolvablePtr resolvable, ResolvableStatus status, void *data)
+upgrade_pkg_cb (constResItemPtr resItem, ResItemStatus status, void *data)
{
UpgradeInfo *info = (UpgradeInfo *)data;
- constResolvablePtr to_be_upgraded;
- ResolvableStatus tbu_status;
+ constResItemPtr to_be_upgraded;
+ ResItemStatus tbu_status;
- if (resolvable_status_is_to_be_installed (status)
- && ! resolvable->isInstalled ()) {
+ if (resItem_status_is_to_be_installed (status)
+ && ! resItem->isInstalled ()) {
- to_be_upgraded = info->world->findInstalledResolvable (resolvable);
+ to_be_upgraded = info->world->findInstalledResItem (resItem);
if (to_be_upgraded) {
tbu_status = info->context->getStatus (to_be_upgraded);
if (info->fn) {
- info->fn (resolvable, status, to_be_upgraded, tbu_status, info->data);
+ info->fn (resItem, status, to_be_upgraded, tbu_status, info->data);
}
++info->count;
}
int
-ResolverContext::foreachUpgrade (MarkedResolvablePairFn fn, void *data)
+ResolverContext::foreachUpgrade (MarkedResItemPairFn fn, void *data)
{
UpgradeInfo info = { world(), fn, data, this, 0 };
- foreachMarkedResolvable (upgrade_pkg_cb, (void *)&info);
+ foreachMarkedResItem (upgrade_pkg_cb, (void *)&info);
return info.count;
}
static void
-pair_resolvable_collector (constResolvablePtr resolvable, ResolvableStatus status, constResolvablePtr old, ResolvableStatus old_status, void *data)
+pair_resItem_collector (constResItemPtr resItem, ResItemStatus status, constResItemPtr old, ResItemStatus old_status, void *data)
{
- CResolvableList *rl = (CResolvableList *)data;
- rl->push_back (resolvable);
+ CResItemList *rl = (CResItemList *)data;
+ rl->push_back (resItem);
}
-CResolvableList
+CResItemList
ResolverContext::getUpgrades (void)
{
- CResolvableList rl;
+ CResItemList rl;
- foreachUpgrade (pair_resolvable_collector, (void *)&rl);
+ foreachUpgrade (pair_resItem_collector, (void *)&rl);
return rl;
}
//---------------------------------------------------------------------------
// uninstall
-typedef std::map<std::string,constResolvablePtr> UpgradeTable;
+typedef std::map<std::string,constResItemPtr> UpgradeTable;
typedef struct {
- MarkedResolvableFn fn;
- CResolvableList *rl;
+ MarkedResItemFn fn;
+ CResItemList *rl;
UpgradeTable upgrade_hash;
int count;
} UninstallInfo;
static void
-uninstall_pkg_cb (constResolvablePtr resolvable, ResolvableStatus status, void *data)
+uninstall_pkg_cb (constResItemPtr resItem, ResItemStatus status, void *data)
{
UninstallInfo *info = (UninstallInfo *)data;
- UpgradeTable::const_iterator pos = info->upgrade_hash.find(resolvable->name());
+ UpgradeTable::const_iterator pos = info->upgrade_hash.find(resItem->name());
- if (resolvable_status_is_to_be_uninstalled (status)
+ if (resItem_status_is_to_be_uninstalled (status)
&& pos == info->upgrade_hash.end()) {
if (info->fn)
- info->fn (resolvable, status, info->rl);
+ info->fn (resItem, status, info->rl);
++info->count;
}
}
static void
-build_upgrade_hash_cb (constResolvablePtr resolvable_add, ResolvableStatus status_add, constResolvablePtr resolvable_del, ResolvableStatus status_del, void *data)
+build_upgrade_hash_cb (constResItemPtr resItem_add, ResItemStatus status_add, constResItemPtr resItem_del, ResItemStatus status_del, void *data)
{
UpgradeTable *upgrade_hash = (UpgradeTable *)data;
- (*upgrade_hash)[resolvable_del->name()] = resolvable_del;
+ (*upgrade_hash)[resItem_del->name()] = resItem_del;
}
int
-ResolverContext::foreachUninstall (MarkedResolvableFn fn, void *data)
+ResolverContext::foreachUninstall (MarkedResItemFn fn, void *data)
{
UninstallInfo info; // inits upgrade_hash
info.fn = fn;
- info.rl = (CResolvableList *)data;
+ info.rl = (CResItemList *)data;
info.count = 0;
foreachUpgrade (build_upgrade_hash_cb, (void *)&(info.upgrade_hash));
- foreachMarkedResolvable (uninstall_pkg_cb, (void *)&info);
+ foreachMarkedResItem (uninstall_pkg_cb, (void *)&info);
return info.count;
}
-CResolvableList
+CResItemList
ResolverContext::getUninstalls (void)
{
- CResolvableList rl;
+ CResItemList rl;
- foreachUninstall (context_resolvable_collector, (void *)&rl);
+ foreachUninstall (context_resItem_collector, (void *)&rl);
return rl;
}
//---------------------------------------------------------------------------
static void
-install_count_cb (constResolvablePtr resolvable, ResolvableStatus status, void *data)
+install_count_cb (constResItemPtr resItem, ResItemStatus status, void *data)
{
int *count = (int *)data;
- if (! resolvable->isInstalled ()) {
+ if (! resItem->isInstalled ()) {
++*count;
}
}
static void
-uninstall_count_cb (constResolvablePtr resolvable, ResolvableStatus status, void *data)
+uninstall_count_cb (constResItemPtr resItem, ResItemStatus status, void *data)
{
int *count = (int *)data;
- if (resolvable->isInstalled ()) {
+ if (resItem->isInstalled ()) {
++*count;
}
}
int
ResolverContext::upgradeCount (void)
{
- return foreachUpgrade ((MarkedResolvablePairFn)NULL, (void *)NULL);
+ return foreachUpgrade ((MarkedResItemPairFn)NULL, (void *)NULL);
}
void
-ResolverContext::addInfoString (constResolvablePtr resolvable, int priority, string msg)
+ResolverContext::addInfoString (constResItemPtr resItem, int priority, string msg)
{
-// if (getenv ("RC_SPEW")) fprintf (stderr, "ResolverContext::addInfoString(%s) %s\n", resolvable ? resolvable->asString().c_str() : "", msg.c_str());
- ResolverInfoPtr info = new ResolverInfoMisc (resolvable, priority, msg);
+// if (getenv ("RC_SPEW")) fprintf (stderr, "ResolverContext::addInfoString(%s) %s\n", resItem ? resItem->asString().c_str() : "", msg.c_str());
+ ResolverInfoPtr info = new ResolverInfoMisc (resItem, priority, msg);
addInfo (info);
}
void
-ResolverContext::addErrorString (constResolvablePtr resolvable, string msg)
+ResolverContext::addErrorString (constResItemPtr resItem, string msg)
{
- ResolverInfoPtr info = new ResolverInfoMisc (resolvable, RESOLVER_INFO_PRIORITY_VERBOSE, msg);
+ ResolverInfoPtr info = new ResolverInfoMisc (resItem, RESOLVER_INFO_PRIORITY_VERBOSE, msg);
info->flagAsError ();
addInfo (info);
}
//---------------------------------------------------------------------------
// foreach info
-// We call a resolvable mentioned by an error info an "error-resolvable".
-// We call a resolvable mentioned by an important info an "important-resolvable".
+// We call a resItem mentioned by an error info an "error-resItem".
+// We call a resItem mentioned by an important info an "important-resItem".
//
// The rules:
-// (1) An info item that mentions an error-resolvable is important.
-// (2) An info item is about an important-resolvable is important.
+// (1) An info item that mentions an error-resItem is important.
+// (2) An info item is about an important-resItem is important.
static void
mark_important_info (InfoList & il)
{
- CResolvableList error_list; // FIXME, a map is faster
+ CResItemList error_list; // FIXME, a map is faster
bool did_something;
int pass_num = 1;
- /* First of all, store all error-resolvables in a list. */
+ /* First of all, store all error-resItems in a list. */
for (InfoList::iterator iter = il.begin(); iter != il.end(); iter++) {
if ((*iter) != NULL // list items might be set to NULL
&& (*iter)->error ()) {
- constResolvablePtr resolvable = (*iter)->resolvable();
- if (resolvable != NULL) {
- CResolvableList::iterator pos;
+ constResItemPtr resItem = (*iter)->resItem();
+ if (resItem != NULL) {
+ CResItemList::iterator pos;
for (pos = error_list.begin(); pos != error_list.end(); pos++) {
- if (*pos == resolvable)
+ if (*pos == resItem)
break;
}
if (pos == error_list.end()) {
- error_list.push_front (resolvable);
+ error_list.push_front (resItem);
}
}
- CResolvableList resolvables;
+ CResItemList resItems;
constResolverInfoContainerPtr c = *iter; // check if it really is a container
- if (c != NULL) resolvables = c->resolvables();
+ if (c != NULL) resItems = c->resItems();
- for (CResolvableList::iterator res_iter = resolvables.begin(); res_iter != resolvables.end(); res_iter++) {
- CResolvableList::iterator pos;
+ for (CResItemList::iterator res_iter = resItems.begin(); res_iter != resItems.end(); res_iter++) {
+ CResItemList::iterator pos;
for (pos = error_list.begin(); pos != error_list.end(); pos++) {
if (*pos == *iter)
break;
}
}
- CResolvableList important_list; // FIXME, hash is faster
+ CResItemList important_list; // FIXME, hash is faster
do {
++pass_num;
&& (*iter)->important ()) {
bool should_be_important = false;
- for (CResolvableList::const_iterator res_iter = error_list.begin(); res_iter != error_list.end() && ! should_be_important; res_iter++) {
+ for (CResItemList::const_iterator res_iter = error_list.begin(); res_iter != error_list.end() && ! should_be_important; res_iter++) {
constResolverInfoContainerPtr c = *iter;
if (c != NULL // check if it really is a container
&& c->mentions (*res_iter)) {
}
}
- for (CResolvableList::const_iterator res_iter = important_list.begin(); res_iter != important_list.end() && ! should_be_important; res_iter++) {
+ for (CResItemList::const_iterator res_iter = important_list.begin(); res_iter != important_list.end() && ! should_be_important; res_iter++) {
if ((*iter)->isAbout (*res_iter)) {
should_be_important = true;
break;
if (should_be_important) {
did_something = true;
(*iter)->flagAsImportant ();
- CResolvableList resolvables;
+ CResItemList resItems;
constResolverInfoContainerPtr c = *iter; // check if it really is a container
- if (c != NULL) resolvables = c->resolvables();
- for (CResolvableList::iterator res_iter = resolvables.begin(); res_iter != resolvables.end(); res_iter++) {
- CResolvableList::iterator pos;
+ if (c != NULL) resItems = c->resItems();
+ for (CResItemList::iterator res_iter = resItems.begin(); res_iter != resItems.end(); res_iter++) {
+ CResItemList::iterator pos;
for (pos = important_list.begin(); pos != important_list.end(); pos++) {
if (*pos == *res_iter)
break;
void
-ResolverContext::foreachInfo (ResolvablePtr resolvable, int priority, ResolverInfoFn fn, void *data)
+ResolverContext::foreachInfo (ResItemPtr resItem, int priority, ResolverInfoFn fn, void *data)
{
InfoList info_list;
// Assemble a list of copies of all of the info objects
while (context != NULL) {
for (InfoList::iterator iter = context->_log.begin(); iter != context->_log.end(); iter++) {
- if ((resolvable == NULL || (*iter)->resolvable() == resolvable)
+ if ((resItem == NULL || (*iter)->resItem() == resItem)
&& (*iter)->priority() >= priority) {
info_list.push_back ((*iter)->copy());
}
// spew
static void
-spew_pkg_cb (constResolvablePtr resolvable, ResolvableStatus status, void *unused)
+spew_pkg_cb (constResItemPtr resItem, ResItemStatus status, void *unused)
{
- printf (" %s (%s)\n", resolvable->asString().c_str(), ResolverContext::toString(status).c_str());
+ printf (" %s (%s)\n", resItem->asString().c_str(), ResolverContext::toString(status).c_str());
}
void
-spew_pkg2_cb (constResolvablePtr resolvable1, ResolvableStatus status1, constResolvablePtr resolvable2, ResolvableStatus status2, void *unused)
+spew_pkg2_cb (constResItemPtr resItem1, ResItemStatus status1, constResItemPtr resItem2, ResItemStatus status2, void *unused)
{
const char *s1, *s2;
- s1 = resolvable1->asString().c_str();
- s2 = resolvable2->asString().c_str();
+ s1 = resItem1->asString().c_str();
+ s2 = resItem2->asString().c_str();
printf (" %s (%s) => %s (%s)\n", s2, ResolverContext::toString(status2).c_str(), s1, ResolverContext::toString(status1).c_str());
}
static bool
-requirement_met_cb (constResolvablePtr resolvable, constSpecPtr spec, void *data)
+requirement_met_cb (constResItemPtr resItem, constSpecPtr spec, void *data)
{
RequirementMetInfo *info = (RequirementMetInfo *)data;
- // info->dep is set for resolvable set children. If it is set, query the
+ // info->dep is set for resItem set children. If it is set, query the
// exact version only.
if ((info->dep == NULL || info->dep->equals(spec))
- && info->context->resolvableIsPresent (resolvable))
+ && info->context->resItemIsPresent (resItem))
{
info->flag = true;
}
-//fprintf (stderr, "requirement_met_cb(%s, %s) [info->dep %s] -> %s\n", resolvable->asString().c_str(), spec->asString().c_str(), info->dep != NULL ? info->dep->asString().c_str() : "(none)", info->flag ? "true" : "false");
+//fprintf (stderr, "requirement_met_cb(%s, %s) [info->dep %s] -> %s\n", resItem->asString().c_str(), spec->asString().c_str(), info->dep != NULL ? info->dep->asString().c_str() : "(none)", info->flag ? "true" : "false");
return ! info->flag;
}
info.dep = is_child ? dependency : NULL;
info.flag = false;
- world()->foreachProvidingResolvable (dependency, requirement_met_cb, (void *)&info);
+ world()->foreachProvidingResItem (dependency, requirement_met_cb, (void *)&info);
return info.flag;
}
//---------------------------------------------------------------------------
static bool
-requirement_possible_cb (constResolvablePtr resolvable, constSpecPtr spec, void *data)
+requirement_possible_cb (constResItemPtr resItem, constSpecPtr spec, void *data)
{
RequirementMetInfo *info = (RequirementMetInfo *)data;
- ResolvableStatus status = info->context->getStatus (resolvable);
+ ResItemStatus status = info->context->getStatus (resItem);
- if (! resolvable_status_is_to_be_uninstalled (status)
+ if (! resItem_status_is_to_be_uninstalled (status)
|| status == RESOLVABLE_STATUS_TO_BE_UNINSTALLED_DUE_TO_UNLINK) {
info->flag = true;
}
info.context = this;
info.flag = false;
- world()->foreachProvidingResolvable (dep, requirement_possible_cb, (void *)&info);
+ world()->foreachProvidingResItem (dep, requirement_possible_cb, (void *)&info);
return info.flag;
}
bool
-ResolverContext::resolvableIsPossible (constResolvablePtr resolvable)
+ResolverContext::resItemIsPossible (constResItemPtr resItem)
{
- CDependencyList requires = resolvable->requires();
+ CDependencyList requires = resItem->requires();
for (CDependencyList::iterator iter = requires.begin(); iter != requires.end(); iter++) {
if (! requirementIsPossible (*iter)) {
return false;
} DupNameCheckInfo;
static void
-dup_name_check_cb (constResolvablePtr resolvable, ResolvableStatus status, void *data)
+dup_name_check_cb (constResItemPtr resItem, ResItemStatus status, void *data)
{
DupNameCheckInfo *info = (DupNameCheckInfo *)data;
if (! info->flag
- && resolvable_status_is_to_be_installed (status)
- && info->spec->name() == resolvable->name()
- && !info->spec->equals(resolvable)) {
+ && resItem_status_is_to_be_installed (status)
+ && info->spec->name() == resItem->name()
+ && !info->spec->equals(resItem)) {
info->flag = true;
}
}
bool
-ResolverContext::isParallelInstall (constResolvablePtr resolvable)
+ResolverContext::isParallelInstall (constResItemPtr resItem)
{
DupNameCheckInfo info;
- info.spec = resolvable;
+ info.spec = resItem;
info.flag = false;
- foreachMarkedResolvable (dup_name_check_cb, (void *)&info);
+ foreachMarkedResItem (dup_name_check_cb, (void *)&info);
return info.flag;
}
#include <zypp/solver/detail/ResolverContextPtr.h>
#include <zypp/solver/detail/ResolverInfo.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItem.h>
#include <zypp/solver/detail/Channel.h>
///////////////////////////////////////////////////////////////////
RESOLVABLE_STATUS_TO_BE_UNINSTALLED,
RESOLVABLE_STATUS_TO_BE_UNINSTALLED_DUE_TO_OBSOLETE,
RESOLVABLE_STATUS_TO_BE_UNINSTALLED_DUE_TO_UNLINK
-} ResolvableStatus;
+} ResItemStatus;
-#define resolvable_status_is_to_be_installed(x) (((x) == RESOLVABLE_STATUS_TO_BE_INSTALLED) || ((x) == RESOLVABLE_STATUS_TO_BE_INSTALLED_SOFT))
-#define resolvable_status_is_to_be_uninstalled(x) (((x) == RESOLVABLE_STATUS_TO_BE_UNINSTALLED) || ((x) == RESOLVABLE_STATUS_TO_BE_UNINSTALLED_DUE_TO_OBSOLETE) || ((x) == RESOLVABLE_STATUS_TO_BE_UNINSTALLED_DUE_TO_UNLINK))
+#define resItem_status_is_to_be_installed(x) (((x) == RESOLVABLE_STATUS_TO_BE_INSTALLED) || ((x) == RESOLVABLE_STATUS_TO_BE_INSTALLED_SOFT))
+#define resItem_status_is_to_be_uninstalled(x) (((x) == RESOLVABLE_STATUS_TO_BE_UNINSTALLED) || ((x) == RESOLVABLE_STATUS_TO_BE_UNINSTALLED_DUE_TO_OBSOLETE) || ((x) == RESOLVABLE_STATUS_TO_BE_UNINSTALLED_DUE_TO_UNLINK))
-typedef std::map<constResolvablePtr, ResolvableStatus> StatusTable;
+typedef std::map<constResItemPtr, ResItemStatus> StatusTable;
typedef std::list<ResolverInfoPtr> InfoList;
typedef void (*ResolverContextFn) (ResolverContextPtr ctx, void * data);
-typedef void (*MarkedResolvableFn) (constResolvablePtr res, ResolvableStatus status, void *data);
-typedef void (*MarkedResolvablePairFn) (constResolvablePtr res1, ResolvableStatus status1, constResolvablePtr res2, ResolvableStatus status2, void *data);
+typedef void (*MarkedResItemFn) (constResItemPtr res, ResItemStatus status, void *data);
+typedef void (*MarkedResItemPairFn) (constResItemPtr res1, ResItemStatus status1, constResItemPtr res2, ResItemStatus status2, void *data);
///////////////////////////////////////////////////////////////////
StatusTable _status;
// just a caching mechanism
- constResolvablePtr _last_checked_resolvable;
- ResolvableStatus _last_checked_status;
+ constResItemPtr _last_checked_resItem;
+ ResItemStatus _last_checked_status;
InfoList _log;
unsigned long long _download_size;
friend std::ostream& operator<<(std::ostream&, const ResolverContext & context);
std::string asString (void ) const;
- static std::string toString (const ResolvableStatus & status);
+ static std::string toString (const ResItemStatus & status);
// ---------------------------------- accessors
// ---------------------------------- methods
- ResolvableStatus getStatus (constResolvablePtr res); // non-const, because its caching
- void setStatus (constResolvablePtr res, ResolvableStatus status);
+ ResItemStatus getStatus (constResItemPtr res); // non-const, because its caching
+ void setStatus (constResItemPtr res, ResItemStatus status);
- bool installResolvable (constResolvablePtr resolvable, bool is_soft, int other_penalty);
- bool upgradeResolvable (constResolvablePtr new_resolvable, constResolvablePtr old_resolvable, bool is_soft, int other_penalty);
- bool uninstallResolvable (constResolvablePtr resolvable, bool part_of_upgrade, bool due_to_obsolete, bool due_to_unlink);
+ bool installResItem (constResItemPtr resItem, bool is_soft, int other_penalty);
+ bool upgradeResItem (constResItemPtr new_resItem, constResItemPtr old_resItem, bool is_soft, int other_penalty);
+ bool uninstallResItem (constResItemPtr resItem, bool part_of_upgrade, bool due_to_obsolete, bool due_to_unlink);
- bool resolvableIsPresent (constResolvablePtr resolvable);
- bool resolvableIsAbsent (constResolvablePtr resolvable);
+ bool resItemIsPresent (constResItemPtr resItem);
+ bool resItemIsAbsent (constResItemPtr resItem);
- void foreachMarkedResolvable (MarkedResolvableFn fn, void *data) const;
- CResolvableList getMarkedResolvables (void) const;
+ void foreachMarkedResItem (MarkedResItemFn fn, void *data) const;
+ CResItemList getMarkedResItems (void) const;
- int foreachInstall (MarkedResolvableFn fn, void *data) const;
- CResolvableList getInstalls (void) const;
+ int foreachInstall (MarkedResItemFn fn, void *data) const;
+ CResItemList getInstalls (void) const;
int installCount (void) const;
- int foreachUninstall (MarkedResolvableFn fn, void *data); // non-const, calls foreachUpgrade
- CResolvableList getUninstalls (void);
+ int foreachUninstall (MarkedResItemFn fn, void *data); // non-const, calls foreachUpgrade
+ CResItemList getUninstalls (void);
int uninstallCount (void);
- int foreachUpgrade (MarkedResolvablePairFn fn, void *data); // non-const, calls getStatus
- CResolvableList getUpgrades (void);
+ int foreachUpgrade (MarkedResItemPairFn fn, void *data); // non-const, calls getStatus
+ CResItemList getUpgrades (void);
int upgradeCount (void);
void addInfo (ResolverInfoPtr info);
- void addInfoString (constResolvablePtr resolvable, int priority, std::string str);
- void addErrorString (constResolvablePtr resolvable, std::string str);
+ void addInfoString (constResItemPtr resItem, int priority, std::string str);
+ void addErrorString (constResItemPtr resItem, std::string str);
- void foreachInfo (ResolvablePtr resolvable, int priority, ResolverInfoFn fn, void *data);
+ void foreachInfo (ResItemPtr resItem, int priority, ResolverInfoFn fn, void *data);
InfoList getInfo (void);
void spew (void);
bool requirementIsMet (constDependencyPtr dep, bool is_child);
bool requirementIsPossible (constDependencyPtr dep);
- bool resolvableIsPossible (constResolvablePtr resolvable);
- bool isParallelInstall (constResolvablePtr resolvable);
+ bool resItemIsPossible (constResItemPtr resItem);
+ bool isParallelInstall (constResItemPtr resItem);
int getChannelPriority (constChannelPtr channel) const;
res += info_type_to_string (resolverinfo._type);
res += "> ";
}
- if (resolverinfo._resolvable != NULL) {
- res += resolverinfo._resolvable->asString();
+ if (resolverinfo._resItem != NULL) {
+ res += resolverinfo._resItem->asString();
res += ": ";
}
//---------------------------------------------------------------------------
-ResolverInfo::ResolverInfo (ResolverInfoType type, constResolvablePtr resolvable, int priority)
+ResolverInfo::ResolverInfo (ResolverInfoType type, constResItemPtr resItem, int priority)
: _type (type)
- , _resolvable (resolvable)
+ , _resItem (resItem)
, _priority (priority)
, _error (false)
, _important (false)
if (to_be_merged == NULL) return false;
if (_type != to_be_merged->_type
- || _resolvable != to_be_merged->_resolvable) {
+ || _resItem != to_be_merged->_resItem) {
return false;
}
ResolverInfoPtr
ResolverInfo::copy (void) const
{
- ResolverInfoPtr cpy = new ResolverInfo(_type, _resolvable, _priority);
+ ResolverInfoPtr cpy = new ResolverInfo(_type, _resItem, _priority);
cpy->copy (this);
//---------------------------------------------------------------------------
bool
-ResolverInfo::isAbout (constResolvablePtr resolvable) const
+ResolverInfo::isAbout (constResItemPtr resItem) const
{
- if (_resolvable == NULL)
+ if (_resItem == NULL)
return false;
- return _resolvable->name() == resolvable->name();
+ return _resItem->name() == resItem->name();
}
///////////////////////////////////////////////////////////////////
#include <map>
#include <string.h>
#include <zypp/solver/detail/ResolverInfoPtr.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItem.h>
#include <zypp/solver/detail/Channel.h>
///////////////////////////////////////////////////////////////////
private:
ResolverInfoType _type;
- constResolvablePtr _resolvable;
+ constResItemPtr _resItem;
int _priority;
bool _error;
protected:
- ResolverInfo (ResolverInfoType type, constResolvablePtr resolvable, int priority);
+ ResolverInfo (ResolverInfoType type, constResItemPtr resItem, int priority);
public:
// ---------------------------------- accessors
ResolverInfoType type (void) const { return _type; }
- constResolvablePtr resolvable (void) const { return _resolvable; }
+ constResItemPtr resItem (void) const { return _resItem; }
int priority (void) const { return _priority; }
int error (void) const { return _error; }
bool merge (ResolverInfoPtr to_be_merged);
virtual ResolverInfoPtr copy (void) const;
- bool isAbout (constResolvablePtr resolvable) const;
+ bool isAbout (constResItemPtr resItem) const;
};
///////////////////////////////////////////////////////////////////
string res = "<resolverinfochildof '";
res += ResolverInfo::toString (child);
- res += string ("part of ") + child.resolvablesToString(false);
+ res += string ("part of ") + child.resItemsToString(false);
res += "'>";
return res;
//---------------------------------------------------------------------------
-ResolverInfoChildOf::ResolverInfoChildOf (constResolvablePtr resolvable, constResolvablePtr dependency)
- : ResolverInfoContainer (RESOLVER_INFO_TYPE_CHILD_OF, resolvable, RESOLVER_INFO_PRIORITY_USER, dependency)
+ResolverInfoChildOf::ResolverInfoChildOf (constResItemPtr resItem, constResItemPtr dependency)
+ : ResolverInfoContainer (RESOLVER_INFO_TYPE_CHILD_OF, resItem, RESOLVER_INFO_PRIORITY_USER, dependency)
{
}
ResolverInfoPtr
ResolverInfoChildOf::copy (void) const
{
- ResolverInfoChildOfPtr cpy = new ResolverInfoChildOf(resolvable(), NULL);
+ ResolverInfoChildOfPtr cpy = new ResolverInfoChildOf(resItem(), NULL);
((ResolverInfoContainerPtr)cpy)->copy (this);
public:
- ResolverInfoChildOf (constResolvablePtr resolvable, constResolvablePtr dependency);
+ ResolverInfoChildOf (constResItemPtr resItem, constResItemPtr dependency);
virtual ~ResolverInfoChildOf();
// ---------------------------------- I/O
string res;
res += ResolverInfo::toString (with);
- res += string ("conflicts with ") + with.resolvablesToString(false);
+ res += string ("conflicts with ") + with.resItemsToString(false);
return res;
}
//---------------------------------------------------------------------------
-ResolverInfoConflictsWith::ResolverInfoConflictsWith (constResolvablePtr resolvable, constResolvablePtr with)
- : ResolverInfoContainer (RESOLVER_INFO_TYPE_CONFLICTS_WITH, resolvable, RESOLVER_INFO_PRIORITY_USER, with)
+ResolverInfoConflictsWith::ResolverInfoConflictsWith (constResItemPtr resItem, constResItemPtr with)
+ : ResolverInfoContainer (RESOLVER_INFO_TYPE_CONFLICTS_WITH, resItem, RESOLVER_INFO_PRIORITY_USER, with)
{
}
ResolverInfoPtr
ResolverInfoConflictsWith::copy (void) const
{
- ResolverInfoConflictsWithPtr cpy = new ResolverInfoConflictsWith(resolvable(), NULL);
+ ResolverInfoConflictsWithPtr cpy = new ResolverInfoConflictsWith(resItem(), NULL);
((ResolverInfoContainerPtr)cpy)->copy (this);
public:
- ResolverInfoConflictsWith (constResolvablePtr resolvable, constResolvablePtr with);
+ ResolverInfoConflictsWith (constResItemPtr resItem, constResItemPtr with);
virtual ~ResolverInfoConflictsWith();
// ---------------------------------- I/O
string res = "<resolverinfocontainer '";
res += ResolverInfo::toString (container);
- for (CResolvableList::const_iterator iter = container._resolvable_list.begin(); iter != container._resolvable_list.end(); iter++) {
- if (iter != container._resolvable_list.begin()) res += ", ";
+ for (CResItemList::const_iterator iter = container._resItem_list.begin(); iter != container._resItem_list.end(); iter++) {
+ if (iter != container._resItem_list.begin()) res += ", ";
res += ((constSpecPtr)(*iter))->asString();
}
res += "'>";
//---------------------------------------------------------------------------
-ResolverInfoContainer::ResolverInfoContainer (ResolverInfoType type, constResolvablePtr resolvable, int priority, constResolvablePtr child)
- : ResolverInfo (type, resolvable, priority)
+ResolverInfoContainer::ResolverInfoContainer (ResolverInfoType type, constResItemPtr resItem, int priority, constResItemPtr child)
+ : ResolverInfo (type, resItem, priority)
{
if (child != NULL)
- _resolvable_list.push_back (child);
+ _resItem_list.push_back (child);
}
res = ((ResolverInfoPtr)this)->merge ((ResolverInfoPtr)to_be_merged);
if (!res) return res;
- typedef std::map<constResolvablePtr, bool> SeenTable;
+ typedef std::map<constResItemPtr, bool> SeenTable;
SeenTable seen_packages;
- for (CResolvableList::const_iterator iter = _resolvable_list.begin(); iter != _resolvable_list.end(); iter++) {
+ for (CResItemList::const_iterator iter = _resItem_list.begin(); iter != _resItem_list.end(); iter++) {
seen_packages[*iter] = true;
}
- CResolvableList rl = to_be_merged->resolvables();
- for (CResolvableList::const_iterator iter = rl.begin(); iter != rl.end(); iter++) {
+ CResItemList rl = to_be_merged->resItems();
+ for (CResItemList::const_iterator iter = rl.begin(); iter != rl.end(); iter++) {
SeenTable::const_iterator pos = seen_packages.find(*iter);
if (pos == seen_packages.end()) {
- _resolvable_list.push_front (*iter);
+ _resItem_list.push_front (*iter);
seen_packages[*iter] = true;
}
}
{
((ResolverInfoPtr)this)->copy(from);
- for (CResolvableList::const_iterator iter = from->_resolvable_list.begin(); iter != from->_resolvable_list.end(); iter++) {
- _resolvable_list.push_back (*iter);
+ for (CResItemList::const_iterator iter = from->_resItem_list.begin(); iter != from->_resItem_list.end(); iter++) {
+ _resItem_list.push_back (*iter);
}
}
ResolverInfoPtr
ResolverInfoContainer::copy (void) const
{
- ResolverInfoContainerPtr cpy = new ResolverInfoContainer(type(), resolvable(), priority());
+ ResolverInfoContainerPtr cpy = new ResolverInfoContainer(type(), resItem(), priority());
cpy->copy (this);
//---------------------------------------------------------------------------
string
-ResolverInfoContainer::resolvablesToString (bool names_only) const
+ResolverInfoContainer::resItemsToString (bool names_only) const
{
string res;
- if (_resolvable_list.empty())
+ if (_resItem_list.empty())
return res;
res += " [";
- for (CResolvableList::const_iterator iter = _resolvable_list.begin(); iter != _resolvable_list.end(); iter++) {
- if (iter != _resolvable_list.begin())
+ for (CResItemList::const_iterator iter = _resItem_list.begin(); iter != _resItem_list.end(); iter++) {
+ if (iter != _resItem_list.begin())
res += ", ";
res += (names_only ? (*iter)->name() : ((constSpecPtr)(*iter))->asString());
bool
-ResolverInfoContainer::mentions (constResolvablePtr resolvable) const
+ResolverInfoContainer::mentions (constResItemPtr resItem) const
{
- if (isAbout(resolvable))
+ if (isAbout(resItem))
return true;
- // Search resolvable_list for any mention of the resolvable.
+ // Search resItem_list for any mention of the resItem.
- for (CResolvableList::const_iterator iter = _resolvable_list.begin(); iter != _resolvable_list.end(); iter++) {
- if ((*iter)->name() == resolvable->name()) {
+ for (CResItemList::const_iterator iter = _resItem_list.begin(); iter != _resItem_list.end(); iter++) {
+ if ((*iter)->name() == resItem->name()) {
return true;
}
}
void
-ResolverInfoContainer::addRelatedResolvable (constResolvablePtr resolvable)
+ResolverInfoContainer::addRelatedResItem (constResItemPtr resItem)
{
- if (!mentions(resolvable)) {
- _resolvable_list.push_front (resolvable);
+ if (!mentions(resItem)) {
+ _resItem_list.push_front (resItem);
}
}
void
-ResolverInfoContainer::addRelatedResolvableList (const CResolvableList & resolvables)
+ResolverInfoContainer::addRelatedResItemList (const CResItemList & resItems)
{
- for (CResolvableList::const_iterator iter = resolvables.begin(); iter != resolvables.end(); iter++) {
- _resolvable_list.push_front (*iter);
+ for (CResItemList::const_iterator iter = resItems.begin(); iter != resItems.end(); iter++) {
+ _resItem_list.push_front (*iter);
}
}
private:
- CResolvableList _resolvable_list;
+ CResItemList _resItem_list;
protected:
- ResolverInfoContainer (ResolverInfoType type, constResolvablePtr resolvable, int priority, constResolvablePtr child = NULL);
+ ResolverInfoContainer (ResolverInfoType type, constResItemPtr resItem, int priority, constResItemPtr child = NULL);
public:
virtual ~ResolverInfoContainer();
// ---------------------------------- accessors
- CResolvableList resolvables (void) const { return _resolvable_list; }
+ CResItemList resItems (void) const { return _resItem_list; }
// ---------------------------------- methods
virtual bool merge (ResolverInfoContainerPtr to_be_merged);
virtual ResolverInfoPtr copy (void) const;
- std::string resolvablesToString (bool names_only) const;
+ std::string resItemsToString (bool names_only) const;
- bool mentions (constResolvablePtr resolvable) const;
- void addRelatedResolvable (constResolvablePtr resolvable);
- void addRelatedResolvableList (const CResolvableList & resolvables);
+ bool mentions (constResItemPtr resItem) const;
+ void addRelatedResItem (constResItemPtr resItem);
+ void addRelatedResItemList (const CResItemList & resItems);
};
string res;
res += ResolverInfo::toString (on);
- res += string ("depended on ") + on.resolvablesToString(false);
+ res += string ("depended on ") + on.resItemsToString(false);
return res;
}
//---------------------------------------------------------------------------
-ResolverInfoDependsOn::ResolverInfoDependsOn (constResolvablePtr resolvable, constResolvablePtr on)
- : ResolverInfoContainer (RESOLVER_INFO_TYPE_DEPENDS_ON, resolvable, RESOLVER_INFO_PRIORITY_USER, on)
+ResolverInfoDependsOn::ResolverInfoDependsOn (constResItemPtr resItem, constResItemPtr on)
+ : ResolverInfoContainer (RESOLVER_INFO_TYPE_DEPENDS_ON, resItem, RESOLVER_INFO_PRIORITY_USER, on)
{
}
ResolverInfoPtr
ResolverInfoDependsOn::copy (void) const
{
- ResolverInfoDependsOnPtr cpy = new ResolverInfoDependsOn(resolvable(), NULL);
+ ResolverInfoDependsOnPtr cpy = new ResolverInfoDependsOn(resItem(), NULL);
((ResolverInfoContainerPtr)cpy)->copy (this);
public:
- ResolverInfoDependsOn (constResolvablePtr resolvable, constResolvablePtr on);
+ ResolverInfoDependsOn (constResItemPtr resItem, constResItemPtr on);
virtual ~ResolverInfoDependsOn();
// ---------------------------------- I/O
res += ResolverInfo::toString (misc, false);
res += "]";
#endif
- res += misc.resolvablesToString(false);
+ res += misc.resItemsToString(false);
if (!misc._action.empty()) {
res += string (", Action: ") + misc._action + "\n";
}
//---------------------------------------------------------------------------
-ResolverInfoMisc::ResolverInfoMisc (constResolvablePtr resolvable, int priority, const string & msg)
- : ResolverInfoContainer (RESOLVER_INFO_TYPE_MISC, resolvable, priority)
+ResolverInfoMisc::ResolverInfoMisc (constResItemPtr resItem, int priority, const string & msg)
+ : ResolverInfoContainer (RESOLVER_INFO_TYPE_MISC, resItem, priority)
, _msg (msg)
{
}
ResolverInfoPtr
ResolverInfoMisc::copy (void) const
{
- ResolverInfoMiscPtr cpy = new ResolverInfoMisc(resolvable(), priority(), _msg);
+ ResolverInfoMiscPtr cpy = new ResolverInfoMisc(resItem(), priority(), _msg);
((ResolverInfoContainerPtr)cpy)->copy (this);
public:
- ResolverInfoMisc (constResolvablePtr resolvable, int priority, const std::string & msg);
+ ResolverInfoMisc (constResItemPtr resItem, int priority, const std::string & msg);
virtual ~ResolverInfoMisc();
// ---------------------------------- I/O
//---------------------------------------------------------------------------
-ResolverInfoMissingReq::ResolverInfoMissingReq (constResolvablePtr resolvable, constDependencyPtr missing_req)
- : ResolverInfo (RESOLVER_INFO_TYPE_MISSING_REQ, resolvable, RESOLVER_INFO_PRIORITY_USER)
+ResolverInfoMissingReq::ResolverInfoMissingReq (constResItemPtr resItem, constDependencyPtr missing_req)
+ : ResolverInfo (RESOLVER_INFO_TYPE_MISSING_REQ, resItem, RESOLVER_INFO_PRIORITY_USER)
, _missing_req (missing_req)
{
}
ResolverInfoPtr
ResolverInfoMissingReq::copy (void) const
{
- ResolverInfoMissingReqPtr cpy = new ResolverInfoMissingReq(resolvable(), _missing_req);
+ ResolverInfoMissingReqPtr cpy = new ResolverInfoMissingReq(resItem(), _missing_req);
((ResolverInfoPtr)cpy)->copy (this);
public:
- ResolverInfoMissingReq (constResolvablePtr resolvable, constDependencyPtr missing_req);
+ ResolverInfoMissingReq (constResItemPtr resItem, constDependencyPtr missing_req);
virtual ~ResolverInfoMissingReq();
// ---------------------------------- I/O
string res;
res += ResolverInfo::toString (by, false);
- res += string (" needed by ") + by.resolvablesToString(false);
+ res += string (" needed by ") + by.resItemsToString(false);
return res;
}
//---------------------------------------------------------------------------
-ResolverInfoNeededBy::ResolverInfoNeededBy (constResolvablePtr resolvable)
- : ResolverInfoContainer (RESOLVER_INFO_TYPE_NEEDED_BY, resolvable, RESOLVER_INFO_PRIORITY_USER, NULL)
+ResolverInfoNeededBy::ResolverInfoNeededBy (constResItemPtr resItem)
+ : ResolverInfoContainer (RESOLVER_INFO_TYPE_NEEDED_BY, resItem, RESOLVER_INFO_PRIORITY_USER, NULL)
{
}
ResolverInfoPtr
ResolverInfoNeededBy::copy (void) const
{
- ResolverInfoNeededByPtr cpy = new ResolverInfoNeededBy(resolvable());
+ ResolverInfoNeededByPtr cpy = new ResolverInfoNeededBy(resItem());
((ResolverInfoContainerPtr)cpy)->copy (this);
public:
- ResolverInfoNeededBy (constResolvablePtr resolvable);
+ ResolverInfoNeededBy (constResItemPtr resItem);
virtual ~ResolverInfoNeededBy();
// ---------------------------------- I/O
string res;
res += ResolverInfo::toString (obsoletes);
- res += string ("replaced by ") + obsoletes.resolvablesToString(false);
+ res += string ("replaced by ") + obsoletes.resItemsToString(false);
return res;
}
//---------------------------------------------------------------------------
-ResolverInfoObsoletes::ResolverInfoObsoletes (constResolvablePtr resolvable, constResolvablePtr obsoletes)
- : ResolverInfoContainer (RESOLVER_INFO_TYPE_OBSOLETES, resolvable, RESOLVER_INFO_PRIORITY_USER, obsoletes)
+ResolverInfoObsoletes::ResolverInfoObsoletes (constResItemPtr resItem, constResItemPtr obsoletes)
+ : ResolverInfoContainer (RESOLVER_INFO_TYPE_OBSOLETES, resItem, RESOLVER_INFO_PRIORITY_USER, obsoletes)
{
}
ResolverInfoPtr
ResolverInfoObsoletes::copy (void) const
{
- ResolverInfoObsoletesPtr cpy = new ResolverInfoObsoletes(resolvable(), NULL);
+ ResolverInfoObsoletesPtr cpy = new ResolverInfoObsoletes(resItem(), NULL);
((ResolverInfoContainerPtr)cpy)->copy (this);
public:
- ResolverInfoObsoletes (constResolvablePtr resolvable, constResolvablePtr obsoletes);
+ ResolverInfoObsoletes (constResItemPtr resItem, constResItemPtr obsoletes);
virtual ~ResolverInfoObsoletes();
// ---------------------------------- I/O
//---------------------------------------------------------------------------
void
-ResolverQueue::addResolvableToInstall (constResolvablePtr resolvable)
+ResolverQueue::addResItemToInstall (constResItemPtr resItem)
{
QueueItemInstallPtr item;
- if (_context->resolvableIsPresent (resolvable)) {
- printf ("%s is already installed", ((constSpecPtr)resolvable)->asString().c_str());
+ if (_context->resItemIsPresent (resItem)) {
+ printf ("%s is already installed", ((constSpecPtr)resItem)->asString().c_str());
return;
}
- item = new QueueItemInstall (_context->world(), resolvable);
+ item = new QueueItemInstall (_context->world(), resItem);
item->setExplicitlyRequested ();
addItem (item);
void
-ResolverQueue::addResolvableToRemove (constResolvablePtr resolvable, bool remove_only_mode)
+ResolverQueue::addResItemToRemove (constResItemPtr resItem, bool remove_only_mode)
{
QueueItemUninstallPtr item;
- if (_context->resolvableIsAbsent (resolvable))
+ if (_context->resItemIsAbsent (resItem))
return;
- item = new QueueItemUninstall (_context->world(), resolvable, "user request");
+ item = new QueueItemUninstall (_context->world(), resItem, "user request");
if (remove_only_mode)
item->setRemoveOnly ();
void
-ResolverQueue::addResolvableToVerify (constResolvablePtr resolvable)
+ResolverQueue::addResItemToVerify (constResItemPtr resItem)
{
WorldPtr world;
world = _context->world ();
- CDependencyList requires = resolvable->requires();
+ CDependencyList requires = resItem->requires();
for (CDependencyList::const_iterator iter = requires.begin(); iter != requires.end(); iter++) {
QueueItemRequirePtr item = new QueueItemRequire (world, *iter);
- item->addResolvable (resolvable);
+ item->addResItem (resItem);
addItem (item);
}
- CDependencyList conflicts = resolvable->conflicts();
+ CDependencyList conflicts = resItem->conflicts();
for (CDependencyList::const_iterator iter = conflicts.begin(); iter != conflicts.end(); iter++) {
- QueueItemConflictPtr item = new QueueItemConflict (world, *iter, resolvable);
+ QueueItemConflictPtr item = new QueueItemConflict (world, *iter, resItem);
addItem (item);
}
}
/* Penalties are negative priorities */
int penalty;
- penalty = - queue->context()->getChannelPriority (install_item->resolvable()->channel());
+ penalty = - queue->context()->getChannelPriority (install_item->resItem()->channel());
install_item->setOtherPenalty (penalty);
}
/*
Check for deferrable items: if we have two install items where the to-be-installed
- resolvables have the same name, then we will defer the lower-priority install if
+ resItems have the same name, then we will defer the lower-priority install if
one of the following is true:
- (1) Both resolvables have the same version
+ (1) Both resItems have the same version
(2) The lower-priority channel is a previous version.
*/
QueueItemPtr item2 = *iter2;
if (item->isInstall() && item2->isInstall()) {
- constResolvablePtr r = ((QueueItemInstallPtr) item)->resolvable();
- constResolvablePtr r2 = ((QueueItemInstallPtr) item2)->resolvable();
+ constResItemPtr r = ((QueueItemInstallPtr) item)->resItem();
+ constResItemPtr r2 = ((QueueItemInstallPtr) item2)->resItem();
constChannelPtr channel = r->channel();
constChannelPtr channel2 = r2->channel();
int priority, priority2;
#include <zypp/solver/detail/ResolverQueuePtr.h>
#include <zypp/solver/detail/ResolverContextPtr.h>
#include <zypp/solver/detail/QueueItem.h>
-#include <zypp/solver/detail/ResolvablePtr.h>
+#include <zypp/solver/detail/ResItemPtr.h>
#include <zypp/solver/detail/DependencyPtr.h>
///////////////////////////////////////////////////////////////////
// ---------------------------------- methods
- void addResolvableToInstall (constResolvablePtr resolvable);
- void addResolvableToRemove (constResolvablePtr resolvable, bool remove_only_mode);
- void addResolvableToVerify (constResolvablePtr resolvable);
+ void addResItemToInstall (constResItemPtr resItem);
+ void addResItemToRemove (constResItemPtr resItem, bool remove_only_mode);
+ void addResItemToVerify (constResItemPtr resItem);
void addExtraDependency (constDependencyPtr dep);
void addExtraConflict (constDependencyPtr dep);
void addItem (QueueItemPtr item);
#if 0
xmlNode *
-rc_resolvable_spec_to_xml_node (RCResolvableSpec *spec)
+rc_resItem_spec_to_xml_node (RCResItemSpec *spec)
{
xmlNode *spec_node;
char buffer[128];
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* Spec.h resolvable specification: name + edition
+/* Spec.h resItem specification: name + edition
*
* Copyright (C) 2000-2002 Ximian, Inc.
* Copyright (C) 2005 SUSE Linux Products GmbH
//
// CLASS NAME : Name
/**
- * A resolvable name
+ * A resItem name
**/
class Name : public Ustring {
#include <zypp/solver/detail/Version.h>
#include <zypp/solver/detail/Packman.h>
#include <zypp/solver/detail/StoreWorld.h>
-#include <zypp/solver/detail/ResolvableAndDependency.h>
+#include <zypp/solver/detail/ResItemAndDependency.h>
#include <zypp/solver/detail/debug.h>
///////////////////////////////////////////////////////////////////
StoreWorld::StoreWorld (WorldType type)
: World (type)
- , _resolvable_kind(Kind::Unknown)
+ , _resItem_kind(Kind::Unknown)
{
}
//---------------------------------------------------------------------------
-// Add/remove resolvables
+// Add/remove resItems
bool
-StoreWorld::addResolvable (constResolvablePtr resolvable)
+StoreWorld::addResItem (constResItemPtr resItem)
{
ArchList compat_arch_list;
- ResolvableAndDependencyPtr r_and_d;
+ ResItemAndDependencyPtr r_and_d;
const char *package_name;
constChannelPtr channel;
int arch_score;
bool actually_added_package = false;
- if (resolvable == NULL) return false;
+ if (resItem == NULL) return false;
compat_arch_list = Arch::System->getCompatList();
//fprintf (stderr, "Arch::System '%s' -> %d compats\n", Arch::System->asString().c_str(), (int) compat_arch_list.size());
- channel = resolvable->channel ();
+ channel = resItem->channel ();
-// fprintf (stderr, "StoreWorld[%p]::addResolvable(%s) [%s]\n", this, ((constSpecPtr)resolvable)->asString().c_str(), channel?channel->name():"?");
+// fprintf (stderr, "StoreWorld[%p]::addResItem(%s) [%s]\n", this, ((constSpecPtr)resItem)->asString().c_str(), channel?channel->name():"?");
- arch_score = resolvable->arch()->getCompatScore(compat_arch_list);
+ arch_score = resItem->arch()->getCompatScore(compat_arch_list);
- /* Before we do anything, check to make sure that a resolvable of the
+ /* Before we do anything, check to make sure that a resItem of the
same name isn't already in that channel. If there is a
duplicate, we keep the one with the most recent version number
and drop the other.
- This check only applies to resolvables in a channel. We have
+ This check only applies to resItems in a channel. We have
to allow for multiple installs. Grrrr...
*/
- if (!resolvable->isInstalled ()) { // its not a system package
+ if (!resItem->isInstalled ()) { // its not a system package
- constResolvablePtr dup_res;
+ constResItemPtr dup_res;
int dup_arch_score;
- /* Filter out resolvables with totally incompatible arches */
+ /* Filter out resItems with totally incompatible arches */
if (arch_score < 0) {
- rc_debug (RC_DEBUG_LEVEL_DEBUG, "Ignoring resolvable with incompatible arch: Arch '%s', %s", resolvable->arch()->asString().c_str(), resolvable->asString(true).c_str());
+ rc_debug (RC_DEBUG_LEVEL_DEBUG, "Ignoring resItem with incompatible arch: Arch '%s', %s", resItem->arch()->asString().c_str(), resItem->asString(true).c_str());
goto finished;
}
- package_name = resolvable->name().c_str();
- dup_res = findResolvable (channel, package_name);
+ package_name = resItem->name().c_str();
+ dup_res = findResItem (channel, package_name);
/* This shouldn't happen (and would be caught by the check
below, because cmp will equal 0), but it never hurts to
check and produce a more explicit warning message. */
- if (resolvable == dup_res) {
- rc_debug (RC_DEBUG_LEVEL_WARNING, "Ignoring re-add of resolvable '%s'", package_name);
+ if (resItem == dup_res) {
+ rc_debug (RC_DEBUG_LEVEL_WARNING, "Ignoring re-add of resItem '%s'", package_name);
goto finished;
}
if (dup_res != NULL) {
int cmp;
- cmp = GVersion.compare (resolvable, dup_res);
-//fprintf (stderr, "res: %s, dup_res %s, cmp %d\n", resolvable->asString().c_str(), dup_res->asString().c_str(), cmp);
+ cmp = GVersion.compare (resItem, dup_res);
+//fprintf (stderr, "res: %s, dup_res %s, cmp %d\n", resItem->asString().c_str(), dup_res->asString().c_str(), cmp);
dup_arch_score = dup_res->arch()->getCompatScore(compat_arch_list);
- /* If the resolvable we are trying to add has a lower
+ /* If the resItem we are trying to add has a lower
version number, just ignore it. */
if (cmp < 0) {
- rc_debug (RC_DEBUG_LEVEL_INFO, "Not adding resolvable '%s'.\n\tA newer version is already in the channel.", resolvable->asString().c_str());
+ rc_debug (RC_DEBUG_LEVEL_INFO, "Not adding resItem '%s'.\n\tA newer version is already in the channel.", resItem->asString().c_str());
rc_debug (RC_DEBUG_LEVEL_INFO, "\t%s", dup_res->asString().c_str());
goto finished;
}
- /* If the version numbers are equal, we ignore the resolvable to
+ /* If the version numbers are equal, we ignore the resItem to
add if it has a less-preferable arch. If both
- resolvables have the same version # and arch, we favor the
- first resolvable and just return. */
+ resItems have the same version # and arch, we favor the
+ first resItem and just return. */
if (cmp == 0 && arch_score > dup_arch_score) {
- rc_debug (RC_DEBUG_LEVEL_INFO, "Not adding resolvable '%s'.\n\tAnother resolvable with the same version but with a preferred arch is already in the channel.", resolvable->asString().c_str());
+ rc_debug (RC_DEBUG_LEVEL_INFO, "Not adding resItem '%s'.\n\tAnother resItem with the same version but with a preferred arch is already in the channel.", resItem->asString().c_str());
rc_debug (RC_DEBUG_LEVEL_INFO, "\t%s", dup_res->asString().c_str());
goto finished;
}
- /* Otherwise we throw out the old resolvable and proceed with
+ /* Otherwise we throw out the old resItem and proceed with
adding the newer one. */
- rc_debug (RC_DEBUG_LEVEL_INFO, "Replacing resolvable '%s'.\n\tAnother resolvable in the channel has the same name and a superior %s.", dup_res->asString().c_str(), cmp ? "version" : "arch");
- rc_debug (RC_DEBUG_LEVEL_INFO, "\t%s", resolvable->asString().c_str());
+ rc_debug (RC_DEBUG_LEVEL_INFO, "Replacing resItem '%s'.\n\tAnother resItem in the channel has the same name and a superior %s.", dup_res->asString().c_str(), cmp ? "version" : "arch");
+ rc_debug (RC_DEBUG_LEVEL_INFO, "\t%s", resItem->asString().c_str());
- removeResolvable (dup_res);
+ removeResItem (dup_res);
}
}
actually_added_package = true;
if (channel && !channel->hidden()) {
- touchResolvableSequenceNumber ();
+ touchResItemSequenceNumber ();
}
- /* StoreWorld all of our resolvables in a hash by name. */
- _resolvables_by_name.insert (ResolvableTable::value_type (resolvable->name(), resolvable));
+ /* StoreWorld all of our resItems in a hash by name. */
+ _resItems_by_name.insert (ResItemTable::value_type (resItem->name(), resItem));
- /* StoreWorld all of the resolvable's provides in a hash by name. */
- for (CDependencyList::const_iterator i = resolvable->provides().begin(); i != resolvable->provides().end(); i++) {
- r_and_d = new ResolvableAndDependency (resolvable, *i);
+ /* StoreWorld all of the resItem's provides in a hash by name. */
+ for (CDependencyList::const_iterator i = resItem->provides().begin(); i != resItem->provides().end(); i++) {
+ r_and_d = new ResItemAndDependency (resItem, *i);
- _provides_by_name.insert (ResolvableAndDependencyTable::value_type (r_and_d->dependency()->name(), r_and_d));
+ _provides_by_name.insert (ResItemAndDependencyTable::value_type (r_and_d->dependency()->name(), r_and_d));
}
- /* StoreWorld all of the resolvable's requires in a hash by name. */
+ /* StoreWorld all of the resItem's requires in a hash by name. */
- for (CDependencyList::const_iterator i = resolvable->requires().begin(); i != resolvable->requires().end(); i++) {
- r_and_d = new ResolvableAndDependency (resolvable, *i);
+ for (CDependencyList::const_iterator i = resItem->requires().begin(); i != resItem->requires().end(); i++) {
+ r_and_d = new ResItemAndDependency (resItem, *i);
- _requires_by_name.insert (ResolvableAndDependencyTable::value_type (r_and_d->dependency()->name(), r_and_d));
+ _requires_by_name.insert (ResItemAndDependencyTable::value_type (r_and_d->dependency()->name(), r_and_d));
}
/* "Recommends" are treated as requirements. */
#warning Recommends are treated as requirements
- for (CDependencyList::const_iterator i = resolvable->recommends().begin(); i != resolvable->recommends().end(); i++) {
- r_and_d = new ResolvableAndDependency (resolvable, *i);
+ for (CDependencyList::const_iterator i = resItem->recommends().begin(); i != resItem->recommends().end(); i++) {
+ r_and_d = new ResItemAndDependency (resItem, *i);
- _requires_by_name.insert (ResolvableAndDependencyTable::value_type (r_and_d->dependency()->name(), r_and_d));
+ _requires_by_name.insert (ResItemAndDependencyTable::value_type (r_and_d->dependency()->name(), r_and_d));
}
- /* StoreWorld all of the resolvable's conflicts in a hash by name. */
+ /* StoreWorld all of the resItem's conflicts in a hash by name. */
- for (CDependencyList::const_iterator i = resolvable->conflicts().begin(); i != resolvable->conflicts().end(); i++) {
- r_and_d = new ResolvableAndDependency (resolvable, *i);
- _conflicts_by_name.insert (ResolvableAndDependencyTable::value_type (r_and_d->dependency()->name(), r_and_d));
+ for (CDependencyList::const_iterator i = resItem->conflicts().begin(); i != resItem->conflicts().end(); i++) {
+ r_and_d = new ResItemAndDependency (resItem, *i);
+ _conflicts_by_name.insert (ResItemAndDependencyTable::value_type (r_and_d->dependency()->name(), r_and_d));
}
finished:
void
-StoreWorld::addResolvablesFromList (const CResolvableList & slist)
+StoreWorld::addResItemsFromList (const CResItemList & slist)
{
- for (CResolvableList::const_iterator i = slist.begin(); i != slist.end(); i++) {
- if (!addResolvable (*i)) {
- fprintf (stderr, "addResolvable failed\n");
+ for (CResItemList::const_iterator i = slist.begin(); i != slist.end(); i++) {
+ if (!addResItem (*i)) {
+ fprintf (stderr, "addResItem failed\n");
break;
}
}
//---------------------------------------------------------------------------
static void
-resolvable_table_remove (ResolvableTable & table, constResolvablePtr resolvable)
+resItem_table_remove (ResItemTable & table, constResItemPtr resItem)
{
- const string name = resolvable->name();
- for (ResolvableTable::iterator pos = table.lower_bound(name); pos != table.upper_bound(name); pos++) {
- constResolvablePtr res = pos->second;
- if (res == resolvable) {
+ const string name = resItem->name();
+ for (ResItemTable::iterator pos = table.lower_bound(name); pos != table.upper_bound(name); pos++) {
+ constResItemPtr res = pos->second;
+ if (res == resItem) {
table.erase (pos);
break;
}
static void
-resolvable_and_dependency_table_remove (ResolvableAndDependencyTable & table, constResolvablePtr resolvable)
+resItem_and_dependency_table_remove (ResItemAndDependencyTable & table, constResItemPtr resItem)
{
- const string name = resolvable->name();
+ const string name = resItem->name();
// FIXME: this is inefficient but lower_bound can't to strcasecmp :-(
-// for (ResolvableAndDependencyTable::iterator pos = table.lower_bound(name); pos != table.upper_bound(name); pos++) {
- for (ResolvableAndDependencyTable::iterator pos = table.begin(); pos != table.end(); pos++) {
- constResolvableAndDependencyPtr r_and_d = pos->second;
- if (r_and_d->resolvable() == resolvable) {
+// for (ResItemAndDependencyTable::iterator pos = table.lower_bound(name); pos != table.upper_bound(name); pos++) {
+ for (ResItemAndDependencyTable::iterator pos = table.begin(); pos != table.end(); pos++) {
+ constResItemAndDependencyPtr r_and_d = pos->second;
+ if (r_and_d->resItem() == resItem) {
table.erase (pos);
break;
}
}
void
-StoreWorld::removeResolvable (constResolvablePtr resolvable)
+StoreWorld::removeResItem (constResItemPtr resItem)
{
- if (getenv("RC_SPEW")) fprintf (stderr, "StoreWorld::removeResolvable (%s)\n", resolvable->asString().c_str());
+ if (getenv("RC_SPEW")) fprintf (stderr, "StoreWorld::removeResItem (%s)\n", resItem->asString().c_str());
- constChannelPtr channel = resolvable->channel ();
+ constChannelPtr channel = resItem->channel ();
if (! (channel && channel->hidden ()))
- touchResolvableSequenceNumber ();
+ touchResItemSequenceNumber ();
- resolvable_and_dependency_table_remove (_provides_by_name, resolvable);
- resolvable_and_dependency_table_remove (_requires_by_name, resolvable);
- resolvable_and_dependency_table_remove (_conflicts_by_name, resolvable);
+ resItem_and_dependency_table_remove (_provides_by_name, resItem);
+ resItem_and_dependency_table_remove (_requires_by_name, resItem);
+ resItem_and_dependency_table_remove (_conflicts_by_name, resItem);
- resolvable_table_remove (_resolvables_by_name, resolvable);
+ resItem_table_remove (_resItems_by_name, resItem);
return;
}
void
-StoreWorld::removeResolvables (constChannelPtr channel)
+StoreWorld::removeResItems (constChannelPtr channel)
{
- fprintf (stderr, "StoreWorld::removeResolvables(%s) not implemented\n", channel->asString().c_str());
+ fprintf (stderr, "StoreWorld::removeResItems(%s) not implemented\n", channel->asString().c_str());
}
}
//---------------------------------------------------------------------------
-// Single resolvable queries
+// Single resItem queries
static bool
-installed_version_cb (constResolvablePtr resolvable, void *data)
+installed_version_cb (constResItemPtr resItem, void *data)
{
- constResolvablePtr *installed = (constResolvablePtr *)data;
+ constResItemPtr *installed = (constResItemPtr *)data;
- if (resolvable->isInstalled ()) {
- *installed = resolvable;
+ if (resItem->isInstalled ()) {
+ *installed = resItem;
return false;
}
return true;
}
-constResolvablePtr
-StoreWorld::findInstalledResolvable (constResolvablePtr resolvable)
+constResItemPtr
+StoreWorld::findInstalledResItem (constResItemPtr resItem)
{
- constResolvablePtr installed;
+ constResItemPtr installed;
sync ();
- foreachResolvableByName (resolvable->name(), new Channel(CHANNEL_TYPE_ANY) /* is this right? */, installed_version_cb, &installed);
+ foreachResItemByName (resItem->name(), new Channel(CHANNEL_TYPE_ANY) /* is this right? */, installed_version_cb, &installed);
return installed;
}
//
-// findResolvable
+// findResItem
// @channel: A non-wildcard #Channel.
-// @name: The name of a resolvable.
+// @name: The name of a resItem.
//
-// Searches the world for a resolvable in the specified channel
+// Searches the world for a resItem in the specified channel
// with the specified name. @channel must be an actual
// channel, not a wildcard.
//
-// Return value: The matching resolvable, or %NULL if no such
-// resolvable exists.
+// Return value: The matching resItem, or %NULL if no such
+// resItem exists.
//
-constResolvablePtr
-StoreWorld::findResolvable (constChannelPtr channel, const char *name) const
+constResItemPtr
+StoreWorld::findResItem (constChannelPtr channel, const char *name) const
{
syncConditional (channel);
- for (ResolvableTable::const_iterator pos = _resolvables_by_name.lower_bound(name); pos != _resolvables_by_name.upper_bound(name); pos++) {
- constResolvablePtr res = pos->second;
+ for (ResItemTable::const_iterator pos = _resItems_by_name.lower_bound(name); pos != _resItems_by_name.upper_bound(name); pos++) {
+ constResItemPtr res = pos->second;
if (res->channel() == channel) {
return res;
}
}
-constResolvablePtr
-StoreWorld::findResolvableWithConstraint (constChannelPtr channel, const char *name, constDependencyPtr constraint, bool is_and) const
+constResItemPtr
+StoreWorld::findResItemWithConstraint (constChannelPtr channel, const char *name, constDependencyPtr constraint, bool is_and) const
{
- fprintf (stderr, "StoreWorld::findResolvableWithConstraint() not implemented\n");
+ fprintf (stderr, "StoreWorld::findResItemWithConstraint() not implemented\n");
return 0;
}
ChannelPtr
-StoreWorld::guessResolvableChannel (constResolvablePtr resolvable) const
+StoreWorld::guessResItemChannel (constResItemPtr resItem) const
{
- fprintf (stderr, "StoreWorld::guessResolvableChannel(%s) not implemented\n", ((constSpecPtr)resolvable)->asString().c_str());
+ fprintf (stderr, "StoreWorld::guessResItemChannel(%s) not implemented\n", ((constSpecPtr)resItem)->asString().c_str());
return 0;
}
//-----------------------------------------------------------------------------
-// foreach resolvable
+// foreach resItem
typedef struct {
ChannelPtr channel;
- CResolvableFn callback;
+ CResItemFn callback;
void *data;
int count;
bool short_circuit;
-} ForeachResolvableInfo;
+} ForeachResItemInfo;
static void
-foreach_resolvable_cb (const string &name, constResolvablePtr resolvable, void *data)
+foreach_resItem_cb (const string &name, constResItemPtr resItem, void *data)
{
- ForeachResolvableInfo *info = (ForeachResolvableInfo *)data;
+ ForeachResItemInfo *info = (ForeachResItemInfo *)data;
if (info->short_circuit)
return;
- /* FIXME: we should filter out dup uninstalled resolvables. */
+ /* FIXME: we should filter out dup uninstalled resItems. */
- if (resolvable && info->channel->equals(resolvable->channel ())) {
+ if (resItem && info->channel->equals(resItem->channel ())) {
if (info->callback) {
- if (! info->callback (resolvable, info->data))
+ if (! info->callback (resItem, info->data))
info->short_circuit = true;
}
++info->count;
int
-StoreWorld::foreachResolvable (ChannelPtr channel, CResolvableFn fn, void *data)
+StoreWorld::foreachResItem (ChannelPtr channel, CResItemFn fn, void *data)
{
- return foreachResolvableByName ("", channel, fn, data);
+ return foreachResItemByName ("", channel, fn, data);
}
int
-StoreWorld::foreachResolvableByName (const std::string & name, ChannelPtr channel, CResolvableFn fn, void *data)
+StoreWorld::foreachResItemByName (const std::string & name, ChannelPtr channel, CResItemFn fn, void *data)
{
if (name.empty()) {
- ForeachResolvableInfo info;
+ ForeachResItemInfo info;
info.channel = channel;
info.callback = fn;
info.count = 0;
info.short_circuit = false;
- for (ResolvableTable::const_iterator iter = _resolvables_by_name.begin(); iter != _resolvables_by_name.end(); iter++) {
- foreach_resolvable_cb (iter->first, iter->second, (void *)&info);
+ for (ResItemTable::const_iterator iter = _resItems_by_name.begin(); iter != _resItems_by_name.end(); iter++) {
+ foreach_resItem_cb (iter->first, iter->second, (void *)&info);
}
return info.short_circuit ? -1 : info.count;
}
- ResolvableTable installed; // FIXME: <Spec, Resolvable> rc_resolvable_spec_equal
+ ResItemTable installed; // FIXME: <Spec, resItem> rc_resItem_spec_equal
int count = 0;
- for (ResolvableTable::const_iterator iter = _resolvables_by_name.lower_bound(name); iter != _resolvables_by_name.upper_bound(name); iter++) {
- constResolvablePtr resolvable = iter->second;
- if (resolvable->isInstalled()) {
- const string str = ((constSpecPtr)resolvable)->asString();
- installed.insert (ResolvableTable::value_type(str,resolvable));
+ for (ResItemTable::const_iterator iter = _resItems_by_name.lower_bound(name); iter != _resItems_by_name.upper_bound(name); iter++) {
+ constResItemPtr resItem = iter->second;
+ if (resItem->isInstalled()) {
+ const string str = ((constSpecPtr)resItem)->asString();
+ installed.insert (ResItemTable::value_type(str,resItem));
}
}
- for (ResolvableTable::const_iterator iter = _resolvables_by_name.lower_bound(name); iter != _resolvables_by_name.upper_bound(name); iter++) {
- constResolvablePtr resolvable = iter->second;
- if (channel->equals (resolvable->channel())) {
- if (resolvable->isInstalled()
- || installed.find(((constSpecPtr)resolvable)->asString()) == installed.end()) {
+ for (ResItemTable::const_iterator iter = _resItems_by_name.lower_bound(name); iter != _resItems_by_name.upper_bound(name); iter++) {
+ constResItemPtr resItem = iter->second;
+ if (channel->equals (resItem->channel())) {
+ if (resItem->isInstalled()
+ || installed.find(((constSpecPtr)resItem)->asString()) == installed.end()) {
if (fn) {
- if (! fn(resolvable, data)) {
+ if (! fn(resItem, data)) {
count = -1;
goto finished;
}
int
-StoreWorld::foreachResolvableByMatch (constMatchPtr match, CResolvableFn fn, void *data)
+StoreWorld::foreachResItemByMatch (constMatchPtr match, CResItemFn fn, void *data)
{
- fprintf (stderr, "StoreWorld::foreachResolvableByMatch () not implemented\n");
+ fprintf (stderr, "StoreWorld::foreachResItemByMatch () not implemented\n");
return 0;
}
//-----------------------------------------------------------------------------
-// iterater over resolvables with dependency
+// iterater over resItems with dependency
-typedef std::map<constSpecPtr, constResolvableAndDependencyPtr> InstalledTable;
+typedef std::map<constSpecPtr, constResItemAndDependencyPtr> InstalledTable;
int
-StoreWorld::foreachProvidingResolvable (constDependencyPtr dep, ResolvableAndSpecFn fn, void *data)
+StoreWorld::foreachProvidingResItem (constDependencyPtr dep, ResItemAndSpecFn fn, void *data)
{
int count = 0;
InstalledTable installed;
-//fprintf (stderr, "StoreWorld::foreachProvidingResolvable(%s)\n", dep->asString().c_str());
- for (ResolvableAndDependencyTable::const_iterator iter = _provides_by_name.lower_bound(dep->name()); iter != _provides_by_name.upper_bound(dep->name()); iter++) {
- constResolvableAndDependencyPtr r_and_d = iter->second;
- constResolvablePtr res = r_and_d->resolvable();
-//fprintf (stderr, "StoreWorld::foreachProvidingResolvable(): %s\n", res->asString(true).c_str());
+//fprintf (stderr, "StoreWorld::foreachProvidingResItem(%s)\n", dep->asString().c_str());
+ for (ResItemAndDependencyTable::const_iterator iter = _provides_by_name.lower_bound(dep->name()); iter != _provides_by_name.upper_bound(dep->name()); iter++) {
+ constResItemAndDependencyPtr r_and_d = iter->second;
+ constResItemPtr res = r_and_d->resItem();
+//fprintf (stderr, "StoreWorld::foreachProvidingResItem(): %s\n", res->asString(true).c_str());
if (res != NULL && res->isInstalled ()) {
installed[res] = r_and_d;
}
}
- for (ResolvableAndDependencyTable::const_iterator iter = _provides_by_name.lower_bound(dep->name()); iter != _provides_by_name.upper_bound(dep->name()); iter++) {
- constResolvableAndDependencyPtr r_and_d = iter->second;
+ for (ResItemAndDependencyTable::const_iterator iter = _provides_by_name.lower_bound(dep->name()); iter != _provides_by_name.upper_bound(dep->name()); iter++) {
+ constResItemAndDependencyPtr r_and_d = iter->second;
if (r_and_d && r_and_d->verifyRelation (dep)) {
-//fprintf (stderr, "found: %s\n", r_and_d->resolvable()->asString(true).c_str());
- /* If we have multiple identical resolvables in RCWorld,
- we want to only include the resolvable that is installed and
+//fprintf (stderr, "found: %s\n", r_and_d->resItem()->asString(true).c_str());
+ /* If we have multiple identical resItems in RCWorld,
+ we want to only include the resItem that is installed and
skip the rest. */
- if (r_and_d->resolvable()->isInstalled()
- || installed.find(r_and_d->resolvable()) == installed.end()) {
+ if (r_and_d->resItem()->isInstalled()
+ || installed.find(r_and_d->resItem()) == installed.end()) {
if (fn) {
- if (! fn(r_and_d->resolvable(), r_and_d->dependency(), data)) {
+ if (! fn(r_and_d->resItem(), r_and_d->dependency(), data)) {
count = -1;
goto finished;
}
}
int
-StoreWorld::foreachRequiringResolvable (constDependencyPtr dep, ResolvableAndDepFn fn, void *data)
+StoreWorld::foreachRequiringResItem (constDependencyPtr dep, ResItemAndDepFn fn, void *data)
{
int count = 0;
InstalledTable installed;
- for (ResolvableAndDependencyTable::const_iterator iter = _requires_by_name.lower_bound(dep->name()); iter != _requires_by_name.upper_bound(dep->name()); iter++) {
- constResolvableAndDependencyPtr r_and_d = iter->second;
- constResolvablePtr res = r_and_d->resolvable();
+ 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;
+ constResItemPtr res = r_and_d->resItem();
if (res != NULL && res->isInstalled ()) {
//fprintf (stderr, "is installed: %s\n", res->asString(true).c_str());
installed[res] = r_and_d;
}
}
- for (ResolvableAndDependencyTable::const_iterator iter = _requires_by_name.lower_bound(dep->name()); iter != _requires_by_name.upper_bound(dep->name()); iter++) {
- constResolvableAndDependencyPtr r_and_d = iter->second;
+ 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()->verifyRelation (dep)) {
/* Skip dups if one of them in installed. */
- if (r_and_d->resolvable()->isInstalled()
- || installed.find(r_and_d->resolvable()) == installed.end()) {
+ if (r_and_d->resItem()->isInstalled()
+ || installed.find(r_and_d->resItem()) == installed.end()) {
if (fn) {
- if (! fn(r_and_d->resolvable(), r_and_d->dependency(), data)) {
+ if (! fn(r_and_d->resItem(), r_and_d->dependency(), data)) {
count = -1;
goto finished;
}
int
-StoreWorld::foreachConflictingResolvable (constDependencyPtr dep, ResolvableAndDepFn fn, void *data)
+StoreWorld::foreachConflictingResItem (constDependencyPtr dep, ResItemAndDepFn fn, void *data)
{
int count = 0;
InstalledTable installed;
-//fprintf (stderr, "StoreWorld::foreachConflictingResolvable (%s)\n", dep->name().c_str());
- for (ResolvableAndDependencyTable::const_iterator iter = _conflicts_by_name.lower_bound(dep->name()); iter != _conflicts_by_name.upper_bound(dep->name()); iter++) {
- constResolvableAndDependencyPtr r_and_d = iter->second;
- constResolvablePtr res = r_and_d->resolvable();
+//fprintf (stderr, "StoreWorld::foreachConflictingResItem (%s)\n", dep->name().c_str());
+ for (ResItemAndDependencyTable::const_iterator iter = _conflicts_by_name.lower_bound(dep->name()); iter != _conflicts_by_name.upper_bound(dep->name()); iter++) {
+ constResItemAndDependencyPtr r_and_d = iter->second;
+ constResItemPtr res = r_and_d->resItem();
//fprintf (stderr, "==> %s\n", res->asString().c_str());
if (res != NULL && res->isInstalled ()) {
installed[res] = r_and_d;
}
}
- for (ResolvableAndDependencyTable::const_iterator iter = _conflicts_by_name.lower_bound(dep->name()); iter != _conflicts_by_name.upper_bound(dep->name()); iter++) {
- constResolvableAndDependencyPtr r_and_d = iter->second;
+ for (ResItemAndDependencyTable::const_iterator iter = _conflicts_by_name.lower_bound(dep->name()); iter != _conflicts_by_name.upper_bound(dep->name()); iter++) {
+ constResItemAndDependencyPtr r_and_d = iter->second;
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->verifyRelation (dep)) {
/* Skip dups if one of them in installed. */
- if (r_and_d->resolvable()->isInstalled()
- || installed.find(r_and_d->resolvable()) == installed.end()) {
+ if (r_and_d->resItem()->isInstalled()
+ || installed.find(r_and_d->resItem()) == installed.end()) {
if (fn) {
- if (! fn(r_and_d->resolvable(), r_and_d->dependency(), data)) {
+ if (! fn(r_and_d->resItem(), r_and_d->dependency(), data)) {
count = -1;
goto finished;
}
|| ! containsChannel (channel))
return;
- removeResolvables (channel);
+ removeResItems (channel);
for (ChannelList::iterator iter = _channels.begin(); iter != _channels.end(); iter++) {
if ((*iter)->equals (channel)) {
#include <map>
#include <zypp/solver/detail/StoreWorldPtr.h>
-#include <zypp/solver/detail/ResolvableAndDependency.h>
+#include <zypp/solver/detail/ResItemAndDependency.h>
#include <zypp/solver/detail/PackmanPtr.h>
#include <zypp/solver/detail/World.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItem.h>
#include <zypp/solver/detail/Match.h>
///////////////////////////////////////////////////////////////////
int _freeze_count;
- ResolvableTable _resolvables_by_name;
- ResolvableAndDependencyTable _provides_by_name;
- ResolvableAndDependencyTable _requires_by_name;
- ResolvableAndDependencyTable _conflicts_by_name;
+ ResItemTable _resItems_by_name;
+ ResItemAndDependencyTable _provides_by_name;
+ ResItemAndDependencyTable _requires_by_name;
+ ResItemAndDependencyTable _conflicts_by_name;
PackmanPtr _packman;
- Kind _resolvable_kind;
+ Kind _resItem_kind;
ChannelList _channels;
// ---------------------------------- methods
- // Add/remove resolvables
+ // Add/remove resItems
- bool addResolvable (constResolvablePtr resolvable);
- void addResolvablesFromList (const CResolvableList & slist);
- void removeResolvable (constResolvablePtr resolvable);
- void removeResolvables (constChannelPtr channel);
+ bool addResItem (constResItemPtr resItem);
+ void addResItemsFromList (const CResItemList & slist);
+ void removeResItem (constResItemPtr resItem);
+ void removeResItems (constChannelPtr channel);
void clear ();
- // Iterate over resolvables
+ // Iterate over resItems
- virtual int foreachResolvable (ChannelPtr channel, CResolvableFn fn, void *data);
- virtual int foreachResolvableByName (const std::string & name, ChannelPtr channel, CResolvableFn fn, void *data);
- virtual int foreachResolvableByMatch (constMatchPtr match, CResolvableFn fn, void *data);
+ virtual int foreachResItem (ChannelPtr channel, CResItemFn fn, void *data);
+ virtual int foreachResItemByName (const std::string & name, ChannelPtr channel, CResItemFn fn, void *data);
+ virtual int foreachResItemByMatch (constMatchPtr match, CResItemFn fn, void *data);
// Iterate across provides or requirement
- virtual int foreachProvidingResolvable (constDependencyPtr dep, ResolvableAndSpecFn fn, void *data);
- virtual int foreachRequiringResolvable (constDependencyPtr dep, ResolvableAndDepFn fn, void *data);
- virtual int foreachConflictingResolvable (constDependencyPtr dep, ResolvableAndDepFn fn, void *data);
+ virtual int foreachProvidingResItem (constDependencyPtr dep, ResItemAndSpecFn fn, void *data);
+ virtual int foreachRequiringResItem (constDependencyPtr dep, ResItemAndDepFn fn, void *data);
+ virtual int foreachConflictingResItem (constDependencyPtr dep, ResItemAndDepFn fn, void *data);
// Channels
virtual int foreachChannel (ChannelFn fn, void *data) const;
- // Single resolvable queries
+ // Single resItem queries
- virtual constResolvablePtr findInstalledResolvable (constResolvablePtr resolvable);
- virtual constResolvablePtr findResolvable (constChannelPtr channel, const char *name) const;
- virtual constResolvablePtr findResolvableWithConstraint (constChannelPtr channel, const char *name, constDependencyPtr constraint, bool is_and) const;
- virtual ChannelPtr guessResolvableChannel (constResolvablePtr resolvable) const;
+ virtual constResItemPtr findInstalledResItem (constResItemPtr resItem);
+ virtual constResItemPtr findResItem (constChannelPtr channel, const char *name) const;
+ virtual constResItemPtr findResItemWithConstraint (constChannelPtr channel, const char *name, constDependencyPtr constraint, bool is_and) const;
+ virtual ChannelPtr guessResItemChannel (constResItemPtr resItem) const;
};
static bool
-add_resolvable_cb (constResolvablePtr res, void *data)
+add_resItem_cb (constResItemPtr res, void *data)
{
UndumpWorld *undump = (UndumpWorld *)data;
- undump->addResolvable (res);
+ undump->addResItem (res);
return true;
}
UndumpWorld::load (const char *filename)
{
if (filename) {
- extract_packages_from_undump_file (filename, add_channel_cb, add_resolvable_cb, add_lock_cb, (void *)this);
+ extract_packages_from_undump_file (filename, add_channel_cb, add_resItem_cb, add_lock_cb, (void *)this);
}
}
//---------------------------------------------------------------------------
-// Resolvable Locks
+// ResItem Locks
typedef struct {
- constResolvablePtr resolvable;
+ constResItemPtr resItem;
WorldPtr world;
bool is_locked;
} IsLockedInfo;
{
IsLockedInfo *info = (IsLockedInfo *)data;
- if (match->test (info->resolvable, info->world)) {
+ if (match->test (info->resItem, info->world)) {
info->is_locked = true;
return false;
}
bool
-World::resolvableIsLocked (constResolvablePtr resolvable)
+World::resItemIsLocked (constResItemPtr resItem)
{
IsLockedInfo info;
- info.resolvable = resolvable;
+ info.resItem = resItem;
info.world = this;
info.is_locked = false;
// Transacting
bool
-World::canTransactResolvable (constResolvablePtr resolvable)
+World::canTransactResItem (constResItemPtr resItem)
{
- if (getenv("FIXME")) fprintf (stderr, "World::canTransactResolvable() not implemented\n");
+ if (getenv("FIXME")) fprintf (stderr, "World::canTransactResItem() not implemented\n");
return false;
}
bool
-World::transact (const ResolvableList & installResolvables, const ResolvableList & remove_resolvables, int flags)
+World::transact (const ResItemList & installResItems, const ResItemList & remove_resItems, int flags)
{
if (getenv("FIXME")) fprintf (stderr, "World::transact() not implemented\n");
return false;
// Upgrades
typedef struct {
- constResolvablePtr original_resolvable;
- CResolvableFn fn;
+ constResItemPtr original_resItem;
+ CResItemFn fn;
void *data;
int count;
WorldPtr world;
} ForeachUpgradeInfo;
static bool
-foreach_upgrade_cb (constResolvablePtr resolvable, void *data)
+foreach_upgrade_cb (constResItemPtr resItem, void *data)
{
ForeachUpgradeInfo *info = (ForeachUpgradeInfo *)data;
int cmp;
- cmp = GVersion.compare (info->original_resolvable, resolvable);
+ cmp = GVersion.compare (info->original_resItem, resItem);
if (cmp >= 0) // original is already better
return true;
- if (info->world->resolvableIsLocked (resolvable))
+ if (info->world->resItemIsLocked (resItem))
return true;
if (info->fn)
- info->fn (resolvable, info->data);
+ info->fn (resItem, info->data);
++info->count;
return true;
// rc_world_foreach_upgrade:
// @world: An #RCWorld.
-// @resolvable: An #RCResolvable.
+// @resItem: An #RCResItem.
// @channel: An #RCChannel or channel wildcard.
// @fn: A callback function.
// @user_data: Pointer passed to the callback function.
//
-// Searchs @world for all resolvables whose channel matches
-// @channel and that are an upgrade for @resolvable.
-// (To be precise, an upgrade is a resolvable with the same
-// name as @resolvable but with a greater version number.)
+// Searchs @world for all resItems whose channel matches
+// @channel and that are an upgrade for @resItem.
+// (To be precise, an upgrade is a resItem with the same
+// name as @resItem but with a greater version number.)
//
-// Return value: The number of matching resolvables
+// Return value: The number of matching resItems
// that the callback functions was invoked on, or
// -1 in the case of an error.
int
-World::foreachUpgrade (constResolvablePtr resolvable, ChannelPtr channel, CResolvableFn fn, void *data)
+World::foreachUpgrade (constResItemPtr resItem, ChannelPtr channel, CResItemFn fn, void *data)
{
ForeachUpgradeInfo info;
syncConditional (channel);
- info.original_resolvable = resolvable;
+ info.original_resItem = resItem;
info.fn = fn;
info.data = data;
info.count = 0;
info.world = this;
- foreachResolvableByName (resolvable->name(), channel, foreach_upgrade_cb, (void *)&info);
+ foreachResItemByName (resItem->name(), channel, foreach_upgrade_cb, (void *)&info);
return info.count;
}
typedef struct {
WorldPtr world;
- constResolvablePtr system_resolvable;
- CResolvableList best_upgrades;
+ constResItemPtr system_resItem;
+ CResItemList best_upgrades;
bool subscribed_only;
- ResolvablePairFn fn;
+ ResItemPairFn fn;
void *data;
int count;
} SystemUpgradeInfo;
static bool
-foreach_system_upgrade_cb (constResolvablePtr upgrade, void *data)
+foreach_system_upgrade_cb (constResItemPtr upgrade, void *data)
{
SystemUpgradeInfo *info = (SystemUpgradeInfo *)data;
constChannelPtr channel = upgrade->channel();
return true;
}
- if (info->world->resolvableIsLocked (upgrade))
+ if (info->world->resItemIsLocked (upgrade))
return true;
if (info->best_upgrades.empty()) {
}
else {
/* All the versions are equal, so picking the first is fine */
- constResolvablePtr best_up = info->best_upgrades.front();
+ constResItemPtr best_up = info->best_upgrades.front();
cmp = GVersion.compare (best_up, upgrade);
if (cmp <= 0) {
- /* We have a new best resolvable... */
+ /* We have a new best resItem... */
info->best_upgrades.pop_front();
info->best_upgrades.push_back (upgrade);
}
static void
-foreach_system_resolvable_cb (const string & name, constResolvablePtr resolvable, SystemUpgradeInfo *info)
+foreach_system_resItem_cb (const string & name, constResItemPtr resItem, SystemUpgradeInfo *info)
{
- info->system_resolvable = resolvable;
+ info->system_resItem = resItem;
info->best_upgrades.clear();
- /* If the resolvable is excluded, skip it. */
- if (info->world->resolvableIsLocked (info->system_resolvable))
+ /* If the resItem is excluded, skip it. */
+ if (info->world->resItemIsLocked (info->system_resItem))
return;
- info->world->foreachUpgrade (info->system_resolvable, new Channel (CHANNEL_TYPE_NONSYSTEM), foreach_system_upgrade_cb, info);
+ info->world->foreachUpgrade (info->system_resItem, new Channel (CHANNEL_TYPE_NONSYSTEM), foreach_system_upgrade_cb, info);
- for (CResolvableList::const_iterator iter = info->best_upgrades.begin(); iter != info->best_upgrades.end(); iter++) {
- constResolvablePtr upgrade = *iter;
+ for (CResItemList::const_iterator iter = info->best_upgrades.begin(); iter != info->best_upgrades.end(); iter++) {
+ constResItemPtr upgrade = *iter;
if (info->fn)
- info->fn (info->system_resolvable, upgrade, info->data);
+ info->fn (info->system_resItem, upgrade, info->data);
++info->count;
}
info->best_upgrades.clear();
}
-typedef map<const string,constResolvablePtr> UniqueTable;
+typedef map<const string,constResItemPtr> UniqueTable;
static bool
-build_unique_table_cb (constResolvablePtr resolvable, void *data)
+build_unique_table_cb (constResItemPtr resItem, void *data)
{
UniqueTable *unique_table = (UniqueTable *)data;
- UniqueTable::const_iterator pos = unique_table->find (resolvable->name());
+ UniqueTable::const_iterator pos = unique_table->find (resItem->name());
if (pos != unique_table->end()) {
- if (GVersion.compare (resolvable, pos->second) <= 0)
+ if (GVersion.compare (resItem, pos->second) <= 0)
return true;
}
- (*unique_table)[resolvable->name()] = resolvable;
+ (*unique_table)[resItem->name()] = resItem;
return true;
}
* @fn: A callback function.
* @user_data: Pointer to be passed to the callback function.
*
- * Iterates across all system resolvables in @world for which there
- * exists an upgrade, and passes both the original resolvable and
- * the upgrade resolvable to the callback function.
+ * Iterates across all system resItems in @world for which there
+ * exists an upgrade, and passes both the original resItem and
+ * the upgrade resItem to the callback function.
*
- * Return value: The number of matching resolvables that the callback
+ * Return value: The number of matching resItems that the callback
* function was invoked on, or -1 in case of an error.
**/
int
-World::foreachSystemUpgrade (bool subscribed_only, ResolvablePairFn fn, void *data)
+World::foreachSystemUpgrade (bool subscribed_only, ResItemPairFn fn, void *data)
{
SystemUpgradeInfo info;
UniqueTable unique_table;
- /* rc_world_foreach_resolvable calls rc_world_sync */
+ /* rc_world_foreach_resItem calls rc_world_sync */
- foreachResolvable (new Channel (CHANNEL_TYPE_SYSTEM), build_unique_table_cb, &unique_table);
+ foreachResItem (new Channel (CHANNEL_TYPE_SYSTEM), build_unique_table_cb, &unique_table);
info.world = this;
info.subscribed_only = subscribed_only;
info.count = 0;
for (UniqueTable::const_iterator iter = unique_table.begin(); iter != unique_table.end(); iter++) {
- foreach_system_resolvable_cb (iter->first, iter->second, &info);
+ foreach_system_resItem_cb (iter->first, iter->second, &info);
}
return info.count;
PackageUpdateList
-World::getUpgrades (constResolvablePtr resolvable, constChannelPtr channel)
+World::getUpgrades (constResItemPtr resItem, constChannelPtr channel)
{
fprintf (stderr, "World::getUpgrades not implemented\n");
return PackageUpdateList();
}
-constResolvablePtr
-World::getBestUpgrade (constResolvablePtr resolvable, bool subscribed_only)
+constResItemPtr
+World::getBestUpgrade (constResItemPtr resItem, bool subscribed_only)
{
fprintf (stderr, "World::getBestUpgrade not implemented\n");
return 0;
#include <zypp/solver/detail/WorldPtr.h>
#include <zypp/solver/detail/MultiWorldPtr.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItem.h>
#include <zypp/solver/detail/Channel.h>
#include <zypp/solver/detail/Match.h>
#include <zypp/solver/detail/Pending.h>
typedef void (*WorldSpewFn) (constWorldPtr world, FILE *out);
typedef constWorldPtr (*WorldDupFn) (constWorldPtr world);
-typedef bool (*WorldCanTransactResolvableFn) (constWorldPtr world, constResolvablePtr resolvable);
-typedef bool (*WorldTransactFn) (constWorldPtr world, const ResolvableList & install_resolvables, const ResolvableList & remove_resolvables, int flags);
+typedef bool (*WorldCanTransactResItemFn) (constWorldPtr world, constResItemPtr resItem);
+typedef bool (*WorldTransactFn) (constWorldPtr world, const ResItemList & install_resItems, const ResItemList & remove_resItems, int flags);
typedef bool (*WorldGetSubscribedFn) (const World *world, constChannelPtr channel);
typedef void (*WorldSetSubscribedFn) (World *world, ChannelPtr channel, bool subs_status);
typedef void (*WorldRemoveLockFn) (constWorldPtr world, constMatchPtr lock);
typedef void (*WorldClearLockFn) (constWorldPtr world);
-typedef int (*WorldForeachResolvableFn) (constWorldPtr world, const char *name, constChannelPtr channel, ResolvableFn callback, void *user_data);
-typedef int (*WorldForeachPackageSpecFn) (constWorldPtr world, constDependencyPtr dep, ResolvableAndSpecFn callback, void *user_data);
-typedef int (*WorldForeachPackageDepFn) (constWorldPtr world, constDependencyPtr dep, ResolvableAndDepFn callback, void *user_data);
+typedef int (*WorldForeachResItemFn) (constWorldPtr world, const char *name, constChannelPtr channel, ResItemFn callback, void *user_data);
+typedef int (*WorldForeachPackageSpecFn) (constWorldPtr world, constDependencyPtr dep, ResItemAndSpecFn callback, void *user_data);
+typedef int (*WorldForeachPackageDepFn) (constWorldPtr world, constDependencyPtr dep, ResItemAndDepFn callback, void *user_data);
typedef void (*WorldSerializeFn) (constWorldPtr world, constXmlNodePtr root);
typedef void (*WorldUnserializeFn) (constWorldPtr world, constXmlNodePtr node);
/* The sequence numbers gets incremented every
time the RCWorld is changed. */
- unsigned int _seq_no_resolvables;
+ unsigned int _seq_no_resItems;
unsigned int _seq_no_channels;
unsigned int _seq_no_subscriptions;
unsigned int _seq_no_locks;
bool isMultiWorld () const { return _type == MULTI_WORLD; }
bool isServiceWorld () const { return _type == SERVICE_WORLD; }
- unsigned int resolvableSequenceNumber (void) const { return _seq_no_resolvables; }
+ unsigned int resItemSequenceNumber (void) const { return _seq_no_resItems; }
unsigned int channelSequenceNumber (void) const { return _seq_no_channels; }
unsigned int subscriptionSequenceNumber (void) const { return _seq_no_subscriptions; }
unsigned int lockSequenceNumber (void) const { return _seq_no_locks; }
- void touchResolvableSequenceNumber (void) { _seq_no_resolvables++; }
+ void touchResItemSequenceNumber (void) { _seq_no_resItems++; }
void touchChannelSequenceNumber (void) { _seq_no_channels++; }
void touchSubscriptionSequenceNumber (void) { _seq_no_subscriptions++; }
void touchLockSequenceNumber (void) { _seq_no_locks++; }
virtual ChannelPtr getChannelByAlias (const char *alias) const = 0;
virtual ChannelPtr getChannelById (const char *channel_id) const = 0;
- // Resolvable Locks
+ // ResItem Locks
virtual int foreachLock (MatchFn fn, void *data) const;
void removeLock (constMatchPtr lock);
void clearLocks ();
- bool resolvableIsLocked (constResolvablePtr resolvable);
+ bool resItemIsLocked (constResItemPtr resItem);
- // Single resolvable queries
+ // Single resItem queries
- virtual constResolvablePtr findInstalledResolvable (constResolvablePtr resolvable) = 0;
- virtual constResolvablePtr findResolvable (constChannelPtr channel, const char *name) const = 0;
- virtual constResolvablePtr findResolvableWithConstraint (constChannelPtr channel, const char *name, constDependencyPtr constraint, bool is_and) const = 0;
- virtual ChannelPtr guessResolvableChannel (constResolvablePtr resolvable) const = 0;
+ virtual constResItemPtr findInstalledResItem (constResItemPtr resItem) = 0;
+ virtual constResItemPtr findResItem (constChannelPtr channel, const char *name) const = 0;
+ virtual constResItemPtr findResItemWithConstraint (constChannelPtr channel, const char *name, constDependencyPtr constraint, bool is_and) const = 0;
+ virtual ChannelPtr guessResItemChannel (constResItemPtr resItem) const = 0;
- // Iterate across resolvables
+ // Iterate across resItems
- virtual int foreachResolvable (ChannelPtr channel, CResolvableFn fn, void *data) = 0;
- virtual int foreachResolvableByName (const std::string & name, ChannelPtr channel, CResolvableFn fn, void *user_data) = 0;
- virtual int foreachResolvableByMatch (constMatchPtr match, CResolvableFn fn, void *user_data) = 0;
+ virtual int foreachResItem (ChannelPtr channel, CResItemFn fn, void *data) = 0;
+ virtual int foreachResItemByName (const std::string & name, ChannelPtr channel, CResItemFn fn, void *user_data) = 0;
+ virtual int foreachResItemByMatch (constMatchPtr match, CResItemFn fn, void *user_data) = 0;
// Iterate across provides or requirement
- virtual int foreachProvidingResolvable (constDependencyPtr dep, ResolvableAndSpecFn fn, void *user_data) = 0;
- virtual int foreachRequiringResolvable (constDependencyPtr dep, ResolvableAndDepFn fn, void *user_data) = 0;
- virtual int foreachConflictingResolvable (constDependencyPtr dep, ResolvableAndDepFn fn, void *user_data) = 0;
+ virtual int foreachProvidingResItem (constDependencyPtr dep, ResItemAndSpecFn fn, void *user_data) = 0;
+ virtual int foreachRequiringResItem (constDependencyPtr dep, ResItemAndDepFn fn, void *user_data) = 0;
+ virtual int foreachConflictingResItem (constDependencyPtr dep, ResItemAndDepFn fn, void *user_data) = 0;
// upgrades
- int foreachUpgrade (constResolvablePtr resolvable, ChannelPtr channel, CResolvableFn fn, void *data);
- PackageUpdateList getUpgrades (constResolvablePtr resolvable, constChannelPtr channel);
- constResolvablePtr getBestUpgrade (constResolvablePtr resolvable, bool subscribed_only);
- int foreachSystemUpgrade (bool subscribed_only, ResolvablePairFn fn, void *data);
+ int foreachUpgrade (constResItemPtr resItem, ChannelPtr channel, CResItemFn fn, void *data);
+ PackageUpdateList getUpgrades (constResItemPtr resItem, constChannelPtr channel);
+ constResItemPtr getBestUpgrade (constResItemPtr resItem, bool subscribed_only);
+ int foreachSystemUpgrade (bool subscribed_only, ResItemPairFn fn, void *data);
// provider
- bool getSingleProvider (constDependencyPtr dep, constChannelPtr channel, constResolvablePtr *resolvable);
+ bool getSingleProvider (constDependencyPtr dep, constChannelPtr channel, constResItemPtr *resItem);
// Transacting
- bool canTransactResolvable (constResolvablePtr resolvable);
- bool transact (const ResolvableList & installResolvables, const ResolvableList & remove_resolvables, int flags);
+ bool canTransactResItem (constResItemPtr resItem);
+ bool transact (const ResItemList & installResItems, const ResItemList & remove_resItems, int flags);
// XML serialization
/* ------ */
-static RCResolvableDep *
-rc_xml_node_to_resolvable_dep_internal (const xmlNode *node)
+static RCResItemDep *
+rc_xml_node_to_resItem_dep_internal (const xmlNode *node)
{
gchar *name = NULL, *version = NULL, *release = NULL;
gboolean has_epoch = false;
guint32 epoch = 0;
- RCResolvableRelation relation;
- RCResolvableDep *dep;
+ RCResItemRelation relation;
+ RCResItemDep *dep;
gchar *tmp;
name = xml_get_prop (node, "name");
tmp = xml_get_prop (node, "op");
if (tmp) {
- relation = rc_resolvable_relation_from_string (tmp);
+ relation = rc_resItem_relation_from_string (tmp);
has_epoch = xml_get_guint32_value (node, "epoch", &epoch);
}
/* FIXME: should get channel from XML */
- dep = rc_resolvable_dep_new (name, has_epoch, epoch, version, release,
+ dep = rc_resItem_dep_new (name, has_epoch, epoch, version, release,
relation, RC_TYPE_RESOLVABLE, RC_CHANNEL_ANY,
false, false);
g_free (release);
return dep;
-} /* rc_xml_node_to_resolvable_dep_internal */
+} /* rc_xml_node_to_resItem_dep_internal */
-RCResolvableDep *
-rc_xml_node_to_resolvable_dep (const xmlNode *node)
+RCResItemDep *
+rc_xml_node_to_resItem_dep (const xmlNode *node)
{
- RCResolvableDep *dep = NULL;
+ RCResItemDep *dep = NULL;
if (!g_strcasecmp (node->name, "dep")) {
- dep = rc_xml_node_to_resolvable_dep_internal (node);
+ dep = rc_xml_node_to_resItem_dep_internal (node);
return (dep);
} else if (!g_strcasecmp (node->name, "or")) {
- RCResolvableDepSList *or_dep_slist = NULL;
+ RCResItemDepSList *or_dep_slist = NULL;
RCDepOr *or;
xmlNode *iter = node->xmlChildrenNode;
if (iter->type == XML_ELEMENT_NODE) {
or_dep_slist = g_slist_append(
or_dep_slist,
- rc_xml_node_to_resolvable_dep_internal (iter));
+ rc_xml_node_to_resItem_dep_internal (iter));
}
iter = iter->next;
}
return (dep);
-} /* rc_xml_node_to_resolvable_dep */
+} /* rc_xml_node_to_resItem_dep */
/* ------ */
int
-extract_packages_from_xml_node (XmlNodePtr node, ChannelPtr channel, CResolvableFn callback, void *data)
+extract_packages_from_xml_node (XmlNodePtr node, ChannelPtr channel, CResItemFn callback, void *data)
{
PackagePtr package;
int count = 0;
int
-extract_packages_from_helix_buffer (const char *buf, size_t len, ChannelPtr channel, CResolvableFn callback, void *data)
+extract_packages_from_helix_buffer (const char *buf, size_t len, ChannelPtr channel, CResItemFn callback, void *data)
{
unsigned int count = 0;
PackageList packages;
int
-extract_packages_from_helix_file (const string & filename, ChannelPtr channel, CResolvableFn callback, void *data)
+extract_packages_from_helix_file (const string & filename, ChannelPtr channel, CResItemFn callback, void *data)
{
Buffer *buf;
int count;
int
-extract_packages_from_undump_buffer (const char *buf, size_t len, ChannelAndSubscribedFn channel_callback, CResolvableFn resolvable_callback, MatchFn lock_callback, void *data)
+extract_packages_from_undump_buffer (const char *buf, size_t len, ChannelAndSubscribedFn channel_callback, CResItemFn resItem_callback, MatchFn lock_callback, void *data)
{
xmlDoc *doc;
XmlNodePtr dump_node;
channel_callback (system_channel, false, data);
}
- subcount = extract_packages_from_xml_node (channel_node, system_channel, resolvable_callback, data);
+ subcount = extract_packages_from_xml_node (channel_node, system_channel, resItem_callback, data);
if (subcount < 0) {
/* Do something clever */
channel_callback (current_channel, subscribed != 0, data);
}
- if (resolvable_callback) {
+ if (resItem_callback) {
int subcount;
- subcount = extract_packages_from_xml_node (channel_node, current_channel, resolvable_callback, data);
+ subcount = extract_packages_from_xml_node (channel_node, current_channel, resItem_callback, data);
if (subcount < 0) {
/* FIXME: do something clever */
fprintf (stderr, "No packages found\n");
int
-extract_packages_from_undump_file (const string & filename, ChannelAndSubscribedFn channel_callback, CResolvableFn resolvable_callback, MatchFn lock_callback, void *data)
+extract_packages_from_undump_file (const string & filename, ChannelAndSubscribedFn channel_callback, CResItemFn resItem_callback, MatchFn lock_callback, void *data)
{
Buffer *buf;
int count;
if (buf == NULL)
return -1;
- count = extract_packages_from_undump_buffer ((const char *)(buf->data), buf->size, channel_callback, resolvable_callback, lock_callback, data);
+ count = extract_packages_from_undump_buffer ((const char *)(buf->data), buf->size, channel_callback, resItem_callback, lock_callback, data);
buffer_unmap_file (buf);
#if 0
/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
-static ResolvablePtr
+static ResItemPtr
fill_debian_package (const char *buf, const char *url_prefix, int *off)
{
const char *ibuf;
RCPackageUpdate *up = NULL;
- ResolvablePtr r;
- ResolvableList requires, provides, conflicts, suggests, recommends;
+ ResItemPtr r;
+ ResItemList requires, provides, conflicts, suggests, recommends;
up = rc_package_update_new ();
}
if (!strncmp (key, "package", strlen ("package"))) {
- rc_resolvable_spec_set_name (RC_RESOLVABLE_SPEC (pkg), value->str);
+ rc_resItem_spec_set_name (RC_RESOLVABLE_SPEC (pkg), value->str);
} else if (!strncmp (key, "installed-size",
strlen ("installed-size"))) {
up->installed_size = strtoul (value->str, NULL, 10) * 1024;
pkg->description = g_strconcat (newline + 1, "\n", NULL);
}
} else if (!strncmp (key, "version", strlen ("version"))) {
- RCResolvableSpec *spec = RC_RESOLVABLE_SPEC (pkg);
+ RCResItemSpec *spec = RC_RESOLVABLE_SPEC (pkg);
rc_version_parse (value->str, spec);
} else if (!strncmp (key, "section", strlen ("section"))) {
pkg->section = rc_debman_section_to_package_section (value->str);
} else if (!strncmp (key, "md5sum", strlen ("md5sum"))) {
up->md5sum = strdup (value->str);
} else if (!strncmp (key, "architecture", strlen ("architecture"))) {
- rc_resolvable_spec_set_arch (RC_RESOLVABLE_SPEC (pkg), rc_arch_from_string (value->str));
+ rc_resItem_spec_set_arch (RC_RESOLVABLE_SPEC (pkg), rc_arch_from_string (value->str));
}
g_string_free (value, true);
up->importance = RC_IMPORTANCE_SUGGESTED;
up->description = strdup ("Upstream Debian release");
- rc_resolvable_spec_copy (rc_package_update_get_spec(up), RC_RESOLVABLE_SPEC (pkg));
+ rc_resItem_spec_copy (rc_package_update_get_spec(up), RC_RESOLVABLE_SPEC (pkg));
rc_package_add_update (pkg, up);
r = RC_RESOLVABLE (pkg);
/* Make sure to provide myself, for the dep code! */
- provides = g_slist_append (provides, rc_resolvable_dep_new_from_spec
+ provides = g_slist_append (provides, rc_resItem_dep_new_from_spec
(RC_RESOLVABLE_SPEC (pkg),
RC_RELATION_EQUAL,
RC_TYPE_PACKAGE,
- rc_resolvable_get_channel (r),
+ rc_resItem_get_channel (r),
false, false));
- rc_resolvable_set_requires (r, requires);
- rc_resolvable_set_provides (r, provides);
- rc_resolvable_set_conflicts (r, conflicts);
- rc_resolvable_set_obsoletes (r, NULL);
- rc_resolvable_set_suggests (r, suggests);
- rc_resolvable_set_recommends(r, recommends);
+ rc_resItem_set_requires (r, requires);
+ rc_resItem_set_provides (r, provides);
+ rc_resItem_set_conflicts (r, conflicts);
+ rc_resItem_set_obsoletes (r, NULL);
+ rc_resItem_set_suggests (r, suggests);
+ rc_resItem_set_recommends(r, recommends);
/* returns the number of characters we processed */
return ibuf - buf;
}
#endif
int
-extract_packages_from_debian_buffer (const char *buf, size_t len, ChannelPtr channel, CResolvableFn callback, void *data)
+extract_packages_from_debian_buffer (const char *buf, size_t len, ChannelPtr channel, CResItemFn callback, void *data)
{
const char *pos;
int count = 0;
int off;
/* All debian packages "have" epochs */
- ResolvablePtr resolvable = fill_debian_package (iter, channel->getFilePath (), &off);
+ ResItemPtr resItem = fill_debian_package (iter, channel->getFilePath (), &off);
- resolvable->setEpoch (0);
- resolvable->setArch (Arch::Noarch);
- resolvable->setChannel (channel);
+ resItem->setEpoch (0);
+ resItem->setArch (Arch::Noarch);
+ resItem->setChannel (channel);
if (callback)
- callback (resolvable, data);
+ callback (resItem, data);
++count;
int
-extract_packages_from_debian_file (const string & filename, ChannelPtr channel, CResolvableFn callback, void *data)
+extract_packages_from_debian_file (const string & filename, ChannelPtr channel, CResItemFn callback, void *data)
{
Buffer *buf;
int count;
rc_rpmman_depends_fill (rpmman, h, p, true);
pu = rc_package_update_new ();
- rc_resolvable_spec_copy (rc_package_update_get_spec (pu), RC_RESOLVABLE_SPEC (p));
+ rc_resItem_spec_copy (rc_package_update_get_spec (pu), RC_RESOLVABLE_SPEC (p));
pu->importance = RC_IMPORTANCE_SUGGESTED;
pu->description = strdup ("No information available.");
pu->package_url = url;
extract_packages_from_aptrpm_buffer (const guint8 *data, size_t len,
RCPackman *packman,
ChannelPtr channel,
- CResolvableFn callback,
+ CResItemFn callback,
void * user_data)
{
#ifndef ENABLE_RPM
const int hdrmagic_len = 8;
const char *hdrmagic;
const guint8 *cur_ptr;
- RCResolvableSpec *spec;
+ RCResItemSpec *spec;
g_return_val_if_fail (packman != NULL, -1);
rc_rpmman_read_header (rpmman, h, p);
rc_rpmman_depends_fill (rpmman, h, p, true);
- rc_resolvable_set_channel (RC_RESOLVABLE (p), channel);
+ rc_resItem_set_channel (RC_RESOLVABLE (p), channel);
pu = rc_package_update_new ();
- rc_resolvable_spec_copy (rc_package_update_get_spec (pu), RC_RESOLVABLE_SPEC (p));
+ rc_resItem_spec_copy (rc_package_update_get_spec (pu), RC_RESOLVABLE_SPEC (p));
pu->importance = RC_IMPORTANCE_SUGGESTED;
pu->description = strdup ("No information available.");
spec = RC_RESOLVABLE_SPEC (p);
pu->package_url = strdup_printf ("%s/%s-%s-%s.%s.rpm",
rc_channel_get_file_path (channel),
- rc_resolvable_spec_get_name (spec),
- rc_resolvable_spec_get_version (spec),
- rc_resolvable_spec_get_release (spec),
+ rc_resItem_spec_get_name (spec),
+ rc_resItem_spec_get_version (spec),
+ rc_resItem_spec_get_release (spec),
archstr);
p->history = g_slist_append (p->history, pu);
if (callback)
- callback ((RCResolvable *) p, user_data);
+ callback ((RCResItem *) p, user_data);
g_object_unref (p);
extract_packages_from_aptrpm_file (const char *filename,
RCPackman *packman,
ChannelPtr channel,
- CResolvableFn callback,
+ CResItemFn callback,
void * user_data)
{
WorldPtr world = *((WorldPtr *)data);
}
struct HashIterInfo {
- CResolvableFn callback;
+ CResItemFn callback;
void * user_data;
int count;
};
static void
hash_iter_cb (void * key, void * val, void * user_data)
{
- RCResolvable *r = val;
+ RCResItem *r = val;
struct HashIterInfo *info = user_data;
if (info->callback)
RCPackageUpdate *up;
up = rc_package_update_new ();
- rc_resolvable_spec_copy ((RCResolvableSpec *) up,
+ rc_resItem_spec_copy ((RCResItemSpec *) up,
RC_RESOLVABLE_SPEC (pkg));
up->importance = RC_IMPORTANCE_SUGGESTED;
rc_package_add_update (pkg, up);
}
typedef struct {
- CResolvableFn user_callback;
+ CResItemFn user_callback;
void * user_data;
const gchar *path;
} PackagesFromDirInfo;
update->package_url,
NULL);
if (info->user_callback)
- return info->user_callback ((RCResolvable *)package, info->user_data);
+ return info->user_callback ((RCResItem *)package, info->user_data);
return true;
}
ChannelPtr channel,
RCPackman *packman,
bool recursive,
- CResolvableFn callback,
+ CResItemFn callback,
void * user_data)
{
WorldPtr world = *((WorldPtr *)data);
pkg = rc_packman_query_file (packman, file_path, true);
if (pkg != NULL) {
- rc_resolvable_set_channel (RC_RESOLVABLE (pkg), channel);
+ rc_resItem_set_channel (RC_RESOLVABLE (pkg), channel);
pkg->package_filename = strdup (file_path);
pkg->local_package = false;
add_fake_history (pkg);
#include <zypp/solver/detail/XmlNode.h>
#include <zypp/solver/detail/Channel.h>
#include <zypp/solver/detail/Pending.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItem.h>
#include <zypp/solver/detail/Package.h>
#include <zypp/solver/detail/Match.h>
#include <zypp/solver/detail/StoreWorldPtr.h>
//////////////////////////////////////////////////////////////////
-int extract_packages_from_helix_buffer (const char data[], size_t len, ChannelPtr channel, CResolvableFn callback, void *data);
-int extract_packages_from_helix_file (const std::string & filename, ChannelPtr channel, CResolvableFn callback, void *data);
+int extract_packages_from_helix_buffer (const char data[], size_t len, ChannelPtr channel, CResItemFn callback, void *data);
+int extract_packages_from_helix_file (const std::string & filename, ChannelPtr channel, CResItemFn callback, void *data);
-int extract_packages_from_xml_node (constXmlNodePtr node, ChannelPtr channel, ResolvableFn callback, void *data);
+int extract_packages_from_xml_node (constXmlNodePtr node, ChannelPtr channel, ResItemFn callback, void *data);
-int extract_packages_from_debian_buffer (const char *data, size_t len, ChannelPtr channel, CResolvableFn callback, void *data);
-int extract_packages_from_debian_file (const std::string & filename, ChannelPtr channel, CResolvableFn callback, void *data);
+int extract_packages_from_debian_buffer (const char *data, size_t len, ChannelPtr channel, CResItemFn callback, void *data);
+int extract_packages_from_debian_file (const std::string & filename, ChannelPtr channel, CResItemFn callback, void *data);
PackagePtr extract_yum_package (const char *data, size_t len, PackmanPtr packman, const std::string & url);
-int extract_packages_from_aptrpm_buffer (const char *data, size_t len, PackmanPtr packman, ChannelPtr channel, ResolvableFn callback, void *data);
-int extract_packages_from_aptrpm_file (const std::string & filename, PackmanPtr packman, ChannelPtr channel, ResolvableFn callback, void *data);
+int extract_packages_from_aptrpm_buffer (const char *data, size_t len, PackmanPtr packman, ChannelPtr channel, ResItemFn callback, void *data);
+int extract_packages_from_aptrpm_file (const std::string & filename, PackmanPtr packman, ChannelPtr channel, ResItemFn callback, void *data);
-int extract_packages_from_undump_buffer (const char *data, size_t len, ChannelAndSubscribedFn channel_callback, CResolvableFn package_callback, MatchFn lock_callback, void *data);
-int extract_packages_from_undump_file (const std::string & filename, ChannelAndSubscribedFn channel_callback, CResolvableFn package_callback, MatchFn lock_callback, void *data);
+int extract_packages_from_undump_buffer (const char *data, size_t len, ChannelAndSubscribedFn channel_callback, CResItemFn package_callback, MatchFn lock_callback, void *data);
+int extract_packages_from_undump_file (const std::string & filename, ChannelAndSubscribedFn channel_callback, CResItemFn package_callback, MatchFn lock_callback, void *data);
-int extract_packages_from_directory (const std::string & path, ChannelPtr channel, PackmanPtr packman, bool recursive, ResolvableFn callback, void *data);
+int extract_packages_from_directory (const std::string & path, ChannelPtr channel, PackmanPtr packman, bool recursive, ResItemFn callback, void *data);
///////////////////////////////////////////////////////////////////
}; // namespace ZYPP
#include <zypp/solver/detail/Channel.h>
#include <zypp/solver/detail/Dependency.h>
#include <zypp/solver/detail/Match.h>
-#include <zypp/solver/detail/Resolvable.h>
+#include <zypp/solver/detail/ResItem.h>
#include <zypp/solver/detail/Spec.h>
#include <zypp/solver/detail/Version.h>
#include <zypp/solver/detail/World.h>
#if 0
static void
-lock_resolvable (ResolvablePtr resolvable)
+lock_resItem (ResItemPtr resItem)
{
- RCResolvableDep *dep;
- RCResolvableMatch *match;
+ RCResItemDep *dep;
+ RCResItemMatch *match;
- dep = rc_resolvable_dep_new_from_spec (RC_RESOLVABLE_SPEC (resolvable),
+ dep = rc_resItem_dep_new_from_spec (RC_RESOLVABLE_SPEC (resItem),
RC_RELATION_EQUAL, RC_TYPE_RESOLVABLE,
RC_CHANNEL_ANY, false, false);
- match = rc_resolvable_match_new ();
- rc_resolvable_match_set_dep (match, dep);
+ match = rc_resItem_match_new ();
+ rc_resItem_match_set_dep (match, dep);
- rc_resolvable_dep_unref (dep);
+ rc_resItem_dep_unref (dep);
rc_world_add_lock (rc_get_world (), match);
}
static bool
-remove_resolvable_cb (RCWorld *world, gpointer user_data)
+remove_resItem_cb (RCWorld *world, gpointer user_data)
{
- ResolvablePtr resolvable = user_data;
+ ResItemPtr resItem = user_data;
- rc_world_store_remove_resolvable (RC_WORLD_STORE (world), resolvable);
+ rc_world_store_remove_resItem (RC_WORLD_STORE (world), resItem);
return true;
}
static void
-remove_resolvable (ResolvablePtr resolvable)
+remove_resItem (ResItemPtr resItem)
{
rc_world_multi_foreach_subworld_by_type (RC_WORLD_MULTI (world),
RC_TYPE_WORLD_STORE,
- remove_resolvable_cb, resolvable);
+ remove_resItem_cb, resItem);
}
/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
typedef list<string> StringList;
static void
-assemble_install_cb (constResolvablePtr resolvable,
- ResolvableStatus status,
+assemble_install_cb (constResItemPtr resItem,
+ ResItemStatus status,
void *data)
{
StringList *slist = (StringList *)data;
- string str = stringutil::form ("%-7s ", resolvable->isInstalled() ? "|flag" : "install");
- str += resolvable->asString();
+ string str = stringutil::form ("%-7s ", resItem->isInstalled() ? "|flag" : "install");
+ str += resItem->asString();
slist->push_back (str);
}
static void
-assemble_uninstall_cb (constResolvablePtr resolvable,
- ResolvableStatus status,
+assemble_uninstall_cb (constResItemPtr resItem,
+ ResItemStatus status,
void *data)
{
StringList *slist = (StringList *)data;
- string str = stringutil::form ("%-7s ", resolvable->isInstalled() ? "remove" : "|unflag");
- str += resolvable->asString();
+ string str = stringutil::form ("%-7s ", resItem->isInstalled() ? "remove" : "|unflag");
+ str += resItem->asString();
slist->push_back (str);
}
static void
-assemble_upgrade_cb (constResolvablePtr res1,
- ResolvableStatus status1,
- constResolvablePtr res2,
- ResolvableStatus status2,
+assemble_upgrade_cb (constResItemPtr res1,
+ ResItemStatus status1,
+ constResItemPtr res2,
+ ResItemStatus status2,
void *data)
{
StringList *slist = (StringList *)data;
//---------------------------------------------------------------------------------------------------------------------
static bool
-mark_as_system_cb (constResolvablePtr resolvable, void *unused)
+mark_as_system_cb (constResItemPtr resItem, void *unused)
{
- ResolvablePtr r = ResolvablePtr::cast_away_const(resolvable);
+ ResItemPtr r = ResItemPtr::cast_away_const(resItem);
r->setInstalled (true);
return true;
}
-static constResolvablePtr
-get_resolvable (const char *channel_name, const char *package_name)
+static constResItemPtr
+get_resItem (const char *channel_name, const char *package_name)
{
constChannelPtr channel;
- constResolvablePtr resolvable;
+ constResItemPtr resItem;
channel = get_channel (channel_name);
return NULL;
}
- resolvable = world->findResolvable (channel, package_name);
+ resItem = world->findResItem (channel, package_name);
- if (resolvable == NULL) {
+ if (resItem == NULL) {
fprintf (stderr, "Can't find package '%s' in channel '%s': no such package\n", package_name, channel_name);
return NULL;
}
- return resolvable;
+ return resItem;
}
//---------------------------------------------------------------------------------------------------------------------
// setup related functions
static bool
-add_to_world_cb (constResolvablePtr resolvable, void *data)
+add_to_world_cb (constResItemPtr resItem, void *data)
{
WorldPtr world = *((WorldPtr *)data);
- ((StoreWorldPtr)world)->addResolvable (resolvable);
+ ((StoreWorldPtr)world)->addResItem (resItem);
return true;
}
}
if (system_packages) {
- store->foreachResolvable (channel, mark_as_system_cb, NULL);
+ store->foreachResItem (channel, mark_as_system_cb, NULL);
}
printf ("Loaded %d package%s from %s\n", count, count == 1 ? "" : "s", pathname.c_str()); fflush (stdout);
} else if (node->equals ("force-install")) {
const char *channel_name = node->getProp ("channel");
const char *package_name = node->getProp ("package");
- constResolvablePtr resolvable;
+ constResItemPtr resItem;
constChannelPtr system_channel;
assertExit (channel_name);
assertExit (package_name);
- resolvable = get_resolvable (channel_name, package_name);
- if (resolvable) {
+ resItem = get_resItem (channel_name, package_name);
+ if (resItem) {
printf (">!> Force-installing %s from channel %s\n", package_name, channel_name);
system_channel = world->getChannelById ("@system");
if (!system_channel)
fprintf (stderr, "No system channel available!\n");
- ResolvablePtr r = ResolvablePtr::cast_away_const(resolvable);
+ ResItemPtr r = ResItemPtr::cast_away_const(resItem);
r->setChannel (system_channel);
r->setInstalled (true);
} else {
free ((void *)package_name);
} else if (node->equals ("force-uninstall")) {
const char *package_name = node->getProp ("package");
- constResolvablePtr resolvable;
+ constResItemPtr resItem;
assertExit (package_name);
- resolvable = get_resolvable ("@system", package_name);
+ resItem = get_resItem ("@system", package_name);
- if (! resolvable) {
+ if (! resItem) {
fprintf (stderr, "Can't force-uninstall installed package '%s'\n", package_name);
} else {
printf (">!> Force-uninstalling '%s'\n", package_name);
} else if (node->equals ("lock")) {
const char *channel_name = node->getProp ("channel");
const char *package_name = node->getProp ("package");
- constResolvablePtr resolvable;
+ constResItemPtr resItem;
assertExit (channel_name);
assertExit (package_name);
- resolvable = get_resolvable (channel_name, package_name);
- if (resolvable) {
+ resItem = get_resItem (channel_name, package_name);
+ if (resItem) {
printf (">!> Locking %s from channel %s\n", package_name, channel_name);
- ResolvablePtr r = ResolvablePtr::cast_away_const(resolvable);
+ ResItemPtr r = ResItemPtr::cast_away_const(resItem);
r->setLocked (true);
} else {
fprintf (stderr, "Unknown package %s::%s\n", channel_name, package_name);
static bool
-trial_upgrade_cb (constResolvablePtr original, constResolvablePtr upgrade, void *user_data)
+trial_upgrade_cb (constResItemPtr original, constResItemPtr upgrade, void *user_data)
{
Resolver *resolver = (Resolver *)user_data;
- resolver->addResolvableToInstall (upgrade);
+ resolver->addResItemToInstall (upgrade);
printf (">!> Upgrading %s => %s\n", original->asString().c_str(), upgrade->asString().c_str());
const char *channel_name = node->getProp ("channel");
const char *package_name = node->getProp ("package");
- constResolvablePtr resolvable;
+ constResItemPtr resItem;
assertExit (channel_name);
assertExit (package_name);
- resolvable = get_resolvable (channel_name, package_name);
- if (resolvable) {
+ resItem = get_resItem (channel_name, package_name);
+ if (resItem) {
printf (">!> Installing %s from channel %s\n", package_name, channel_name);
- resolver.addResolvableToInstall (resolvable);
+ resolver.addResItemToInstall (resItem);
} else {
fprintf (stderr, "Unknown package %s::%s\n", channel_name, package_name);
}
} else if (node->equals ("uninstall")) {
const char *package_name = node->getProp ("package");
- constResolvablePtr resolvable;
+ constResItemPtr resItem;
assertExit (package_name);
- resolvable = get_resolvable ("@system", package_name);
- if (resolvable) {
+ resItem = get_resItem ("@system", package_name);
+ if (resItem) {
printf (">!> Uninstalling %s\n", package_name);
- resolver.addResolvableToRemove (resolvable);
+ resolver.addResItemToRemove (resItem);
} else {
fprintf (stderr, "Unknown system package %s\n", package_name);
}