]> git.saurik.com Git - apt.git/blame_incremental - apt-pkg/indexcopy.h
Merge branch 'cmake'
[apt.git] / apt-pkg / indexcopy.h
... / ...
CommitLineData
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
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>
13#ifndef APT_11_CLEAN_HEADERS
14#include <string>
15#include <stdio.h>
16#endif
17
18#include <apt-pkg/macros.h>
19
20#ifndef APT_10_CLEANER_HEADERS
21#include <apt-pkg/gpgv.h>
22class FileFd;
23#endif
24#ifndef APT_8_CLEANER_HEADERS
25using std::string;
26using std::vector;
27#endif
28
29class pkgTagSection;
30class pkgCdromStatus;
31class FileFd;
32class metaIndex;
33
34class IndexCopy /*{{{*/
35{
36 /** \brief dpointer placeholder (for later in case we need it) */
37 void * const d;
38
39 protected:
40
41 pkgTagSection *Section;
42
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;
50 virtual bool RewriteEntry(FileFd &Target, std::string const &File) = 0;
51 virtual const char *GetFileName() = 0;
52 virtual const char *Type() = 0;
53
54 public:
55
56 bool CopyPackages(std::string CDROM,std::string Name,std::vector<std::string> &List,
57 pkgCdromStatus *log);
58 IndexCopy();
59 virtual ~IndexCopy();
60};
61 /*}}}*/
62class PackageCopy : public IndexCopy /*{{{*/
63{
64 void * const d;
65 protected:
66
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";};
71
72 public:
73 PackageCopy();
74 virtual ~PackageCopy();
75};
76 /*}}}*/
77class SourceCopy : public IndexCopy /*{{{*/
78{
79 void * const d;
80 protected:
81
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";};
86
87 public:
88 SourceCopy();
89 virtual ~SourceCopy();
90};
91 /*}}}*/
92class TranslationsCopy /*{{{*/
93{
94 void * const d;
95 protected:
96 pkgTagSection *Section;
97
98 public:
99 bool CopyTranslations(std::string CDROM,std::string Name,std::vector<std::string> &List,
100 pkgCdromStatus *log);
101
102 TranslationsCopy();
103 virtual ~TranslationsCopy();
104};
105 /*}}}*/
106class SigVerify /*{{{*/
107{
108 /** \brief dpointer placeholder (for later in case we need it) */
109 void * const d;
110
111 APT_HIDDEN bool Verify(std::string prefix,std::string file, metaIndex *records);
112 APT_HIDDEN bool CopyMetaIndex(std::string CDROM, std::string CDName,
113 std::string prefix, std::string file);
114
115 public:
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);
118
119 APT_DEPRECATED_MSG("Use ExecGPGV instead") static bool RunGPGV(std::string const &File, std::string const &FileOut,
120 int const &statusfd, int fd[2]);
121 APT_DEPRECATED_MSG("Use ExecGPGV instead") static bool RunGPGV(std::string const &File, std::string const &FileOut,
122 int const &statusfd = -1);
123
124 SigVerify();
125 virtual ~SigVerify();
126};
127 /*}}}*/
128
129#endif