]>
Commit | Line | Data |
---|---|---|
1 | // -*- mode: cpp; mode: fold -*- | |
2 | // Description /*{{{*/ | |
3 | // $Id: indexcopy.h,v 1.3 2001/05/27 04:46:54 jgg Exp $ | |
4 | /* ###################################################################### | |
5 | ||
6 | Index Copying - Aid for copying and verifying the index files | |
7 | ||
8 | ##################################################################### */ | |
9 | /*}}}*/ | |
10 | #ifndef INDEXCOPY_H | |
11 | #define INDEXCOPY_H | |
12 | ||
13 | #include <vector> | |
14 | #include <string> | |
15 | #include <stdio.h> | |
16 | ||
17 | #include <apt-pkg/macros.h> | |
18 | ||
19 | #ifndef APT_10_CLEANER_HEADERS | |
20 | #include <apt-pkg/gpgv.h> | |
21 | class FileFd; | |
22 | #endif | |
23 | #ifndef APT_8_CLEANER_HEADERS | |
24 | using std::string; | |
25 | using std::vector; | |
26 | #endif | |
27 | ||
28 | class pkgTagSection; | |
29 | class indexRecords; | |
30 | class pkgCdromStatus; | |
31 | ||
32 | class IndexCopy /*{{{*/ | |
33 | { | |
34 | /** \brief dpointer placeholder (for later in case we need it) */ | |
35 | void *d; | |
36 | ||
37 | protected: | |
38 | ||
39 | pkgTagSection *Section; | |
40 | ||
41 | std::string ChopDirs(std::string Path,unsigned int Depth); | |
42 | bool ReconstructPrefix(std::string &Prefix,std::string OrigPath,std::string CD, | |
43 | std::string File); | |
44 | bool ReconstructChop(unsigned long &Chop,std::string Dir,std::string File); | |
45 | void ConvertToSourceList(std::string CD,std::string &Path); | |
46 | bool GrabFirst(std::string Path,std::string &To,unsigned int Depth); | |
47 | virtual bool GetFile(std::string &Filename,unsigned long long &Size) = 0; | |
48 | virtual bool RewriteEntry(FILE *Target,std::string File) = 0; | |
49 | virtual const char *GetFileName() = 0; | |
50 | virtual const char *Type() = 0; | |
51 | ||
52 | public: | |
53 | ||
54 | bool CopyPackages(std::string CDROM,std::string Name,std::vector<std::string> &List, | |
55 | pkgCdromStatus *log); | |
56 | virtual ~IndexCopy() {}; | |
57 | }; | |
58 | /*}}}*/ | |
59 | class PackageCopy : public IndexCopy /*{{{*/ | |
60 | { | |
61 | protected: | |
62 | ||
63 | virtual bool GetFile(std::string &Filename,unsigned long long &Size); | |
64 | virtual bool RewriteEntry(FILE *Target,std::string File); | |
65 | virtual const char *GetFileName() {return "Packages";}; | |
66 | virtual const char *Type() {return "Package";}; | |
67 | ||
68 | }; | |
69 | /*}}}*/ | |
70 | class SourceCopy : public IndexCopy /*{{{*/ | |
71 | { | |
72 | protected: | |
73 | ||
74 | virtual bool GetFile(std::string &Filename,unsigned long long &Size); | |
75 | virtual bool RewriteEntry(FILE *Target,std::string File); | |
76 | virtual const char *GetFileName() {return "Sources";}; | |
77 | virtual const char *Type() {return "Source";}; | |
78 | ||
79 | }; | |
80 | /*}}}*/ | |
81 | class TranslationsCopy /*{{{*/ | |
82 | { | |
83 | protected: | |
84 | pkgTagSection *Section; | |
85 | ||
86 | public: | |
87 | bool CopyTranslations(std::string CDROM,std::string Name,std::vector<std::string> &List, | |
88 | pkgCdromStatus *log); | |
89 | }; | |
90 | /*}}}*/ | |
91 | class SigVerify /*{{{*/ | |
92 | { | |
93 | /** \brief dpointer placeholder (for later in case we need it) */ | |
94 | void *d; | |
95 | ||
96 | bool Verify(std::string prefix,std::string file, indexRecords *records); | |
97 | bool CopyMetaIndex(std::string CDROM, std::string CDName, | |
98 | std::string prefix, std::string file); | |
99 | ||
100 | public: | |
101 | bool CopyAndVerify(std::string CDROM,std::string Name,std::vector<std::string> &SigList, | |
102 | std::vector<std::string> PkgList,std::vector<std::string> SrcList); | |
103 | ||
104 | APT_DEPRECATED static bool RunGPGV(std::string const &File, std::string const &FileOut, | |
105 | int const &statusfd, int fd[2]); | |
106 | APT_DEPRECATED static bool RunGPGV(std::string const &File, std::string const &FileOut, | |
107 | int const &statusfd = -1); | |
108 | }; | |
109 | /*}}}*/ | |
110 | ||
111 | #endif |