]> git.saurik.com Git - apt.git/blob - apt-pkg/indexcopy.h
rework hashsum verification in the acquire system
[apt.git] / apt-pkg / indexcopy.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: indexcopy.h,v 1.3 2001/05/27 04:46:54 jgg Exp $
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>
15 #include <stdio.h>
16
17 #include <apt-pkg/macros.h>
18
19 #ifndef APT_10_CLEANER_HEADERS
20 #include <apt-pkg/gpgv.h>
21 class FileFd;
22 #endif
23 #ifndef APT_8_CLEANER_HEADERS
24 using std::string;
25 using std::vector;
26 #endif
27
28 class pkgTagSection;
29 class indexRecords;
30 class pkgCdromStatus;
31 class FileFd;
32
33 class IndexCopy /*{{{*/
34 {
35 /** \brief dpointer placeholder (for later in case we need it) */
36 void *d;
37
38 protected:
39
40 pkgTagSection *Section;
41
42 std::string ChopDirs(std::string Path,unsigned int Depth);
43 bool ReconstructPrefix(std::string &Prefix,std::string OrigPath,std::string CD,
44 std::string File);
45 bool ReconstructChop(unsigned long &Chop,std::string Dir,std::string File);
46 void ConvertToSourceList(std::string CD,std::string &Path);
47 bool GrabFirst(std::string Path,std::string &To,unsigned int Depth);
48 virtual bool GetFile(std::string &Filename,unsigned long long &Size) = 0;
49 virtual bool RewriteEntry(FileFd &Target, std::string const &File) = 0;
50 virtual const char *GetFileName() = 0;
51 virtual const char *Type() = 0;
52
53 public:
54
55 bool CopyPackages(std::string CDROM,std::string Name,std::vector<std::string> &List,
56 pkgCdromStatus *log);
57 virtual ~IndexCopy();
58 };
59 /*}}}*/
60 class PackageCopy : public IndexCopy /*{{{*/
61 {
62 protected:
63
64 virtual bool GetFile(std::string &Filename,unsigned long long &Size);
65 virtual bool RewriteEntry(FileFd &Target, std::string const &File);
66 virtual const char *GetFileName() {return "Packages";};
67 virtual const char *Type() {return "Package";};
68
69 };
70 /*}}}*/
71 class SourceCopy : public IndexCopy /*{{{*/
72 {
73 protected:
74
75 virtual bool GetFile(std::string &Filename,unsigned long long &Size);
76 virtual bool RewriteEntry(FileFd &Target, std::string const &File);
77 virtual const char *GetFileName() {return "Sources";};
78 virtual const char *Type() {return "Source";};
79
80 };
81 /*}}}*/
82 class TranslationsCopy /*{{{*/
83 {
84 protected:
85 pkgTagSection *Section;
86
87 public:
88 bool CopyTranslations(std::string CDROM,std::string Name,std::vector<std::string> &List,
89 pkgCdromStatus *log);
90 };
91 /*}}}*/
92 class SigVerify /*{{{*/
93 {
94 /** \brief dpointer placeholder (for later in case we need it) */
95 void *d;
96
97 APT_HIDDEN bool Verify(std::string prefix,std::string file, indexRecords *records);
98 APT_HIDDEN bool CopyMetaIndex(std::string CDROM, std::string CDName,
99 std::string prefix, std::string file);
100
101 public:
102 bool CopyAndVerify(std::string CDROM,std::string Name,std::vector<std::string> &SigList,
103 std::vector<std::string> PkgList,std::vector<std::string> SrcList);
104
105 APT_DEPRECATED static bool RunGPGV(std::string const &File, std::string const &FileOut,
106 int const &statusfd, int fd[2]);
107 APT_DEPRECATED static bool RunGPGV(std::string const &File, std::string const &FileOut,
108 int const &statusfd = -1);
109 };
110 /*}}}*/
111
112 #endif