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