summaryrefslogtreecommitdiff
path: root/ftparchive
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-02-18 15:39:03 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2010-02-18 15:39:03 +0100
commit113942be71c90e7d6a9cff93cc05ac119db526de (patch)
tree2872bfb8c3b12dc8f9fe9e1622ddffeea528d4e6 /ftparchive
parentb9dacd11a4707092f070d49b1cb1acff642eebf0 (diff)
parent3c5a611808e7af5aec4c2ab12ce0bce79f74928d (diff)
merge from the lp:~donkult/apt/sid branch
Diffstat (limited to 'ftparchive')
-rw-r--r--ftparchive/apt-ftparchive.cc7
-rw-r--r--ftparchive/writer.cc30
-rw-r--r--ftparchive/writer.h6
3 files changed, 21 insertions, 22 deletions
diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc
index 5b6b3940c..f1a182e52 100644
--- a/ftparchive/apt-ftparchive.cc
+++ b/ftparchive/apt-ftparchive.cc
@@ -333,7 +333,7 @@ bool PackageMap::GenContents(Configuration &Setup,
gettimeofday(&StartTime,0);
// Create a package writer object.
- ContentsWriter Contents("");
+ ContentsWriter Contents("", Arch);
if (PkgExt.empty() == false && Contents.SetExts(PkgExt) == false)
return _error->Error(_("Package extension list is too long"));
if (_error->PendingError() == true)
@@ -606,7 +606,7 @@ bool SimpleGenPackages(CommandLine &CmdL)
// Create a package writer object.
PackagesWriter Packages(_config->Find("APT::FTPArchive::DB"),
- Override, "");
+ Override, "", _config->Find("APT::FTPArchive::Architecture"));
if (_error->PendingError() == true)
return false;
@@ -629,7 +629,7 @@ bool SimpleGenContents(CommandLine &CmdL)
return ShowHelp(CmdL);
// Create a package writer object.
- ContentsWriter Contents(_config->Find("APT::FTPArchive::DB"));
+ ContentsWriter Contents(_config->Find("APT::FTPArchive::DB"), _config->Find("APT::FTPArchive::Architecture"));
if (_error->PendingError() == true)
return false;
@@ -910,6 +910,7 @@ int main(int argc, const char *argv[])
{0,"delink","APT::FTPArchive::DeLinkAct",0},
{0,"readonly","APT::FTPArchive::ReadOnlyDB",0},
{0,"contents","APT::FTPArchive::Contents",0},
+ {'a',"arch","APT::FTPArchive::Architecture",CommandLine::HasArg},
{'c',"config-file",0,CommandLine::ConfigFile},
{'o',"option",0,CommandLine::ArbItem},
{0,0,0,0}};
diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc
index 18a3de0c2..9e5b7d4f3 100644
--- a/ftparchive/writer.cc
+++ b/ftparchive/writer.cc
@@ -54,7 +54,7 @@ inline void SetTFRewriteData(struct TFRewriteData &tfrd,
// FTWScanner::FTWScanner - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
-FTWScanner::FTWScanner()
+FTWScanner::FTWScanner(string const &Arch): Arch(Arch)
{
ErrorPrinted = false;
NoLinkAct = !_config->FindB("APT::FTPArchive::DeLinkAct",true);
@@ -299,12 +299,11 @@ bool FTWScanner::Delink(string &FileName,const char *OriginalPath,
// ---------------------------------------------------------------------
/* */
PackagesWriter::PackagesWriter(string const &DB,string const &Overrides,string const &ExtOverrides,
- string const &aArch) :
- Db(DB),Stats(Db.Stats), Arch(aArch)
+ string const &Arch) :
+ FTWScanner(Arch), Db(DB), Stats(Db.Stats)
{
Output = stdout;
- SetExts(".deb .udeb .foo .bar .baz");
- AddPattern("*.deb");
+ SetExts(".deb .udeb");
DeLinkLimit = 0;
// Process the command line options
@@ -340,17 +339,16 @@ bool FTWScanner::SetExts(string const &Vals)
string::size_type Start = 0;
while (Start <= Vals.length()-1)
{
- string::size_type Space = Vals.find(' ',Start);
- string::size_type Length;
- if (Space == string::npos)
+ string::size_type const Space = Vals.find(' ',Start);
+ string::size_type const Length = ((Space == string::npos) ? Vals.length() : Space) - Start;
+ if ( Arch.empty() == false )
{
- Length = Vals.length()-Start;
+ AddPattern(string("*_") + Arch + Vals.substr(Start, Length));
+ AddPattern(string("*_all") + Vals.substr(Start, Length));
}
else
- {
- Length = Space-Start;
- }
- AddPattern(string("*") + Vals.substr(Start, Length));
+ AddPattern(string("*") + Vals.substr(Start, Length));
+
Start += Length + 1;
}
@@ -767,11 +765,11 @@ bool SourcesWriter::DoPackage(string FileName)
// ContentsWriter::ContentsWriter - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
-ContentsWriter::ContentsWriter(string const &DB) :
- Db(DB), Stats(Db.Stats)
+ContentsWriter::ContentsWriter(string const &DB, string const &Arch) :
+ FTWScanner(Arch), Db(DB), Stats(Db.Stats)
{
- AddPattern("*.deb");
+ SetExts(".deb");
Output = stdout;
}
/*}}}*/
diff --git a/ftparchive/writer.h b/ftparchive/writer.h
index 520e91dd6..af7ba4edd 100644
--- a/ftparchive/writer.h
+++ b/ftparchive/writer.h
@@ -34,6 +34,7 @@ class FTWScanner
{
protected:
vector<string> Patterns;
+ string Arch;
const char *OriginalPath;
bool ErrorPrinted;
@@ -68,7 +69,7 @@ class FTWScanner
void AddPattern(string const &Pattern) { Patterns.push_back(Pattern); };
bool SetExts(string const &Vals);
- FTWScanner();
+ FTWScanner(string const &Arch = string());
};
class PackagesWriter : public FTWScanner
@@ -92,7 +93,6 @@ class PackagesWriter : public FTWScanner
string DirStrip;
FILE *Output;
struct CacheDB::Stats &Stats;
- string Arch;
inline bool ReadOverride(string const &File) {return Over.ReadOverride(File);};
inline bool ReadExtraOverride(string const &File)
@@ -125,7 +125,7 @@ class ContentsWriter : public FTWScanner
void Finish() {Gen.Print(Output);};
inline bool ReadyDB(string const &DB) {return Db.ReadyDB(DB);};
- ContentsWriter(string const &DB);
+ ContentsWriter(string const &DB, string const &Arch = string());
virtual ~ContentsWriter() {};
};