From 63e4bdfec29cc701740f78535d2cc7900e062b87 Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Fri, 3 Mar 2006 17:14:00 +0000 Subject: [PATCH] start implementing gpg keys support for sources --- zypp/Source.cc | 3 +++ zypp/Source.h | 3 ++- zypp/source/SourceImpl.cc | 13 +++++++++++++ zypp/source/SourceImpl.h | 13 ++++++++++++- zypp/source/susetags/SuseTagsImpl.cc | 13 ++++++++++++- zypp/source/susetags/SuseTagsImpl.h | 2 +- 6 files changed, 43 insertions(+), 4 deletions(-) diff --git a/zypp/Source.cc b/zypp/Source.cc index a78ca22..09abda6 100644 --- a/zypp/Source.cc +++ b/zypp/Source.cc @@ -153,6 +153,9 @@ namespace zypp std::string Source_Ref::vendor (void) const { return _pimpl->vendor(); } + const std::set Source_Ref::publicKeys() const + { return _pimpl->publicKeys(); } + std::string Source_Ref::unique_id (void) const { return _pimpl->unique_id(); } diff --git a/zypp/Source.h b/zypp/Source.h index b869adf..3877708 100644 --- a/zypp/Source.h +++ b/zypp/Source.h @@ -110,7 +110,8 @@ namespace zypp unsigned priorityUnsubscribed (void) const; void setPriorityUnsubscribed (unsigned p); const Pathname & cacheDir (void) const; - + const std::set publicKeys() const; + // for ZMD std::string zmdName (void) const; void setZmdName (const std::string name_r); diff --git a/zypp/source/SourceImpl.cc b/zypp/source/SourceImpl.cc index f42bdbc..735b3b5 100644 --- a/zypp/source/SourceImpl.cc +++ b/zypp/source/SourceImpl.cc @@ -107,6 +107,16 @@ namespace zypp return const_cast(this)->provideResolvables(self, kind); } + void SourceImpl::dirInfo(const unsigned media_nr, + std::list &retlist, + const Pathname &path_r, + bool dots ) const + { + DBG << "reading " << path_r << " file list" << endl; + media::MediaAccessId _media = _media_set->getMediaAccessId( media_nr ); + media_mgr.dirInfo( _media, retlist, path_r, dots ); + } + const Pathname SourceImpl::provideFile(const Pathname & file_r, const unsigned media_nr, bool cached, @@ -291,6 +301,9 @@ namespace zypp std::string SourceImpl::vendor (void) const { return ""; } + const std::set SourceImpl::publicKeys() const + { return std::set(); } + std::string SourceImpl::unique_id (void) const { return ""; } diff --git a/zypp/source/SourceImpl.h b/zypp/source/SourceImpl.h index 545a84a..3cd1b69 100644 --- a/zypp/source/SourceImpl.h +++ b/zypp/source/SourceImpl.h @@ -103,6 +103,17 @@ namespace zypp const Pathname provideDir(const Pathname & path, const unsigned media_nr = 1, const bool recursive = false); + + /** + * Provide info about a directory + * + * \throws Exception + * + */ + void dirInfo( const unsigned media_nr, + std::list &retlist, + const Pathname &path_r, + bool dots = true) const; void changeMedia(const media::MediaId & media_r, const Pathname & path_r); @@ -135,7 +146,7 @@ namespace zypp virtual unsigned priorityUnsubscribed (void) const; virtual void setPriorityUnsubscribed (unsigned p); virtual const Pathname & cacheDir (void); - + virtual const std::set publicKeys() const; virtual std::string type(void) const; diff --git a/zypp/source/susetags/SuseTagsImpl.cc b/zypp/source/susetags/SuseTagsImpl.cc index d62c4f2..4571698 100644 --- a/zypp/source/susetags/SuseTagsImpl.cc +++ b/zypp/source/susetags/SuseTagsImpl.cc @@ -60,6 +60,7 @@ namespace zypp filesystem::mkdir(cache_dir_r + "DATA"); filesystem::mkdir(cache_dir_r + "MEDIA"); filesystem::mkdir(cache_dir_r + "DESCRIPTION"); + filesystem::mkdir(cache_dir_r + "PUBLICKEYS"); } void SuseTagsImpl::storeMetadata(const Pathname & cache_dir_r) @@ -75,7 +76,12 @@ namespace zypp media_mgr.provideDirTree(media_num, "suse/setup/descr"); Pathname descr_src = media_mgr.localPath(media_num, "suse/setup/descr"); Pathname media_src = media_mgr.localPath(media_num, "media.1"); - Pathname content_src = media_mgr.localPath(media_num, "content"); + Pathname content_src = media_mgr.localPath(media_num, "content"); + + // get the list of cache keys + //std::list keys; + //dirInfo( media_num, keys, + if (0 != assert_dir((cache_dir_r + "DATA").dirname(), 0700)) { ZYPP_THROW(Exception("Cannot create cache directory: " + cache_dir_r.asString())); @@ -194,6 +200,11 @@ namespace zypp report->finishData( url(), CreateSourceReport::NO_ERROR, "" ); } + const std::set SuseTagsImpl::publicKeys() const + { + std::set(); + } + ResStore SuseTagsImpl::provideResolvables(Source_Ref source_r, Resolvable::Kind kind) { callback::SendReport report; diff --git a/zypp/source/susetags/SuseTagsImpl.h b/zypp/source/susetags/SuseTagsImpl.h index 64bf626..406a877 100644 --- a/zypp/source/susetags/SuseTagsImpl.h +++ b/zypp/source/susetags/SuseTagsImpl.h @@ -59,7 +59,7 @@ namespace zypp virtual unsigned numberOfMedia(void) const; virtual std::string vendor (void) const; - + virtual const std::set publicKeys() const; virtual std::string unique_id (void) const; Pathname sourceDir( const NVRAD& nvrad ); -- 2.7.4