From 040e6b1ffc83c5ff48f0980d8be308538ba68c68 Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Thu, 11 Sep 2008 14:50:27 +0000 Subject: [PATCH] repository keys work --- package/libzypp.changes | 8 ++++++++ zypp/Repository.cc | 15 ++++++++++++++- zypp/Repository.h | 27 +++++++++++++++++++++++++++ zypp/sat/SolvAttr.cc | 2 +- zypp/sat/SolvAttr.h | 1 + 5 files changed, 51 insertions(+), 2 deletions(-) diff --git a/package/libzypp.changes b/package/libzypp.changes index 118f74a..528a5fe 100644 --- a/package/libzypp.changes +++ b/package/libzypp.changes @@ -1,4 +1,12 @@ ------------------------------------------------------------------- +Thu Sep 11 16:01:57 CEST 2008 - dmacvicar@suse.de + +- add Repostiroy::updateKeys and + Repository::providesUpdatesForKey(string) for repo and + product matching +- Provide Repository::isUpdateRepo + +------------------------------------------------------------------- Thu Sep 11 14:41:28 CEST 2008 - ma@suse.de - Fix evaluation of vendor support flags. diff --git a/zypp/Repository.cc b/zypp/Repository.cc index 09dd10f..d2fac68 100644 --- a/zypp/Repository.cc +++ b/zypp/Repository.cc @@ -123,7 +123,6 @@ namespace zypp return Date(); } - bool Repository::maybeOutdated() const { // system repo is not mirrored @@ -138,7 +137,21 @@ namespace zypp return suggestedExpirationTimestamp() < Date::now(); } + + Repository::UpdateKeys Repository::updateKeys() const + { return UpdateKeys( sat::SolvAttr::repositoryUpdates, *this ); } + + bool Repository::providesUpdatesForKey( const std::string &key ) const + { + UpdateKeys keys(updateKeys()); + return ( keys.find(key) != keys.end() ); + } + bool Repository::isUpdateRepo() const + { + return ( ! updateKeys().empty() ); + } + bool Repository::solvablesEmpty() const { NO_REPOSITORY_RETURN( true ); diff --git a/zypp/Repository.h b/zypp/Repository.h index 0a516dd..932402b 100644 --- a/zypp/Repository.h +++ b/zypp/Repository.h @@ -24,6 +24,12 @@ namespace zypp { ///////////////////////////////////////////////////////////////// + namespace sat + { + template + class ArrayAttr; + } + namespace detail { struct ByRepository; @@ -41,6 +47,7 @@ namespace zypp typedef filter_iterator SolvableIterator; typedef sat::detail::size_type size_type; typedef sat::detail::RepoIdType IdType; + typedef sat::ArrayAttr UpdateKeys; public: /** Default ctor creates \ref noRepository.*/ @@ -133,6 +140,23 @@ namespace zypp */ bool maybeOutdated() const; + /** + * if the repository claims to update something then + * it is an update repository + */ + 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 + */ + bool providesUpdatesForKey( const std::string &key ) const; + /** Whether \ref Repository contains solvables. */ bool solvablesEmpty() const; @@ -315,4 +339,7 @@ namespace zypp ///////////////////////////////////////////////////////////////// } // namespace zypp /////////////////////////////////////////////////////////////////// + +#include "zypp/sat/LookupAttr.h" + #endif // ZYPP_SAT_REPOSITORY_H diff --git a/zypp/sat/SolvAttr.cc b/zypp/sat/SolvAttr.cc index a25ef1b..3a5f360 100644 --- a/zypp/sat/SolvAttr.cc +++ b/zypp/sat/SolvAttr.cc @@ -113,7 +113,7 @@ namespace sat // repository const SolvAttr SolvAttr::repositoryTimestamp ( REPOSITORY_TIMESTAMP ); const SolvAttr SolvAttr::repositoryExpire ( REPOSITORY_EXPIRE ); - + const SolvAttr SolvAttr::repositoryUpdates ( REPOSITORY_UPDATES ); } // namespace sat ///////////////////////////////////////////////////////////////// diff --git a/zypp/sat/SolvAttr.h b/zypp/sat/SolvAttr.h index 6e1dbdf..b700b67 100644 --- a/zypp/sat/SolvAttr.h +++ b/zypp/sat/SolvAttr.h @@ -140,6 +140,7 @@ namespace sat //@{ static const SolvAttr repositoryTimestamp; static const SolvAttr repositoryExpire; + static const SolvAttr repositoryUpdates; //@} //@} -- 2.7.4