]>
git.saurik.com Git - apt.git/blob - apt-pkg/indexcopy.h
   1 // -*- mode: cpp; mode: fold -*- 
   3 // $Id: indexcopy.h,v 1.3 2001/05/27 04:46:54 jgg Exp $ 
   4 /* ###################################################################### 
   6    Index Copying - Aid for copying and verifying the index files 
   8    ##################################################################### */ 
  22 class IndexCopy                                                         
/*{{{*/ 
  24    /** \brief dpointer placeholder (for later in case we need it) */ 
  29    pkgTagSection 
*Section
; 
  31    std::string 
ChopDirs(std::string Path
,unsigned int Depth
); 
  32    bool ReconstructPrefix(std::string 
&Prefix
,std::string OrigPath
,std::string CD
, 
  34    bool ReconstructChop(unsigned long &Chop
,std::string Dir
,std::string File
); 
  35    void ConvertToSourceList(std::string CD
,std::string 
&Path
); 
  36    bool GrabFirst(std::string Path
,std::string 
&To
,unsigned int Depth
); 
  37    virtual bool GetFile(std::string 
&Filename
,unsigned long long &Size
) = 0; 
  38    virtual bool RewriteEntry(FILE *Target
,std::string File
) = 0; 
  39    virtual const char *GetFileName() = 0; 
  40    virtual const char *Type() = 0; 
  44    bool CopyPackages(std::string CDROM
,std::string Name
,std::vector
<std::string
> &List
, 
  46    virtual ~IndexCopy() {}; 
  49 class PackageCopy 
: public IndexCopy                                    
/*{{{*/ 
  53    virtual bool GetFile(std::string 
&Filename
,unsigned long long &Size
); 
  54    virtual bool RewriteEntry(FILE *Target
,std::string File
); 
  55    virtual const char *GetFileName() {return "Packages";}; 
  56    virtual const char *Type() {return "Package";}; 
  60 class SourceCopy 
: public IndexCopy                                     
/*{{{*/ 
  64    virtual bool GetFile(std::string 
&Filename
,unsigned long long &Size
); 
  65    virtual bool RewriteEntry(FILE *Target
,std::string File
); 
  66    virtual const char *GetFileName() {return "Sources";}; 
  67    virtual const char *Type() {return "Source";}; 
  71 class TranslationsCopy                                                  
/*{{{*/ 
  74    pkgTagSection 
*Section
; 
  77    bool CopyTranslations(std::string CDROM
,std::string Name
,std::vector
<std::string
> &List
, 
  81 class SigVerify                                                         
/*{{{*/ 
  83    /** \brief dpointer placeholder (for later in case we need it) */ 
  86    bool Verify(std::string prefix
,std::string file
, indexRecords 
*records
); 
  87    bool CopyMetaIndex(std::string CDROM
, std::string CDName
,  
  88                       std::string prefix
, std::string file
); 
  91    bool CopyAndVerify(std::string CDROM
,std::string Name
,std::vector
<std::string
> &SigList
, 
  92                       std::vector
<std::string
> PkgList
,std::vector
<std::string
> SrcList
); 
  94    /** \brief generates and run the command to verify a file with gpgv */ 
  95    static bool RunGPGV(std::string 
const &File
, std::string 
const &FileOut
, 
  96                        int const &statusfd
, int fd
[2]); 
  97    inline static bool RunGPGV(std::string 
const &File
, std::string 
const &FileOut
, 
  98                               int const &statusfd 
= -1) { 
 100       return RunGPGV(File
, FileOut
, statusfd
, fd
);