]>
git.saurik.com Git - apt.git/blob - ftparchive/writer.h
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: writer.h,v 1.4.2.2 2003/12/26 22:55:43 mdz Exp $
4 /* ######################################################################
8 The file writer classes. These write various types of output, sources,
11 ##################################################################### */
25 #include "apt-ftparchive.h"
36 vector
<string
> Patterns
;
38 const char *OriginalPath
;
41 // Stuff for the delinker
44 static FTWScanner
*Owner
;
45 static int ScannerFTW(const char *File
,const struct stat
*sb
,int Flag
);
46 static int ScannerFile(const char *File
, bool const &ReadLink
);
48 bool Delink(string
&FileName
,const char *OriginalPath
,
49 unsigned long &Bytes
,off_t
const &FileSize
);
51 inline void NewLine(unsigned const &Priority
)
53 if (ErrorPrinted
== false && Quiet
<= Priority
)
62 unsigned long DeLinkLimit
;
63 string InternalPrefix
;
65 virtual bool DoPackage(string FileName
) = 0;
66 bool RecursiveScan(string
const &Dir
);
67 bool LoadFileList(string
const &BaseDir
,string
const &File
);
68 void ClearPatterns() { Patterns
.clear(); };
69 void AddPattern(string
const &Pattern
) { Patterns
.push_back(Pattern
); };
70 bool SetExts(string
const &Vals
);
72 FTWScanner(string
const &Arch
= string());
75 class PackagesWriter
: public FTWScanner
95 struct CacheDB::Stats
&Stats
;
97 inline bool ReadOverride(string
const &File
) {return Over
.ReadOverride(File
);};
98 inline bool ReadExtraOverride(string
const &File
)
99 {return Over
.ReadExtraOverride(File
);};
100 virtual bool DoPackage(string FileName
);
102 PackagesWriter(string
const &DB
,string
const &Overrides
,string
const &ExtOverrides
=string(),
103 string
const &Arch
=string());
104 virtual ~PackagesWriter() {};
107 class ContentsWriter
: public FTWScanner
117 struct CacheDB::Stats
&Stats
;
120 bool DoPackage(string FileName
,string Package
);
121 virtual bool DoPackage(string FileName
)
122 {return DoPackage(FileName
,string());};
123 bool ReadFromPkgs(string
const &PkgFile
,string
const &PkgCompress
);
125 void Finish() {Gen
.Print(Output
);};
126 inline bool ReadyDB(string
const &DB
) {return Db
.ReadyDB(DB
);};
128 ContentsWriter(string
const &DB
, string
const &Arch
= string());
129 virtual ~ContentsWriter() {};
132 class SourcesWriter
: public FTWScanner
137 unsigned long BufSize
;
147 struct CacheDB::Stats Stats
;
149 virtual bool DoPackage(string FileName
);
151 SourcesWriter(string
const &BOverrides
,string
const &SOverrides
,
152 string
const &ExtOverrides
=string());
153 virtual ~SourcesWriter() {free(Buffer
);};
156 class ReleaseWriter
: public FTWScanner
159 ReleaseWriter(string
const &DB
);
160 virtual bool DoPackage(string FileName
);
174 // Limited by FileFd::Size()
178 map
<string
,struct CheckSum
> CheckSums
;