start implementing gpg keys support for sources
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 3 Mar 2006 17:14:00 +0000 (17:14 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 3 Mar 2006 17:14:00 +0000 (17:14 +0000)
zypp/Source.cc
zypp/Source.h
zypp/source/SourceImpl.cc
zypp/source/SourceImpl.h
zypp/source/susetags/SuseTagsImpl.cc
zypp/source/susetags/SuseTagsImpl.h

index a78ca22..09abda6 100644 (file)
@@ -153,6 +153,9 @@ namespace zypp
   std::string Source_Ref::vendor (void) const
   { return _pimpl->vendor(); }
 
+  const std::set<Pathname> Source_Ref::publicKeys() const
+  { return _pimpl->publicKeys(); }
+  
   std::string Source_Ref::unique_id (void) const
   { return _pimpl->unique_id(); }
   
index b869adf..3877708 100644 (file)
@@ -110,7 +110,8 @@ namespace zypp
     unsigned priorityUnsubscribed (void) const;
     void setPriorityUnsubscribed (unsigned p);
     const Pathname & cacheDir (void) const;
-
+    const std::set<Pathname> publicKeys() const;
+    
     // for ZMD
     std::string zmdName (void) const;
     void setZmdName (const std::string name_r);
index f42bdbc..735b3b5 100644 (file)
@@ -107,6 +107,16 @@ namespace zypp
       return const_cast<SourceImpl*>(this)->provideResolvables(self, kind);
     }
 
+    void SourceImpl::dirInfo(const unsigned media_nr,
+                             std::list<std::string> &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<Pathname> SourceImpl::publicKeys() const
+    { return std::set<Pathname>(); }
+    
     std::string SourceImpl::unique_id (void) const
     { return ""; }
 
index 545a84a..3cd1b69 100644 (file)
@@ -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<std::string> &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<Pathname> publicKeys() const;
 
       virtual std::string type(void) const;
 
index d62c4f2..4571698 100644 (file)
@@ -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<string> 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<Pathname> SuseTagsImpl::publicKeys() const
+      {
+        std::set<Pathname>();
+      }
+      
       ResStore SuseTagsImpl::provideResolvables(Source_Ref source_r, Resolvable::Kind kind)
       {
         callback::SendReport<CreateSourceReport> report;
index 64bf626..406a877 100644 (file)
@@ -59,7 +59,7 @@ namespace zypp
        
         virtual unsigned numberOfMedia(void) const;
         virtual std::string vendor (void) const;
-       
+        virtual const std::set<Pathname> publicKeys() const;
         virtual std::string unique_id (void) const;
         
         Pathname sourceDir( const NVRAD& nvrad );