]> git.saurik.com Git - apt.git/blame - apt-pkg/indexcopy.h
add missing translated apt.8 manpages, thanks to Helge Kreutzmann.
[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
a4f6bdc8
DK
17#ifndef APT_8_CLEANER_HEADERS
18using std::string;
19using std::vector;
20#endif
21
143abaeb
AL
22class pkgTagSection;
23class FileFd;
a75c6a6e
MZ
24class indexRecords;
25class pkgCdromStatus;
143abaeb 26
92fcbfc1 27class IndexCopy /*{{{*/
143abaeb 28{
be9b62f7
MV
29 /** \brief dpointer placeholder (for later in case we need it) */
30 void *d;
31
143abaeb
AL
32 protected:
33
34 pkgTagSection *Section;
35
8f3ba4e8
DK
36 std::string ChopDirs(std::string Path,unsigned int Depth);
37 bool ReconstructPrefix(std::string &Prefix,std::string OrigPath,std::string CD,
38 std::string File);
39 bool ReconstructChop(unsigned long &Chop,std::string Dir,std::string File);
40 void ConvertToSourceList(std::string CD,std::string &Path);
41 bool GrabFirst(std::string Path,std::string &To,unsigned int Depth);
42 virtual bool GetFile(std::string &Filename,unsigned long long &Size) = 0;
43 virtual bool RewriteEntry(FILE *Target,std::string File) = 0;
143abaeb
AL
44 virtual const char *GetFileName() = 0;
45 virtual const char *Type() = 0;
b2e465d6 46
143abaeb
AL
47 public:
48
8f3ba4e8 49 bool CopyPackages(std::string CDROM,std::string Name,std::vector<std::string> &List,
a75c6a6e 50 pkgCdromStatus *log);
0432d731 51 virtual ~IndexCopy() {};
143abaeb 52};
92fcbfc1
DK
53 /*}}}*/
54class PackageCopy : public IndexCopy /*{{{*/
143abaeb
AL
55{
56 protected:
57
8f3ba4e8
DK
58 virtual bool GetFile(std::string &Filename,unsigned long long &Size);
59 virtual bool RewriteEntry(FILE *Target,std::string File);
143abaeb
AL
60 virtual const char *GetFileName() {return "Packages";};
61 virtual const char *Type() {return "Package";};
62
143abaeb 63};
92fcbfc1
DK
64 /*}}}*/
65class SourceCopy : public IndexCopy /*{{{*/
143abaeb
AL
66{
67 protected:
68
8f3ba4e8
DK
69 virtual bool GetFile(std::string &Filename,unsigned long long &Size);
70 virtual bool RewriteEntry(FILE *Target,std::string File);
143abaeb
AL
71 virtual const char *GetFileName() {return "Sources";};
72 virtual const char *Type() {return "Source";};
73
143abaeb 74};
92fcbfc1
DK
75 /*}}}*/
76class TranslationsCopy /*{{{*/
22f8568d
MV
77{
78 protected:
79 pkgTagSection *Section;
80
81 public:
8f3ba4e8 82 bool CopyTranslations(std::string CDROM,std::string Name,std::vector<std::string> &List,
22f8568d
MV
83 pkgCdromStatus *log);
84};
92fcbfc1
DK
85 /*}}}*/
86class SigVerify /*{{{*/
a75c6a6e 87{
be9b62f7
MV
88 /** \brief dpointer placeholder (for later in case we need it) */
89 void *d;
90
8f3ba4e8
DK
91 bool Verify(std::string prefix,std::string file, indexRecords *records);
92 bool CopyMetaIndex(std::string CDROM, std::string CDName,
93 std::string prefix, std::string file);
a75c6a6e
MZ
94
95 public:
8f3ba4e8
DK
96 bool CopyAndVerify(std::string CDROM,std::string Name,std::vector<std::string> &SigList,
97 std::vector<std::string> PkgList,std::vector<std::string> SrcList);
a319c4ee 98
cf440fac
DK
99 /** \brief generates and run the command to verify a file with gpgv */
100 static bool RunGPGV(std::string const &File, std::string const &FileOut,
101 int const &statusfd, int fd[2]);
102 inline static bool RunGPGV(std::string const &File, std::string const &FileOut,
103 int const &statusfd = -1) {
104 int fd[2];
105 return RunGPGV(File, FileOut, statusfd, fd);
106 };
a75c6a6e 107};
92fcbfc1 108 /*}}}*/
22f8568d 109
143abaeb 110#endif