]>
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 | |
076d01b0 AL |
17 | using std::string; |
18 | using std::vector; | |
19 | ||
143abaeb AL |
20 | class pkgTagSection; |
21 | class FileFd; | |
a75c6a6e MZ |
22 | class indexRecords; |
23 | class pkgCdromStatus; | |
143abaeb | 24 | |
92fcbfc1 | 25 | class IndexCopy /*{{{*/ |
143abaeb | 26 | { |
be9b62f7 MV |
27 | /** \brief dpointer placeholder (for later in case we need it) */ |
28 | void *d; | |
29 | ||
143abaeb AL |
30 | protected: |
31 | ||
32 | pkgTagSection *Section; | |
33 | ||
34 | string ChopDirs(string Path,unsigned int Depth); | |
35 | bool ReconstructPrefix(string &Prefix,string OrigPath,string CD, | |
36 | string File); | |
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); | |
650faab0 | 40 | virtual bool GetFile(string &Filename,unsigned long long &Size) = 0; |
b2e465d6 | 41 | virtual bool RewriteEntry(FILE *Target,string File) = 0; |
143abaeb AL |
42 | virtual const char *GetFileName() = 0; |
43 | virtual const char *Type() = 0; | |
b2e465d6 | 44 | |
143abaeb AL |
45 | public: |
46 | ||
a75c6a6e MZ |
47 | bool CopyPackages(string CDROM,string Name,vector<string> &List, |
48 | pkgCdromStatus *log); | |
0432d731 | 49 | virtual ~IndexCopy() {}; |
143abaeb | 50 | }; |
92fcbfc1 DK |
51 | /*}}}*/ |
52 | class PackageCopy : public IndexCopy /*{{{*/ | |
143abaeb AL |
53 | { |
54 | protected: | |
55 | ||
650faab0 | 56 | virtual bool GetFile(string &Filename,unsigned long long &Size); |
b2e465d6 | 57 | virtual bool RewriteEntry(FILE *Target,string File); |
143abaeb AL |
58 | virtual const char *GetFileName() {return "Packages";}; |
59 | virtual const char *Type() {return "Package";}; | |
60 | ||
143abaeb | 61 | }; |
92fcbfc1 DK |
62 | /*}}}*/ |
63 | class SourceCopy : public IndexCopy /*{{{*/ | |
143abaeb AL |
64 | { |
65 | protected: | |
66 | ||
650faab0 | 67 | virtual bool GetFile(string &Filename,unsigned long long &Size); |
b2e465d6 | 68 | virtual bool RewriteEntry(FILE *Target,string File); |
143abaeb AL |
69 | virtual const char *GetFileName() {return "Sources";}; |
70 | virtual const char *Type() {return "Source";}; | |
71 | ||
143abaeb | 72 | }; |
92fcbfc1 DK |
73 | /*}}}*/ |
74 | class TranslationsCopy /*{{{*/ | |
22f8568d MV |
75 | { |
76 | protected: | |
77 | pkgTagSection *Section; | |
78 | ||
79 | public: | |
80 | bool CopyTranslations(string CDROM,string Name,vector<string> &List, | |
81 | pkgCdromStatus *log); | |
82 | }; | |
92fcbfc1 DK |
83 | /*}}}*/ |
84 | class SigVerify /*{{{*/ | |
a75c6a6e | 85 | { |
be9b62f7 MV |
86 | /** \brief dpointer placeholder (for later in case we need it) */ |
87 | void *d; | |
88 | ||
a75c6a6e MZ |
89 | bool Verify(string prefix,string file, indexRecords *records); |
90 | bool CopyMetaIndex(string CDROM, string CDName, | |
91 | string prefix, string file); | |
92 | ||
93 | public: | |
94 | bool CopyAndVerify(string CDROM,string Name,vector<string> &SigList, | |
95 | vector<string> PkgList,vector<string> SrcList); | |
a319c4ee | 96 | |
cf440fac DK |
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) { | |
102 | int fd[2]; | |
103 | return RunGPGV(File, FileOut, statusfd, fd); | |
104 | }; | |
a75c6a6e | 105 | }; |
92fcbfc1 | 106 | /*}}}*/ |
22f8568d | 107 | |
143abaeb | 108 | #endif |