cacheset.cc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. /* ######################################################################
  4. Simple wrapper around a std::set to provide a similar interface to
  5. a set of cache structures as to the complete set of all structures
  6. in the pkgCache. Currently only Package is supported.
  7. ##################################################################### */
  8. /*}}}*/
  9. // Include Files /*{{{*/
  10. #include <config.h>
  11. #include <apt-pkg/aptconfiguration.h>
  12. #include <apt-pkg/cachefile.h>
  13. #include <apt-pkg/cachefilter.h>
  14. #include <apt-pkg/cacheset.h>
  15. #include <apt-pkg/error.h>
  16. #include <apt-pkg/strutl.h>
  17. #include <apt-pkg/versionmatch.h>
  18. #include <apt-pkg/pkgrecords.h>
  19. #include <apt-pkg/policy.h>
  20. #include <vector>
  21. #include <regex.h>
  22. #include <apti18n.h>
  23. /*}}}*/
  24. namespace APT {
  25. // FromTask - Return all packages in the cache from a specific task /*{{{*/
  26. bool PackageContainerInterface::FromTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
  27. size_t const archfound = pattern.find_last_of(':');
  28. std::string arch = "native";
  29. if (archfound != std::string::npos) {
  30. arch = pattern.substr(archfound+1);
  31. pattern.erase(archfound);
  32. }
  33. if (pattern[pattern.length() -1] != '^')
  34. return false;
  35. pattern.erase(pattern.length()-1);
  36. if (unlikely(Cache.GetPkgCache() == 0 || Cache.GetDepCache() == 0))
  37. return false;
  38. bool const wasEmpty = pci->empty();
  39. if (wasEmpty == true)
  40. pci->setConstructor(TASK);
  41. // get the records
  42. pkgRecords Recs(Cache);
  43. // build regexp for the task
  44. regex_t Pattern;
  45. char S[300];
  46. snprintf(S, sizeof(S), "^Task:.*[, ]%s([, ]|$)", pattern.c_str());
  47. if(regcomp(&Pattern,S, REG_EXTENDED | REG_NOSUB | REG_NEWLINE) != 0) {
  48. _error->Error("Failed to compile task regexp");
  49. return false;
  50. }
  51. bool found = false;
  52. for (pkgCache::GrpIterator Grp = Cache->GrpBegin(); Grp.end() == false; ++Grp) {
  53. pkgCache::PkgIterator Pkg = Grp.FindPkg(arch);
  54. if (Pkg.end() == true)
  55. continue;
  56. pkgCache::VerIterator ver = Cache[Pkg].CandidateVerIter(Cache);
  57. if(ver.end() == true)
  58. continue;
  59. pkgRecords::Parser &parser = Recs.Lookup(ver.FileList());
  60. const char *start, *end;
  61. parser.GetRec(start,end);
  62. unsigned int const length = end - start;
  63. char buf[length];
  64. strncpy(buf, start, length);
  65. buf[length-1] = '\0';
  66. if (regexec(&Pattern, buf, 0, 0, 0) != 0)
  67. continue;
  68. pci->insert(Pkg);
  69. helper.showTaskSelection(Pkg, pattern);
  70. found = true;
  71. }
  72. regfree(&Pattern);
  73. if (found == false) {
  74. helper.canNotFindTask(pci, Cache, pattern);
  75. pci->setConstructor(UNKNOWN);
  76. return false;
  77. }
  78. if (wasEmpty == false && pci->getConstructor() != UNKNOWN)
  79. pci->setConstructor(UNKNOWN);
  80. return true;
  81. }
  82. /*}}}*/
  83. // FromRegEx - Return all packages in the cache matching a pattern /*{{{*/
  84. bool PackageContainerInterface::FromRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
  85. static const char * const isregex = ".?+*|[^$";
  86. if (pattern.find_first_of(isregex) == std::string::npos)
  87. return false;
  88. bool const wasEmpty = pci->empty();
  89. if (wasEmpty == true)
  90. pci->setConstructor(REGEX);
  91. size_t archfound = pattern.find_last_of(':');
  92. std::string arch = "native";
  93. if (archfound != std::string::npos) {
  94. arch = pattern.substr(archfound+1);
  95. if (arch.find_first_of(isregex) == std::string::npos)
  96. pattern.erase(archfound);
  97. else
  98. arch = "native";
  99. }
  100. if (unlikely(Cache.GetPkgCache() == 0))
  101. return false;
  102. APT::CacheFilter::PackageNameMatchesRegEx regexfilter(pattern);
  103. bool found = false;
  104. for (pkgCache::GrpIterator Grp = Cache.GetPkgCache()->GrpBegin(); Grp.end() == false; ++Grp) {
  105. if (regexfilter(Grp) == false)
  106. continue;
  107. pkgCache::PkgIterator Pkg = Grp.FindPkg(arch);
  108. if (Pkg.end() == true) {
  109. if (archfound == std::string::npos) {
  110. std::vector<std::string> archs = APT::Configuration::getArchitectures();
  111. for (std::vector<std::string>::const_iterator a = archs.begin();
  112. a != archs.end() && Pkg.end() != true; ++a)
  113. Pkg = Grp.FindPkg(*a);
  114. }
  115. if (Pkg.end() == true)
  116. continue;
  117. }
  118. pci->insert(Pkg);
  119. helper.showRegExSelection(Pkg, pattern);
  120. found = true;
  121. }
  122. if (found == false) {
  123. helper.canNotFindRegEx(pci, Cache, pattern);
  124. pci->setConstructor(UNKNOWN);
  125. return false;
  126. }
  127. if (wasEmpty == false && pci->getConstructor() != UNKNOWN)
  128. pci->setConstructor(UNKNOWN);
  129. return true;
  130. }
  131. /*}}}*/
  132. // FromName - Returns the package defined by this string /*{{{*/
  133. pkgCache::PkgIterator PackageContainerInterface::FromName(pkgCacheFile &Cache,
  134. std::string const &str, CacheSetHelper &helper) {
  135. std::string pkg = str;
  136. size_t archfound = pkg.find_last_of(':');
  137. std::string arch;
  138. if (archfound != std::string::npos) {
  139. arch = pkg.substr(archfound+1);
  140. pkg.erase(archfound);
  141. }
  142. if (Cache.GetPkgCache() == 0)
  143. return pkgCache::PkgIterator(Cache, 0);
  144. pkgCache::PkgIterator Pkg(Cache, 0);
  145. if (arch.empty() == true) {
  146. pkgCache::GrpIterator Grp = Cache.GetPkgCache()->FindGrp(pkg);
  147. if (Grp.end() == false)
  148. Pkg = Grp.FindPreferredPkg();
  149. } else
  150. Pkg = Cache.GetPkgCache()->FindPkg(pkg, arch);
  151. if (Pkg.end() == true)
  152. return helper.canNotFindPkgName(Cache, str);
  153. return Pkg;
  154. }
  155. /*}}}*/
  156. // FromGroup - Returns the package defined by this string /*{{{*/
  157. bool PackageContainerInterface::FromGroup(PackageContainerInterface * const pci, pkgCacheFile &Cache,
  158. std::string pkg, CacheSetHelper &helper) {
  159. if (unlikely(Cache.GetPkgCache() == 0))
  160. return false;
  161. size_t const archfound = pkg.find_last_of(':');
  162. std::string arch;
  163. if (archfound != std::string::npos) {
  164. arch = pkg.substr(archfound+1);
  165. pkg.erase(archfound);
  166. }
  167. pkgCache::GrpIterator Grp = Cache.GetPkgCache()->FindGrp(pkg);
  168. if (Grp.end() == false) {
  169. if (arch.empty() == true) {
  170. pkgCache::PkgIterator Pkg = Grp.FindPreferredPkg();
  171. if (Pkg.end() == false)
  172. {
  173. pci->insert(Pkg);
  174. return true;
  175. }
  176. } else {
  177. bool found = false;
  178. // for 'linux-any' return the first package matching, for 'linux-*' return all matches
  179. bool const isGlobal = arch.find('*') != std::string::npos;
  180. APT::CacheFilter::PackageArchitectureMatchesSpecification pams(arch);
  181. for (pkgCache::PkgIterator Pkg = Grp.PackageList(); Pkg.end() == false; Pkg = Grp.NextPkg(Pkg)) {
  182. if (pams(Pkg) == false)
  183. continue;
  184. pci->insert(Pkg);
  185. found = true;
  186. if (isGlobal == false)
  187. break;
  188. }
  189. if (found == true)
  190. return true;
  191. }
  192. }
  193. pkgCache::PkgIterator Pkg = helper.canNotFindPkgName(Cache, pkg);
  194. if (Pkg.end() == true)
  195. return false;
  196. pci->insert(Pkg);
  197. return true;
  198. }
  199. /*}}}*/
  200. // FromString - Return all packages matching a specific string /*{{{*/
  201. bool PackageContainerInterface::FromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &str, CacheSetHelper &helper) {
  202. bool found = true;
  203. _error->PushToStack();
  204. if (FromGroup(pci, Cache, str, helper) == false &&
  205. FromTask(pci, Cache, str, helper) == false &&
  206. FromRegEx(pci, Cache, str, helper) == false)
  207. {
  208. helper.canNotFindPackage(pci, Cache, str);
  209. found = false;
  210. }
  211. if (found == true)
  212. _error->RevertToStack();
  213. else
  214. _error->MergeWithStack();
  215. return found;
  216. }
  217. /*}}}*/
  218. // FromCommandLine - Return all packages specified on commandline /*{{{*/
  219. bool PackageContainerInterface::FromCommandLine(PackageContainerInterface * const pci, pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper) {
  220. bool found = false;
  221. for (const char **I = cmdline; *I != 0; ++I)
  222. found |= PackageContainerInterface::FromString(pci, Cache, *I, helper);
  223. return found;
  224. }
  225. /*}}}*/
  226. // FromModifierCommandLine - helper doing the work for PKG:GroupedFromCommandLine /*{{{*/
  227. bool PackageContainerInterface::FromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci,
  228. pkgCacheFile &Cache, const char * cmdline,
  229. std::list<Modifier> const &mods, CacheSetHelper &helper) {
  230. std::string str = cmdline;
  231. unsigned short fallback = modID;
  232. bool modifierPresent = false;
  233. for (std::list<Modifier>::const_iterator mod = mods.begin();
  234. mod != mods.end(); ++mod) {
  235. size_t const alength = strlen(mod->Alias);
  236. switch(mod->Pos) {
  237. case Modifier::POSTFIX:
  238. if (str.compare(str.length() - alength, alength,
  239. mod->Alias, 0, alength) != 0)
  240. continue;
  241. str.erase(str.length() - alength);
  242. modID = mod->ID;
  243. break;
  244. case Modifier::PREFIX:
  245. continue;
  246. case Modifier::NONE:
  247. continue;
  248. }
  249. modifierPresent = true;
  250. break;
  251. }
  252. if (modifierPresent == true) {
  253. bool const errors = helper.showErrors(false);
  254. pkgCache::PkgIterator Pkg = FromName(Cache, cmdline, helper);
  255. helper.showErrors(errors);
  256. if (Pkg.end() == false) {
  257. pci->insert(Pkg);
  258. modID = fallback;
  259. return true;
  260. }
  261. }
  262. return FromString(pci, Cache, str, helper);
  263. }
  264. /*}}}*/
  265. // FromModifierCommandLine - helper doing the work for VER:GroupedFromCommandLine /*{{{*/
  266. bool VersionContainerInterface::FromModifierCommandLine(unsigned short &modID,
  267. VersionContainerInterface * const vci,
  268. pkgCacheFile &Cache, const char * cmdline,
  269. std::list<Modifier> const &mods,
  270. CacheSetHelper &helper) {
  271. Version select = NEWEST;
  272. std::string str = cmdline;
  273. bool modifierPresent = false;
  274. unsigned short fallback = modID;
  275. for (std::list<Modifier>::const_iterator mod = mods.begin();
  276. mod != mods.end(); ++mod) {
  277. if (modID == fallback && mod->ID == fallback)
  278. select = mod->SelectVersion;
  279. size_t const alength = strlen(mod->Alias);
  280. switch(mod->Pos) {
  281. case Modifier::POSTFIX:
  282. if (str.compare(str.length() - alength, alength,
  283. mod->Alias, 0, alength) != 0)
  284. continue;
  285. str.erase(str.length() - alength);
  286. modID = mod->ID;
  287. select = mod->SelectVersion;
  288. break;
  289. case Modifier::PREFIX:
  290. continue;
  291. case Modifier::NONE:
  292. continue;
  293. }
  294. modifierPresent = true;
  295. break;
  296. }
  297. if (modifierPresent == true) {
  298. bool const errors = helper.showErrors(false);
  299. bool const found = VersionContainerInterface::FromString(vci, Cache, cmdline, select, helper, true);
  300. helper.showErrors(errors);
  301. if (found == true) {
  302. modID = fallback;
  303. return true;
  304. }
  305. }
  306. return FromString(vci, Cache, str, select, helper);
  307. }
  308. /*}}}*/
  309. // FromCommandLine - Return all versions specified on commandline /*{{{*/
  310. bool VersionContainerInterface::FromCommandLine(VersionContainerInterface * const vci,
  311. pkgCacheFile &Cache, const char **cmdline,
  312. Version const &fallback, CacheSetHelper &helper) {
  313. bool found = false;
  314. for (const char **I = cmdline; *I != 0; ++I)
  315. found |= VersionContainerInterface::FromString(vci, Cache, *I, fallback, helper);
  316. return found;
  317. }
  318. /*}}}*/
  319. // FromString - Returns all versions spedcified by a string /*{{{*/
  320. bool VersionContainerInterface::FromString(VersionContainerInterface * const vci,
  321. pkgCacheFile &Cache, std::string pkg,
  322. Version const &fallback, CacheSetHelper &helper,
  323. bool const onlyFromName) {
  324. std::string ver;
  325. bool verIsRel = false;
  326. size_t const vertag = pkg.find_last_of("/=");
  327. if (vertag != std::string::npos) {
  328. ver = pkg.substr(vertag+1);
  329. verIsRel = (pkg[vertag] == '/');
  330. pkg.erase(vertag);
  331. }
  332. PackageSet pkgset;
  333. if (onlyFromName == false)
  334. PackageContainerInterface::FromString(&pkgset, Cache, pkg, helper);
  335. else {
  336. pkgset.insert(PackageContainerInterface::FromName(Cache, pkg, helper));
  337. }
  338. bool errors = true;
  339. if (pkgset.getConstructor() != PackageSet::UNKNOWN)
  340. errors = helper.showErrors(false);
  341. bool found = false;
  342. for (PackageSet::const_iterator P = pkgset.begin();
  343. P != pkgset.end(); ++P) {
  344. if (vertag == std::string::npos) {
  345. found |= VersionContainerInterface::FromPackage(vci, Cache, P, fallback, helper);
  346. continue;
  347. }
  348. pkgCache::VerIterator V;
  349. if (ver == "installed")
  350. V = getInstalledVer(Cache, P, helper);
  351. else if (ver == "candidate")
  352. V = getCandidateVer(Cache, P, helper);
  353. else if (ver == "newest") {
  354. if (P->VersionList != 0)
  355. V = P.VersionList();
  356. else
  357. V = helper.canNotFindNewestVer(Cache, P);
  358. } else {
  359. pkgVersionMatch Match(ver, (verIsRel == true ? pkgVersionMatch::Release :
  360. pkgVersionMatch::Version));
  361. V = Match.Find(P);
  362. if (V.end() == true) {
  363. if (verIsRel == true)
  364. _error->Error(_("Release '%s' for '%s' was not found"),
  365. ver.c_str(), P.FullName(true).c_str());
  366. else
  367. _error->Error(_("Version '%s' for '%s' was not found"),
  368. ver.c_str(), P.FullName(true).c_str());
  369. continue;
  370. }
  371. }
  372. if (V.end() == true)
  373. continue;
  374. helper.showSelectedVersion(P, V, ver, verIsRel);
  375. vci->insert(V);
  376. found = true;
  377. }
  378. if (pkgset.getConstructor() != PackageSet::UNKNOWN)
  379. helper.showErrors(errors);
  380. return found;
  381. }
  382. /*}}}*/
  383. // FromPackage - versions from package based on fallback /*{{{*/
  384. bool VersionContainerInterface::FromPackage(VersionContainerInterface * const vci,
  385. pkgCacheFile &Cache,
  386. pkgCache::PkgIterator const &P,
  387. Version const &fallback,
  388. CacheSetHelper &helper) {
  389. pkgCache::VerIterator V;
  390. bool showErrors;
  391. bool found = false;
  392. switch(fallback) {
  393. case ALL:
  394. if (P->VersionList != 0)
  395. for (V = P.VersionList(); V.end() != true; ++V)
  396. found |= vci->insert(V);
  397. else
  398. helper.canNotFindAllVer(vci, Cache, P);
  399. break;
  400. case CANDANDINST:
  401. found |= vci->insert(getInstalledVer(Cache, P, helper));
  402. found |= vci->insert(getCandidateVer(Cache, P, helper));
  403. break;
  404. case CANDIDATE:
  405. found |= vci->insert(getCandidateVer(Cache, P, helper));
  406. break;
  407. case INSTALLED:
  408. found |= vci->insert(getInstalledVer(Cache, P, helper));
  409. break;
  410. case CANDINST:
  411. showErrors = helper.showErrors(false);
  412. V = getCandidateVer(Cache, P, helper);
  413. if (V.end() == true)
  414. V = getInstalledVer(Cache, P, helper);
  415. helper.showErrors(showErrors);
  416. if (V.end() == false)
  417. found |= vci->insert(V);
  418. else
  419. helper.canNotFindInstCandVer(vci, Cache, P);
  420. break;
  421. case INSTCAND:
  422. showErrors = helper.showErrors(false);
  423. V = getInstalledVer(Cache, P, helper);
  424. if (V.end() == true)
  425. V = getCandidateVer(Cache, P, helper);
  426. helper.showErrors(showErrors);
  427. if (V.end() == false)
  428. found |= vci->insert(V);
  429. else
  430. helper.canNotFindInstCandVer(vci, Cache, P);
  431. break;
  432. case NEWEST:
  433. if (P->VersionList != 0)
  434. found |= vci->insert(P.VersionList());
  435. else
  436. helper.canNotFindNewestVer(Cache, P);
  437. break;
  438. }
  439. return found;
  440. }
  441. /*}}}*/
  442. // getCandidateVer - Returns the candidate version of the given package /*{{{*/
  443. pkgCache::VerIterator VersionContainerInterface::getCandidateVer(pkgCacheFile &Cache,
  444. pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper) {
  445. pkgCache::VerIterator Cand;
  446. if (Cache.IsPolicyBuilt() == true || Cache.IsDepCacheBuilt() == false) {
  447. if (unlikely(Cache.GetPolicy() == 0))
  448. return pkgCache::VerIterator(Cache);
  449. Cand = Cache.GetPolicy()->GetCandidateVer(Pkg);
  450. } else {
  451. Cand = Cache[Pkg].CandidateVerIter(Cache);
  452. }
  453. if (Cand.end() == true)
  454. return helper.canNotFindCandidateVer(Cache, Pkg);
  455. return Cand;
  456. }
  457. /*}}}*/
  458. // getInstalledVer - Returns the installed version of the given package /*{{{*/
  459. pkgCache::VerIterator VersionContainerInterface::getInstalledVer(pkgCacheFile &Cache,
  460. pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper) {
  461. if (Pkg->CurrentVer == 0)
  462. return helper.canNotFindInstalledVer(Cache, Pkg);
  463. return Pkg.CurrentVer();
  464. }
  465. /*}}}*/
  466. // canNotFindPkgName - handle the case no package has this name /*{{{*/
  467. pkgCache::PkgIterator CacheSetHelper::canNotFindPkgName(pkgCacheFile &Cache,
  468. std::string const &str) {
  469. if (ShowError == true)
  470. _error->Insert(ErrorType, _("Unable to locate package %s"), str.c_str());
  471. return pkgCache::PkgIterator(Cache, 0);
  472. }
  473. /*}}}*/
  474. // canNotFindTask - handle the case no package is found for a task /*{{{*/
  475. void CacheSetHelper::canNotFindTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern) {
  476. if (ShowError == true)
  477. _error->Insert(ErrorType, _("Couldn't find task '%s'"), pattern.c_str());
  478. }
  479. /*}}}*/
  480. // canNotFindRegEx - handle the case no package is found by a regex /*{{{*/
  481. void CacheSetHelper::canNotFindRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern) {
  482. if (ShowError == true)
  483. _error->Insert(ErrorType, _("Couldn't find any package by regex '%s'"), pattern.c_str());
  484. }
  485. /*}}}*/
  486. // canNotFindPackage - handle the case no package is found from a string/*{{{*/
  487. void CacheSetHelper::canNotFindPackage(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &str) {
  488. }
  489. /*}}}*/
  490. // canNotFindAllVer /*{{{*/
  491. void CacheSetHelper::canNotFindAllVer(VersionContainerInterface * const vci, pkgCacheFile &Cache,
  492. pkgCache::PkgIterator const &Pkg) {
  493. if (ShowError == true)
  494. _error->Insert(ErrorType, _("Can't select versions from package '%s' as it is purely virtual"), Pkg.FullName(true).c_str());
  495. }
  496. /*}}}*/
  497. // canNotFindInstCandVer /*{{{*/
  498. void CacheSetHelper::canNotFindInstCandVer(VersionContainerInterface * const vci, pkgCacheFile &Cache,
  499. pkgCache::PkgIterator const &Pkg) {
  500. if (ShowError == true)
  501. _error->Insert(ErrorType, _("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str());
  502. }
  503. /*}}}*/
  504. // canNotFindInstCandVer /*{{{*/
  505. void CacheSetHelper::canNotFindCandInstVer(VersionContainerInterface * const vci, pkgCacheFile &Cache,
  506. pkgCache::PkgIterator const &Pkg) {
  507. if (ShowError == true)
  508. _error->Insert(ErrorType, _("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str());
  509. }
  510. /*}}}*/
  511. // canNotFindNewestVer /*{{{*/
  512. pkgCache::VerIterator CacheSetHelper::canNotFindNewestVer(pkgCacheFile &Cache,
  513. pkgCache::PkgIterator const &Pkg) {
  514. if (ShowError == true)
  515. _error->Insert(ErrorType, _("Can't select newest version from package '%s' as it is purely virtual"), Pkg.FullName(true).c_str());
  516. return pkgCache::VerIterator(Cache, 0);
  517. }
  518. /*}}}*/
  519. // canNotFindCandidateVer /*{{{*/
  520. pkgCache::VerIterator CacheSetHelper::canNotFindCandidateVer(pkgCacheFile &Cache,
  521. pkgCache::PkgIterator const &Pkg) {
  522. if (ShowError == true)
  523. _error->Insert(ErrorType, _("Can't select candidate version from package %s as it has no candidate"), Pkg.FullName(true).c_str());
  524. return pkgCache::VerIterator(Cache, 0);
  525. }
  526. /*}}}*/
  527. // canNotFindInstalledVer /*{{{*/
  528. pkgCache::VerIterator CacheSetHelper::canNotFindInstalledVer(pkgCacheFile &Cache,
  529. pkgCache::PkgIterator const &Pkg) {
  530. if (ShowError == true)
  531. _error->Insert(ErrorType, _("Can't select installed version from package %s as it is not installed"), Pkg.FullName(true).c_str());
  532. return pkgCache::VerIterator(Cache, 0);
  533. }
  534. /*}}}*/
  535. // showTaskSelection /*{{{*/
  536. void CacheSetHelper::showTaskSelection(pkgCache::PkgIterator const &pkg,
  537. std::string const &pattern) {
  538. }
  539. /*}}}*/
  540. // showRegExSelection /*{{{*/
  541. void CacheSetHelper::showRegExSelection(pkgCache::PkgIterator const &pkg,
  542. std::string const &pattern) {
  543. }
  544. /*}}}*/
  545. // showSelectedVersion /*{{{*/
  546. void CacheSetHelper::showSelectedVersion(pkgCache::PkgIterator const &Pkg,
  547. pkgCache::VerIterator const Ver,
  548. std::string const &ver,
  549. bool const verIsRel) {
  550. }
  551. /*}}}*/
  552. }