deblistparser.cc 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: deblistparser.cc,v 1.29.2.5 2004/01/06 01:43:44 mdz Exp $
  4. /* ######################################################################
  5. Package Cache Generator - Generator for the cache structure.
  6. This builds the cache structure from the abstract package list parser.
  7. ##################################################################### */
  8. /*}}}*/
  9. // Include Files /*{{{*/
  10. #include <apt-pkg/deblistparser.h>
  11. #include <apt-pkg/error.h>
  12. #include <apt-pkg/configuration.h>
  13. #include <apt-pkg/aptconfiguration.h>
  14. #include <apt-pkg/strutl.h>
  15. #include <apt-pkg/crc-16.h>
  16. #include <apt-pkg/md5.h>
  17. #include <ctype.h>
  18. #include <system.h>
  19. /*}}}*/
  20. static debListParser::WordList PrioList[] = {{"important",pkgCache::State::Important},
  21. {"required",pkgCache::State::Required},
  22. {"standard",pkgCache::State::Standard},
  23. {"optional",pkgCache::State::Optional},
  24. {"extra",pkgCache::State::Extra},
  25. {}};
  26. // ListParser::debListParser - Constructor /*{{{*/
  27. // ---------------------------------------------------------------------
  28. /* */
  29. debListParser::debListParser(FileFd *File) : Tags(File)
  30. {
  31. Arch = _config->Find("APT::architecture");
  32. }
  33. /*}}}*/
  34. // ListParser::UniqFindTagWrite - Find the tag and write a unq string /*{{{*/
  35. // ---------------------------------------------------------------------
  36. /* */
  37. unsigned long debListParser::UniqFindTagWrite(const char *Tag)
  38. {
  39. const char *Start;
  40. const char *Stop;
  41. if (Section.Find(Tag,Start,Stop) == false)
  42. return 0;
  43. return WriteUniqString(Start,Stop - Start);
  44. }
  45. /*}}}*/
  46. // ListParser::Package - Return the package name /*{{{*/
  47. // ---------------------------------------------------------------------
  48. /* This is to return the name of the package this section describes */
  49. string debListParser::Package()
  50. {
  51. string Result = Section.FindS("Package");
  52. if (Result.empty() == true)
  53. _error->Error("Encountered a section with no Package: header");
  54. return Result;
  55. }
  56. /*}}}*/
  57. // ListParser::Version - Return the version string /*{{{*/
  58. // ---------------------------------------------------------------------
  59. /* This is to return the string describing the version in debian form,
  60. epoch:upstream-release. If this returns the blank string then the
  61. entry is assumed to only describe package properties */
  62. string debListParser::Version()
  63. {
  64. return Section.FindS("Version");
  65. }
  66. /*}}}*/
  67. // ListParser::NewVersion - Fill in the version structure /*{{{*/
  68. // ---------------------------------------------------------------------
  69. /* */
  70. bool debListParser::NewVersion(pkgCache::VerIterator Ver)
  71. {
  72. // Parse the section
  73. Ver->Section = UniqFindTagWrite("Section");
  74. Ver->Arch = UniqFindTagWrite("Architecture");
  75. // Archive Size
  76. Ver->Size = (unsigned)Section.FindI("Size");
  77. // Unpacked Size (in K)
  78. Ver->InstalledSize = (unsigned)Section.FindI("Installed-Size");
  79. Ver->InstalledSize *= 1024;
  80. // Priority
  81. const char *Start;
  82. const char *Stop;
  83. if (Section.Find("Priority",Start,Stop) == true)
  84. {
  85. if (GrabWord(string(Start,Stop-Start),PrioList,Ver->Priority) == false)
  86. Ver->Priority = pkgCache::State::Extra;
  87. }
  88. if (ParseDepends(Ver,"Depends",pkgCache::Dep::Depends) == false)
  89. return false;
  90. if (ParseDepends(Ver,"Pre-Depends",pkgCache::Dep::PreDepends) == false)
  91. return false;
  92. if (ParseDepends(Ver,"Suggests",pkgCache::Dep::Suggests) == false)
  93. return false;
  94. if (ParseDepends(Ver,"Recommends",pkgCache::Dep::Recommends) == false)
  95. return false;
  96. if (ParseDepends(Ver,"Conflicts",pkgCache::Dep::Conflicts) == false)
  97. return false;
  98. if (ParseDepends(Ver,"Breaks",pkgCache::Dep::DpkgBreaks) == false)
  99. return false;
  100. if (ParseDepends(Ver,"Replaces",pkgCache::Dep::Replaces) == false)
  101. return false;
  102. if (ParseDepends(Ver,"Enhances",pkgCache::Dep::Enhances) == false)
  103. return false;
  104. // Obsolete.
  105. if (ParseDepends(Ver,"Optional",pkgCache::Dep::Suggests) == false)
  106. return false;
  107. if (ParseProvides(Ver) == false)
  108. return false;
  109. return true;
  110. }
  111. /*}}}*/
  112. // ListParser::Description - Return the description string /*{{{*/
  113. // ---------------------------------------------------------------------
  114. /* This is to return the string describing the package in debian
  115. form. If this returns the blank string then the entry is assumed to
  116. only describe package properties */
  117. string debListParser::Description()
  118. {
  119. string const lang = DescriptionLanguage();
  120. if (lang.empty())
  121. return Section.FindS("Description");
  122. else
  123. return Section.FindS(string("Description-").append(lang).c_str());
  124. }
  125. /*}}}*/
  126. // ListParser::DescriptionLanguage - Return the description lang string /*{{{*/
  127. // ---------------------------------------------------------------------
  128. /* This is to return the string describing the language of
  129. description. If this returns the blank string then the entry is
  130. assumed to describe original description. */
  131. string debListParser::DescriptionLanguage()
  132. {
  133. if (Section.FindS("Description").empty() == false)
  134. return "";
  135. std::vector<string> const lang = APT::Configuration::getLanguages();
  136. for (std::vector<string>::const_iterator l = lang.begin();
  137. l != lang.end(); l++)
  138. if (Section.FindS(string("Description-").append(*l).c_str()).empty() == false)
  139. return *l;
  140. return "";
  141. }
  142. /*}}}*/
  143. // ListParser::Description - Return the description_md5 MD5SumValue /*{{{*/
  144. // ---------------------------------------------------------------------
  145. /* This is to return the md5 string to allow the check if it is the right
  146. description. If no Description-md5 is found in the section it will be
  147. calculated.
  148. */
  149. MD5SumValue debListParser::Description_md5()
  150. {
  151. string value = Section.FindS("Description-md5");
  152. if (value.empty())
  153. {
  154. MD5Summation md5;
  155. md5.Add((Description() + "\n").c_str());
  156. return md5.Result();
  157. } else
  158. return MD5SumValue(value);
  159. }
  160. /*}}}*/
  161. // ListParser::UsePackage - Update a package structure /*{{{*/
  162. // ---------------------------------------------------------------------
  163. /* This is called to update the package with any new information
  164. that might be found in the section */
  165. bool debListParser::UsePackage(pkgCache::PkgIterator Pkg,
  166. pkgCache::VerIterator Ver)
  167. {
  168. if (Pkg->Section == 0)
  169. Pkg->Section = UniqFindTagWrite("Section");
  170. if (Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false)
  171. return false;
  172. if (Section.FindFlag("Important",Pkg->Flags,pkgCache::Flag::Important) == false)
  173. return false;
  174. if (strcmp(Pkg.Name(),"apt") == 0)
  175. Pkg->Flags |= pkgCache::Flag::Important;
  176. if (ParseStatus(Pkg,Ver) == false)
  177. return false;
  178. return true;
  179. }
  180. /*}}}*/
  181. // ListParser::VersionHash - Compute a unique hash for this version /*{{{*/
  182. // ---------------------------------------------------------------------
  183. /* */
  184. unsigned short debListParser::VersionHash()
  185. {
  186. const char *Sections[] ={"Installed-Size",
  187. "Depends",
  188. "Pre-Depends",
  189. // "Suggests",
  190. // "Recommends",
  191. "Conflicts",
  192. "Breaks",
  193. "Replaces",0};
  194. unsigned long Result = INIT_FCS;
  195. char S[1024];
  196. for (const char **I = Sections; *I != 0; I++)
  197. {
  198. const char *Start;
  199. const char *End;
  200. if (Section.Find(*I,Start,End) == false || End - Start >= (signed)sizeof(S))
  201. continue;
  202. /* Strip out any spaces from the text, this undoes dpkgs reformatting
  203. of certain fields. dpkg also has the rather interesting notion of
  204. reformatting depends operators < -> <= */
  205. char *I = S;
  206. for (; Start != End; Start++)
  207. {
  208. if (isspace(*Start) == 0)
  209. *I++ = tolower_ascii(*Start);
  210. if (*Start == '<' && Start[1] != '<' && Start[1] != '=')
  211. *I++ = '=';
  212. if (*Start == '>' && Start[1] != '>' && Start[1] != '=')
  213. *I++ = '=';
  214. }
  215. Result = AddCRC16(Result,S,I - S);
  216. }
  217. return Result;
  218. }
  219. /*}}}*/
  220. // ListParser::ParseStatus - Parse the status field /*{{{*/
  221. // ---------------------------------------------------------------------
  222. /* Status lines are of the form,
  223. Status: want flag status
  224. want = unknown, install, hold, deinstall, purge
  225. flag = ok, reinstreq, hold, hold-reinstreq
  226. status = not-installed, unpacked, half-configured,
  227. half-installed, config-files, post-inst-failed,
  228. removal-failed, installed
  229. Some of the above are obsolete (I think?) flag = hold-* and
  230. status = post-inst-failed, removal-failed at least.
  231. */
  232. bool debListParser::ParseStatus(pkgCache::PkgIterator Pkg,
  233. pkgCache::VerIterator Ver)
  234. {
  235. const char *Start;
  236. const char *Stop;
  237. if (Section.Find("Status",Start,Stop) == false)
  238. return true;
  239. // Isolate the first word
  240. const char *I = Start;
  241. for(; I < Stop && *I != ' '; I++);
  242. if (I >= Stop || *I != ' ')
  243. return _error->Error("Malformed Status line");
  244. // Process the want field
  245. WordList WantList[] = {{"unknown",pkgCache::State::Unknown},
  246. {"install",pkgCache::State::Install},
  247. {"hold",pkgCache::State::Hold},
  248. {"deinstall",pkgCache::State::DeInstall},
  249. {"purge",pkgCache::State::Purge},
  250. {}};
  251. if (GrabWord(string(Start,I-Start),WantList,Pkg->SelectedState) == false)
  252. return _error->Error("Malformed 1st word in the Status line");
  253. // Isloate the next word
  254. I++;
  255. Start = I;
  256. for(; I < Stop && *I != ' '; I++);
  257. if (I >= Stop || *I != ' ')
  258. return _error->Error("Malformed status line, no 2nd word");
  259. // Process the flag field
  260. WordList FlagList[] = {{"ok",pkgCache::State::Ok},
  261. {"reinstreq",pkgCache::State::ReInstReq},
  262. {"hold",pkgCache::State::HoldInst},
  263. {"hold-reinstreq",pkgCache::State::HoldReInstReq},
  264. {}};
  265. if (GrabWord(string(Start,I-Start),FlagList,Pkg->InstState) == false)
  266. return _error->Error("Malformed 2nd word in the Status line");
  267. // Isloate the last word
  268. I++;
  269. Start = I;
  270. for(; I < Stop && *I != ' '; I++);
  271. if (I != Stop)
  272. return _error->Error("Malformed Status line, no 3rd word");
  273. // Process the flag field
  274. WordList StatusList[] = {{"not-installed",pkgCache::State::NotInstalled},
  275. {"unpacked",pkgCache::State::UnPacked},
  276. {"half-configured",pkgCache::State::HalfConfigured},
  277. {"installed",pkgCache::State::Installed},
  278. {"half-installed",pkgCache::State::HalfInstalled},
  279. {"config-files",pkgCache::State::ConfigFiles},
  280. {"triggers-awaited",pkgCache::State::TriggersAwaited},
  281. {"triggers-pending",pkgCache::State::TriggersPending},
  282. {"post-inst-failed",pkgCache::State::HalfConfigured},
  283. {"removal-failed",pkgCache::State::HalfInstalled},
  284. {}};
  285. if (GrabWord(string(Start,I-Start),StatusList,Pkg->CurrentState) == false)
  286. return _error->Error("Malformed 3rd word in the Status line");
  287. /* A Status line marks the package as indicating the current
  288. version as well. Only if it is actually installed.. Otherwise
  289. the interesting dpkg handling of the status file creates bogus
  290. entries. */
  291. if (!(Pkg->CurrentState == pkgCache::State::NotInstalled ||
  292. Pkg->CurrentState == pkgCache::State::ConfigFiles))
  293. {
  294. if (Ver.end() == true)
  295. _error->Warning("Encountered status field in a non-version description");
  296. else
  297. Pkg->CurrentVer = Ver.Index();
  298. }
  299. return true;
  300. }
  301. const char *debListParser::ConvertRelation(const char *I,unsigned int &Op)
  302. {
  303. // Determine the operator
  304. switch (*I)
  305. {
  306. case '<':
  307. I++;
  308. if (*I == '=')
  309. {
  310. I++;
  311. Op = pkgCache::Dep::LessEq;
  312. break;
  313. }
  314. if (*I == '<')
  315. {
  316. I++;
  317. Op = pkgCache::Dep::Less;
  318. break;
  319. }
  320. // < is the same as <= and << is really Cs < for some reason
  321. Op = pkgCache::Dep::LessEq;
  322. break;
  323. case '>':
  324. I++;
  325. if (*I == '=')
  326. {
  327. I++;
  328. Op = pkgCache::Dep::GreaterEq;
  329. break;
  330. }
  331. if (*I == '>')
  332. {
  333. I++;
  334. Op = pkgCache::Dep::Greater;
  335. break;
  336. }
  337. // > is the same as >= and >> is really Cs > for some reason
  338. Op = pkgCache::Dep::GreaterEq;
  339. break;
  340. case '=':
  341. Op = pkgCache::Dep::Equals;
  342. I++;
  343. break;
  344. // HACK around bad package definitions
  345. default:
  346. Op = pkgCache::Dep::Equals;
  347. break;
  348. }
  349. return I;
  350. }
  351. /*}}}*/
  352. // ListParser::ParseDepends - Parse a dependency element /*{{{*/
  353. // ---------------------------------------------------------------------
  354. /* This parses the dependency elements out of a standard string in place,
  355. bit by bit. */
  356. const char *debListParser::ParseDepends(const char *Start,const char *Stop,
  357. string &Package,string &Ver,
  358. unsigned int &Op, bool const &ParseArchFlags,
  359. bool const &StripMultiArch)
  360. {
  361. // Strip off leading space
  362. for (;Start != Stop && isspace(*Start) != 0; Start++);
  363. // Parse off the package name
  364. const char *I = Start;
  365. for (;I != Stop && isspace(*I) == 0 && *I != '(' && *I != ')' &&
  366. *I != ',' && *I != '|'; I++);
  367. // Malformed, no '('
  368. if (I != Stop && *I == ')')
  369. return 0;
  370. if (I == Start)
  371. return 0;
  372. // Stash the package name
  373. Package.assign(Start,I - Start);
  374. // We don't want to confuse library users which can't handle MultiArch
  375. if (StripMultiArch == true) {
  376. size_t const found = Package.rfind(':');
  377. if (found != string::npos)
  378. Package = Package.substr(0,found);
  379. }
  380. // Skip white space to the '('
  381. for (;I != Stop && isspace(*I) != 0 ; I++);
  382. // Parse a version
  383. if (I != Stop && *I == '(')
  384. {
  385. // Skip the '('
  386. for (I++; I != Stop && isspace(*I) != 0 ; I++);
  387. if (I + 3 >= Stop)
  388. return 0;
  389. I = ConvertRelation(I,Op);
  390. // Skip whitespace
  391. for (;I != Stop && isspace(*I) != 0; I++);
  392. Start = I;
  393. for (;I != Stop && *I != ')'; I++);
  394. if (I == Stop || Start == I)
  395. return 0;
  396. // Skip trailing whitespace
  397. const char *End = I;
  398. for (; End > Start && isspace(End[-1]); End--);
  399. Ver.assign(Start,End-Start);
  400. I++;
  401. }
  402. else
  403. {
  404. Ver.clear();
  405. Op = pkgCache::Dep::NoOp;
  406. }
  407. // Skip whitespace
  408. for (;I != Stop && isspace(*I) != 0; I++);
  409. if (ParseArchFlags == true)
  410. {
  411. string arch = _config->Find("APT::Architecture");
  412. // Parse an architecture
  413. if (I != Stop && *I == '[')
  414. {
  415. // malformed
  416. I++;
  417. if (I == Stop)
  418. return 0;
  419. const char *End = I;
  420. bool Found = false;
  421. bool NegArch = false;
  422. while (I != Stop)
  423. {
  424. // look for whitespace or ending ']'
  425. while (End != Stop && !isspace(*End) && *End != ']')
  426. End++;
  427. if (End == Stop)
  428. return 0;
  429. if (*I == '!')
  430. {
  431. NegArch = true;
  432. I++;
  433. }
  434. if (stringcmp(arch,I,End) == 0)
  435. Found = true;
  436. if (*End++ == ']') {
  437. I = End;
  438. break;
  439. }
  440. I = End;
  441. for (;I != Stop && isspace(*I) != 0; I++);
  442. }
  443. if (NegArch)
  444. Found = !Found;
  445. if (Found == false)
  446. Package = ""; /* not for this arch */
  447. }
  448. // Skip whitespace
  449. for (;I != Stop && isspace(*I) != 0; I++);
  450. }
  451. if (I != Stop && *I == '|')
  452. Op |= pkgCache::Dep::Or;
  453. if (I == Stop || *I == ',' || *I == '|')
  454. {
  455. if (I != Stop)
  456. for (I++; I != Stop && isspace(*I) != 0; I++);
  457. return I;
  458. }
  459. return 0;
  460. }
  461. /*}}}*/
  462. // ListParser::ParseDepends - Parse a dependency list /*{{{*/
  463. // ---------------------------------------------------------------------
  464. /* This is the higher level depends parser. It takes a tag and generates
  465. a complete depends tree for the given version. */
  466. bool debListParser::ParseDepends(pkgCache::VerIterator Ver,
  467. const char *Tag,unsigned int Type)
  468. {
  469. const char *Start;
  470. const char *Stop;
  471. if (Section.Find(Tag,Start,Stop) == false)
  472. return true;
  473. string Package;
  474. string Version;
  475. unsigned int Op;
  476. while (1)
  477. {
  478. Start = ParseDepends(Start,Stop,Package,Version,Op);
  479. if (Start == 0)
  480. return _error->Error("Problem parsing dependency %s",Tag);
  481. if (NewDepends(Ver,Package,Version,Op,Type) == false)
  482. return false;
  483. if (Start == Stop)
  484. break;
  485. }
  486. return true;
  487. }
  488. /*}}}*/
  489. // ListParser::ParseProvides - Parse the provides list /*{{{*/
  490. // ---------------------------------------------------------------------
  491. /* */
  492. bool debListParser::ParseProvides(pkgCache::VerIterator Ver)
  493. {
  494. const char *Start;
  495. const char *Stop;
  496. if (Section.Find("Provides",Start,Stop) == false)
  497. return true;
  498. string Package;
  499. string Version;
  500. unsigned int Op;
  501. while (1)
  502. {
  503. Start = ParseDepends(Start,Stop,Package,Version,Op);
  504. if (Start == 0)
  505. return _error->Error("Problem parsing Provides line");
  506. if (Op != pkgCache::Dep::NoOp) {
  507. _error->Warning("Ignoring Provides line with DepCompareOp for package %s", Package.c_str());
  508. } else {
  509. if (NewProvides(Ver,Package,Version) == false)
  510. return false;
  511. }
  512. if (Start == Stop)
  513. break;
  514. }
  515. return true;
  516. }
  517. /*}}}*/
  518. // ListParser::GrabWord - Matches a word and returns /*{{{*/
  519. // ---------------------------------------------------------------------
  520. /* Looks for a word in a list of words - for ParseStatus */
  521. bool debListParser::GrabWord(string Word,WordList *List,unsigned char &Out)
  522. {
  523. for (unsigned int C = 0; List[C].Str != 0; C++)
  524. {
  525. if (strcasecmp(Word.c_str(),List[C].Str) == 0)
  526. {
  527. Out = List[C].Val;
  528. return true;
  529. }
  530. }
  531. return false;
  532. }
  533. /*}}}*/
  534. // ListParser::Step - Move to the next section in the file /*{{{*/
  535. // ---------------------------------------------------------------------
  536. /* This has to be carefull to only process the correct architecture */
  537. bool debListParser::Step()
  538. {
  539. iOffset = Tags.Offset();
  540. while (Tags.Step(Section) == true)
  541. {
  542. /* See if this is the correct Architecture, if it isn't then we
  543. drop the whole section. A missing arch tag only happens (in theory)
  544. inside the Status file, so that is a positive return */
  545. const char *Start;
  546. const char *Stop;
  547. if (Section.Find("Architecture",Start,Stop) == false)
  548. return true;
  549. if (stringcmp(Arch,Start,Stop) == 0)
  550. return true;
  551. if (stringcmp(Start,Stop,"all") == 0)
  552. return true;
  553. iOffset = Tags.Offset();
  554. }
  555. return false;
  556. }
  557. /*}}}*/
  558. // ListParser::LoadReleaseInfo - Load the release information /*{{{*/
  559. // ---------------------------------------------------------------------
  560. /* */
  561. bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator FileI,
  562. FileFd &File, string component)
  563. {
  564. pkgTagFile Tags(&File, File.Size() + 256); // XXX
  565. pkgTagSection Section;
  566. if (Tags.Step(Section) == false)
  567. return false;
  568. //mvo: I don't think we need to fill that in (it's unused since apt-0.6)
  569. //FileI->Architecture = WriteUniqString(Arch);
  570. // apt-secure does no longer download individual (per-section) Release
  571. // file. to provide Component pinning we use the section name now
  572. FileI->Component = WriteUniqString(component);
  573. const char *Start;
  574. const char *Stop;
  575. if (Section.Find("Suite",Start,Stop) == true)
  576. FileI->Archive = WriteUniqString(Start,Stop - Start);
  577. if (Section.Find("Component",Start,Stop) == true)
  578. FileI->Component = WriteUniqString(Start,Stop - Start);
  579. if (Section.Find("Version",Start,Stop) == true)
  580. FileI->Version = WriteUniqString(Start,Stop - Start);
  581. if (Section.Find("Origin",Start,Stop) == true)
  582. FileI->Origin = WriteUniqString(Start,Stop - Start);
  583. if (Section.Find("Codename",Start,Stop) == true)
  584. FileI->Codename = WriteUniqString(Start,Stop - Start);
  585. if (Section.Find("Label",Start,Stop) == true)
  586. FileI->Label = WriteUniqString(Start,Stop - Start);
  587. if (Section.Find("Architecture",Start,Stop) == true)
  588. FileI->Architecture = WriteUniqString(Start,Stop - Start);
  589. if (Section.FindFlag("NotAutomatic",FileI->Flags,
  590. pkgCache::Flag::NotAutomatic) == false)
  591. _error->Warning("Bad NotAutomatic flag");
  592. return !_error->PendingError();
  593. }
  594. /*}}}*/
  595. // ListParser::GetPrio - Convert the priority from a string /*{{{*/
  596. // ---------------------------------------------------------------------
  597. /* */
  598. unsigned char debListParser::GetPrio(string Str)
  599. {
  600. unsigned char Out;
  601. if (GrabWord(Str,PrioList,Out) == false)
  602. Out = pkgCache::State::Extra;
  603. return Out;
  604. }
  605. /*}}}*/