info product: show CPEid and report enabled/missing update repos
authorMichael Andres <ma@suse.de>
Fri, 4 Apr 2014 12:04:25 +0000 (14:04 +0200)
committerMichael Andres <ma@suse.de>
Fri, 4 Apr 2014 12:04:25 +0000 (14:04 +0200)
src/info.cc

index 8b59138..2e8ee1c 100644 (file)
@@ -445,21 +445,46 @@ void printProductInfo(Zypper & zypper, const ui::Selectable & s)
       Date eol( product->endOfLife() );
       cout << _("End of Support") << ": " << ( eol ? eol.printDate() : _("undefined") ) << endl;
     }
-
-    std::list<Repository::ContentIdentifier> l;
-    unsigned cl = product->updateContentIdentifierSize( l );
-    if ( cl )
     {
-      cout << _("Update Repositories")   << ": " << cl << endl;
-      unsigned n = 0;
-      for ( const auto & el : l )
+      cout << _("CPE Name") << ": ";
+      const CpeId & cpe( product->cpeId() );
+      if ( cpe )
+       cout << cpe << endl;
+      else if ( CpeId::NoThrowType::lastMalformed.empty() )
+       cout <<  _("undefined") << endl;
+      else
+       cout <<  _("invalid CPE Name") << ": " << CpeId::NoThrowType::lastMalformed << endl;
+    }
+    {
+      cout << _("Update Repositories");
+      std::list<Repository::ContentIdentifier> l;
+      unsigned cl = product->updateContentIdentifierSize( l );
+      if ( cl )
       {
-       cout << "[" << n << "] " << _("Update Repository Content Id")   << ": " << el << endl;
+       cout << ": " << cl << endl;
+       unsigned n = 0;
+       for ( const auto & el : l )
+       {
+         cout << "[" << ++n << "] " << _("Content Id")   << ": " << el << endl;
+         bool found = false;
+         for_( it, sat::Pool::instance().reposBegin(), sat::Pool::instance().reposEnd() )
+         {
+           if ( (*it).hasContentIdentifier( el ) )
+           {
+             found = true;
+             cout << "    " << _("Provided by enabled repository")   << ": " << (*it).name() << endl;
+
+           }
+         }
+         if ( ! found )
+         {
+           cout << "    " << _("Not provided by any enabled repository")   << endl;
+         }
+       }
       }
+      else
+       cout << ": " << _("undefined") << endl;
     }
-    else
-      cout << _("Update Repositories")   << ": " << _("undefined") << endl;
-
 
     printSummaryDesc(pool_item.resolvable());