Using zypp's identical() instead of our equalNVRA (bnc #467106)
authorJán Kupec <jkupec@suse.cz>
Mon, 1 Mar 2010 14:20:18 +0000 (15:20 +0100)
committerJán Kupec <jkupec@suse.cz>
Mon, 1 Mar 2010 14:20:18 +0000 (15:20 +0100)
src/install.cc
src/misc.cc
src/search.cc
src/update.cc
src/utils/misc.cc
src/utils/misc.h

index 560b5de..a8d269a 100755 (executable)
@@ -87,7 +87,7 @@ mark_for_install(Zypper & zypper,
     candidate = s->installedObj();
 
   if (s->installedObj() &&
-      equalNVRA(*s->installedObj().resolvable(), *candidate.resolvable()) &&
+      identical(s->installedObj(), candidate) &&
       !force)
   {
     // if it is broken install anyway, even if it is installed
@@ -316,7 +316,7 @@ mark_selectable(Zypper & zypper,
   bool theoneinstalled; // is the One installed ?
   if (!traits::isPseudoInstalled(s.kind()))
     theoneinstalled = !s.installedEmpty() &&
-      equalNVRA(*s.installedObj().resolvable(), *theone.resolvable());
+      identical(s.installedObj(), theone);
   else if (s.kind() == ResKind::patch)
     theoneinstalled = theone.isRelevant() && theone.isSatisfied();
   else
index 8f5c043..a066371 100644 (file)
@@ -277,7 +277,7 @@ void report_licenses(Zypper & zypper)
 
       for_(it, s->availableBegin(), s->availableEnd())
       {
-        if (equalNVRA(*it->resolvable(), *inst.resolvable()))
+        if (identical(*it, inst))
         {
           inst_with_repo = *it;
           ++count_installed_repo;
index 3068cf8..647d54b 100644 (file)
@@ -560,7 +560,7 @@ void list_packages(Zypper & zypper)
       {
         if (notinst_only)
           continue;
-        row << (equalNVRA(*installed.resolvable(), *pi.resolvable()) ? "i" : "v");
+        row << (identical(installed, pi) ? "i" : "v");
       }
       else
       {
@@ -679,7 +679,7 @@ static void list_product_table(Zypper & zypper)
 
       if (installed)
       {
-        if (equalNVRA(*installed.resolvable(), *pi.resolvable()))
+        if (identical(installed, pi))
         {
           if (notinst_only)
             continue;
index bc0839c..d94500b 100755 (executable)
@@ -752,7 +752,7 @@ void mark_updates(Zypper & zypper, const ResKindSet & kinds, bool skip_interacti
             if (!theone)
               theone = s->installedObj();
 
-            if (equalNVRA(*s->installedObj().resolvable(), *theone.resolvable()))
+            if (identical(s->installedObj(), theone))
             {
               DBG << "the One (" << theone << ") is installed, skipping." << endl;
               zypper.out().info(str::form(
index 8edf163..11050da 100644 (file)
@@ -149,21 +149,6 @@ string string_patch_status(const PoolItem & pi)
 
 // ----------------------------------------------------------------------------
 
-bool equalNVRA(const Resolvable & lhs, const Resolvable & rhs)
-{
-  if (lhs.name() != rhs.name())
-    return false;
-  if (lhs.kind() != rhs.kind())
-    return false;
-  if (lhs.edition() != rhs.edition())
-    return false;
-  if (lhs.arch() != rhs.arch())
-    return false;
-  return true;
-}
-
-// ----------------------------------------------------------------------------
-
 bool looks_like_url (const string& s)
 {
 /*
index 4163ad8..a1a9eb6 100644 (file)
@@ -49,8 +49,6 @@ std::string kind_to_string_localized(
 
 std::string string_patch_status(const zypp::PoolItem & pi);
 
-bool equalNVRA(const zypp::Resolvable & lhs, const zypp::Resolvable & rhs);
-
 /**
  * Creates a Url out of \a urls_s. If the url_s looks looks_like_url()
  * Url(url_s) is returned. Otherwise if \a url_s represends a valid path to