]>
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
/*{{{*/
29 pkgTagSection
*Section
;
31 string
ChopDirs(string Path
,unsigned int Depth
);
32 bool ReconstructPrefix(string
&Prefix
,string OrigPath
,string CD
,
34 bool ReconstructChop(unsigned long &Chop
,string Dir
,string File
);
35 void ConvertToSourceList(string CD
,string
&Path
);
36 bool GrabFirst(string Path
,string
&To
,unsigned int Depth
);
37 virtual bool GetFile(string
&Filename
,unsigned long &Size
) = 0;
38 virtual bool RewriteEntry(FILE *Target
,string File
) = 0;
39 virtual const char *GetFileName() = 0;
40 virtual const char *Type() = 0;
44 bool CopyPackages(string CDROM
,string Name
,vector
<string
> &List
,
46 virtual ~IndexCopy() {};
49 class PackageCopy
: public IndexCopy
/*{{{*/
53 virtual bool GetFile(string
&Filename
,unsigned long &Size
);
54 virtual bool RewriteEntry(FILE *Target
,string File
);
55 virtual const char *GetFileName() {return "Packages";};
56 virtual const char *Type() {return "Package";};
61 class SourceCopy
: public IndexCopy
/*{{{*/
65 virtual bool GetFile(string
&Filename
,unsigned long &Size
);
66 virtual bool RewriteEntry(FILE *Target
,string File
);
67 virtual const char *GetFileName() {return "Sources";};
68 virtual const char *Type() {return "Source";};
73 class TranslationsCopy
/*{{{*/
76 pkgTagSection
*Section
;
79 bool CopyTranslations(string CDROM
,string Name
,vector
<string
> &List
,
83 class SigVerify
/*{{{*/
85 bool Verify(string prefix
,string file
, indexRecords
*records
);
86 bool CopyMetaIndex(string CDROM
, string CDName
,
87 string prefix
, string file
);
90 bool CopyAndVerify(string CDROM
,string Name
,vector
<string
> &SigList
,
91 vector
<string
> PkgList
,vector
<string
> SrcList
);
93 /** \brief generates and run the command to verify a file with gpgv */
94 static bool RunGPGV(std::string
const &File
, std::string
const &FileOut
,
95 int const &statusfd
, int fd
[2]);
96 inline static bool RunGPGV(std::string
const &File
, std::string
const &FileOut
,
97 int const &statusfd
= -1) {
99 return RunGPGV(File
, FileOut
, statusfd
, fd
);