For installed products also filelists when trying to find the buddy (bnc#784900)
authorMichael Andres <ma@suse.de>
Mon, 15 Oct 2012 12:34:18 +0000 (14:34 +0200)
committerMichael Andres <ma@suse.de>
Mon, 15 Oct 2012 12:34:18 +0000 (14:34 +0200)
zypp/Product.cc

index b8c04411c097341fc562180218e59dd5c47bbff0..3157c35a4f9e4d346aab5582056a13269376e5b7 100644 (file)
@@ -94,6 +94,24 @@ namespace zypp
           found = *it;
       }
     }
+
+    if ( ! found && isSystem() )
+    {
+      // bnc#784900: for installed products check whether the file is owned by
+      // some package. If so, ust this as buddy.
+      sat::LookupAttr q( sat::SolvAttr::filelist, repository() );
+      std::string refFile( referenceFilename() );
+      if ( ! refFile.empty() )
+      {
+       StrMatcher matcher( referenceFilename() );
+       q.setStrMatcher( matcher );
+       if ( ! q.empty() )
+         found = q.begin().inSolvAttr();
+      }
+      else
+       INT << "Product referenceFilename unexpectedly empty!" << endl;
+    }
+
     if ( ! found )
       WAR << *this << ": no reference package found: " << identCap << endl;
     return found;