sourcelist.cc 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: sourcelist.cc,v 1.3 2002/08/15 20:51:37 niemeyer Exp $
  4. /* ######################################################################
  5. List of Sources
  6. ##################################################################### */
  7. /*}}}*/
  8. // Include Files /*{{{*/
  9. #include<config.h>
  10. #include <apt-pkg/sourcelist.h>
  11. #include <apt-pkg/cmndline.h>
  12. #include <apt-pkg/error.h>
  13. #include <apt-pkg/fileutl.h>
  14. #include <apt-pkg/strutl.h>
  15. #include <apt-pkg/configuration.h>
  16. #include <apt-pkg/metaindex.h>
  17. #include <apt-pkg/indexfile.h>
  18. #include <apt-pkg/tagfile.h>
  19. #include <apt-pkg/pkgcache.h>
  20. #include <apt-pkg/cacheiterators.h>
  21. #include <apt-pkg/debindexfile.h>
  22. #include <ctype.h>
  23. #include <stddef.h>
  24. #include <time.h>
  25. #include <cstring>
  26. #include <map>
  27. #include <string>
  28. #include <vector>
  29. #include <fstream>
  30. #include <algorithm>
  31. #include <apti18n.h>
  32. /*}}}*/
  33. using namespace std;
  34. // Global list of Items supported
  35. static pkgSourceList::Type *ItmList[10];
  36. pkgSourceList::Type **pkgSourceList::Type::GlobalList = ItmList;
  37. unsigned long pkgSourceList::Type::GlobalListLen = 0;
  38. // Type::Type - Constructor /*{{{*/
  39. // ---------------------------------------------------------------------
  40. /* Link this to the global list of items*/
  41. pkgSourceList::Type::Type(char const * const pName, char const * const pLabel) : Name(pName), Label(pLabel)
  42. {
  43. ItmList[GlobalListLen] = this;
  44. ++GlobalListLen;
  45. }
  46. pkgSourceList::Type::~Type() {}
  47. /*}}}*/
  48. // Type::GetType - Get a specific meta for a given type /*{{{*/
  49. // ---------------------------------------------------------------------
  50. /* */
  51. pkgSourceList::Type *pkgSourceList::Type::GetType(const char *Type)
  52. {
  53. for (unsigned I = 0; I != GlobalListLen; ++I)
  54. if (strcmp(GlobalList[I]->Name,Type) == 0)
  55. return GlobalList[I];
  56. return 0;
  57. }
  58. /*}}}*/
  59. // Type::FixupURI - Normalize the URI and check it.. /*{{{*/
  60. // ---------------------------------------------------------------------
  61. /* */
  62. bool pkgSourceList::Type::FixupURI(string &URI) const
  63. {
  64. if (URI.empty() == true)
  65. return false;
  66. if (URI.find(':') == string::npos)
  67. return false;
  68. URI = SubstVar(URI,"$(ARCH)",_config->Find("APT::Architecture"));
  69. // Make sure that the URI is / postfixed
  70. if (URI[URI.size() - 1] != '/')
  71. URI += '/';
  72. return true;
  73. }
  74. /*}}}*/
  75. bool pkgSourceList::Type::ParseStanza(vector<metaIndex *> &List, /*{{{*/
  76. pkgTagSection &Tags,
  77. unsigned int const i,
  78. FileFd &Fd)
  79. {
  80. map<string, string> Options;
  81. string Enabled = Tags.FindS("Enabled");
  82. if (Enabled.empty() == false && StringToBool(Enabled) == false)
  83. return true;
  84. std::map<char const * const, std::pair<char const * const, bool> > mapping;
  85. #define APT_PLUSMINUS(X, Y) \
  86. mapping.insert(std::make_pair(X, std::make_pair(Y, true))); \
  87. mapping.insert(std::make_pair(X "-Add", std::make_pair(Y "+", true))); \
  88. mapping.insert(std::make_pair(X "-Remove", std::make_pair(Y "-", true)))
  89. APT_PLUSMINUS("Architectures", "arch");
  90. APT_PLUSMINUS("Languages", "lang");
  91. APT_PLUSMINUS("Targets", "target");
  92. #undef APT_PLUSMINUS
  93. mapping.insert(std::make_pair("Trusted", std::make_pair("trusted", false)));
  94. mapping.insert(std::make_pair("Check-Valid-Until", std::make_pair("check-valid-until", false)));
  95. mapping.insert(std::make_pair("Valid-Until-Min", std::make_pair("valid-until-min", false)));
  96. mapping.insert(std::make_pair("Valid-Until-Max", std::make_pair("valid-until-max", false)));
  97. mapping.insert(std::make_pair("Signed-By", std::make_pair("signed-by", false)));
  98. mapping.insert(std::make_pair("PDiffs", std::make_pair("pdiffs", false)));
  99. mapping.insert(std::make_pair("By-Hash", std::make_pair("by-hash", false)));
  100. for (std::map<char const * const, std::pair<char const * const, bool> >::const_iterator m = mapping.begin(); m != mapping.end(); ++m)
  101. if (Tags.Exists(m->first))
  102. {
  103. std::string option = Tags.FindS(m->first);
  104. // for deb822 the " " is the delimiter, but the backend expects ","
  105. if (m->second.second == true)
  106. std::replace(option.begin(), option.end(), ' ', ',');
  107. Options[m->second.first] = option;
  108. }
  109. {
  110. std::string entry;
  111. strprintf(entry, "%s:%i", Fd.Name().c_str(), i);
  112. Options["sourceslist-entry"] = entry;
  113. }
  114. // now create one item per suite/section
  115. string Suite = Tags.FindS("Suites");
  116. Suite = SubstVar(Suite,"$(ARCH)",_config->Find("APT::Architecture"));
  117. string const Component = Tags.FindS("Components");
  118. string const URIS = Tags.FindS("URIs");
  119. std::vector<std::string> const list_uris = VectorizeString(URIS, ' ');
  120. std::vector<std::string> const list_suite = VectorizeString(Suite, ' ');
  121. std::vector<std::string> const list_comp = VectorizeString(Component, ' ');
  122. if (list_uris.empty())
  123. // TRANSLATOR: %u is a line number, the first %s is a filename of a file with the extension "second %s" and the third %s is a unique identifier for bugreports
  124. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), i, "sources", Fd.Name().c_str(), "URI");
  125. for (std::vector<std::string>::const_iterator U = list_uris.begin();
  126. U != list_uris.end(); ++U)
  127. {
  128. std::string URI = *U;
  129. if (U->empty() || FixupURI(URI) == false)
  130. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), i, "sources", Fd.Name().c_str(), "URI parse");
  131. if (list_suite.empty())
  132. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), i, "sources", Fd.Name().c_str(), "Suite");
  133. for (std::vector<std::string>::const_iterator S = list_suite.begin();
  134. S != list_suite.end(); ++S)
  135. {
  136. if (S->empty() == false && (*S)[S->size() - 1] == '/')
  137. {
  138. if (list_comp.empty() == false)
  139. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), i, "sources", Fd.Name().c_str(), "absolute Suite Component");
  140. if (CreateItem(List, URI, *S, "", Options) == false)
  141. return false;
  142. }
  143. else
  144. {
  145. if (list_comp.empty())
  146. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), i, "sources", Fd.Name().c_str(), "Component");
  147. for (std::vector<std::string>::const_iterator C = list_comp.begin();
  148. C != list_comp.end(); ++C)
  149. {
  150. if (CreateItem(List, URI, *S, *C, Options) == false)
  151. {
  152. return false;
  153. }
  154. }
  155. }
  156. }
  157. }
  158. return true;
  159. }
  160. /*}}}*/
  161. // Type::ParseLine - Parse a single line /*{{{*/
  162. // ---------------------------------------------------------------------
  163. /* This is a generic one that is the 'usual' format for sources.list
  164. Weird types may override this. */
  165. bool pkgSourceList::Type::ParseLine(vector<metaIndex *> &List,
  166. const char *Buffer,
  167. unsigned int const CurLine,
  168. string const &File) const
  169. {
  170. for (;Buffer != 0 && isspace(*Buffer); ++Buffer); // Skip whitespaces
  171. // Parse option field if it exists
  172. // e.g.: [ option1=value1 option2=value2 ]
  173. map<string, string> Options;
  174. {
  175. std::string entry;
  176. strprintf(entry, "%s:%i", File.c_str(), CurLine);
  177. Options["sourceslist-entry"] = entry;
  178. }
  179. if (Buffer != 0 && Buffer[0] == '[')
  180. {
  181. ++Buffer; // ignore the [
  182. for (;Buffer != 0 && isspace(*Buffer); ++Buffer); // Skip whitespaces
  183. while (*Buffer != ']')
  184. {
  185. // get one option, e.g. option1=value1
  186. string option;
  187. if (ParseQuoteWord(Buffer,option) == false)
  188. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "[option] unparseable");
  189. if (option.length() < 3)
  190. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "[option] too short");
  191. // accept options even if the last has no space before the ]-end marker
  192. if (option.at(option.length()-1) == ']')
  193. {
  194. for (; *Buffer != ']'; --Buffer);
  195. option.resize(option.length()-1);
  196. }
  197. size_t const needle = option.find('=');
  198. if (needle == string::npos)
  199. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "[option] not assignment");
  200. string const key = string(option, 0, needle);
  201. string const value = string(option, needle + 1, option.length());
  202. if (key.empty() == true)
  203. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "[option] no key");
  204. if (value.empty() == true)
  205. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "[option] no value");
  206. Options[key] = value;
  207. }
  208. ++Buffer; // ignore the ]
  209. for (;Buffer != 0 && isspace(*Buffer); ++Buffer); // Skip whitespaces
  210. }
  211. string URI;
  212. string Dist;
  213. string Section;
  214. if (ParseQuoteWord(Buffer,URI) == false)
  215. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "URI");
  216. if (ParseQuoteWord(Buffer,Dist) == false)
  217. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "Suite");
  218. if (FixupURI(URI) == false)
  219. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "URI parse");
  220. // Check for an absolute dists specification.
  221. if (Dist.empty() == false && Dist[Dist.size() - 1] == '/')
  222. {
  223. if (ParseQuoteWord(Buffer,Section) == true)
  224. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "absolute Suite Component");
  225. Dist = SubstVar(Dist,"$(ARCH)",_config->Find("APT::Architecture"));
  226. return CreateItem(List, URI, Dist, Section, Options);
  227. }
  228. // Grab the rest of the dists
  229. if (ParseQuoteWord(Buffer,Section) == false)
  230. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "Component");
  231. do
  232. {
  233. if (CreateItem(List, URI, Dist, Section, Options) == false)
  234. return false;
  235. }
  236. while (ParseQuoteWord(Buffer,Section) == true);
  237. return true;
  238. }
  239. /*}}}*/
  240. // SourceList::pkgSourceList - Constructors /*{{{*/
  241. // ---------------------------------------------------------------------
  242. /* */
  243. pkgSourceList::pkgSourceList() : d(NULL)
  244. {
  245. }
  246. /*}}}*/
  247. // SourceList::~pkgSourceList - Destructor /*{{{*/
  248. // ---------------------------------------------------------------------
  249. /* */
  250. pkgSourceList::~pkgSourceList()
  251. {
  252. for (const_iterator I = SrcList.begin(); I != SrcList.end(); ++I)
  253. delete *I;
  254. SrcList.clear();
  255. for (auto F = VolatileFiles.begin(); F != VolatileFiles.end(); ++F)
  256. delete (*F);
  257. VolatileFiles.clear();
  258. }
  259. /*}}}*/
  260. // SourceList::ReadMainList - Read the main source list from etc /*{{{*/
  261. // ---------------------------------------------------------------------
  262. /* */
  263. bool pkgSourceList::ReadMainList()
  264. {
  265. // CNC:2003-03-03 - Multiple sources list support.
  266. bool Res = true;
  267. #if 0
  268. Res = ReadVendors();
  269. if (Res == false)
  270. return false;
  271. #endif
  272. Reset();
  273. // CNC:2003-11-28 - Entries in sources.list have priority over
  274. // entries in sources.list.d.
  275. string Main = _config->FindFile("Dir::Etc::sourcelist", "/dev/null");
  276. string Parts = _config->FindDir("Dir::Etc::sourceparts", "/dev/null");
  277. if (RealFileExists(Main) == true)
  278. Res &= ReadAppend(Main);
  279. else if (DirectoryExists(Parts) == false && APT::String::Endswith(Parts, "/dev/null") == false)
  280. // Only warn if there are no sources.list.d.
  281. _error->WarningE("DirectoryExists", _("Unable to read %s"), Parts.c_str());
  282. if (DirectoryExists(Parts) == true)
  283. Res &= ReadSourceDir(Parts);
  284. else if (Main.empty() == false && RealFileExists(Main) == false &&
  285. APT::String::Endswith(Parts, "/dev/null") == false)
  286. // Only warn if there is no sources.list file.
  287. _error->WarningE("RealFileExists", _("Unable to read %s"), Main.c_str());
  288. return Res;
  289. }
  290. /*}}}*/
  291. // SourceList::Reset - Clear the sourcelist contents /*{{{*/
  292. // ---------------------------------------------------------------------
  293. /* */
  294. void pkgSourceList::Reset()
  295. {
  296. for (const_iterator I = SrcList.begin(); I != SrcList.end(); ++I)
  297. delete *I;
  298. SrcList.clear();
  299. }
  300. /*}}}*/
  301. // SourceList::Read - Parse the sourcelist file /*{{{*/
  302. // ---------------------------------------------------------------------
  303. /* */
  304. bool pkgSourceList::Read(string const &File)
  305. {
  306. Reset();
  307. return ReadAppend(File);
  308. }
  309. /*}}}*/
  310. // SourceList::ReadAppend - Parse a sourcelist file /*{{{*/
  311. // ---------------------------------------------------------------------
  312. /* */
  313. bool pkgSourceList::ReadAppend(string const &File)
  314. {
  315. if (flExtension(File) == "sources")
  316. return ParseFileDeb822(File);
  317. else
  318. return ParseFileOldStyle(File);
  319. }
  320. /*}}}*/
  321. // SourceList::ReadFileOldStyle - Read Traditional style sources.list /*{{{*/
  322. // ---------------------------------------------------------------------
  323. /* */
  324. bool pkgSourceList::ParseFileOldStyle(std::string const &File)
  325. {
  326. // Open the stream for reading
  327. ifstream F(File.c_str(),ios::in /*| ios::nocreate*/);
  328. if (F.fail() == true)
  329. return _error->Errno("ifstream::ifstream",_("Opening %s"),File.c_str());
  330. std::string Buffer;
  331. for (unsigned int CurLine = 1; std::getline(F, Buffer); ++CurLine)
  332. {
  333. // remove comments
  334. size_t curpos = 0;
  335. while ((curpos = Buffer.find('#', curpos)) != std::string::npos)
  336. {
  337. size_t const openbrackets = std::count(Buffer.begin(), Buffer.begin() + curpos, '[');
  338. size_t const closedbrackets = std::count(Buffer.begin(), Buffer.begin() + curpos, ']');
  339. if (openbrackets > closedbrackets)
  340. {
  341. // a # in an option, unlikely, but oh well, it was supported so stick to it
  342. ++curpos;
  343. continue;
  344. }
  345. Buffer.erase(curpos);
  346. break;
  347. }
  348. // remove spaces before/after
  349. curpos = Buffer.find_first_not_of(" \t\r");
  350. if (curpos != 0)
  351. Buffer.erase(0, curpos);
  352. curpos = Buffer.find_last_not_of(" \t\r");
  353. if (curpos != std::string::npos)
  354. Buffer.erase(curpos + 1);
  355. if (Buffer.empty())
  356. continue;
  357. // Grok it
  358. std::string const LineType = Buffer.substr(0, Buffer.find_first_of(" \t\v"));
  359. if (LineType.empty() || LineType == Buffer)
  360. return _error->Error(_("Malformed line %u in source list %s (type)"),CurLine,File.c_str());
  361. Type *Parse = Type::GetType(LineType.c_str());
  362. if (Parse == 0)
  363. return _error->Error(_("Type '%s' is not known on line %u in source list %s"),LineType.c_str(),CurLine,File.c_str());
  364. if (Parse->ParseLine(SrcList, Buffer.c_str() + LineType.length(), CurLine, File) == false)
  365. return false;
  366. }
  367. return true;
  368. }
  369. /*}}}*/
  370. // SourceList::ParseFileDeb822 - Parse deb822 style sources.list /*{{{*/
  371. // ---------------------------------------------------------------------
  372. /* Returns: the number of stanzas parsed*/
  373. bool pkgSourceList::ParseFileDeb822(string const &File)
  374. {
  375. unsigned int i = 1;
  376. // see if we can read the file
  377. FileFd Fd(File, FileFd::ReadOnly);
  378. pkgTagFile Sources(&Fd, pkgTagFile::SUPPORT_COMMENTS);
  379. if (Fd.IsOpen() == false || Fd.Failed())
  380. return _error->Error(_("Malformed stanza %u in source list %s (type)"),i,File.c_str());
  381. // read step by step
  382. pkgTagSection Tags;
  383. while (Sources.Step(Tags) == true)
  384. {
  385. if(Tags.Exists("Types") == false)
  386. return _error->Error(_("Malformed stanza %u in source list %s (type)"),i,File.c_str());
  387. string const types = Tags.FindS("Types");
  388. std::vector<std::string> const list_types = VectorizeString(types, ' ');
  389. for (std::vector<std::string>::const_iterator I = list_types.begin();
  390. I != list_types.end(); ++I)
  391. {
  392. Type *Parse = Type::GetType((*I).c_str());
  393. if (Parse == 0)
  394. {
  395. _error->Error(_("Type '%s' is not known on stanza %u in source list %s"), (*I).c_str(),i,Fd.Name().c_str());
  396. return false;
  397. }
  398. if (!Parse->ParseStanza(SrcList, Tags, i, Fd))
  399. return false;
  400. ++i;
  401. }
  402. }
  403. return true;
  404. }
  405. /*}}}*/
  406. // SourceList::FindIndex - Get the index associated with a file /*{{{*/
  407. static bool FindInIndexFileContainer(std::vector<pkgIndexFile *> const &Cont, pkgCache::PkgFileIterator const &File, pkgIndexFile *&Found)
  408. {
  409. auto const J = std::find_if(Cont.begin(), Cont.end(), [&File](pkgIndexFile const * const J) {
  410. return J->FindInCache(*File.Cache()) == File;
  411. });
  412. if (J != Cont.end())
  413. {
  414. Found = (*J);
  415. return true;
  416. }
  417. return false;
  418. }
  419. bool pkgSourceList::FindIndex(pkgCache::PkgFileIterator File,
  420. pkgIndexFile *&Found) const
  421. {
  422. for (const_iterator I = SrcList.begin(); I != SrcList.end(); ++I)
  423. if (FindInIndexFileContainer(*(*I)->GetIndexFiles(), File, Found))
  424. return true;
  425. return FindInIndexFileContainer(VolatileFiles, File, Found);
  426. }
  427. /*}}}*/
  428. // SourceList::GetIndexes - Load the index files into the downloader /*{{{*/
  429. // ---------------------------------------------------------------------
  430. /* */
  431. bool pkgSourceList::GetIndexes(pkgAcquire *Owner, bool GetAll) const
  432. {
  433. for (const_iterator I = SrcList.begin(); I != SrcList.end(); ++I)
  434. if ((*I)->GetIndexes(Owner,GetAll) == false)
  435. return false;
  436. return true;
  437. }
  438. /*}}}*/
  439. // CNC:2003-03-03 - By Anton V. Denisov <avd@altlinux.org>.
  440. // SourceList::ReadSourceDir - Read a directory with sources files
  441. // Based on ReadConfigDir() /*{{{*/
  442. // ---------------------------------------------------------------------
  443. /* */
  444. bool pkgSourceList::ReadSourceDir(string const &Dir)
  445. {
  446. std::vector<std::string> ext;
  447. ext.push_back("list");
  448. ext.push_back("sources");
  449. std::vector<std::string> const List = GetListOfFilesInDir(Dir, ext, true);
  450. // Read the files
  451. for (vector<string>::const_iterator I = List.begin(); I != List.end(); ++I)
  452. if (ReadAppend(*I) == false)
  453. return false;
  454. return true;
  455. }
  456. /*}}}*/
  457. // GetLastModified() /*{{{*/
  458. // ---------------------------------------------------------------------
  459. /* */
  460. time_t pkgSourceList::GetLastModifiedTime()
  461. {
  462. vector<string> List;
  463. string Main = _config->FindFile("Dir::Etc::sourcelist");
  464. string Parts = _config->FindDir("Dir::Etc::sourceparts");
  465. // go over the parts
  466. if (DirectoryExists(Parts) == true)
  467. List = GetListOfFilesInDir(Parts, "list", true);
  468. // calculate the time
  469. std::vector<time_t> modtimes;
  470. modtimes.reserve(1 + List.size());
  471. modtimes.push_back(GetModificationTime(Main));
  472. std::transform(List.begin(), List.end(), std::back_inserter(modtimes), GetModificationTime);
  473. auto const maxmtime = std::max_element(modtimes.begin(), modtimes.end());
  474. return *maxmtime;
  475. }
  476. /*}}}*/
  477. std::vector<pkgIndexFile*> pkgSourceList::GetVolatileFiles() const /*{{{*/
  478. {
  479. return VolatileFiles;
  480. }
  481. /*}}}*/
  482. void pkgSourceList::AddVolatileFile(pkgIndexFile * const File) /*{{{*/
  483. {
  484. if (File != nullptr)
  485. VolatileFiles.push_back(File);
  486. }
  487. /*}}}*/
  488. bool pkgSourceList::AddVolatileFile(std::string const &File) /*{{{*/
  489. {
  490. // Note: FileExists matches directories and links, too!
  491. if (File.empty() || FileExists(File) == false)
  492. return false;
  493. std::string const ext = flExtension(File);
  494. if (ext == "deb")
  495. AddVolatileFile(new debDebPkgFileIndex(File));
  496. else if (ext == "dsc")
  497. AddVolatileFile(new debDscFileIndex(File));
  498. else if (FileExists(flCombine(File, "debian/control")))
  499. AddVolatileFile(new debDscFileIndex(flCombine(File, "debian/control")));
  500. else
  501. return false;
  502. return true;
  503. }
  504. /*}}}*/
  505. void pkgSourceList::AddVolatileFiles(CommandLine &CmdL, std::vector<const char*> * const VolatileCmdL)/*{{{*/
  506. {
  507. std::remove_if(CmdL.FileList + 1, CmdL.FileList + 1 + CmdL.FileSize(), [&](char const * const I) {
  508. if (I != nullptr && (I[0] == '/' || (I[0] == '.' && ((I[1] == '.' && I[2] == '/') || I[1] == '/'))))
  509. {
  510. if (AddVolatileFile(I))
  511. {
  512. if (VolatileCmdL != nullptr)
  513. VolatileCmdL->push_back(I);
  514. }
  515. else
  516. _error->Error(_("Unsupported file %s given on commandline"), I);
  517. return true;
  518. }
  519. return false;
  520. });
  521. }
  522. /*}}}*/