if(comprExt.empty())
{
// autoselect the compression method
- if(FileExists("/bin/bzip2"))
- CompressionExtension = ".bz2";
- else
- CompressionExtension = ".gz";
- } else {
- CompressionExtension = (comprExt == "plain" ? "" : comprExt);
+ Configuration::Item const *Opts = _config->Tree("Acquire::CompressionTypes");
+ if (Opts != 0)
+ Opts = Opts->Child;
+
+ const char dirBin[] = "Dir::Bin::";
+ for (; Opts != 0; Opts = Opts->Next)
+ {
+ if (Opts->Tag.empty() == true || Opts->Value.empty() == true)
+ continue;
+ const string bin = _config->FindFile(string(dirBin).append(Opts->Value).c_str(),"");
+ if (bin != "" && !FileExists(bin))
+ continue;
+ comprExt = '.' + Opts->Tag;
+ break;
+ }
}
+ CompressionExtension = ((comprExt == "plain" || comprExt == ".") ? "" : comprExt);
+
Desc.URI = URI + CompressionExtension;
Desc.Description = URIDesc;
/*}}}*/
void pkgAcqIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf) /*{{{*/
{
- bool descChanged = false;
- // no .bz2 found, retry with .gz
- if(Desc.URI.substr(Desc.URI.size()-3) == "bz2") {
- Desc.URI = Desc.URI.substr(0,Desc.URI.size()-3) + "gz";
-
- new pkgAcqIndex(Owner, RealURI, Desc.Description,Desc.ShortDesc,
- ExpectedHash, string(".gz"));
- descChanged = true;
- }
- // no .gz found, retry with uncompressed
- else if(Desc.URI.substr(Desc.URI.size()-2) == "gz") {
- Desc.URI = Desc.URI.substr(0,Desc.URI.size()-2);
+ Configuration::Item const *Opts = _config->Tree("Acquire::CompressionTypes");
+ if (Opts != 0)
+ Opts = Opts->Child;
+
+ const char dirBin[] = "Dir::Bin::";
+ for (; Opts != 0; Opts = Opts->Next)
+ {
+ if (Opts->Tag.empty() == true || Opts->Value.empty() == true)
+ continue;
+
+ // jump over all already checked compression types
+ const unsigned int nameLen = Desc.URI.size() - Opts->Tag.size();
+ if(Desc.URI.substr(nameLen) != Opts->Tag || Opts->Next == 0)
+ continue;
+
+ // check if we need an external binary for this compression type
+ const string bin = _config->FindFile(string(dirBin).append(Opts->Next->Value).c_str(),"");
+ if (bin != "" && !FileExists(bin))
+ continue;
+
+ // retry with the next extension
+ Desc.URI = Desc.URI.substr(0, nameLen) + Opts->Next->Tag;
+
+ new pkgAcqIndex(Owner, RealURI, Desc.Description, Desc.ShortDesc,
+ ExpectedHash, string(".").append(Opts->Next->Tag));
- new pkgAcqIndex(Owner, RealURI, Desc.Description,Desc.ShortDesc,
- ExpectedHash, string("plain"));
- descChanged = true;
- }
- if (descChanged) {
Status = StatDone;
Complete = false;
Dequeue();
Local = true;
string compExt = flExtension(flNotDir(URI(Desc.URI).Path));
- const char *decompProg;
- if(compExt == "bz2")
- decompProg = "bzip2";
- else if(compExt == "gz")
- decompProg = "gzip";
+ string decompProg;
+
+ // get the binary name for your used compression type
+ decompProg = _config->Find(string("Acquire::CompressionTypes::").append(compExt),"");
+ if(decompProg.empty() == false);
// flExtensions returns the full name if no extension is found
// this is why we have this complicated compare operation here
// FIMXE: add a new flJustExtension() that return "" if no
Decompression = true;
DestFile += ".decomp";
- Desc.URI = string(decompProg) + ":" + FileName;
+ Desc.URI = decompProg + ":" + FileName;
QueueURI(Desc);
- Mode = decompProg;
+ Mode = decompProg.c_str();
}
/*}}}*/
// AcqIndexTrans::pkgAcqIndexTrans - Constructor /*{{{*/
*
* \param compressExt The compression-related extension with which
* this index file should be downloaded, or "" to autodetect
- * (".bz2" is used if bzip2 is installed, ".gz" otherwise).
+ * Compression types can be set with config Acquire::CompressionTypes,
+ * default is ".lzma" or ".bz2" (if the needed binaries are present)
+ * fallback is ".gz" or none.
*/
pkgAcqIndex(pkgAcquire *Owner,string URI,string URIDesc,
string ShortDesc, HashString ExpectedHash, string compressExt="");
* \param URIDesc A "URI-style" description of this index file.
*
* \param ShortDesc A brief description of this index file.
- *
- * \param ExpectedHash The expected hashsum of this index file.
- *
- * \param compressExt The compression-related extension with which
- * this index file should be downloaded, or "" to autodetect
- * (".bz2" is used if bzip2 is installed, ".gz" otherwise).
*/
pkgAcqIndexTrans(pkgAcquire *Owner,string URI,string URIDesc,
string ShortDesc);
if (Res == false)
return false;
-
+
+ // we load all config files, now check the configs and setup post-defaults:
+ // * check for CompressionTypes setup
+ {
+ Configuration::Item const *Opts = _config->Tree("Acquire::CompressionTypes");
+ if (Opts != 0)
+ Opts = Opts->Child;
+ bool foundLzma=false, foundBzip2=false, foundGzip=false;
+ for (; Opts != 0; Opts = Opts->Next)
+ {
+ if (Opts->Value == "lzma") foundLzma = true;
+ else if (Opts->Value == "bz2") foundBzip2 = true;
+ else if (Opts->Value == "gz") foundGzip = true;
+ }
+ if (!foundBzip2) Cnf.Set("Acquire::CompressionTypes::bz2","bzip2");
+ if (!foundLzma) Cnf.Set("Acquire::CompressionTypes::lzma","lzma");
+ if (!foundGzip) Cnf.Set("Acquire::CompressionTypes::gz","gzip");
+ Cnf.CndSet("Dir::Bin::lzma", "/usr/bin/lzma");
+ Cnf.CndSet("Dir::Bin::bzip2", "/bin/bzip2");
+ }
+
+
+
if (Cnf.FindB("Debug::pkgInitConfig",false) == true)
Cnf.Dump();
- use sizeof instead strlen (by Marius Vollmer, Closes: #504325)
* doc/apt-mark.8.xml:
- improve manpage based on patch by Carl Chenet (Closes: #510286)
+ * apt-pkg/acquire-item.cc:
+ - use configsettings for dynamic compression type use and order.
+ Based on a patch by Jyrki Muukkonen, thanks! (LP: #71746)
+ * apt-pkg/init.cc:
+ - add default configuration for compression types and add lzma
+ support. Order is now bzip2, lzma, gzip, none (Closes: #510526)
+ * ftparchive/writer.cc:
+ - add lzma support also here, patch for this (and inspiration for
+ the one above) by Robert Millan, thanks!
[ George Danchev ]
* cmdline/apt-cache.cc:
</para></listitem>
</varlistentry>
+ <varlistentry><term>CompressionTypes</term>
+ <listitem><para>List of compression types which are understood by the acquire methods.
+ Files like <filename>Packages</filename> can be available in various compression formats.
+ This list defines in which order the acquire methods will try to download these files.
+ Per default <command>bzip2</command> compressed files will be prefered over
+ <command>lzma</command>, <command>gzip</command> and uncompressed files. The syntax for
+ the configuration fileentry (this option can't be set at runtime with the -o option) is
+ <synopsis>Acquire::CompressionTypes::<replaceable>FileExtension</replaceable> "<replaceable>Methodname</replaceable>";</synopsis>
+ e.g. <synopsis>Acquire::CompressionTypes::bz2 "bzip2";</synopsis>
+ Note that at runtime the <literal>Dir::Bin::<replaceable>Methodname</replaceable></literal> will
+ be checked: If this setting exists the method will only be used if this file exists, e.g. for
+ the bzip2 method above (the inbuilt) setting is <literallayout>Dir::Bin::bzip2 "/bin/bzip2";</literallayout>
+ </para></listitem>
+ </varlistentry>
</variablelist>
</para>
</refsect1>
<para>Binary programs are pointed to by <literal>Dir::Bin</literal>. <literal>Dir::Bin::Methods</literal>
specifies the location of the method handlers and <literal>gzip</literal>,
+ <literal>bzip2</literal>, <literal>lzma</literal>,
<literal>dpkg</literal>, <literal>apt-get</literal> <literal>dpkg-source</literal>
<literal>dpkg-buildpackage</literal> and <literal>apt-cache</literal> specify the location
of the respective programs.</para>
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");
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2009-08-09 10:20+0200\n"
+"POT-Creation-Date: 2009-08-10 23:54+0200\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"
msgid "Please insert the disc labeled: '%s' in the drive '%s' and press enter."
msgstr ""
-#: apt-pkg/init.cc:132
+#: apt-pkg/init.cc:154
#, c-format
msgid "Packaging system '%s' is not supported"
msgstr ""
-#: apt-pkg/init.cc:148
+#: apt-pkg/init.cc:170
msgid "Unable to determine a suitable packaging system type"
msgstr ""
msgid "MD5Sum mismatch"
msgstr ""
-#: apt-pkg/acquire-item.cc:644 apt-pkg/acquire-item.cc:1406
+#: apt-pkg/acquire-item.cc:663 apt-pkg/acquire-item.cc:1425
msgid "Hash Sum mismatch"
msgstr ""
-#: apt-pkg/acquire-item.cc:1101
+#: apt-pkg/acquire-item.cc:1120
msgid "There is no public key available for the following key IDs:\n"
msgstr ""
-#: apt-pkg/acquire-item.cc:1211
+#: apt-pkg/acquire-item.cc:1230
#, c-format
msgid ""
"I wasn't able to locate a file for the %s package. This might mean you need "
"to manually fix this package. (due to missing arch)"
msgstr ""
-#: apt-pkg/acquire-item.cc:1270
+#: apt-pkg/acquire-item.cc:1289
#, c-format
msgid ""
"I wasn't able to locate file for the %s package. This might mean you need to "
"manually fix this package."
msgstr ""
-#: apt-pkg/acquire-item.cc:1311
+#: apt-pkg/acquire-item.cc:1330
#, c-format
msgid ""
"The package index files are corrupted. No Filename: field for package %s."
msgstr ""
-#: apt-pkg/acquire-item.cc:1398
+#: apt-pkg/acquire-item.cc:1417
msgid "Size mismatch"
msgstr ""