diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2009-12-10 22:20:07 +0100 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2009-12-10 22:20:07 +0100 |
commit | 43be0ac4b37f3a82ae4a16e473c3d8e44637ce1b (patch) | |
tree | 7c0e75b291d132b6f1577fc2267f8ea0a60df459 /ftparchive | |
parent | 9307ef07498d37c0b5e05b036195abaf7ad0105c (diff) | |
parent | a0895a74fe95997a5d75e5b54c95afb9594554f6 (diff) |
merged from the mvo branch (and contains all non-abi break changes from donkult)
Diffstat (limited to 'ftparchive')
-rw-r--r-- | ftparchive/cachedb.cc | 10 | ||||
-rw-r--r-- | ftparchive/writer.cc | 21 | ||||
-rw-r--r-- | ftparchive/writer.h | 1 |
3 files changed, 25 insertions, 7 deletions
diff --git a/ftparchive/cachedb.cc b/ftparchive/cachedb.cc index ff9a92d32..dfda827b6 100644 --- a/ftparchive/cachedb.cc +++ b/ftparchive/cachedb.cc @@ -182,11 +182,11 @@ bool CacheDB::GetFileInfo(string FileName, bool DoControl, bool DoContents, Stats.Bytes += CurStat.FileSize; Stats.Packages++; - if (DoControl && LoadControl() == false - || DoContents && LoadContents(GenContentsOnly) == false - || DoMD5 && GetMD5(false) == false - || DoSHA1 && GetSHA1(false) == false - || DoSHA256 && GetSHA256(false) == false) + if ((DoControl && LoadControl() == false) + || (DoContents && LoadContents(GenContentsOnly) == false) + || (DoMD5 && GetMD5(false) == false) + || (DoSHA1 && GetSHA1(false) == false) + || (DoSHA256 && GetSHA256(false) == false)) { delete Fd; Fd = NULL; diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc index 293e851f5..b2ebdca8a 100644 --- a/ftparchive/writer.cc +++ b/ftparchive/writer.cc @@ -308,6 +308,7 @@ PackagesWriter::PackagesWriter(string DB,string Overrides,string ExtOverrides, DoSHA256 = _config->FindB("APT::FTPArchive::SHA256",true); DoContents = _config->FindB("APT::FTPArchive::Contents",true); NoOverride = _config->FindB("APT::FTPArchive::NoOverrideMsg",false); + LongDescription = _config->FindB("APT::FTPArchive::LongDescription",true); if (Db.Loaded() == false) DoContents = false; @@ -414,10 +415,18 @@ bool PackagesWriter::DoPackage(string FileName) NewFileName = FileName; if (PathPrefix.empty() == false) NewFileName = flCombine(PathPrefix,NewFileName); - + + /* Configuration says we don't want to include the long Description + in the package file - instead we want to ship a separated file */ + string desc; + if (LongDescription == false) { + desc = Tags.FindS("Description").append("\n"); + OverItem->FieldOverride["Description"] = desc.substr(0, desc.find('\n')).c_str(); + } + // This lists all the changes to the fields we are going to make. // (7 hardcoded + maintainer + suggests + end marker) - TFRewriteData Changes[6+2+OverItem->FieldOverride.size()+1]; + TFRewriteData Changes[6+2+OverItem->FieldOverride.size()+1+1]; unsigned int End = 0; SetTFRewriteData(Changes[End++], "Size", Size); @@ -429,6 +438,14 @@ bool PackagesWriter::DoPackage(string FileName) SetTFRewriteData(Changes[End++], "Status", 0); SetTFRewriteData(Changes[End++], "Optional", 0); + string DescriptionMd5; + if (LongDescription == false) { + MD5Summation descmd5; + descmd5.Add(desc.c_str()); + DescriptionMd5 = descmd5.Result().Value(); + SetTFRewriteData(Changes[End++], "Description-md5", DescriptionMd5.c_str()); + } + // Rewrite the maintainer field if necessary bool MaintFailed; string NewMaint = OverItem->SwapMaint(Tags.FindS("Maintainer"),MaintFailed); diff --git a/ftparchive/writer.h b/ftparchive/writer.h index 6e161c752..e76438900 100644 --- a/ftparchive/writer.h +++ b/ftparchive/writer.h @@ -86,6 +86,7 @@ class PackagesWriter : public FTWScanner bool DoSHA256; bool NoOverride; bool DoContents; + bool LongDescription; // General options string PathPrefix; |