Browse Source

add APT::FTPArchive::AlwaysStat to disable the too aggressive

caching if versions are build multiply times (not recommend)
Patch by Christoph Goehre, thanks! (Closes: #463260)
debian/1.8.y
David Kalnischkies 14 years ago
parent
commit
ff574e76be
  1. 3
      debian/changelog
  2. 12
      doc/apt-ftparchive.1.xml
  3. 39
      doc/po/apt-doc.pot
  4. 14
      ftparchive/cachedb.cc
  5. 4
      ftparchive/cachedb.h
  6. 5
      ftparchive/writer.cc
  7. 1
      ftparchive/writer.h
  8. 24
      po/apt-all.pot

3
debian/changelog

@ -80,6 +80,9 @@ apt (0.7.25) UNRELEASED; urgency=low
- add https options which default to http ones (Closes: #557085)
* ftparchive/writer.{cc,h}:
- add APT::FTPArchive::LongDescription to be able to disable them
- add APT::FTPArchive::AlwaysStat to disable the too aggressive
caching if versions are build multiply times (not recommend)
Patch by Christoph Goehre, thanks! (Closes: #463260)
* apt-pkg/deb/debsrcrecords.cc:
- use "diff" filetype for .debian.tar.* files (Closes: #554898)

12
doc/apt-ftparchive.1.xml

@ -544,6 +544,18 @@ for i in Sections do
Configuration Item: <literal>APT::FTPArchive::ReadOnlyDB</literal>.</para></listitem>
</varlistentry>
<varlistentry><term><option>APT::FTPArchive::AlwaysStat</option></term>
<listitem><para>
&apt-ftparchive; caches as much as possible of metadata in it is cachedb. If packages
are recompiled and/or republished with the same version again, this will lead to problems
as the now outdated cached metadata like size and checksums will be used. With this option
enabled this will no longer happen as it will be checked if the file was changed.
Note that this option is set to "<literal>false</literal>" by default as it is not recommend
to upload multiply versions/builds of a package with the same versionnumber, so in theory
nobody will have these problems and therefore all these extra checks are useless.
</para></listitem>
</varlistentry>
<varlistentry><term><option>APT::FTPArchive::LongDescription</option></term>
<listitem><para>
This configuration option defaults to "<literal>true</literal>" and should only be set to

39
doc/po/apt-doc.pot

@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2009-11-27 00:18+0100\n"
"POT-Creation-Date: 2009-11-28 02:08+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -1411,7 +1411,7 @@ msgid ""
msgstr ""
#. type: Content of: <refentry><refsect1><variablelist>
#: apt-cache.8.xml:356 apt-cdrom.8.xml:150 apt-config.8.xml:98 apt-extracttemplates.1.xml:67 apt-ftparchive.1.xml:556 apt-get.8.xml:554 apt-sortpkgs.1.xml:64
#: apt-cache.8.xml:356 apt-cdrom.8.xml:150 apt-config.8.xml:98 apt-extracttemplates.1.xml:67 apt-ftparchive.1.xml:568 apt-get.8.xml:554 apt-sortpkgs.1.xml:64
msgid "&apt-commonoptions;"
msgstr ""
@ -1426,7 +1426,7 @@ msgid "&file-sourceslist; &file-statelists;"
msgstr ""
#. type: Content of: <refentry><refsect1><title>
#: apt-cache.8.xml:368 apt-cdrom.8.xml:155 apt-config.8.xml:103 apt-extracttemplates.1.xml:74 apt-ftparchive.1.xml:572 apt-get.8.xml:569 apt-key.8.xml:162 apt-mark.8.xml:133 apt-secure.8.xml:181 apt-sortpkgs.1.xml:69 apt.conf.5.xml:1023 apt_preferences.5.xml:622 sources.list.5.xml:233
#: apt-cache.8.xml:368 apt-cdrom.8.xml:155 apt-config.8.xml:103 apt-extracttemplates.1.xml:74 apt-ftparchive.1.xml:584 apt-get.8.xml:569 apt-key.8.xml:162 apt-mark.8.xml:133 apt-secure.8.xml:181 apt-sortpkgs.1.xml:69 apt.conf.5.xml:1023 apt_preferences.5.xml:622 sources.list.5.xml:233
msgid "See Also"
msgstr ""
@ -1436,7 +1436,7 @@ msgid "&apt-conf;, &sources-list;, &apt-get;"
msgstr ""
#. type: Content of: <refentry><refsect1><title>
#: apt-cache.8.xml:373 apt-cdrom.8.xml:160 apt-config.8.xml:108 apt-extracttemplates.1.xml:78 apt-ftparchive.1.xml:576 apt-get.8.xml:575 apt-mark.8.xml:137 apt-sortpkgs.1.xml:73
#: apt-cache.8.xml:373 apt-cdrom.8.xml:160 apt-config.8.xml:108 apt-extracttemplates.1.xml:78 apt-ftparchive.1.xml:588 apt-get.8.xml:575 apt-mark.8.xml:137 apt-sortpkgs.1.xml:73
msgid "Diagnostics"
msgstr ""
@ -1735,7 +1735,7 @@ msgid "Just show the contents of the configuration space."
msgstr ""
#. type: Content of: <refentry><refsect1><para>
#: apt-config.8.xml:104 apt-extracttemplates.1.xml:75 apt-ftparchive.1.xml:573 apt-sortpkgs.1.xml:70
#: apt-config.8.xml:104 apt-extracttemplates.1.xml:75 apt-ftparchive.1.xml:585 apt-sortpkgs.1.xml:70
msgid "&apt-conf;"
msgstr ""
@ -2690,12 +2690,31 @@ msgstr ""
#. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
#: apt-ftparchive.1.xml:547
msgid "<option>APT::FTPArchive::LongDescription</option>"
msgid "<option>APT::FTPArchive::AlwaysStat</option>"
msgstr ""
#. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
#: apt-ftparchive.1.xml:549
msgid ""
"&apt-ftparchive; caches as much as possible of metadata in it is cachedb. If "
"packages are recompiled and/or republished with the same version again, this "
"will lead to problems as the now outdated cached metadata like size and "
"checksums will be used. With this option enabled this will no longer happen "
"as it will be checked if the file was changed. Note that this option is set "
"to \"<literal>false</literal>\" by default as it is not recommend to upload "
"multiply versions/builds of a package with the same versionnumber, so in "
"theory nobody will have these problems and therefore all these extra checks "
"are useless."
msgstr ""
#. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
#: apt-ftparchive.1.xml:559
msgid "<option>APT::FTPArchive::LongDescription</option>"
msgstr ""
#. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
#: apt-ftparchive.1.xml:561
msgid ""
"This configuration option defaults to \"<literal>true</literal>\" and should "
"only be set to <literal>\"false\"</literal> if the Archive generated with "
"&apt-ftparchive; also provides <filename>Translation</filename> files. Note "
@ -2704,12 +2723,12 @@ msgid ""
msgstr ""
#. type: Content of: <refentry><refsect1><title>
#: apt-ftparchive.1.xml:561 apt.conf.5.xml:1011 apt_preferences.5.xml:462 sources.list.5.xml:193
#: apt-ftparchive.1.xml:573 apt.conf.5.xml:1011 apt_preferences.5.xml:462 sources.list.5.xml:193
msgid "Examples"
msgstr ""
#. type: Content of: <refentry><refsect1><para><programlisting>
#: apt-ftparchive.1.xml:567
#: apt-ftparchive.1.xml:579
#, no-wrap
msgid ""
"<command>apt-ftparchive</command> packages "
@ -2718,14 +2737,14 @@ msgid ""
msgstr ""
#. type: Content of: <refentry><refsect1><para>
#: apt-ftparchive.1.xml:563
#: apt-ftparchive.1.xml:575
msgid ""
"To create a compressed Packages file for a directory containing binary "
"packages (.deb): <placeholder type=\"programlisting\" id=\"0\"/>"
msgstr ""
#. type: Content of: <refentry><refsect1><para>
#: apt-ftparchive.1.xml:577
#: apt-ftparchive.1.xml:589
msgid ""
"<command>apt-ftparchive</command> returns zero on normal operation, decimal "
"100 on error."

14
ftparchive/cachedb.cc

@ -102,9 +102,9 @@ bool CacheDB::OpenFile()
// ---------------------------------------------------------------------
/* This gets the size from the database if it's there. If we need
* to look at the file, also get the mtime from the file. */
bool CacheDB::GetFileStat()
bool CacheDB::GetFileStat(bool const &doStat)
{
if ((CurStat.Flags & FlSize) == FlSize)
if ((CurStat.Flags & FlSize) == FlSize && doStat == false)
{
/* Already worked out the file size */
}
@ -162,7 +162,7 @@ bool CacheDB::GetCurStat()
// ---------------------------------------------------------------------
bool CacheDB::GetFileInfo(string FileName, bool DoControl, bool DoContents,
bool GenContentsOnly,
bool DoMD5, bool DoSHA1, bool DoSHA256)
bool DoMD5, bool DoSHA1, bool DoSHA256, bool const &checkMtime)
{
this->FileName = FileName;
@ -171,14 +171,18 @@ bool CacheDB::GetFileInfo(string FileName, bool DoControl, bool DoContents,
return false;
}
OldStat = CurStat;
if (GetFileStat() == false)
if (GetFileStat(checkMtime) == false)
{
delete Fd;
Fd = NULL;
return false;
}
/* if mtime changed, update CurStat from disk */
if (checkMtime == true && OldStat.mtime != CurStat.mtime)
CurStat.Flags = FlSize;
Stats.Bytes += CurStat.FileSize;
Stats.Packages++;

4
ftparchive/cachedb.h

@ -63,7 +63,7 @@ class CacheDB
return true;
}
bool OpenFile();
bool GetFileStat();
bool GetFileStat(bool const &doStat = false);
bool GetCurStat();
bool LoadControl();
bool LoadContents(bool GenOnly);
@ -125,7 +125,7 @@ class CacheDB
bool SetFile(string FileName,struct stat St,FileFd *Fd);
bool GetFileInfo(string FileName, bool DoControl, bool DoContents,
bool GenContentsOnly, bool DoMD5, bool DoSHA1, bool DoSHA256);
bool GenContentsOnly, bool DoMD5, bool DoSHA1, bool DoSHA256, bool const &checkMtime = false);
bool Finish();
bool Clean();

5
ftparchive/writer.cc

@ -306,6 +306,7 @@ PackagesWriter::PackagesWriter(string DB,string Overrides,string ExtOverrides,
DoMD5 = _config->FindB("APT::FTPArchive::MD5",true);
DoSHA1 = _config->FindB("APT::FTPArchive::SHA1",true);
DoSHA256 = _config->FindB("APT::FTPArchive::SHA256",true);
DoAlwaysStat = _config->FindB("APT::FTPArchive::AlwaysStat", false);
DoContents = _config->FindB("APT::FTPArchive::Contents",true);
NoOverride = _config->FindB("APT::FTPArchive::NoOverrideMsg",false);
LongDescription = _config->FindB("APT::FTPArchive::LongDescription",true);
@ -360,7 +361,7 @@ bool FTWScanner::SetExts(string Vals)
bool PackagesWriter::DoPackage(string FileName)
{
// Pull all the data we need form the DB
if (Db.GetFileInfo(FileName, true, DoContents, true, DoMD5, DoSHA1, DoSHA256)
if (Db.GetFileInfo(FileName, true, DoContents, true, DoMD5, DoSHA1, DoSHA256, DoAlwaysStat)
== false)
{
return false;
@ -753,7 +754,7 @@ ContentsWriter::ContentsWriter(string DB) :
determine what the package name is. */
bool ContentsWriter::DoPackage(string FileName,string Package)
{
if (!Db.GetFileInfo(FileName, Package.empty(), true, false, false, false, false))
if (!Db.GetFileInfo(FileName, Package.empty(), true, false, false, false, false, false))
{
return false;
}

1
ftparchive/writer.h

@ -84,6 +84,7 @@ class PackagesWriter : public FTWScanner
bool DoMD5;
bool DoSHA1;
bool DoSHA256;
bool DoAlwaysStat;
bool NoOverride;
bool DoContents;
bool LongDescription;

24
po/apt-all.pot

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-11-27 09:49+0100\n"
"POT-Creation-Date: 2009-11-28 02:10+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -357,11 +357,11 @@ msgstr ""
msgid "Failed to stat %s"
msgstr ""
#: ftparchive/cachedb.cc:238
#: ftparchive/cachedb.cc:242
msgid "Archive has no control record"
msgstr ""
#: ftparchive/cachedb.cc:444
#: ftparchive/cachedb.cc:448
msgid "Unable to get a cursor"
msgstr ""
@ -426,26 +426,26 @@ msgstr ""
msgid " DeLink limit of %sB hit.\n"
msgstr ""
#: ftparchive/writer.cc:388
#: ftparchive/writer.cc:389
msgid "Archive had no package field"
msgstr ""
#: ftparchive/writer.cc:396 ftparchive/writer.cc:627
#: ftparchive/writer.cc:397 ftparchive/writer.cc:628
#, c-format
msgid " %s has no override entry\n"
msgstr ""
#: ftparchive/writer.cc:457 ftparchive/writer.cc:715
#: ftparchive/writer.cc:458 ftparchive/writer.cc:716
#, c-format
msgid " %s maintainer is %s not %s\n"
msgstr ""
#: ftparchive/writer.cc:637
#: ftparchive/writer.cc:638
#, c-format
msgid " %s has no source override entry\n"
msgstr ""
#: ftparchive/writer.cc:641
#: ftparchive/writer.cc:642
#, c-format
msgid " %s has no binary override entry either\n"
msgstr ""
@ -1764,22 +1764,22 @@ msgstr ""
msgid "Connecting to %s"
msgstr ""
#: methods/connect.cc:165 methods/connect.cc:184
#: methods/connect.cc:166 methods/connect.cc:185
#, c-format
msgid "Could not resolve '%s'"
msgstr ""
#: methods/connect.cc:190
#: methods/connect.cc:191
#, c-format
msgid "Temporary failure resolving '%s'"
msgstr ""
#: methods/connect.cc:193
#: methods/connect.cc:194
#, c-format
msgid "Something wicked happened resolving '%s:%s' (%i - %s)"
msgstr ""
#: methods/connect.cc:240
#: methods/connect.cc:241
#, c-format
msgid "Unable to connect to %s:%s:"
msgstr ""

Loading…
Cancel
Save