]>
Commit | Line | Data |
---|---|---|
143abaeb AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
143abaeb AL |
3 | /* ###################################################################### |
4 | ||
5 | Index Copying - Aid for copying and verifying the index files | |
6 | ||
7 | ##################################################################### */ | |
8 | /*}}}*/ | |
9 | #ifndef INDEXCOPY_H | |
10 | #define INDEXCOPY_H | |
11 | ||
12 | #include <vector> | |
88a8975f | 13 | #ifndef APT_11_CLEAN_HEADERS |
143abaeb | 14 | #include <string> |
b2e465d6 | 15 | #include <stdio.h> |
88a8975f | 16 | #endif |
143abaeb | 17 | |
2f5b6151 DK |
18 | #include <apt-pkg/macros.h> |
19 | ||
453b82a3 DK |
20 | #ifndef APT_10_CLEANER_HEADERS |
21 | #include <apt-pkg/gpgv.h> | |
22 | class FileFd; | |
23 | #endif | |
a4f6bdc8 DK |
24 | #ifndef APT_8_CLEANER_HEADERS |
25 | using std::string; | |
26 | using std::vector; | |
27 | #endif | |
28 | ||
143abaeb | 29 | class pkgTagSection; |
a75c6a6e | 30 | class pkgCdromStatus; |
88593886 | 31 | class FileFd; |
5ad0096a | 32 | class metaIndex; |
143abaeb | 33 | |
92fcbfc1 | 34 | class IndexCopy /*{{{*/ |
143abaeb | 35 | { |
be9b62f7 | 36 | /** \brief dpointer placeholder (for later in case we need it) */ |
6c55f07a | 37 | void * const d; |
be9b62f7 | 38 | |
143abaeb AL |
39 | protected: |
40 | ||
41 | pkgTagSection *Section; | |
42 | ||
8f3ba4e8 DK |
43 | std::string ChopDirs(std::string Path,unsigned int Depth); |
44 | bool ReconstructPrefix(std::string &Prefix,std::string OrigPath,std::string CD, | |
45 | std::string File); | |
46 | bool ReconstructChop(unsigned long &Chop,std::string Dir,std::string File); | |
47 | void ConvertToSourceList(std::string CD,std::string &Path); | |
48 | bool GrabFirst(std::string Path,std::string &To,unsigned int Depth); | |
49 | virtual bool GetFile(std::string &Filename,unsigned long long &Size) = 0; | |
88593886 | 50 | virtual bool RewriteEntry(FileFd &Target, std::string const &File) = 0; |
143abaeb AL |
51 | virtual const char *GetFileName() = 0; |
52 | virtual const char *Type() = 0; | |
b2e465d6 | 53 | |
143abaeb AL |
54 | public: |
55 | ||
8f3ba4e8 | 56 | bool CopyPackages(std::string CDROM,std::string Name,std::vector<std::string> &List, |
a75c6a6e | 57 | pkgCdromStatus *log); |
c8a4ce6c | 58 | IndexCopy(); |
862bafea | 59 | virtual ~IndexCopy(); |
143abaeb | 60 | }; |
92fcbfc1 DK |
61 | /*}}}*/ |
62 | class PackageCopy : public IndexCopy /*{{{*/ | |
143abaeb | 63 | { |
6c55f07a | 64 | void * const d; |
143abaeb | 65 | protected: |
c8a4ce6c | 66 | |
3b302846 DK |
67 | virtual bool GetFile(std::string &Filename,unsigned long long &Size) APT_OVERRIDE; |
68 | virtual bool RewriteEntry(FileFd &Target, std::string const &File) APT_OVERRIDE; | |
69 | virtual const char *GetFileName() APT_OVERRIDE {return "Packages";}; | |
70 | virtual const char *Type() APT_OVERRIDE {return "Package";}; | |
c8a4ce6c DK |
71 | |
72 | public: | |
73 | PackageCopy(); | |
74 | virtual ~PackageCopy(); | |
143abaeb | 75 | }; |
92fcbfc1 DK |
76 | /*}}}*/ |
77 | class SourceCopy : public IndexCopy /*{{{*/ | |
143abaeb | 78 | { |
6c55f07a | 79 | void * const d; |
143abaeb AL |
80 | protected: |
81 | ||
3b302846 DK |
82 | virtual bool GetFile(std::string &Filename,unsigned long long &Size) APT_OVERRIDE; |
83 | virtual bool RewriteEntry(FileFd &Target, std::string const &File) APT_OVERRIDE; | |
84 | virtual const char *GetFileName() APT_OVERRIDE {return "Sources";}; | |
85 | virtual const char *Type() APT_OVERRIDE {return "Source";}; | |
c8a4ce6c DK |
86 | |
87 | public: | |
88 | SourceCopy(); | |
89 | virtual ~SourceCopy(); | |
143abaeb | 90 | }; |
92fcbfc1 DK |
91 | /*}}}*/ |
92 | class TranslationsCopy /*{{{*/ | |
22f8568d | 93 | { |
6c55f07a | 94 | void * const d; |
22f8568d MV |
95 | protected: |
96 | pkgTagSection *Section; | |
97 | ||
98 | public: | |
8f3ba4e8 | 99 | bool CopyTranslations(std::string CDROM,std::string Name,std::vector<std::string> &List, |
22f8568d | 100 | pkgCdromStatus *log); |
c8a4ce6c DK |
101 | |
102 | TranslationsCopy(); | |
103 | virtual ~TranslationsCopy(); | |
22f8568d | 104 | }; |
92fcbfc1 DK |
105 | /*}}}*/ |
106 | class SigVerify /*{{{*/ | |
a75c6a6e | 107 | { |
be9b62f7 | 108 | /** \brief dpointer placeholder (for later in case we need it) */ |
6c55f07a | 109 | void * const d; |
be9b62f7 | 110 | |
5ad0096a | 111 | APT_HIDDEN bool Verify(std::string prefix,std::string file, metaIndex *records); |
3809194b | 112 | APT_HIDDEN bool CopyMetaIndex(std::string CDROM, std::string CDName, |
8f3ba4e8 | 113 | std::string prefix, std::string file); |
a75c6a6e MZ |
114 | |
115 | public: | |
8f3ba4e8 DK |
116 | bool CopyAndVerify(std::string CDROM,std::string Name,std::vector<std::string> &SigList, |
117 | std::vector<std::string> PkgList,std::vector<std::string> SrcList); | |
a319c4ee | 118 | |
5dd00edb | 119 | APT_DEPRECATED_MSG("Use ExecGPGV instead") static bool RunGPGV(std::string const &File, std::string const &FileOut, |
27cc55ee | 120 | int const &statusfd, int fd[2]); |
5dd00edb | 121 | APT_DEPRECATED_MSG("Use ExecGPGV instead") static bool RunGPGV(std::string const &File, std::string const &FileOut, |
27cc55ee | 122 | int const &statusfd = -1); |
c8a4ce6c DK |
123 | |
124 | SigVerify(); | |
125 | virtual ~SigVerify(); | |
a75c6a6e | 126 | }; |
92fcbfc1 | 127 | /*}}}*/ |
22f8568d | 128 | |
143abaeb | 129 | #endif |