]>
git.saurik.com Git - apt.git/blob - apt-pkg/indexcopy.h
1 // -*- mode: cpp; mode: fold -*-
3 /* ######################################################################
5 Index Copying - Aid for copying and verifying the index files
7 ##################################################################### */
13 #ifndef APT_11_CLEAN_HEADERS
18 #include <apt-pkg/macros.h>
20 #ifndef APT_10_CLEANER_HEADERS
21 #include <apt-pkg/gpgv.h>
24 #ifndef APT_8_CLEANER_HEADERS
34 class IndexCopy
/*{{{*/
36 /** \brief dpointer placeholder (for later in case we need it) */
41 pkgTagSection
*Section
;
43 std::string
ChopDirs(std::string Path
,unsigned int Depth
);
44 bool ReconstructPrefix(std::string
&Prefix
,std::string OrigPath
,std::string CD
,
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;
56 bool CopyPackages(std::string CDROM
,std::string Name
,std::vector
<std::string
> &List
,
62 class PackageCopy
: public IndexCopy
/*{{{*/
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";};
74 virtual ~PackageCopy();
77 class SourceCopy
: public IndexCopy
/*{{{*/
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";};
89 virtual ~SourceCopy();
92 class TranslationsCopy
/*{{{*/
96 pkgTagSection
*Section
;
99 bool CopyTranslations(std::string CDROM
,std::string Name
,std::vector
<std::string
> &List
,
100 pkgCdromStatus
*log
);
103 virtual ~TranslationsCopy();
106 class SigVerify
/*{{{*/
108 /** \brief dpointer placeholder (for later in case we need it) */
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
);
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
);
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);
125 virtual ~SigVerify();