From 9d20d8c8eb99ff85d082956813c3d624132d5399 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 10 Dec 2009 21:48:54 +0100 Subject: merged -r 1920..1922 from lp:~donkult/apt/sid --- ftparchive/writer.cc | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'ftparchive/writer.cc') 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); -- cgit v1.2.3-70-g09d2