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