]>
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 ##################################################################### */
27 #include "apt-ftparchive.h"
38 vector
<string
> Patterns
;
39 const char *OriginalPath
;
43 // Stuff for the delinker
46 static FTWScanner
*Owner
;
47 static int ScannerFTW(const char *File
,const struct stat
*sb
,int Flag
);
48 static int ScannerFile(const char *File
, bool ReadLink
);
50 bool Delink(string
&FileName
,const char *OriginalPath
,
51 unsigned long &Bytes
,off_t FileSize
);
53 inline void NewLine(unsigned Priority
)
55 if (ErrorPrinted
== false && Quiet
<= Priority
)
64 unsigned long DeLinkLimit
;
65 string InternalPrefix
;
67 virtual bool DoPackage(string FileName
) = 0;
68 bool RecursiveScan(string Dir
);
69 bool LoadFileList(string BaseDir
,string File
);
70 void ClearPatterns() { Patterns
.clear(); };
71 void AddPattern(string Pattern
) { Patterns
.push_back(Pattern
); };
72 bool SetExts(string Vals
);
75 virtual ~FTWScanner() {delete [] RealPath
;};
78 class PackagesWriter
: public FTWScanner
96 struct CacheDB::Stats
&Stats
;
99 inline bool ReadOverride(string File
) {return Over
.ReadOverride(File
);};
100 inline bool ReadExtraOverride(string File
)
101 {return Over
.ReadExtraOverride(File
);};
102 virtual bool DoPackage(string FileName
);
104 PackagesWriter(string DB
,string Overrides
,string ExtOverrides
=string(),
105 string Arch
=string());
106 virtual ~PackagesWriter() {};
109 class ContentsWriter
: public FTWScanner
119 struct CacheDB::Stats
&Stats
;
122 bool DoPackage(string FileName
,string Package
);
123 virtual bool DoPackage(string FileName
)
124 {return DoPackage(FileName
,string());};
125 bool ReadFromPkgs(string PkgFile
,string PkgCompress
);
127 void Finish() {Gen
.Print(Output
);};
128 inline bool ReadyDB(string DB
) {return Db
.ReadyDB(DB
);};
130 ContentsWriter(string DB
);
131 virtual ~ContentsWriter() {};
134 class SourcesWriter
: public FTWScanner
139 unsigned long BufSize
;
149 struct CacheDB::Stats Stats
;
151 virtual bool DoPackage(string FileName
);
153 SourcesWriter(string BOverrides
,string SOverrides
,
154 string ExtOverrides
=string());
155 virtual ~SourcesWriter() {free(Buffer
);};
158 class ReleaseWriter
: public FTWScanner
161 ReleaseWriter(string DB
);
162 virtual bool DoPackage(string FileName
);
176 // Limited by FileFd::Size()
180 map
<string
,struct CheckSum
> CheckSums
;