summaryrefslogtreecommitdiff
path: root/ftparchive/writer.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-01-26 15:51:45 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2010-01-26 15:51:45 +0100
commit51f9f4d78deabf54dbbb6881139d2b1a319ffbfc (patch)
tree60a2bcd8911acd5c4ab8b4558bfd30344b673ff5 /ftparchive/writer.cc
parent76fe5db7153957f8fda437e3bd614312b076f19e (diff)
parentc1f168f54be5b4babeb9b91cd7145441ea2489ad (diff)
merge from the mvo branch
Diffstat (limited to 'ftparchive/writer.cc')
-rw-r--r--ftparchive/writer.cc25
1 files changed, 22 insertions, 3 deletions
diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc
index 9d248ab86..4e6c9a77d 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);
@@ -446,7 +463,7 @@ bool PackagesWriter::DoPackage(string FileName)
SetTFRewriteData(Changes[End++], "Maintainer", NewMaint.c_str());
/* Get rid of the Optional tag. This is an ugly, ugly, ugly hack that
- dpkg-scanpackages does.. Well sort of. dpkg-scanpackages just does renaming
+ dpkg-scanpackages does. Well sort of. dpkg-scanpackages just does renaming
but dpkg does this append bit. So we do the append bit, at least that way the
status file and package file will remain similar. There are other transforms
but optional is the only legacy one still in use for some lazy reason. */
@@ -815,9 +832,11 @@ ReleaseWriter::ReleaseWriter(string DB)
AddPattern("Packages");
AddPattern("Packages.gz");
AddPattern("Packages.bz2");
+ AddPattern("Packages.lzma");
AddPattern("Sources");
AddPattern("Sources.gz");
AddPattern("Sources.bz2");
+ AddPattern("Sources.lzma");
AddPattern("Release");
AddPattern("md5sum.txt");