]>
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 ##################################################################### */
17 #ifndef APT_8_CLEANER_HEADERS
27 class IndexCopy
/*{{{*/
29 /** \brief dpointer placeholder (for later in case we need it) */
34 pkgTagSection
*Section
;
36 std::string
ChopDirs(std::string Path
,unsigned int Depth
);
37 bool ReconstructPrefix(std::string
&Prefix
,std::string OrigPath
,std::string CD
,
39 bool ReconstructChop(unsigned long &Chop
,std::string Dir
,std::string File
);
40 void ConvertToSourceList(std::string CD
,std::string
&Path
);
41 bool GrabFirst(std::string Path
,std::string
&To
,unsigned int Depth
);
42 virtual bool GetFile(std::string
&Filename
,unsigned long long &Size
) = 0;
43 virtual bool RewriteEntry(FILE *Target
,std::string File
) = 0;
44 virtual const char *GetFileName() = 0;
45 virtual const char *Type() = 0;
49 bool CopyPackages(std::string CDROM
,std::string Name
,std::vector
<std::string
> &List
,
51 virtual ~IndexCopy() {};
54 class PackageCopy
: public IndexCopy
/*{{{*/
58 virtual bool GetFile(std::string
&Filename
,unsigned long long &Size
);
59 virtual bool RewriteEntry(FILE *Target
,std::string File
);
60 virtual const char *GetFileName() {return "Packages";};
61 virtual const char *Type() {return "Package";};
65 class SourceCopy
: public IndexCopy
/*{{{*/
69 virtual bool GetFile(std::string
&Filename
,unsigned long long &Size
);
70 virtual bool RewriteEntry(FILE *Target
,std::string File
);
71 virtual const char *GetFileName() {return "Sources";};
72 virtual const char *Type() {return "Source";};
76 class TranslationsCopy
/*{{{*/
79 pkgTagSection
*Section
;
82 bool CopyTranslations(std::string CDROM
,std::string Name
,std::vector
<std::string
> &List
,
86 class SigVerify
/*{{{*/
88 /** \brief dpointer placeholder (for later in case we need it) */
91 bool Verify(std::string prefix
,std::string file
, indexRecords
*records
);
92 bool CopyMetaIndex(std::string CDROM
, std::string CDName
,
93 std::string prefix
, std::string file
);
96 bool CopyAndVerify(std::string CDROM
,std::string Name
,std::vector
<std::string
> &SigList
,
97 std::vector
<std::string
> PkgList
,std::vector
<std::string
> SrcList
);
99 /** \brief generates and run the command to verify a file with gpgv */
100 static bool RunGPGV(std::string
const &File
, std::string
const &FileOut
,
101 int const &statusfd
, int fd
[2]);
102 inline static bool RunGPGV(std::string
const &File
, std::string
const &FileOut
,
103 int const &statusfd
= -1) {
105 return RunGPGV(File
, FileOut
, statusfd
, fd
);