]>
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 ##################################################################### */
25 class IndexCopy
/*{{{*/
27 /** \brief dpointer placeholder (for later in case we need it) */
32 pkgTagSection
*Section
;
34 string
ChopDirs(string Path
,unsigned int Depth
);
35 bool ReconstructPrefix(string
&Prefix
,string OrigPath
,string CD
,
37 bool ReconstructChop(unsigned long &Chop
,string Dir
,string File
);
38 void ConvertToSourceList(string CD
,string
&Path
);
39 bool GrabFirst(string Path
,string
&To
,unsigned int Depth
);
40 virtual bool GetFile(string
&Filename
,unsigned long &Size
) = 0;
41 virtual bool RewriteEntry(FILE *Target
,string File
) = 0;
42 virtual const char *GetFileName() = 0;
43 virtual const char *Type() = 0;
47 bool CopyPackages(string CDROM
,string Name
,vector
<string
> &List
,
49 virtual ~IndexCopy() {};
52 class PackageCopy
: public IndexCopy
/*{{{*/
56 virtual bool GetFile(string
&Filename
,unsigned long &Size
);
57 virtual bool RewriteEntry(FILE *Target
,string File
);
58 virtual const char *GetFileName() {return "Packages";};
59 virtual const char *Type() {return "Package";};
63 class SourceCopy
: public IndexCopy
/*{{{*/
67 virtual bool GetFile(string
&Filename
,unsigned long &Size
);
68 virtual bool RewriteEntry(FILE *Target
,string File
);
69 virtual const char *GetFileName() {return "Sources";};
70 virtual const char *Type() {return "Source";};
74 class TranslationsCopy
/*{{{*/
77 pkgTagSection
*Section
;
80 bool CopyTranslations(string CDROM
,string Name
,vector
<string
> &List
,
84 class SigVerify
/*{{{*/
86 /** \brief dpointer placeholder (for later in case we need it) */
89 bool Verify(string prefix
,string file
, indexRecords
*records
);
90 bool CopyMetaIndex(string CDROM
, string CDName
,
91 string prefix
, string file
);
94 bool CopyAndVerify(string CDROM
,string Name
,vector
<string
> &SigList
,
95 vector
<string
> PkgList
,vector
<string
> SrcList
);
97 /** \brief generates and run the command to verify a file with gpgv */
98 static bool RunGPGV(std::string
const &File
, std::string
const &FileOut
,
99 int const &statusfd
, int fd
[2]);
100 inline static bool RunGPGV(std::string
const &File
, std::string
const &FileOut
,
101 int const &statusfd
= -1) {
103 return RunGPGV(File
, FileOut
, statusfd
, fd
);