]>
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/macros.h> |
18 | ||
453b82a3 DK |
19 | #ifndef APT_10_CLEANER_HEADERS |
20 | #include <apt-pkg/gpgv.h> | |
21 | class FileFd; | |
22 | #endif | |
a4f6bdc8 DK |
23 | #ifndef APT_8_CLEANER_HEADERS |
24 | using std::string; | |
25 | using std::vector; | |
26 | #endif | |
27 | ||
143abaeb | 28 | class pkgTagSection; |
a75c6a6e MZ |
29 | class indexRecords; |
30 | class pkgCdromStatus; | |
143abaeb | 31 | |
92fcbfc1 | 32 | class IndexCopy /*{{{*/ |
143abaeb | 33 | { |
be9b62f7 MV |
34 | /** \brief dpointer placeholder (for later in case we need it) */ |
35 | void *d; | |
36 | ||
143abaeb AL |
37 | protected: |
38 | ||
39 | pkgTagSection *Section; | |
40 | ||
8f3ba4e8 DK |
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; | |
143abaeb AL |
49 | virtual const char *GetFileName() = 0; |
50 | virtual const char *Type() = 0; | |
b2e465d6 | 51 | |
143abaeb AL |
52 | public: |
53 | ||
8f3ba4e8 | 54 | bool CopyPackages(std::string CDROM,std::string Name,std::vector<std::string> &List, |
a75c6a6e | 55 | pkgCdromStatus *log); |
0432d731 | 56 | virtual ~IndexCopy() {}; |
143abaeb | 57 | }; |
92fcbfc1 DK |
58 | /*}}}*/ |
59 | class PackageCopy : public IndexCopy /*{{{*/ | |
143abaeb AL |
60 | { |
61 | protected: | |
62 | ||
8f3ba4e8 DK |
63 | virtual bool GetFile(std::string &Filename,unsigned long long &Size); |
64 | virtual bool RewriteEntry(FILE *Target,std::string File); | |
143abaeb AL |
65 | virtual const char *GetFileName() {return "Packages";}; |
66 | virtual const char *Type() {return "Package";}; | |
67 | ||
143abaeb | 68 | }; |
92fcbfc1 DK |
69 | /*}}}*/ |
70 | class SourceCopy : public IndexCopy /*{{{*/ | |
143abaeb AL |
71 | { |
72 | protected: | |
73 | ||
8f3ba4e8 DK |
74 | virtual bool GetFile(std::string &Filename,unsigned long long &Size); |
75 | virtual bool RewriteEntry(FILE *Target,std::string File); | |
143abaeb AL |
76 | virtual const char *GetFileName() {return "Sources";}; |
77 | virtual const char *Type() {return "Source";}; | |
78 | ||
143abaeb | 79 | }; |
92fcbfc1 DK |
80 | /*}}}*/ |
81 | class TranslationsCopy /*{{{*/ | |
22f8568d MV |
82 | { |
83 | protected: | |
84 | pkgTagSection *Section; | |
85 | ||
86 | public: | |
8f3ba4e8 | 87 | bool CopyTranslations(std::string CDROM,std::string Name,std::vector<std::string> &List, |
22f8568d MV |
88 | pkgCdromStatus *log); |
89 | }; | |
92fcbfc1 DK |
90 | /*}}}*/ |
91 | class SigVerify /*{{{*/ | |
a75c6a6e | 92 | { |
be9b62f7 MV |
93 | /** \brief dpointer placeholder (for later in case we need it) */ |
94 | void *d; | |
95 | ||
3809194b DK |
96 | APT_HIDDEN bool Verify(std::string prefix,std::string file, indexRecords *records); |
97 | APT_HIDDEN bool CopyMetaIndex(std::string CDROM, std::string CDName, | |
8f3ba4e8 | 98 | std::string prefix, std::string file); |
a75c6a6e MZ |
99 | |
100 | public: | |
8f3ba4e8 DK |
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); | |
a319c4ee | 103 | |
453b82a3 | 104 | APT_DEPRECATED static bool RunGPGV(std::string const &File, std::string const &FileOut, |
27cc55ee | 105 | int const &statusfd, int fd[2]); |
453b82a3 | 106 | APT_DEPRECATED static bool RunGPGV(std::string const &File, std::string const &FileOut, |
27cc55ee | 107 | int const &statusfd = -1); |
a75c6a6e | 108 | }; |
92fcbfc1 | 109 | /*}}}*/ |
22f8568d | 110 | |
143abaeb | 111 | #endif |