apt: apt-pkg/indexcopy.h Source File

apt 3.3.3 commandline package manager

indexcopy.h
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 <cstdio>
15#include <string>
16#endif
17
18#include <apt-pkg/macros.h>
19
20
21class pkgTagSection;
22class pkgCdromStatus;
23class FileFd;
24class metaIndex;
25
26 class APT_PUBLIC IndexCopy /*{{{*/
27{
29 void * const d;
30
31 protected:
32
33 pkgTagSection *Section;
34
35 std::string ChopDirs(std::string Path,unsigned int Depth);
36 bool ReconstructPrefix(std::string &Prefix,std::string OrigPath,std::string CD,
37 std::string File);
38 bool ReconstructChop(unsigned long &Chop,std::string Dir,std::string File);
39 void ConvertToSourceList(std::string CD,std::string &Path);
40 bool GrabFirst(std::string Path,std::string &To,unsigned int Depth);
41 virtual bool GetFile(std::string &Filename,unsigned long long &Size) = 0;
42 virtual bool RewriteEntry(FileFd &Target, std::string const &File) = 0;
43 virtual const char *GetFileName() = 0;
44 virtual const char *Type() = 0;
45
46 public:
47
48 bool CopyPackages(std::string CDROM,std::string Name,std::vector<std::string> &List,
49 pkgCdromStatus *log);
50 IndexCopy();
51 virtual ~IndexCopy();
52};
53 /*}}}*/
54 class APT_PUBLIC PackageCopy : public IndexCopy /*{{{*/
55{
56 void * const d;
57 protected:
58 bool GetFile(std::string &Filename, unsigned long long &Size) override;
59 bool RewriteEntry(FileFd &Target, std::string const &File) override;
60 const char *GetFileName() override { return "Packages"; }
61 const char *Type() override { return "Package"; }
62
63 public:
64 PackageCopy();
65 ~PackageCopy() override;
66};
67 /*}}}*/
68 class APT_PUBLIC SourceCopy : public IndexCopy /*{{{*/
69{
70 void * const d;
71 protected:
72 bool GetFile(std::string &Filename, unsigned long long &Size) override;
73 bool RewriteEntry(FileFd &Target, std::string const &File) override;
74 const char *GetFileName() override { return "Sources"; }
75 const char *Type() override { return "Source"; };
76
77 public:
78 SourceCopy();
79 ~SourceCopy() override;
80};
81 /*}}}*/
82 class APT_PUBLIC TranslationsCopy /*{{{*/
83{
84 void * const d;
85 protected:
86 pkgTagSection *Section;
87
88 public:
89 bool CopyTranslations(std::string CDROM,std::string Name,std::vector<std::string> &List,
90 pkgCdromStatus *log);
91
92 TranslationsCopy();
93 virtual ~TranslationsCopy();
94};
95 /*}}}*/
96 class APT_PUBLIC SigVerify /*{{{*/
97{
99 void * const d;
100
101 APT_HIDDEN bool Verify(std::string prefix,std::string file, metaIndex *records);
102 APT_HIDDEN bool CopyMetaIndex(std::string CDROM, std::string CDName,
103 std::string prefix, std::string file);
104
105 public:
106 bool CopyAndVerify(std::string CDROM,std::string Name,std::vector<std::string> &SigList,
107 std::vector<std::string> PkgList,std::vector<std::string> SrcList);
108
109 SigVerify();
110 virtual ~SigVerify();
111};
112 /*}}}*/
113
114#endif
FileFd
Definition fileutl.h:43
SigVerify::CopyAndVerify
bool CopyAndVerify(std::string CDROM, std::string Name, std::vector< std::string > &SigList, std::vector< std::string > PkgList, std::vector< std::string > SrcList)
Definition indexcopy.cc:540
metaIndex
Definition metaindex.h:21
pkgCdromStatus
Definition cdrom.h:15
pkgTagSection
Definition tagfile.h:46