Author: dmacvicar Date: Mon Sep 22 18:57:39 2008 New Revision: 11129 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11129&view=rev Log: - refactor the repository matching with products, not yet complete - move the cpename up to resobject as it is a generic attribute (and can be useful to match vulnerabilities in the future) Modified: trunk/libzypp/zypp/Product.cc trunk/libzypp/zypp/Product.h trunk/libzypp/zypp/Repository.cc trunk/libzypp/zypp/Repository.h trunk/libzypp/zypp/ResObject.cc trunk/libzypp/zypp/ResObject.h trunk/libzypp/zypp/sat/SolvAttr.cc trunk/libzypp/zypp/sat/SolvAttr.h trunk/sat-solver/src/knownid.h trunk/sat-solver/tools/repo_products.c Modified: trunk/libzypp/zypp/Product.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Product.cc?rev=11129... ============================================================================== --- trunk/libzypp/zypp/Product.cc (original) +++ trunk/libzypp/zypp/Product.cc Mon Sep 22 18:57:39 2008 @@ -129,12 +129,6 @@ std::string Product::type() const { return lookupStrAttribute( sat::SolvAttr::productType ); } - std::string Product::updaterepoKey() const - { return lookupStrAttribute( sat::SolvAttr::productUpdaterepoKey ); } - - std::string Product::cpeName() const - { return lookupStrAttribute( sat::SolvAttr::productCpeName ); } - std::liststd::string Product::flags() const { std::liststd::string ret; Modified: trunk/libzypp/zypp/Product.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Product.h?rev=11129&... ============================================================================== --- trunk/libzypp/zypp/Product.h (original) +++ trunk/libzypp/zypp/Product.h Mon Sep 22 18:57:39 2008 @@ -68,21 +68,6 @@ */ std::string type() const ZYPP_DEPRECATED; - /** Update repository indicator string. - * Repositories providing updates/patches for this product - * should (somehow) provide this string. So we are able to - * detect them. - */ - std::string updaterepoKey() const; - - /** - * The Common Platform Enumeration name - * for this product. - * - * See http://cpe.mitre.org - */ - std::string cpeName() const; - /** The product flags */ std::liststd::string flags() const; Modified: trunk/libzypp/zypp/Repository.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Repository.cc?rev=11... ============================================================================== --- trunk/libzypp/zypp/Repository.cc (original) +++ trunk/libzypp/zypp/Repository.cc Mon Sep 22 18:57:39 2008 @@ -143,19 +143,15 @@ return suggestedExpirationTimestamp() < Date::now(); } - - Repository::UpdateKeys Repository::updateKeys() const - { return UpdateKeys( sat::SolvAttr::repositoryUpdates, *this ); } - bool Repository::providesUpdatesForKey( const std::string &key ) const + bool Repository::providesUpdatesFor( const std::string &key ) const { - UpdateKeys keys(updateKeys()); - return ( keys.find(key) != keys.end() ); + return false; } bool Repository::isUpdateRepo() const { - return ( ! updateKeys().empty() ); + return false; } bool Repository::solvablesEmpty() const Modified: trunk/libzypp/zypp/Repository.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Repository.h?rev=111... ============================================================================== --- trunk/libzypp/zypp/Repository.h (original) +++ trunk/libzypp/zypp/Repository.h Mon Sep 22 18:57:39 2008 @@ -143,6 +143,9 @@ /** * Products this repository claims it is * built for. + * + * Products are specified using the CPE form + * See http://cpe.mitre.org/ for more information on CPE */ Products products() const; @@ -156,19 +159,19 @@ /** * if the repository claims to update something then * it is an update repository + * + * This is implemented by looking at an "update" keyword + * on the repository tags */ bool isUpdateRepo() const; /** - * Wether the reposity claims to provide updates to \ref prod - */ - UpdateKeys updateKeys() const; - - /** * wether the repository claims to update something \ref prod - * with key &\key + * with key \ref cpename + * + * See http://cpe.mitre.org/ for more information on CPE */ - bool providesUpdatesForKey( const std::string &key ) const; + bool providesUpdatesFor( const std::string &cpename ) const; /** Whether \ref Repository contains solvables. */ bool solvablesEmpty() const; Modified: trunk/libzypp/zypp/ResObject.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ResObject.cc?rev=111... ============================================================================== --- trunk/libzypp/zypp/ResObject.cc (original) +++ trunk/libzypp/zypp/ResObject.cc Mon Sep 22 18:57:39 2008 @@ -73,6 +73,9 @@ std::string ResObject::distribution() const { return lookupStrAttribute( sat::SolvAttr::distribution ); } + std::string ResObject::cpeName() const + { return lookupStrAttribute( sat::SolvAttr::cpename ); } + ByteCount ResObject::installSize() const { return ByteCount( lookupNumAttribute( sat::SolvAttr::installsize ), ByteCount::K ); } Modified: trunk/libzypp/zypp/ResObject.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ResObject.h?rev=1112... ============================================================================== --- trunk/libzypp/zypp/ResObject.h (original) +++ trunk/libzypp/zypp/ResObject.h Mon Sep 22 18:57:39 2008 @@ -123,6 +123,14 @@ */ std::string distribution() const; + /** + * The Common Platform Enumeration name + * for this product. + * + * See http://cpe.mitre.org + */ + std::string cpeName() const; + /** Installed size. */ ByteCount installSize() const; /** \deprecated Use installSize which is more precise.*/ Modified: trunk/libzypp/zypp/sat/SolvAttr.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SolvAttr.cc?rev=... ============================================================================== --- trunk/libzypp/zypp/sat/SolvAttr.cc (original) +++ trunk/libzypp/zypp/sat/SolvAttr.cc Mon Sep 22 18:57:39 2008 @@ -42,6 +42,7 @@ const SolvAttr SolvAttr::insnotify ( SOLVABLE_MESSAGEINS ); // translated const SolvAttr SolvAttr::delnotify ( SOLVABLE_MESSAGEDEL ); // translated const SolvAttr SolvAttr::eula ( SOLVABLE_EULA ); // translated + const SolvAttr SolvAttr::cpename ( SOLVABLE_CPE_NAME ); const SolvAttr SolvAttr::installtime ( SOLVABLE_INSTALLTIME ); const SolvAttr SolvAttr::buildtime ( SOLVABLE_BUILDTIME ); const SolvAttr SolvAttr::installsize ( SOLVABLE_INSTALLSIZE ); @@ -108,7 +109,6 @@ const SolvAttr SolvAttr::productRegisterRelease( PRODUCT_REGISTER_RELEASE ); const SolvAttr SolvAttr::productUrl( PRODUCT_URL ); const SolvAttr SolvAttr::productUrlType( PRODUCT_URL_TYPE ); - const SolvAttr SolvAttr::productCpeName( PRODUCT_CPE_NAME ); // repository const SolvAttr SolvAttr::repositoryTimestamp ( REPOSITORY_TIMESTAMP ); Modified: trunk/libzypp/zypp/sat/SolvAttr.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SolvAttr.h?rev=1... ============================================================================== --- trunk/libzypp/zypp/sat/SolvAttr.h (original) +++ trunk/libzypp/zypp/sat/SolvAttr.h Mon Sep 22 18:57:39 2008 @@ -64,6 +64,7 @@ static const SolvAttr installsize; static const SolvAttr downloadsize; static const SolvAttr diskusage; + static const SolvAttr cpename; //@} /** \name package */ @@ -133,7 +134,6 @@ static const SolvAttr productRegisterRelease; static const SolvAttr productUrl; static const SolvAttr productUrlType; - static const SolvAttr productCpeName; //@} Modified: trunk/sat-solver/src/knownid.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/knownid.h?rev=1112... ============================================================================== --- trunk/sat-solver/src/knownid.h (original) +++ trunk/sat-solver/src/knownid.h Mon Sep 22 18:57:39 2008 @@ -95,6 +95,7 @@ KNOWNID(SOLVABLE_BUILDTIME, "solvable:buildtime"), KNOWNID(SOLVABLE_BUILDHOST, "solvable:buildhost"), KNOWNID(SOLVABLE_EULA, "solvable:eula"), +KNOWNID(SOLVABLE_CPE_NAME, "solvable:cpename"), KNOWNID(SOLVABLE_MESSAGEINS, "solvable:messageins"), KNOWNID(SOLVABLE_MESSAGEDEL, "solvable:messagedel"), KNOWNID(SOLVABLE_INSTALLSIZE, "solvable:installsize"), @@ -158,7 +159,6 @@ KNOWNID(PRODUCT_UPDATEREPOKEY, "product:updaterepokey"), KNOWNID(PRODUCT_REGISTER_TARGET, "product:regtarget"), KNOWNID(PRODUCT_REGISTER_RELEASE, "product:regrelease"), -KNOWNID(PRODUCT_CPE_NAME, "product:cpename"), /* argh */ KNOWNID(SUSETAGS_DATADIR, "susetags:datadir"), Modified: trunk/sat-solver/tools/repo_products.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/tools/repo_products.c?... ============================================================================== --- trunk/sat-solver/tools/repo_products.c (original) +++ trunk/sat-solver/tools/repo_products.c Mon Sep 22 18:57:39 2008 @@ -355,7 +355,7 @@ break; case STATE_CPENAME: if (pd->content) - repodata_set_str(pd->data, pd->handle, PRODUCT_CPE_NAME, pd->content); + repodata_set_str(pd->data, pd->handle, SOLVABLE_CPE_NAME, pd->content); default: break; } -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org