support buddies in solver testcases
authorMichael Andres <ma@suse.de>
Thu, 14 Aug 2008 16:24:34 +0000 (16:24 +0000)
committerMichael Andres <ma@suse.de>
Thu, 14 Aug 2008 16:24:34 +0000 (16:24 +0000)
zypp/Product.cc
zypp/Product.h

index 70a77afd5491468561565ba3067332c5a5ce61a3..e540cd913c44bc0737a72fa61fa8a86a537515ef 100644 (file)
@@ -79,7 +79,17 @@ namespace zypp
   {
     Capability identCap( lookupStrAttribute( sat::SolvAttr::productReferences ) );
     if ( ! identCap )
+    {
+      // No 'references': fallback to provider of 'product(name) = version'
+      // Without this solver testcase won't work, as it does not remember
+      // 'references'.
+      identCap = Capability( str::form( "product(%s) = %s", name().c_str(), edition().c_str() )  );
+    }
+    if ( ! identCap )
+    {
       return sat::Solvable::noSolvable;
+    }
+
 
     // if there is productReferences defined, we expect
     // a matching package within the same repo.
@@ -94,6 +104,9 @@ namespace zypp
     return sat::Solvable::noSolvable;
   }
 
+  std::string Product::shortName() const
+  { return lookupStrAttribute( sat::SolvAttr::productShortlabel ); }
+
   std::string Product::flavor() const
   { return lookupStrAttribute( sat::SolvAttr::productFlavor ); }
 
@@ -137,12 +150,6 @@ namespace zypp
     return ret;
   }
 
-  std::string Product::shortName() const
-  { return lookupStrAttribute( sat::SolvAttr::productShortlabel ); }
-
-  std::string Product::longName( const Locale & lang_r ) const
-  { return summary( lang_r ); }
-
   std::string Product::distributionName() const
   { return lookupStrAttribute( sat::SolvAttr::productDistproduct ); }
 
index f2c479b2b1ffee9847d8066afa895a39e08183d2..5847d730f6859a91c2b95e4cb1cf36ff0e2d1960 100644 (file)
@@ -44,11 +44,18 @@ namespace zypp
     sat::Solvable referencePackage() const;
 
   public:
-    /** The product flavor (LiveCD Demo, FTP edition,...).*/
+    /** Untranslated short name like <tt>SLES 10</tt>*/
+    std::string shortName() const;
+
+    /** The product flavor (LiveCD Demo, FTP edition,...). */
     std::string flavor() const;
 
-    /** Get the product type (base, add-on) */
-    std::string type() const ZYPP_DEPRECATED;
+    /** Get the product type (base, add-on)
+     * Well, in an ideal world there is only one base product.
+     * It's the installed product denoted by a symlink in
+     * \c /etc/products.d.
+    */
+    std::string type() const;
 
     /** The URL to download the release notes for this product */
     Url releaseNotesUrl() const;
@@ -75,16 +82,20 @@ namespace zypp
     /** The product flags */
     std::list<std::string> flags() const;
 
-    /** Untranslated short name like <tt>SLES 10</tt>*/
-    std::string shortName() const;
-
-    /** Translated long name like <tt>SUSE Linux Enterprise Server 10</tt>*/
-    std::string longName( const Locale & lang_r = Locale() ) const ZYPP_DEPRECATED;
+    /** Translated long name like <tt>SUSE Linux Enterprise Server 10</tt>
+     * \deprecated use summary.
+     */
+    std::string longName( const Locale & lang_r = Locale() ) const ZYPP_DEPRECATED
+    { return summary( lang_r ); }
 
-    /** Vendor specific distribution id. */
+    /** Vendor specific distribution id.
+     * \deprecated replaced by ResObject::distribution
+     */
     std::string distributionName() const ZYPP_DEPRECATED;
 
-    /** Vendor specific distribution version. */
+    /** Vendor specific distribution version.
+     * \deprecated replaced by ResObject::distribution
+     */
     Edition distributionEdition() const ZYPP_DEPRECATED;
 
   protected: