From 277fd5f5b49220e86e2d7f4151e84190cf596b41 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Fri, 26 Sep 2008 13:39:39 +0000 Subject: [PATCH] - Fix computation of Product::flavor. - Add Product::productLine. A vendor specific string denoting the product line. --- VERSION.cmake | 2 +- devel/devel.ma/NewPool.cc | 24 ++++++++++++++++++++---- package/libzypp.changes | 9 +++++++++ zypp/Product.cc | 36 +++++++++++++++++++++++++++++++++--- zypp/Product.h | 3 +++ zypp/sat/SolvAttr.cc | 13 ++++++------- zypp/sat/SolvAttr.h | 1 - 7 files changed, 72 insertions(+), 16 deletions(-) diff --git a/VERSION.cmake b/VERSION.cmake index 43e5419..fafe047 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -63,6 +63,6 @@ SET(LIBZYPP_COMPATMINOR "13") SET(LIBZYPP_MINOR "13") SET(LIBZYPP_PATCH "0") # -# LAST RELEASED: 5.12.0 (12) +# LAST RELEASED: 5.13.0 (13) # (The number in parenthesis is LIBZYPP_COMPATMINOR) #======= diff --git a/devel/devel.ma/NewPool.cc b/devel/devel.ma/NewPool.cc index 239d133..e0812b9 100644 --- a/devel/devel.ma/NewPool.cc +++ b/devel/devel.ma/NewPool.cc @@ -443,6 +443,23 @@ try { INT << "===[START]==========================================" << endl; ZConfig::instance(); + { + Capability cap("flavor(dvd9)"); + DBG << cap.detail().isSimple() << endl; + DBG << cap.detail().isNamed() << endl; + DBG << cap.detail().name() << endl; + std::string capstr = str::stripPrefix( cap.asString(), "flavor(" ); + DBG << capstr << endl; + capstr.erase(capstr.size()-1); + DBG << capstr << endl; + } + + + /////////////////////////////////////////////////////////////////// + INT << "===[END]============================================" << endl << endl; + zypp::base::LogControl::instance().logNothing(); + return 0; + #if 0 RepoManager repoManager( makeRepoManager( sysRoot ) ); @@ -504,7 +521,6 @@ try { getZYpp()->target()->load(); USR << getZYpp()->target()->targetDistribution() << endl; USR << getZYpp()->target()->targetDistributionRelease() << endl; - USR << getZYpp()->target()->targetDistributionFlavor() << endl; } } @@ -616,10 +632,10 @@ try { PoolItem pi ( getPi("amarok") ); MIL << pi << endl; - MIL << pi->as() << endl; - MIL << pi->as() << endl; + MIL << pi->asKind() << endl; + MIL << pi->asKind() << endl; if ( pi->isKind() ) - SEC << pi->as() << endl; + SEC << pi->asKind() << endl; ////////////////////////////////////////////////////////////////// INT << "===[END]============================================" << endl << endl; diff --git a/package/libzypp.changes b/package/libzypp.changes index 5283cbc..bc366e5 100644 --- a/package/libzypp.changes +++ b/package/libzypp.changes @@ -1,4 +1,13 @@ ------------------------------------------------------------------- +Fri Sep 26 15:37:50 CEST 2008 - ma@suse.de + +- Fix computation of Product::flavor. +- Add Product::productLine. A vendor specific string denoting the + product line. +- revision 11182 +- version 5.13.0 (13) + +------------------------------------------------------------------- Thu Sep 25 23:19:55 CEST 2008 - jkupec@suse.cz - ZConfig::credentialsGlobal{File,Dir}() added diff --git a/zypp/Product.cc b/zypp/Product.cc index d9a3168..642cc6d 100644 --- a/zypp/Product.cc +++ b/zypp/Product.cc @@ -114,17 +114,48 @@ namespace zypp if ( (*it).buddy().isKind( ResKind::product ) ) ret.push_back( make( (*it).buddy() ) ); } - return ret; } + std::string Product::productLine() const + { +#warning productLine needs to be implemented. + return std::string(); + } + /////////////////////////////////////////////////////////////////// std::string Product::shortName() const { return lookupStrAttribute( sat::SolvAttr::productShortlabel ); } std::string Product::flavor() const - { return lookupStrAttribute( sat::SolvAttr::productFlavor ); } + { + // Look for a provider of 'product_flavor(name) = version' + // within the same repo. Unlike the reference package, we + // can be relaxed and ignore the architecture. + Capability identCap( str::form( "product_flavor(%s) = %s", name().c_str(), edition().c_str() ) ); + + sat::WhatProvides providers( identCap ); + for_( it, providers.begin(), providers.end() ) + { + if ( it->repository() == repository() ) + { + // Got the package now try to get the provided 'flavor(...)' + Capabilities provides( it->provides() ); + for_( cap, provides.begin(), provides.end() ) + { + std::string capstr( cap.asString() ); + if ( str::hasPrefix( capstr, "flavor(" ) ) + { + capstr = str::stripPrefix( capstr, "flavor(" ); + capstr.erase( capstr.size()-1 ); // trailing ')' + return capstr; + } + } + } + } + return std::string(); + } std::string Product::type() const { return lookupStrAttribute( sat::SolvAttr::productType ); } @@ -162,7 +193,6 @@ namespace zypp /* safety checks, shouldn't happen (tm) */ if (url_type_it == url_type.end()) { - /* FIXME: Raise exception ?! */ ERR << *this << " : The thing that should not happen, happened." << endl; break; } diff --git a/zypp/Product.h b/zypp/Product.h index 3bb0610..093ed0a 100644 --- a/zypp/Product.h +++ b/zypp/Product.h @@ -52,6 +52,9 @@ namespace zypp */ ReplacedProducts replacedProducts() const; + /** Vendor specific string denoting the product line. */ + std::string productLine() const; + public: /** Untranslated short name like SLES 10*/ std::string shortName() const; diff --git a/zypp/sat/SolvAttr.cc b/zypp/sat/SolvAttr.cc index 394ea44..09641a0 100644 --- a/zypp/sat/SolvAttr.cc +++ b/zypp/sat/SolvAttr.cc @@ -103,19 +103,18 @@ namespace sat const SolvAttr SolvAttr::productDistversion ( PRODUCT_DISTVERSION ); const SolvAttr SolvAttr::productType ( PRODUCT_TYPE ); const SolvAttr SolvAttr::productFlags ( PRODUCT_FLAGS ); - const SolvAttr SolvAttr::productFlavor ( PRODUCT_FLAVOR ); const SolvAttr SolvAttr::productUpdaterepoKey ( PRODUCT_UPDATEREPOKEY ); const SolvAttr SolvAttr::productRegisterTarget ( PRODUCT_REGISTER_TARGET ); const SolvAttr SolvAttr::productRegisterRelease( PRODUCT_REGISTER_RELEASE ); - const SolvAttr SolvAttr::productUrl( PRODUCT_URL ); - const SolvAttr SolvAttr::productUrlType( PRODUCT_URL_TYPE ); + const SolvAttr SolvAttr::productUrl ( PRODUCT_URL ); + const SolvAttr SolvAttr::productUrlType ( PRODUCT_URL_TYPE ); // repository const SolvAttr SolvAttr::repositoryTimestamp ( REPOSITORY_TIMESTAMP ); - const SolvAttr SolvAttr::repositoryExpire ( REPOSITORY_EXPIRE ); - const SolvAttr SolvAttr::repositoryUpdates ( REPOSITORY_UPDATES ); - const SolvAttr SolvAttr::repositoryProducts ( REPOSITORY_PRODUCTS ); - const SolvAttr SolvAttr::repositoryKeywords ( REPOSITORY_KEYWORDS ); + const SolvAttr SolvAttr::repositoryExpire ( REPOSITORY_EXPIRE ); + const SolvAttr SolvAttr::repositoryUpdates ( REPOSITORY_UPDATES ); + const SolvAttr SolvAttr::repositoryProducts ( REPOSITORY_PRODUCTS ); + const SolvAttr SolvAttr::repositoryKeywords ( REPOSITORY_KEYWORDS ); } // namespace sat ///////////////////////////////////////////////////////////////// diff --git a/zypp/sat/SolvAttr.h b/zypp/sat/SolvAttr.h index 616f117..8a8405f 100644 --- a/zypp/sat/SolvAttr.h +++ b/zypp/sat/SolvAttr.h @@ -128,7 +128,6 @@ namespace sat static const SolvAttr productDistversion; static const SolvAttr productType; static const SolvAttr productFlags; - static const SolvAttr productFlavor; static const SolvAttr productUpdaterepoKey; static const SolvAttr productRegisterTarget; static const SolvAttr productRegisterRelease; -- 2.7.4