aptconfiguration.cc 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. /* ######################################################################
  4. Provide access methods to various configuration settings,
  5. setup defaults and returns validate settings.
  6. ##################################################################### */
  7. /*}}}*/
  8. // Include Files /*{{{*/
  9. #include <config.h>
  10. #include <apt-pkg/aptconfiguration.h>
  11. #include <apt-pkg/configuration.h>
  12. #include <apt-pkg/error.h>
  13. #include <apt-pkg/fileutl.h>
  14. #include <apt-pkg/macros.h>
  15. #include <apt-pkg/strutl.h>
  16. #include <sys/types.h>
  17. #include <dirent.h>
  18. #include <stdio.h>
  19. #include <fcntl.h>
  20. #include <algorithm>
  21. #include <string>
  22. #include <vector>
  23. /*}}}*/
  24. namespace APT {
  25. // getCompressionTypes - Return Vector of usable compressiontypes /*{{{*/
  26. // ---------------------------------------------------------------------
  27. /* return a vector of compression types in the preferred order. */
  28. std::vector<std::string>
  29. const Configuration::getCompressionTypes(bool const &Cached) {
  30. static std::vector<std::string> types;
  31. if (types.empty() == false) {
  32. if (Cached == true)
  33. return types;
  34. else
  35. types.clear();
  36. }
  37. // setup the defaults for the compressiontypes => method mapping
  38. _config->CndSet("Acquire::CompressionTypes::bz2","bzip2");
  39. _config->CndSet("Acquire::CompressionTypes::xz","xz");
  40. _config->CndSet("Acquire::CompressionTypes::lzma","lzma");
  41. _config->CndSet("Acquire::CompressionTypes::gz","gzip");
  42. setDefaultConfigurationForCompressors();
  43. std::vector<APT::Configuration::Compressor> const compressors = getCompressors();
  44. // accept non-list order as override setting for config settings on commandline
  45. std::string const overrideOrder = _config->Find("Acquire::CompressionTypes::Order","");
  46. if (overrideOrder.empty() == false)
  47. types.push_back(overrideOrder);
  48. // load the order setting into our vector
  49. std::vector<std::string> const order = _config->FindVector("Acquire::CompressionTypes::Order");
  50. for (std::vector<std::string>::const_iterator o = order.begin();
  51. o != order.end(); ++o) {
  52. if ((*o).empty() == true)
  53. continue;
  54. // ignore types we have no method ready to use
  55. std::string const method = std::string("Acquire::CompressionTypes::").append(*o);
  56. if (_config->Exists(method) == false)
  57. continue;
  58. // ignore types we have no app ready to use
  59. std::string const app = _config->Find(method);
  60. std::vector<APT::Configuration::Compressor>::const_iterator c = compressors.begin();
  61. for (; c != compressors.end(); ++c)
  62. if (c->Name == app)
  63. break;
  64. if (c == compressors.end())
  65. continue;
  66. types.push_back(*o);
  67. }
  68. // move again over the option tree to add all missing compression types
  69. ::Configuration::Item const *Types = _config->Tree("Acquire::CompressionTypes");
  70. if (Types != 0)
  71. Types = Types->Child;
  72. for (; Types != 0; Types = Types->Next) {
  73. if (Types->Tag == "Order" || Types->Tag.empty() == true)
  74. continue;
  75. // ignore types we already have in the vector
  76. if (std::find(types.begin(),types.end(),Types->Tag) != types.end())
  77. continue;
  78. // ignore types we have no app ready to use
  79. std::vector<APT::Configuration::Compressor>::const_iterator c = compressors.begin();
  80. for (; c != compressors.end(); ++c)
  81. if (c->Name == Types->Value)
  82. break;
  83. if (c == compressors.end())
  84. continue;
  85. types.push_back(Types->Tag);
  86. }
  87. // add the special "uncompressed" type
  88. if (std::find(types.begin(), types.end(), "uncompressed") == types.end())
  89. {
  90. std::string const uncompr = _config->FindFile("Dir::Bin::uncompressed", "");
  91. if (uncompr.empty() == true || FileExists(uncompr) == true)
  92. types.push_back("uncompressed");
  93. }
  94. return types;
  95. }
  96. /*}}}*/
  97. // GetLanguages - Return Vector of Language Codes /*{{{*/
  98. // ---------------------------------------------------------------------
  99. /* return a vector of language codes in the preferred order.
  100. the special word "environment" will be replaced with the long and the short
  101. code of the local settings and it will be insured that this will not add
  102. duplicates. So in an german local the setting "environment, de_DE, en, de"
  103. will result in "de_DE, de, en".
  104. The special word "none" is the stopcode for the not-All code vector */
  105. std::vector<std::string> const Configuration::getLanguages(bool const &All,
  106. bool const &Cached, char const ** const Locale) {
  107. using std::string;
  108. // The detection is boring and has a lot of cornercases,
  109. // so we cache the results to calculated it only once.
  110. std::vector<string> static allCodes;
  111. std::vector<string> static codes;
  112. // we have something in the cache
  113. if (codes.empty() == false || allCodes.empty() == false) {
  114. if (Cached == true) {
  115. if(All == true && allCodes.empty() == false)
  116. return allCodes;
  117. else
  118. return codes;
  119. } else {
  120. allCodes.clear();
  121. codes.clear();
  122. }
  123. }
  124. // Include all Language codes we have a Translation file for in /var/lib/apt/lists
  125. // so they will be all included in the Cache.
  126. std::vector<string> builtin;
  127. DIR *D = opendir(_config->FindDir("Dir::State::lists").c_str());
  128. if (D != NULL) {
  129. builtin.push_back("none");
  130. for (struct dirent *Ent = readdir(D); Ent != 0; Ent = readdir(D)) {
  131. string const name = SubstVar(Ent->d_name, "%5f", "_");
  132. size_t const foundDash = name.rfind("-");
  133. size_t const foundUnderscore = name.rfind("_", foundDash);
  134. if (foundDash == string::npos || foundUnderscore == string::npos ||
  135. foundDash <= foundUnderscore ||
  136. name.substr(foundUnderscore+1, foundDash-(foundUnderscore+1)) != "Translation")
  137. continue;
  138. string const c = name.substr(foundDash+1);
  139. if (unlikely(c.empty() == true) || c == "en")
  140. continue;
  141. // Skip unusual files, like backups or that alike
  142. string::const_iterator s = c.begin();
  143. for (;s != c.end(); ++s) {
  144. if (isalpha(*s) == 0 && *s != '_')
  145. break;
  146. }
  147. if (s != c.end())
  148. continue;
  149. if (std::find(builtin.begin(), builtin.end(), c) != builtin.end())
  150. continue;
  151. builtin.push_back(c);
  152. }
  153. closedir(D);
  154. }
  155. // FIXME: Remove support for the old APT::Acquire::Translation
  156. // it was undocumented and so it should be not very widthly used
  157. string const oldAcquire = _config->Find("APT::Acquire::Translation","");
  158. if (oldAcquire.empty() == false && oldAcquire != "environment") {
  159. // TRANSLATORS: the two %s are APT configuration options
  160. _error->Notice("Option '%s' is deprecated. Please use '%s' instead, see 'man 5 apt.conf' for details.",
  161. "APT::Acquire::Translation", "Acquire::Languages");
  162. if (oldAcquire != "none")
  163. codes.push_back(oldAcquire);
  164. codes.push_back("en");
  165. allCodes = codes;
  166. for (std::vector<string>::const_iterator b = builtin.begin();
  167. b != builtin.end(); ++b)
  168. if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end())
  169. allCodes.push_back(*b);
  170. if (All == true)
  171. return allCodes;
  172. else
  173. return codes;
  174. }
  175. // get the environment language codes: LC_MESSAGES (and later LANGUAGE)
  176. // we extract both, a long and a short code and then we will
  177. // check if we actually need both (rare) or if the short is enough
  178. string const envMsg = string(Locale == 0 ? std::setlocale(LC_MESSAGES, NULL) : *Locale);
  179. size_t const lenShort = (envMsg.find('_') != string::npos) ? envMsg.find('_') : 2;
  180. size_t const lenLong = (envMsg.find_first_of(".@") != string::npos) ? envMsg.find_first_of(".@") : (lenShort + 3);
  181. string const envLong = envMsg.substr(0,lenLong);
  182. string const envShort = envLong.substr(0,lenShort);
  183. // It is very likely we will need the environment codes later,
  184. // so let us generate them now from LC_MESSAGES and LANGUAGE
  185. std::vector<string> environment;
  186. if (envShort != "C") {
  187. // take care of LC_MESSAGES
  188. if (envLong != envShort)
  189. environment.push_back(envLong);
  190. environment.push_back(envShort);
  191. // take care of LANGUAGE
  192. const char *language_env = getenv("LANGUAGE") == 0 ? "" : getenv("LANGUAGE");
  193. string envLang = Locale == 0 ? language_env : *(Locale+1);
  194. if (envLang.empty() == false) {
  195. std::vector<string> env = VectorizeString(envLang,':');
  196. short addedLangs = 0; // add a maximum of 3 fallbacks from the environment
  197. for (std::vector<string>::const_iterator e = env.begin();
  198. e != env.end() && addedLangs < 3; ++e) {
  199. if (unlikely(e->empty() == true) || *e == "en")
  200. continue;
  201. if (*e == envLong || *e == envShort)
  202. continue;
  203. if (std::find(environment.begin(), environment.end(), *e) != environment.end())
  204. continue;
  205. ++addedLangs;
  206. environment.push_back(*e);
  207. }
  208. }
  209. } else {
  210. environment.push_back("en");
  211. }
  212. // Support settings like Acquire::Languages=none on the command line to
  213. // override the configuration settings vector of languages.
  214. string const forceLang = _config->Find("Acquire::Languages","");
  215. if (forceLang.empty() == false) {
  216. if (forceLang == "none") {
  217. codes.clear();
  218. allCodes.clear();
  219. allCodes.push_back("none");
  220. } else {
  221. if (forceLang == "environment")
  222. codes = environment;
  223. else
  224. codes.push_back(forceLang);
  225. allCodes = codes;
  226. for (std::vector<string>::const_iterator b = builtin.begin();
  227. b != builtin.end(); ++b)
  228. if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end())
  229. allCodes.push_back(*b);
  230. }
  231. if (All == true)
  232. return allCodes;
  233. else
  234. return codes;
  235. }
  236. // cornercase: LANG=C, so we use only "en" Translation
  237. if (envShort == "C") {
  238. allCodes = codes = environment;
  239. allCodes.insert(allCodes.end(), builtin.begin(), builtin.end());
  240. if (All == true)
  241. return allCodes;
  242. else
  243. return codes;
  244. }
  245. std::vector<string> const lang = _config->FindVector("Acquire::Languages");
  246. // the default setting -> "environment, en"
  247. if (lang.empty() == true) {
  248. codes = environment;
  249. if (envShort != "en")
  250. codes.push_back("en");
  251. allCodes = codes;
  252. for (std::vector<string>::const_iterator b = builtin.begin();
  253. b != builtin.end(); ++b)
  254. if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end())
  255. allCodes.push_back(*b);
  256. if (All == true)
  257. return allCodes;
  258. else
  259. return codes;
  260. }
  261. // the configs define the order, so add the environment
  262. // then needed and ensure the codes are not listed twice.
  263. bool noneSeen = false;
  264. for (std::vector<string>::const_iterator l = lang.begin();
  265. l != lang.end(); ++l) {
  266. if (*l == "environment") {
  267. for (std::vector<string>::const_iterator e = environment.begin();
  268. e != environment.end(); ++e) {
  269. if (std::find(allCodes.begin(), allCodes.end(), *e) != allCodes.end())
  270. continue;
  271. if (noneSeen == false)
  272. codes.push_back(*e);
  273. allCodes.push_back(*e);
  274. }
  275. continue;
  276. } else if (*l == "none") {
  277. noneSeen = true;
  278. continue;
  279. } else if (std::find(allCodes.begin(), allCodes.end(), *l) != allCodes.end())
  280. continue;
  281. if (noneSeen == false)
  282. codes.push_back(*l);
  283. allCodes.push_back(*l);
  284. }
  285. for (std::vector<string>::const_iterator b = builtin.begin();
  286. b != builtin.end(); ++b)
  287. if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end())
  288. allCodes.push_back(*b);
  289. if (All == true)
  290. return allCodes;
  291. else
  292. return codes;
  293. }
  294. /*}}}*/
  295. // checkLanguage - are we interested in the given Language? /*{{{*/
  296. bool const Configuration::checkLanguage(std::string Lang, bool const All) {
  297. // the empty Language is always interesting as it is the original
  298. if (Lang.empty() == true)
  299. return true;
  300. // filenames are encoded, so undo this
  301. Lang = SubstVar(Lang, "%5f", "_");
  302. std::vector<std::string> const langs = getLanguages(All, true);
  303. return (std::find(langs.begin(), langs.end(), Lang) != langs.end());
  304. }
  305. /*}}}*/
  306. // getArchitectures - Return Vector of preferred Architectures /*{{{*/
  307. std::vector<std::string> const Configuration::getArchitectures(bool const &Cached) {
  308. using std::string;
  309. std::vector<string> static archs;
  310. if (likely(Cached == true) && archs.empty() == false)
  311. return archs;
  312. string const arch = _config->Find("APT::Architecture");
  313. archs = _config->FindVector("APT::Architectures");
  314. if (unlikely(arch.empty() == true))
  315. return archs;
  316. // FIXME: It is a bit unclean to have debian specific code here…
  317. if (archs.empty() == true) {
  318. archs.push_back(arch);
  319. // Generate the base argument list for dpkg
  320. std::vector<const char *> Args;
  321. string Tmp = _config->Find("Dir::Bin::dpkg","dpkg");
  322. {
  323. string const dpkgChrootDir = _config->FindDir("DPkg::Chroot-Directory", "/");
  324. size_t dpkgChrootLen = dpkgChrootDir.length();
  325. if (dpkgChrootDir != "/" && Tmp.find(dpkgChrootDir) == 0) {
  326. if (dpkgChrootDir[dpkgChrootLen - 1] == '/')
  327. --dpkgChrootLen;
  328. Tmp = Tmp.substr(dpkgChrootLen);
  329. }
  330. }
  331. Args.push_back(Tmp.c_str());
  332. // Stick in any custom dpkg options
  333. ::Configuration::Item const *Opts = _config->Tree("DPkg::Options");
  334. if (Opts != 0) {
  335. Opts = Opts->Child;
  336. for (; Opts != 0; Opts = Opts->Next)
  337. {
  338. if (Opts->Value.empty() == true)
  339. continue;
  340. Args.push_back(Opts->Value.c_str());
  341. }
  342. }
  343. Args.push_back("--print-foreign-architectures");
  344. Args.push_back(NULL);
  345. int external[2] = {-1, -1};
  346. if (pipe(external) != 0)
  347. {
  348. _error->WarningE("getArchitecture", "Can't create IPC pipe for dpkg --print-foreign-architectures");
  349. return archs;
  350. }
  351. pid_t dpkgMultiArch = ExecFork();
  352. if (dpkgMultiArch == 0) {
  353. close(external[0]);
  354. std::string const chrootDir = _config->FindDir("DPkg::Chroot-Directory");
  355. int const nullfd = open("/dev/null", O_RDONLY);
  356. dup2(nullfd, STDIN_FILENO);
  357. dup2(external[1], STDOUT_FILENO);
  358. dup2(nullfd, STDERR_FILENO);
  359. if (chrootDir != "/" && chroot(chrootDir.c_str()) != 0 && chdir("/") != 0)
  360. _error->WarningE("getArchitecture", "Couldn't chroot into %s for dpkg --print-foreign-architectures", chrootDir.c_str());
  361. execvp(Args[0], (char**) &Args[0]);
  362. _error->WarningE("getArchitecture", "Can't detect foreign architectures supported by dpkg!");
  363. _exit(100);
  364. }
  365. close(external[1]);
  366. FILE *dpkg = fdopen(external[0], "r");
  367. if(dpkg != NULL) {
  368. char buf[1024];
  369. while (fgets(buf, sizeof(buf), dpkg) != NULL) {
  370. char* arch = strtok(buf, " ");
  371. while (arch != NULL) {
  372. for (; isspace(*arch) != 0; ++arch);
  373. if (arch[0] != '\0') {
  374. char const* archend = arch;
  375. for (; isspace(*archend) == 0 && *archend != '\0'; ++archend);
  376. string a(arch, (archend - arch));
  377. if (std::find(archs.begin(), archs.end(), a) == archs.end())
  378. archs.push_back(a);
  379. }
  380. arch = strtok(NULL, " ");
  381. }
  382. }
  383. fclose(dpkg);
  384. }
  385. ExecWait(dpkgMultiArch, "dpkg --print-foreign-architectures", true);
  386. return archs;
  387. }
  388. if (archs.empty() == true ||
  389. std::find(archs.begin(), archs.end(), arch) == archs.end())
  390. archs.insert(archs.begin(), arch);
  391. // erase duplicates and empty strings
  392. for (std::vector<string>::reverse_iterator a = archs.rbegin();
  393. a != archs.rend(); ++a) {
  394. if (a->empty() == true || std::find(a + 1, archs.rend(), *a) != archs.rend())
  395. archs.erase(a.base()-1);
  396. if (a == archs.rend())
  397. break;
  398. }
  399. return archs;
  400. }
  401. /*}}}*/
  402. // checkArchitecture - are we interested in the given Architecture? /*{{{*/
  403. bool const Configuration::checkArchitecture(std::string const &Arch) {
  404. if (Arch == "all")
  405. return true;
  406. std::vector<std::string> const archs = getArchitectures(true);
  407. return (std::find(archs.begin(), archs.end(), Arch) != archs.end());
  408. }
  409. /*}}}*/
  410. // setDefaultConfigurationForCompressors /*{{{*/
  411. void Configuration::setDefaultConfigurationForCompressors() {
  412. // Set default application paths to check for optional compression types
  413. _config->CndSet("Dir::Bin::bzip2", "/bin/bzip2");
  414. _config->CndSet("Dir::Bin::xz", "/usr/bin/xz");
  415. if (FileExists(_config->FindFile("Dir::Bin::xz")) == true) {
  416. _config->Set("Dir::Bin::lzma", _config->FindFile("Dir::Bin::xz"));
  417. _config->Set("APT::Compressor::lzma::Binary", "xz");
  418. if (_config->Exists("APT::Compressor::lzma::CompressArg") == false) {
  419. _config->Set("APT::Compressor::lzma::CompressArg::", "--format=lzma");
  420. _config->Set("APT::Compressor::lzma::CompressArg::", "-9");
  421. }
  422. if (_config->Exists("APT::Compressor::lzma::UncompressArg") == false) {
  423. _config->Set("APT::Compressor::lzma::UncompressArg::", "--format=lzma");
  424. _config->Set("APT::Compressor::lzma::UncompressArg::", "-d");
  425. }
  426. } else {
  427. _config->CndSet("Dir::Bin::lzma", "/usr/bin/lzma");
  428. if (_config->Exists("APT::Compressor::lzma::CompressArg") == false) {
  429. _config->Set("APT::Compressor::lzma::CompressArg::", "--suffix=");
  430. _config->Set("APT::Compressor::lzma::CompressArg::", "-9");
  431. }
  432. if (_config->Exists("APT::Compressor::lzma::UncompressArg") == false) {
  433. _config->Set("APT::Compressor::lzma::UncompressArg::", "--suffix=");
  434. _config->Set("APT::Compressor::lzma::UncompressArg::", "-d");
  435. }
  436. }
  437. }
  438. /*}}}*/
  439. // getCompressors - Return Vector of usbale compressors /*{{{*/
  440. // ---------------------------------------------------------------------
  441. /* return a vector of compressors used by apt-ftparchive in the
  442. multicompress functionality or to detect data.tar files */
  443. std::vector<APT::Configuration::Compressor>
  444. const Configuration::getCompressors(bool const Cached) {
  445. static std::vector<APT::Configuration::Compressor> compressors;
  446. if (compressors.empty() == false) {
  447. if (Cached == true)
  448. return compressors;
  449. else
  450. compressors.clear();
  451. }
  452. setDefaultConfigurationForCompressors();
  453. compressors.push_back(Compressor(".", "", "", NULL, NULL, 1));
  454. if (_config->Exists("Dir::Bin::gzip") == false || FileExists(_config->FindFile("Dir::Bin::gzip")) == true)
  455. compressors.push_back(Compressor("gzip",".gz","gzip","-9n","-d",2));
  456. #ifdef HAVE_ZLIB
  457. else
  458. compressors.push_back(Compressor("gzip",".gz","false", NULL, NULL, 2));
  459. #endif
  460. if (_config->Exists("Dir::Bin::bzip2") == false || FileExists(_config->FindFile("Dir::Bin::bzip2")) == true)
  461. compressors.push_back(Compressor("bzip2",".bz2","bzip2","-9","-d",3));
  462. #ifdef HAVE_BZ2
  463. else
  464. compressors.push_back(Compressor("bzip2",".bz2","false", NULL, NULL, 3));
  465. #endif
  466. if (_config->Exists("Dir::Bin::xz") == false || FileExists(_config->FindFile("Dir::Bin::xz")) == true)
  467. compressors.push_back(Compressor("xz",".xz","xz","-6","-d",4));
  468. if (_config->Exists("Dir::Bin::lzma") == false || FileExists(_config->FindFile("Dir::Bin::lzma")) == true)
  469. compressors.push_back(Compressor("lzma",".lzma","lzma","-9","-d",5));
  470. std::vector<std::string> const comp = _config->FindVector("APT::Compressor");
  471. for (std::vector<std::string>::const_iterator c = comp.begin();
  472. c != comp.end(); ++c) {
  473. if (*c == "." || *c == "gzip" || *c == "bzip2" || *c == "lzma" || *c == "xz")
  474. continue;
  475. compressors.push_back(Compressor(c->c_str(), std::string(".").append(*c).c_str(), c->c_str(), "-9", "-d", 100));
  476. }
  477. return compressors;
  478. }
  479. /*}}}*/
  480. // getCompressorExtensions - supported data.tar extensions /*{{{*/
  481. // ---------------------------------------------------------------------
  482. /* */
  483. std::vector<std::string> const Configuration::getCompressorExtensions() {
  484. std::vector<APT::Configuration::Compressor> const compressors = getCompressors();
  485. std::vector<std::string> ext;
  486. for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressors.begin();
  487. c != compressors.end(); ++c)
  488. if (c->Extension.empty() == false && c->Extension != ".")
  489. ext.push_back(c->Extension);
  490. return ext;
  491. }
  492. /*}}}*/
  493. // Compressor constructor /*{{{*/
  494. // ---------------------------------------------------------------------
  495. /* */
  496. Configuration::Compressor::Compressor(char const *name, char const *extension,
  497. char const *binary,
  498. char const *compressArg, char const *uncompressArg,
  499. unsigned short const cost) {
  500. std::string const config = std::string("APT::Compressor::").append(name).append("::");
  501. Name = _config->Find(std::string(config).append("Name"), name);
  502. Extension = _config->Find(std::string(config).append("Extension"), extension);
  503. Binary = _config->Find(std::string(config).append("Binary"), binary);
  504. Cost = _config->FindI(std::string(config).append("Cost"), cost);
  505. std::string const compConf = std::string(config).append("CompressArg");
  506. if (_config->Exists(compConf) == true)
  507. CompressArgs = _config->FindVector(compConf);
  508. else if (compressArg != NULL)
  509. CompressArgs.push_back(compressArg);
  510. std::string const uncompConf = std::string(config).append("UncompressArg");
  511. if (_config->Exists(uncompConf) == true)
  512. UncompressArgs = _config->FindVector(uncompConf);
  513. else if (uncompressArg != NULL)
  514. UncompressArgs.push_back(uncompressArg);
  515. }
  516. /*}}}*/
  517. }