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