From c6474fb6ff482b0457674986a82afab0a3749af2 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 1 Dec 2009 00:28:26 +0100 Subject: fix a few typos in strings, comments and manpage of apt-ftparchive thanks Karl Goetz! (Closes: #558757) --- ftparchive/apt-ftparchive.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ftparchive/apt-ftparchive.cc') diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc index d0dea7768..5b6b3940c 100644 --- a/ftparchive/apt-ftparchive.cc +++ b/ftparchive/apt-ftparchive.cc @@ -3,7 +3,7 @@ // $Id: apt-ftparchive.cc,v 1.8.2.3 2004/01/02 22:01:48 mdz Exp $ /* ###################################################################### - apt-scanpackages - Efficient work-alike for dpkg-scanpackages + apt-ftparchive - Efficient work-alike for dpkg-scanpackages Let contents be disabled from the conf @@ -792,7 +792,7 @@ bool Generate(CommandLine &CmdL) if (_config->FindB("APT::FTPArchive::Contents",true) == false) return true; - c1out << "Done Packages, Starting contents." << endl; + c1out << "Packages done, Starting contents." << endl; // Sort the contents file list by date string ArchiveDir = Setup.FindDir("Dir::ArchiveDir"); -- cgit v1.2.3 From 319810767180e5c57c296b06c93e3ebec9f36a8e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 18 Feb 2010 00:05:14 +0100 Subject: - add --arch option for apt-ftparchive packages and contents commands - if an arch is given accept only *_all.deb and *_arch.deb instead of *.deb. Thanks Stephan Bosch for the patch! (Closes: #319710) --- ftparchive/apt-ftparchive.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ftparchive/apt-ftparchive.cc') 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}}; -- cgit v1.2.3 From 66905344357d03c206d99964a0d941b261f7146c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 22 Mar 2010 18:25:37 +0100 Subject: * ftparchive/writer.cc: - write LongDescriptions if they shouldn't be included in Packages file into i18n/Translation-en by default. It is ensured that each package+description is listed only ones in the Translation file even if we generate multiple Packages file in one run. The file is only generated in "generate" - the simple file commands can't create it by now. Also, the LongDescription is currently a global setting, so generating archives with and without LongDescriptions in the Packages file in the same run are currently not possible. --- ftparchive/apt-ftparchive.cc | 47 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 8 deletions(-) (limited to 'ftparchive/apt-ftparchive.cc') diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc index f1a182e52..e69c88ddd 100644 --- a/ftparchive/apt-ftparchive.cc +++ b/ftparchive/apt-ftparchive.cc @@ -62,6 +62,9 @@ struct PackageMap string SrcOverride; string SrcExtraOverride; + // Translation master file + TranslationWriter *TransWriter; + // Contents string Contents; string ContentsHead; @@ -100,8 +103,9 @@ struct PackageMap vector::iterator End, unsigned long &Left); - PackageMap() : DeLinkLimit(0), Permissions(1), ContentsDone(false), - PkgDone(false), SrcDone(false), ContentsMTime(0) {}; + PackageMap() : TransWriter(NULL), DeLinkLimit(0), Permissions(1), + ContentsDone(false), PkgDone(false), SrcDone(false), + ContentsMTime(0) {}; }; /*}}}*/ @@ -169,6 +173,8 @@ bool PackageMap::GenPackages(Configuration &Setup,struct CacheDB::Stats &Stats) Packages.DirStrip = ArchiveDir; Packages.InternalPrefix = flCombine(ArchiveDir,InternalPrefix); + Packages.TransWriter = TransWriter; + Packages.Stats.DeLinkBytes = Stats.DeLinkBytes; Packages.DeLinkLimit = DeLinkLimit; @@ -436,6 +442,8 @@ void LoadTree(vector &PkgList,Configuration &Setup) "$(DIST)/$(SECTION)/source/"); string DPkg = Setup.Find("TreeDefault::Packages", "$(DIST)/$(SECTION)/binary-$(ARCH)/Packages"); + string DTrans = Setup.Find("TreeDefault::Translation", + "$(DIST)/$(SECTION)/i18n/Translation-en"); string DIPrfx = Setup.Find("TreeDefault::InternalPrefix", "$(DIST)/$(SECTION)/"); string DContents = Setup.Find("TreeDefault::Contents", @@ -461,15 +469,25 @@ void LoadTree(vector &PkgList,Configuration &Setup) string Section; while (ParseQuoteWord(Sections,Section) == true) { - string Tmp2 = Block.Find("Architectures"); string Arch; + struct SubstVar const Vars[] = {{"$(DIST)",&Dist}, + {"$(SECTION)",&Section}, + {"$(ARCH)",&Arch}, + {}}; + TranslationWriter *TransWriter; + if (DTrans.empty() == false) + { + string const TranslationFile = flCombine(Setup.FindDir("Dir::ArchiveDir"), + SubstVar(Block.Find("Translation", DTrans.c_str()), Vars)); + TransWriter = new TranslationWriter(TranslationFile); + } + else + TransWriter = NULL; + + string const Tmp2 = Block.Find("Architectures"); const char *Archs = Tmp2.c_str(); while (ParseQuoteWord(Archs,Arch) == true) { - struct SubstVar Vars[] = {{"$(DIST)",&Dist}, - {"$(SECTION)",&Section}, - {"$(ARCH)",&Arch}, - {}}; PackageMap Itm; Itm.BinOverride = SubstVar(Block.Find("BinOverride"),Vars); @@ -491,6 +509,11 @@ void LoadTree(vector &PkgList,Configuration &Setup) Itm.PkgFile = SubstVar(Block.Find("Packages",DPkg.c_str()),Vars); Itm.Tag = SubstVar("$(DIST)/$(SECTION)/$(ARCH)",Vars); Itm.Arch = Arch; + if (TransWriter != NULL) + { + TransWriter->IncreaseRefCounter(); + Itm.TransWriter = TransWriter; + } Itm.Contents = SubstVar(Block.Find("Contents",DContents.c_str()),Vars); Itm.ContentsHead = SubstVar(Block.Find("Contents::Header",DContentsH.c_str()),Vars); Itm.FLFile = SubstVar(Block.Find("FileList",DFLFile.c_str()),Vars); @@ -500,6 +523,9 @@ void LoadTree(vector &PkgList,Configuration &Setup) Itm.GetGeneral(Setup,Block); PkgList.push_back(Itm); } + // we didn't use this TransWriter, so we can release it + if (TransWriter != NULL && TransWriter->GetRefCounter() == 0) + delete TransWriter; } Top = Top->Next; @@ -788,7 +814,12 @@ bool Generate(CommandLine &CmdL) delete [] List; } - + + // close the Translation master files + for (vector::iterator I = PkgList.begin(); I != PkgList.end(); I++) + if (I->TransWriter != NULL && I->TransWriter->DecreaseRefCounter() == 0) + delete I->TransWriter; + if (_config->FindB("APT::FTPArchive::Contents",true) == false) return true; -- cgit v1.2.3 From b34d4b4745e4f7ead090a03e5efe35bd2e2e82b5 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 26 Mar 2010 15:35:36 +0100 Subject: * ftparchive/apt-ftparchive.cc: - Read default configuration (Closes: #383257) --- ftparchive/apt-ftparchive.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ftparchive/apt-ftparchive.cc') diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc index f1a182e52..5456dd474 100644 --- a/ftparchive/apt-ftparchive.cc +++ b/ftparchive/apt-ftparchive.cc @@ -925,7 +925,7 @@ int main(int argc, const char *argv[]) // Parse the command line and initialize the package library CommandLine CmdL(Args,_config); - if (CmdL.Parse(argc,argv) == false) + if (pkgInitConfig(*_config) == false || CmdL.Parse(argc,argv) == false) { _error->DumpErrors(); return 100; -- cgit v1.2.3 From 3b1fffc35f3eb277d92f38c687c270edd1d8550d Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 26 Mar 2010 16:37:16 +0100 Subject: ftparchive/apt-ftparchive.cc: Include apt-pkg/init.h. --- ftparchive/apt-ftparchive.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'ftparchive/apt-ftparchive.cc') diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc index 5456dd474..4c26f79b8 100644 --- a/ftparchive/apt-ftparchive.cc +++ b/ftparchive/apt-ftparchive.cc @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include -- cgit v1.2.3 From 4e794c509becfd7e2bddfddc1205dc81397a48bd Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 26 Mar 2010 19:18:21 +0100 Subject: Inclusion of Long Descriptions in the Packages files can be set now also in TreeDefaults and Tree to support generation of archives which should support and which shouldn't support splitted out Translation-en files in the same run. --- ftparchive/apt-ftparchive.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'ftparchive/apt-ftparchive.cc') diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc index e69c88ddd..f3e91d90d 100644 --- a/ftparchive/apt-ftparchive.cc +++ b/ftparchive/apt-ftparchive.cc @@ -63,6 +63,7 @@ struct PackageMap string SrcExtraOverride; // Translation master file + bool LongDesc; TranslationWriter *TransWriter; // Contents @@ -103,7 +104,7 @@ struct PackageMap vector::iterator End, unsigned long &Left); - PackageMap() : TransWriter(NULL), DeLinkLimit(0), Permissions(1), + PackageMap() : LongDesc(true), TransWriter(NULL), DeLinkLimit(0), Permissions(1), ContentsDone(false), PkgDone(false), SrcDone(false), ContentsMTime(0) {}; }; @@ -174,6 +175,7 @@ bool PackageMap::GenPackages(Configuration &Setup,struct CacheDB::Stats &Stats) Packages.InternalPrefix = flCombine(ArchiveDir,InternalPrefix); Packages.TransWriter = TransWriter; + Packages.LongDescription = LongDesc; Packages.Stats.DeLinkBytes = Stats.DeLinkBytes; Packages.DeLinkLimit = DeLinkLimit; @@ -456,6 +458,9 @@ void LoadTree(vector &PkgList,Configuration &Setup) string DFLFile = Setup.Find("TreeDefault::FileList", ""); string DSFLFile = Setup.Find("TreeDefault::SourceFileList", ""); + bool const LongDescription = Setup.FindB("TreeDefault::LongDescription", + _config->FindB("APT::FTPArchive::LongDescription", true)); + // Process 'tree' type sections const Configuration::Item *Top = Setup.Tree("tree"); for (Top = (Top == 0?0:Top->Child); Top != 0;) @@ -474,8 +479,9 @@ void LoadTree(vector &PkgList,Configuration &Setup) {"$(SECTION)",&Section}, {"$(ARCH)",&Arch}, {}}; + bool const LongDesc = Block.FindB("LongDescription", LongDescription); TranslationWriter *TransWriter; - if (DTrans.empty() == false) + if (DTrans.empty() == false && LongDesc == false) { string const TranslationFile = flCombine(Setup.FindDir("Dir::ArchiveDir"), SubstVar(Block.Find("Translation", DTrans.c_str()), Vars)); @@ -509,6 +515,7 @@ void LoadTree(vector &PkgList,Configuration &Setup) Itm.PkgFile = SubstVar(Block.Find("Packages",DPkg.c_str()),Vars); Itm.Tag = SubstVar("$(DIST)/$(SECTION)/$(ARCH)",Vars); Itm.Arch = Arch; + Itm.LongDesc = LongDesc; if (TransWriter != NULL) { TransWriter->IncreaseRefCounter(); -- cgit v1.2.3 From 34f1d96cf5657b5e34cd9880dccfa2028fa16b13 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 26 Mar 2010 22:38:50 +0100 Subject: Switch the TranslationWriter to use MultiCompress to be able to generate the compressed files as we want them and to prevent the file to be replaced without a reason which could save us from steady redownloads of a file with the same content. --- ftparchive/apt-ftparchive.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'ftparchive/apt-ftparchive.cc') diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc index f3e91d90d..46831b385 100644 --- a/ftparchive/apt-ftparchive.cc +++ b/ftparchive/apt-ftparchive.cc @@ -134,8 +134,6 @@ void PackageMap::GetGeneral(Configuration &Setup,Configuration &Block) PkgExt = Block.Find("Packages::Extensions", Setup.Find("Default::Packages::Extensions",".deb").c_str()); - Permissions = Setup.FindI("Default::FileMode",0644); - if (FLFile.empty() == false) FLFile = flCombine(Setup.Find("Dir::FileListDir"),FLFile); @@ -458,8 +456,11 @@ void LoadTree(vector &PkgList,Configuration &Setup) string DFLFile = Setup.Find("TreeDefault::FileList", ""); string DSFLFile = Setup.Find("TreeDefault::SourceFileList", ""); - bool const LongDescription = Setup.FindB("TreeDefault::LongDescription", + int const Permissions = Setup.FindI("Default::FileMode",0644); + + bool const LongDescription = Setup.FindB("Default::LongDescription", _config->FindB("APT::FTPArchive::LongDescription", true)); + string const TranslationCompress = Setup.Find("Default::Translation::Compress",". gzip").c_str(); // Process 'tree' type sections const Configuration::Item *Top = Setup.Tree("tree"); @@ -479,13 +480,15 @@ void LoadTree(vector &PkgList,Configuration &Setup) {"$(SECTION)",&Section}, {"$(ARCH)",&Arch}, {}}; + mode_t const Perms = Block.FindI("FileMode", Permissions); bool const LongDesc = Block.FindB("LongDescription", LongDescription); TranslationWriter *TransWriter; if (DTrans.empty() == false && LongDesc == false) { string const TranslationFile = flCombine(Setup.FindDir("Dir::ArchiveDir"), SubstVar(Block.Find("Translation", DTrans.c_str()), Vars)); - TransWriter = new TranslationWriter(TranslationFile); + string const TransCompress = Block.Find("Translation::Compress", TranslationCompress); + TransWriter = new TranslationWriter(TranslationFile, TransCompress, Perms); } else TransWriter = NULL; @@ -495,7 +498,7 @@ void LoadTree(vector &PkgList,Configuration &Setup) while (ParseQuoteWord(Archs,Arch) == true) { PackageMap Itm; - + Itm.Permissions = Perms; Itm.BinOverride = SubstVar(Block.Find("BinOverride"),Vars); Itm.InternalPrefix = SubstVar(Block.Find("InternalPrefix",DIPrfx.c_str()),Vars); -- cgit v1.2.3