From 9c24493fabefe1a2549eaab81770dbe6f24916d9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 26 Nov 2009 23:46:49 +0100 Subject: Add APT::FTPArchive::LongDescription to disable the inclusion of the LongDescriptions in the generated Packages file. --- debian/changelog | 2 ++ doc/apt-ftparchive.1.xml | 13 +++++++++++-- ftparchive/writer.cc | 21 +++++++++++++++++++-- ftparchive/writer.h | 1 + 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 07d9c0303..7315dc571 100644 --- a/debian/changelog +++ b/debian/changelog @@ -72,6 +72,8 @@ apt (0.7.25) UNRELEASED; urgency=low - add config setting for User-Agent to the Acquire group, thanks Timothy J. Miller! (Closes: #355782) - add https options which default to http ones (Closes: #557085) + * ftparchive/writer.{cc,h}: + - add APT::FTPArchive::LongDescription to be able to disable them [ Chris Leick ] * doc/ various manpages: diff --git a/doc/apt-ftparchive.1.xml b/doc/apt-ftparchive.1.xml index d4d77c68e..d47df957a 100644 --- a/doc/apt-ftparchive.1.xml +++ b/doc/apt-ftparchive.1.xml @@ -15,7 +15,7 @@ &apt-email; &apt-product; - 29 February 2004 + 17 August 2009 @@ -543,7 +543,16 @@ for i in Sections do Make the caching databases read only. Configuration Item: APT::FTPArchive::ReadOnlyDB. - + + + + This configuration option defaults to "true" and should only be set to + "false" if the Archive generated with &apt-ftparchive; also provides + Translation files. Note that it is currently not possible to create these + files with apt-ftparchive. + + + &apt-commonoptions; 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; -- cgit v1.2.3