packagemanager.cc 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: packagemanager.cc,v 1.30 2003/04/27 03:04:15 doogie Exp $
  4. /* ######################################################################
  5. Package Manager - Abstacts the package manager
  6. More work is needed in the area of transitioning provides, ie exim
  7. replacing smail. This can cause interesing side effects.
  8. Other cases involving conflicts+replaces should be tested.
  9. ##################################################################### */
  10. /*}}}*/
  11. // Include Files /*{{{*/
  12. #include <config.h>
  13. #include <apt-pkg/packagemanager.h>
  14. #include <apt-pkg/orderlist.h>
  15. #include <apt-pkg/depcache.h>
  16. #include <apt-pkg/error.h>
  17. #include <apt-pkg/version.h>
  18. #include <apt-pkg/acquire-item.h>
  19. #include <apt-pkg/algorithms.h>
  20. #include <apt-pkg/configuration.h>
  21. #include <apt-pkg/sptr.h>
  22. #include <apt-pkg/macros.h>
  23. #include <apt-pkg/pkgcache.h>
  24. #include <apt-pkg/cacheiterators.h>
  25. #include <apt-pkg/strutl.h>
  26. #include <stddef.h>
  27. #include <list>
  28. #include <string>
  29. #include <iostream>
  30. #include <apti18n.h>
  31. /*}}}*/
  32. using namespace std;
  33. bool pkgPackageManager::SigINTStop = false;
  34. // PM::PackageManager - Constructor /*{{{*/
  35. // ---------------------------------------------------------------------
  36. /* */
  37. pkgPackageManager::pkgPackageManager(pkgDepCache *pCache) : Cache(*pCache),
  38. List(NULL), Res(Incomplete)
  39. {
  40. FileNames = new string[Cache.Head().PackageCount];
  41. Debug = _config->FindB("Debug::pkgPackageManager",false);
  42. NoImmConfigure = !_config->FindB("APT::Immediate-Configure",true);
  43. ImmConfigureAll = _config->FindB("APT::Immediate-Configure-All",false);
  44. }
  45. /*}}}*/
  46. // PM::PackageManager - Destructor /*{{{*/
  47. // ---------------------------------------------------------------------
  48. /* */
  49. pkgPackageManager::~pkgPackageManager()
  50. {
  51. delete List;
  52. delete [] FileNames;
  53. }
  54. /*}}}*/
  55. // PM::GetArchives - Queue the archives for download /*{{{*/
  56. // ---------------------------------------------------------------------
  57. /* */
  58. bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
  59. pkgRecords *Recs)
  60. {
  61. if (CreateOrderList() == false)
  62. return false;
  63. bool const ordering =
  64. _config->FindB("PackageManager::UnpackAll",true) ?
  65. List->OrderUnpack() : List->OrderCritical();
  66. if (ordering == false)
  67. return _error->Error("Internal ordering error");
  68. for (pkgOrderList::iterator I = List->begin(); I != List->end(); ++I)
  69. {
  70. PkgIterator Pkg(Cache,*I);
  71. FileNames[Pkg->ID] = string();
  72. // Skip packages to erase
  73. if (Cache[Pkg].Delete() == true)
  74. continue;
  75. // Skip Packages that need configure only.
  76. if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure &&
  77. Cache[Pkg].Keep() == true)
  78. continue;
  79. // Skip already processed packages
  80. if (List->IsNow(Pkg) == false)
  81. continue;
  82. new pkgAcqArchive(Owner,Sources,Recs,Cache[Pkg].InstVerIter(Cache),
  83. FileNames[Pkg->ID]);
  84. }
  85. return true;
  86. }
  87. /*}}}*/
  88. // PM::FixMissing - Keep all missing packages /*{{{*/
  89. // ---------------------------------------------------------------------
  90. /* This is called to correct the installation when packages could not
  91. be downloaded. */
  92. bool pkgPackageManager::FixMissing()
  93. {
  94. pkgDepCache::ActionGroup group(Cache);
  95. pkgProblemResolver Resolve(&Cache);
  96. List->SetFileList(FileNames);
  97. bool Bad = false;
  98. for (PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
  99. {
  100. if (List->IsMissing(I) == false)
  101. continue;
  102. // Okay, this file is missing and we need it. Mark it for keep
  103. Bad = true;
  104. Cache.MarkKeep(I, false, false);
  105. }
  106. // We have to empty the list otherwise it will not have the new changes
  107. delete List;
  108. List = 0;
  109. if (Bad == false)
  110. return true;
  111. // Now downgrade everything that is broken
  112. return Resolve.ResolveByKeep() == true && Cache.BrokenCount() == 0;
  113. }
  114. /*}}}*/
  115. // PM::ImmediateAdd - Add the immediate flag recursivly /*{{{*/
  116. // ---------------------------------------------------------------------
  117. /* This adds the immediate flag to the pkg and recursively to the
  118. dependendies
  119. */
  120. void pkgPackageManager::ImmediateAdd(PkgIterator I, bool UseInstallVer, unsigned const int &Depth)
  121. {
  122. DepIterator D;
  123. if(UseInstallVer)
  124. {
  125. if(Cache[I].InstallVer == 0)
  126. return;
  127. D = Cache[I].InstVerIter(Cache).DependsList();
  128. } else {
  129. if (I->CurrentVer == 0)
  130. return;
  131. D = I.CurrentVer().DependsList();
  132. }
  133. for ( /* nothing */ ; D.end() == false; ++D)
  134. if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
  135. {
  136. if(!List->IsFlag(D.TargetPkg(), pkgOrderList::Immediate))
  137. {
  138. if(Debug)
  139. clog << OutputInDepth(Depth) << "ImmediateAdd(): Adding Immediate flag to " << D.TargetPkg() << " cause of " << D.DepType() << " " << I.FullName() << endl;
  140. List->Flag(D.TargetPkg(),pkgOrderList::Immediate);
  141. ImmediateAdd(D.TargetPkg(), UseInstallVer, Depth + 1);
  142. }
  143. }
  144. return;
  145. }
  146. /*}}}*/
  147. // PM::CreateOrderList - Create the ordering class /*{{{*/
  148. // ---------------------------------------------------------------------
  149. /* This populates the ordering list with all the packages that are
  150. going to change. */
  151. bool pkgPackageManager::CreateOrderList()
  152. {
  153. if (List != 0)
  154. return true;
  155. delete List;
  156. List = new pkgOrderList(&Cache);
  157. if (Debug && ImmConfigureAll)
  158. clog << "CreateOrderList(): Adding Immediate flag for all packages because of APT::Immediate-Configure-All" << endl;
  159. // Generate the list of affected packages and sort it
  160. for (PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
  161. {
  162. // Ignore no-version packages
  163. if (I->VersionList == 0)
  164. continue;
  165. // Mark the package and its dependends for immediate configuration
  166. if ((((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential) &&
  167. NoImmConfigure == false) || ImmConfigureAll)
  168. {
  169. if(Debug && !ImmConfigureAll)
  170. clog << "CreateOrderList(): Adding Immediate flag for " << I.FullName() << endl;
  171. List->Flag(I,pkgOrderList::Immediate);
  172. if (!ImmConfigureAll) {
  173. // Look for other install packages to make immediate configurea
  174. ImmediateAdd(I, true);
  175. // And again with the current version.
  176. ImmediateAdd(I, false);
  177. }
  178. }
  179. // Not interesting
  180. if ((Cache[I].Keep() == true ||
  181. Cache[I].InstVerIter(Cache) == I.CurrentVer()) &&
  182. I.State() == pkgCache::PkgIterator::NeedsNothing &&
  183. (Cache[I].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall &&
  184. (I.Purge() != false || Cache[I].Mode != pkgDepCache::ModeDelete ||
  185. (Cache[I].iFlags & pkgDepCache::Purge) != pkgDepCache::Purge))
  186. continue;
  187. // Append it to the list
  188. List->push_back(I);
  189. }
  190. return true;
  191. }
  192. /*}}}*/
  193. // PM::DepAlwaysTrue - Returns true if this dep is irrelevant /*{{{*/
  194. // ---------------------------------------------------------------------
  195. /* The restriction on provides is to eliminate the case when provides
  196. are transitioning between valid states [ie exim to smail] */
  197. bool pkgPackageManager::DepAlwaysTrue(DepIterator D)
  198. {
  199. if (D.TargetPkg()->ProvidesList != 0)
  200. return false;
  201. if ((Cache[D] & pkgDepCache::DepInstall) != 0 &&
  202. (Cache[D] & pkgDepCache::DepNow) != 0)
  203. return true;
  204. return false;
  205. }
  206. /*}}}*/
  207. // PM::CheckRConflicts - Look for reverse conflicts /*{{{*/
  208. // ---------------------------------------------------------------------
  209. /* This looks over the reverses for a conflicts line that needs early
  210. removal. */
  211. bool pkgPackageManager::CheckRConflicts(PkgIterator Pkg,DepIterator D,
  212. const char *Ver)
  213. {
  214. for (;D.end() == false; ++D)
  215. {
  216. if (D->Type != pkgCache::Dep::Conflicts &&
  217. D->Type != pkgCache::Dep::Obsoletes)
  218. continue;
  219. // The package hasn't been changed
  220. if (List->IsNow(Pkg) == false)
  221. continue;
  222. // Ignore self conflicts, ignore conflicts from irrelevant versions
  223. if (D.IsIgnorable(Pkg) || D.ParentVer() != D.ParentPkg().CurrentVer())
  224. continue;
  225. if (Cache.VS().CheckDep(Ver,D->CompareOp,D.TargetVer()) == false)
  226. continue;
  227. if (EarlyRemove(D.ParentPkg(), &D) == false)
  228. return _error->Error("Reverse conflicts early remove for package '%s' failed",
  229. Pkg.FullName().c_str());
  230. }
  231. return true;
  232. }
  233. /*}}}*/
  234. // PM::ConfigureAll - Run the all out configuration /*{{{*/
  235. // ---------------------------------------------------------------------
  236. /* This configures every package. It is assumed they are all unpacked and
  237. that the final configuration is valid. This is also used to catch packages
  238. that have not been configured when using ImmConfigureAll */
  239. bool pkgPackageManager::ConfigureAll()
  240. {
  241. pkgOrderList OList(&Cache);
  242. // Populate the order list
  243. for (pkgOrderList::iterator I = List->begin(); I != List->end(); ++I)
  244. if (List->IsFlag(pkgCache::PkgIterator(Cache,*I),
  245. pkgOrderList::UnPacked) == true)
  246. OList.push_back(*I);
  247. if (OList.OrderConfigure() == false)
  248. return false;
  249. std::string const conf = _config->Find("PackageManager::Configure","all");
  250. bool const ConfigurePkgs = (conf == "all");
  251. // Perform the configuring
  252. for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); ++I)
  253. {
  254. PkgIterator Pkg(Cache,*I);
  255. /* Check if the package has been configured, this can happen if SmartConfigure
  256. calls its self */
  257. if (List->IsFlag(Pkg,pkgOrderList::Configured)) continue;
  258. if (ConfigurePkgs == true && SmartConfigure(Pkg, 0) == false) {
  259. if (ImmConfigureAll)
  260. _error->Error(_("Could not perform immediate configuration on '%s'. "
  261. "Please see man 5 apt.conf under APT::Immediate-Configure for details. (%d)"),Pkg.FullName().c_str(),1);
  262. else
  263. _error->Error("Internal error, packages left unconfigured. %s",Pkg.FullName().c_str());
  264. return false;
  265. }
  266. List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States);
  267. }
  268. return true;
  269. }
  270. /*}}}*/
  271. // PM::NonLoopingSmart - helper to avoid loops while calling Smart methods /*{{{*/
  272. // -----------------------------------------------------------------------
  273. /* ensures that a loop of the form A depends B, B depends A (and similar)
  274. is not leading us down into infinite recursion segfault land */
  275. bool pkgPackageManager::NonLoopingSmart(SmartAction const action, pkgCache::PkgIterator &Pkg,
  276. pkgCache::PkgIterator DepPkg, int const Depth, bool const PkgLoop,
  277. bool * const Bad, bool * const Changed)
  278. {
  279. if (PkgLoop == false)
  280. List->Flag(Pkg,pkgOrderList::Loop);
  281. bool success = false;
  282. switch(action)
  283. {
  284. case UNPACK_IMMEDIATE: success = SmartUnPack(DepPkg, true, Depth + 1); break;
  285. case UNPACK: success = SmartUnPack(DepPkg, false, Depth + 1); break;
  286. case CONFIGURE: success = SmartConfigure(DepPkg, Depth + 1); break;
  287. }
  288. if (PkgLoop == false)
  289. List->RmFlag(Pkg,pkgOrderList::Loop);
  290. if (success == false)
  291. return false;
  292. if (Bad != NULL)
  293. *Bad = false;
  294. if (Changed != NULL && List->IsFlag(DepPkg,pkgOrderList::Loop) == false)
  295. *Changed = true;
  296. return true;
  297. }
  298. /*}}}*/
  299. // PM::SmartConfigure - Perform immediate configuration of the pkg /*{{{*/
  300. // ---------------------------------------------------------------------
  301. /* This function tries to put the system in a state where Pkg can be configured.
  302. This involves checking each of Pkg's dependencies and unpacking and
  303. configuring packages where needed. */
  304. bool pkgPackageManager::SmartConfigure(PkgIterator Pkg, int const Depth)
  305. {
  306. // If this is true, only check and correct and dependencies without the Loop flag
  307. bool const PkgLoop = List->IsFlag(Pkg,pkgOrderList::Loop);
  308. if (Debug) {
  309. VerIterator InstallVer = VerIterator(Cache,Cache[Pkg].InstallVer);
  310. clog << OutputInDepth(Depth) << "SmartConfigure " << Pkg.FullName() << " (" << InstallVer.VerStr() << ")";
  311. if (PkgLoop)
  312. clog << " (Only Correct Dependencies)";
  313. clog << endl;
  314. }
  315. VerIterator const instVer = Cache[Pkg].InstVerIter(Cache);
  316. /* Because of the ordered list, most dependencies should be unpacked,
  317. however if there is a loop (A depends on B, B depends on A) this will not
  318. be the case, so check for dependencies before configuring. */
  319. bool Bad = false, Changed = false;
  320. const unsigned int max_loops = _config->FindI("APT::pkgPackageManager::MaxLoopCount", 5000);
  321. unsigned int i=0;
  322. std::list<DepIterator> needConfigure;
  323. do
  324. {
  325. // Check each dependency and see if anything needs to be done
  326. // so that it can be configured
  327. Changed = false;
  328. for (DepIterator D = instVer.DependsList(); D.end() == false; )
  329. {
  330. // Compute a single dependency element (glob or)
  331. pkgCache::DepIterator Start, End;
  332. D.GlobOr(Start,End);
  333. if (End->Type != pkgCache::Dep::Depends)
  334. continue;
  335. Bad = true;
  336. // the first pass checks if we its all good, i.e. if we have
  337. // to do anything at all
  338. for (DepIterator Cur = Start; true; ++Cur)
  339. {
  340. SPtrArray<Version *> VList = Cur.AllTargets();
  341. for (Version **I = VList; *I != 0; ++I)
  342. {
  343. VerIterator Ver(Cache,*I);
  344. PkgIterator DepPkg = Ver.ParentPkg();
  345. // Check if the current version of the package is available and will satisfy this dependency
  346. if (DepPkg.CurrentVer() == Ver && List->IsNow(DepPkg) == true &&
  347. List->IsFlag(DepPkg,pkgOrderList::Removed) == false &&
  348. DepPkg.State() == PkgIterator::NeedsNothing)
  349. {
  350. Bad = false;
  351. break;
  352. }
  353. // Check if the version that is going to be installed will satisfy the dependency
  354. if (Cache[DepPkg].InstallVer != *I || List->IsNow(DepPkg) == false)
  355. continue;
  356. if (PkgLoop == true)
  357. {
  358. if (Debug)
  359. std::clog << OutputInDepth(Depth) << "Package " << Pkg << " loops in SmartConfigure" << std::endl;
  360. Bad = false;
  361. }
  362. }
  363. if (Cur == End || Bad == false)
  364. break;
  365. }
  366. // this dependency is in a good state, so we can stop
  367. if (Bad == false)
  368. {
  369. if (Debug)
  370. std::clog << OutputInDepth(Depth) << "Found ok dep " << D.TargetPkg() << std::endl;
  371. continue;
  372. }
  373. // Check for dependencies that have not been unpacked,
  374. // probably due to loops.
  375. for (DepIterator Cur = Start; true; ++Cur)
  376. {
  377. SPtrArray<Version *> VList = Cur.AllTargets();
  378. for (Version **I = VList; *I != 0; ++I)
  379. {
  380. VerIterator Ver(Cache,*I);
  381. PkgIterator DepPkg = Ver.ParentPkg();
  382. // Check if the current version of the package is available and will satisfy this dependency
  383. if (DepPkg.CurrentVer() == Ver && List->IsNow(DepPkg) == true &&
  384. List->IsFlag(DepPkg,pkgOrderList::Removed) == false &&
  385. DepPkg.State() == PkgIterator::NeedsNothing)
  386. continue;
  387. // Check if the version that is going to be installed will satisfy the dependency
  388. if (Cache[DepPkg].InstallVer != *I || List->IsNow(DepPkg) == false)
  389. continue;
  390. if (PkgLoop == true)
  391. {
  392. if (Debug)
  393. std::clog << OutputInDepth(Depth) << "Package " << Pkg << " loops in SmartConfigure" << std::endl;
  394. Bad = false;
  395. }
  396. else
  397. {
  398. if (Debug)
  399. clog << OutputInDepth(Depth) << "Unpacking " << DepPkg.FullName() << " to avoid loop " << Cur << endl;
  400. if (NonLoopingSmart(UNPACK_IMMEDIATE, Pkg, DepPkg, Depth, PkgLoop, &Bad, &Changed) == false)
  401. return false;
  402. }
  403. // at this point we either unpacked a Dep or we are in a loop,
  404. // no need to unpack a second one
  405. break;
  406. }
  407. if (Cur == End || Bad == false)
  408. break;
  409. }
  410. if (Bad == false)
  411. continue;
  412. needConfigure.push_back(Start);
  413. }
  414. if (i++ > max_loops)
  415. return _error->Error("Internal error: MaxLoopCount reached in SmartUnPack (1) for %s, aborting", Pkg.FullName().c_str());
  416. } while (Changed == true);
  417. // now go over anything that needs configuring
  418. Bad = false, Changed = false, i = 0;
  419. do
  420. {
  421. Changed = false;
  422. for (std::list<DepIterator>::const_iterator D = needConfigure.begin(); D != needConfigure.end(); ++D)
  423. {
  424. // Compute a single dependency element (glob or) without modifying D
  425. pkgCache::DepIterator Start, End;
  426. {
  427. pkgCache::DepIterator Discard = *D;
  428. Discard.GlobOr(Start,End);
  429. }
  430. if (End->Type != pkgCache::Dep::Depends)
  431. continue;
  432. Bad = true;
  433. // Search for dependencies which are unpacked but aren't configured yet (maybe loops)
  434. for (DepIterator Cur = Start; true; ++Cur)
  435. {
  436. SPtrArray<Version *> VList = Cur.AllTargets();
  437. for (Version **I = VList; *I != 0; ++I)
  438. {
  439. VerIterator Ver(Cache,*I);
  440. PkgIterator DepPkg = Ver.ParentPkg();
  441. // Check if the version that is going to be installed will satisfy the dependency
  442. if (Cache[DepPkg].InstallVer != *I)
  443. continue;
  444. if (List->IsFlag(DepPkg,pkgOrderList::UnPacked))
  445. {
  446. if (List->IsFlag(DepPkg,pkgOrderList::Loop) && PkgLoop)
  447. {
  448. // This dependency has already been dealt with by another SmartConfigure on Pkg
  449. Bad = false;
  450. break;
  451. }
  452. if (Debug)
  453. std::clog << OutputInDepth(Depth) << "Configure already unpacked " << DepPkg << std::endl;
  454. if (NonLoopingSmart(CONFIGURE, Pkg, DepPkg, Depth, PkgLoop, &Bad, &Changed) == false)
  455. return false;
  456. break;
  457. }
  458. else if (List->IsFlag(DepPkg,pkgOrderList::Configured))
  459. {
  460. Bad = false;
  461. break;
  462. }
  463. }
  464. if (Cur == End || Bad == false)
  465. break;
  466. }
  467. if (Bad == true && Changed == false && Debug == true)
  468. std::clog << OutputInDepth(Depth) << "Could not satisfy " << *D << std::endl;
  469. }
  470. if (i++ > max_loops)
  471. return _error->Error("Internal error: MaxLoopCount reached in SmartUnPack (2) for %s, aborting", Pkg.FullName().c_str());
  472. } while (Changed == true);
  473. if (Bad == true)
  474. return _error->Error(_("Could not configure '%s'. "),Pkg.FullName().c_str());
  475. if (PkgLoop) return true;
  476. static std::string const conf = _config->Find("PackageManager::Configure","all");
  477. static bool const ConfigurePkgs = (conf == "all" || conf == "smart");
  478. if (List->IsFlag(Pkg,pkgOrderList::Configured))
  479. return _error->Error("Internal configure error on '%s'.", Pkg.FullName().c_str());
  480. if (ConfigurePkgs == true && Configure(Pkg) == false)
  481. return false;
  482. List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States);
  483. if ((Cache[Pkg].InstVerIter(Cache)->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same)
  484. for (PkgIterator P = Pkg.Group().PackageList();
  485. P.end() == false; P = Pkg.Group().NextPkg(P))
  486. {
  487. if (Pkg == P || List->IsFlag(P,pkgOrderList::Configured) == true ||
  488. List->IsFlag(P,pkgOrderList::UnPacked) == false ||
  489. Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer &&
  490. (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall))
  491. continue;
  492. if (SmartConfigure(P, (Depth +1)) == false)
  493. return false;
  494. }
  495. // Sanity Check
  496. if (List->IsFlag(Pkg,pkgOrderList::Configured) == false)
  497. return _error->Error(_("Could not configure '%s'. "),Pkg.FullName().c_str());
  498. return true;
  499. }
  500. /*}}}*/
  501. // PM::EarlyRemove - Perform removal of packages before their time /*{{{*/
  502. // ---------------------------------------------------------------------
  503. /* This is called to deal with conflicts arising from unpacking */
  504. bool pkgPackageManager::EarlyRemove(PkgIterator Pkg)
  505. {
  506. return EarlyRemove(Pkg, NULL);
  507. }
  508. bool pkgPackageManager::EarlyRemove(PkgIterator Pkg, DepIterator const * const Dep)
  509. {
  510. if (List->IsNow(Pkg) == false)
  511. return true;
  512. // Already removed it
  513. if (List->IsFlag(Pkg,pkgOrderList::Removed) == true)
  514. return true;
  515. // Woops, it will not be re-installed!
  516. if (List->IsFlag(Pkg,pkgOrderList::InList) == false)
  517. return false;
  518. // these breaks on M-A:same packages can be dealt with. They 'loop' by design
  519. if (Dep != NULL && (*Dep)->Type == pkgCache::Dep::DpkgBreaks && Dep->IsMultiArchImplicit() == true)
  520. return true;
  521. // Essential packages get special treatment
  522. bool IsEssential = false;
  523. if ((Pkg->Flags & pkgCache::Flag::Essential) != 0 ||
  524. (Pkg->Flags & pkgCache::Flag::Important) != 0)
  525. IsEssential = true;
  526. /* Check for packages that are the dependents of essential packages and
  527. promote them too */
  528. if (Pkg->CurrentVer != 0)
  529. {
  530. for (pkgCache::DepIterator D = Pkg.RevDependsList(); D.end() == false &&
  531. IsEssential == false; ++D)
  532. if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
  533. if ((D.ParentPkg()->Flags & pkgCache::Flag::Essential) != 0 ||
  534. (D.ParentPkg()->Flags & pkgCache::Flag::Important) != 0)
  535. IsEssential = true;
  536. }
  537. if (IsEssential == true)
  538. {
  539. if (_config->FindB("APT::Force-LoopBreak",false) == false)
  540. return _error->Error(_("This installation run will require temporarily "
  541. "removing the essential package %s due to a "
  542. "Conflicts/Pre-Depends loop. This is often bad, "
  543. "but if you really want to do it, activate the "
  544. "APT::Force-LoopBreak option."),Pkg.FullName().c_str());
  545. }
  546. // dpkg will auto-deconfigure it, no need for the big remove hammer
  547. else if (Dep != NULL && (*Dep)->Type == pkgCache::Dep::DpkgBreaks)
  548. return true;
  549. bool Res = SmartRemove(Pkg);
  550. if (Cache[Pkg].Delete() == false)
  551. List->Flag(Pkg,pkgOrderList::Removed,pkgOrderList::States);
  552. return Res;
  553. }
  554. /*}}}*/
  555. // PM::SmartRemove - Removal Helper /*{{{*/
  556. // ---------------------------------------------------------------------
  557. /* */
  558. bool pkgPackageManager::SmartRemove(PkgIterator Pkg)
  559. {
  560. if (List->IsNow(Pkg) == false)
  561. return true;
  562. List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States);
  563. return Remove(Pkg,(Cache[Pkg].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge);
  564. }
  565. /*}}}*/
  566. // PM::SmartUnPack - Install helper /*{{{*/
  567. // ---------------------------------------------------------------------
  568. /* This puts the system in a state where it can Unpack Pkg, if Pkg is already
  569. unpacked, or when it has been unpacked, if Immediate==true it configures it. */
  570. bool pkgPackageManager::SmartUnPack(PkgIterator Pkg)
  571. {
  572. return SmartUnPack(Pkg, true, 0);
  573. }
  574. bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int const Depth)
  575. {
  576. bool PkgLoop = List->IsFlag(Pkg,pkgOrderList::Loop);
  577. if (Debug) {
  578. clog << OutputInDepth(Depth) << "SmartUnPack " << Pkg.FullName();
  579. VerIterator InstallVer = VerIterator(Cache,Cache[Pkg].InstallVer);
  580. if (Pkg.CurrentVer() == 0)
  581. clog << " (install version " << InstallVer.VerStr() << ")";
  582. else
  583. clog << " (replace version " << Pkg.CurrentVer().VerStr() << " with " << InstallVer.VerStr() << ")";
  584. if (PkgLoop)
  585. clog << " (Only Perform PreUnpack Checks)";
  586. if (Immediate)
  587. clog << " immediately";
  588. clog << endl;
  589. }
  590. VerIterator const instVer = Cache[Pkg].InstVerIter(Cache);
  591. /* PreUnpack Checks: This loop checks and attempts to rectify any problems that would prevent the package being unpacked.
  592. It addresses: PreDepends, Conflicts, Obsoletes and Breaks (DpkgBreaks). Any resolutions that do not require it should
  593. avoid configuration (calling SmartUnpack with Immediate=true), this is because when unpacking some packages with
  594. complex dependency structures, trying to configure some packages while breaking the loops can complicate things.
  595. This will be either dealt with if the package is configured as a dependency of Pkg (if and when Pkg is configured),
  596. or by the ConfigureAll call at the end of the for loop in OrderInstall. */
  597. bool SomethingBad = false, Changed = false;
  598. bool couldBeTemporaryRemoved = Depth != 0 && List->IsFlag(Pkg,pkgOrderList::Removed) == false;
  599. const unsigned int max_loops = _config->FindI("APT::pkgPackageManager::MaxLoopCount", 5000);
  600. unsigned int i = 0;
  601. do
  602. {
  603. Changed = false;
  604. for (DepIterator D = instVer.DependsList(); D.end() == false; )
  605. {
  606. // Compute a single dependency element (glob or)
  607. pkgCache::DepIterator Start, End;
  608. D.GlobOr(Start,End);
  609. if (End->Type == pkgCache::Dep::PreDepends)
  610. {
  611. bool Bad = true;
  612. if (Debug)
  613. clog << OutputInDepth(Depth) << "PreDepends order for " << Pkg.FullName() << std::endl;
  614. // Look for easy targets: packages that are already okay
  615. for (DepIterator Cur = Start; Bad == true; ++Cur)
  616. {
  617. SPtrArray<Version *> VList = Cur.AllTargets();
  618. for (Version **I = VList; *I != 0; ++I)
  619. {
  620. VerIterator Ver(Cache,*I);
  621. PkgIterator Pkg = Ver.ParentPkg();
  622. // See if the current version is ok
  623. if (Pkg.CurrentVer() == Ver && List->IsNow(Pkg) == true &&
  624. Pkg.State() == PkgIterator::NeedsNothing)
  625. {
  626. Bad = false;
  627. if (Debug)
  628. clog << OutputInDepth(Depth) << "Found ok package " << Pkg.FullName() << endl;
  629. break;
  630. }
  631. }
  632. if (Cur == End)
  633. break;
  634. }
  635. // Look for something that could be configured.
  636. for (DepIterator Cur = Start; Bad == true && Cur.end() == false; ++Cur)
  637. {
  638. SPtrArray<Version *> VList = Cur.AllTargets();
  639. for (Version **I = VList; *I != 0; ++I)
  640. {
  641. VerIterator Ver(Cache,*I);
  642. PkgIterator DepPkg = Ver.ParentPkg();
  643. // Not the install version
  644. if (Cache[DepPkg].InstallVer != *I ||
  645. (Cache[DepPkg].Keep() == true && DepPkg.State() == PkgIterator::NeedsNothing))
  646. continue;
  647. if (List->IsFlag(DepPkg,pkgOrderList::Configured))
  648. {
  649. Bad = false;
  650. break;
  651. }
  652. // check if it needs unpack or if if configure is enough
  653. if (List->IsFlag(DepPkg,pkgOrderList::UnPacked) == false)
  654. {
  655. if (Debug)
  656. clog << OutputInDepth(Depth) << "Trying to SmartUnpack " << DepPkg.FullName() << endl;
  657. if (NonLoopingSmart(UNPACK_IMMEDIATE, Pkg, DepPkg, Depth, PkgLoop, &Bad, &Changed) == false)
  658. return false;
  659. }
  660. else
  661. {
  662. if (Debug)
  663. clog << OutputInDepth(Depth) << "Trying to SmartConfigure " << DepPkg.FullName() << endl;
  664. if (NonLoopingSmart(CONFIGURE, Pkg, DepPkg, Depth, PkgLoop, &Bad, &Changed) == false)
  665. return false;
  666. }
  667. break;
  668. }
  669. }
  670. if (Bad == true)
  671. SomethingBad = true;
  672. }
  673. else if (End->Type == pkgCache::Dep::Conflicts ||
  674. End->Type == pkgCache::Dep::Obsoletes ||
  675. End->Type == pkgCache::Dep::DpkgBreaks)
  676. {
  677. SPtrArray<Version *> VList = End.AllTargets();
  678. for (Version **I = VList; *I != 0; ++I)
  679. {
  680. VerIterator Ver(Cache,*I);
  681. PkgIterator ConflictPkg = Ver.ParentPkg();
  682. if (ConflictPkg.CurrentVer() != Ver)
  683. {
  684. if (Debug)
  685. std::clog << OutputInDepth(Depth) << "Ignore not-installed version " << Ver.VerStr() << " of " << ConflictPkg.FullName() << " for " << End << std::endl;
  686. continue;
  687. }
  688. if (List->IsNow(ConflictPkg) == false)
  689. {
  690. if (Debug)
  691. std::clog << OutputInDepth(Depth) << "Ignore already dealt-with version " << Ver.VerStr() << " of " << ConflictPkg.FullName() << " for " << End << std::endl;
  692. continue;
  693. }
  694. if (List->IsFlag(ConflictPkg,pkgOrderList::Removed) == true)
  695. {
  696. if (Debug)
  697. clog << OutputInDepth(Depth) << "Ignoring " << End << " as " << ConflictPkg.FullName() << "was temporarily removed" << endl;
  698. continue;
  699. }
  700. if (List->IsFlag(ConflictPkg,pkgOrderList::Loop) && PkgLoop)
  701. {
  702. if (End->Type == pkgCache::Dep::DpkgBreaks && End.IsMultiArchImplicit() == true)
  703. {
  704. if (Debug)
  705. clog << OutputInDepth(Depth) << "Because dependency is MultiArchImplicit we ignored looping on: " << ConflictPkg << endl;
  706. continue;
  707. }
  708. if (Debug)
  709. {
  710. if (End->Type == pkgCache::Dep::DpkgBreaks)
  711. clog << OutputInDepth(Depth) << "Because of breaks knot, deconfigure " << ConflictPkg.FullName() << " temporarily" << endl;
  712. else
  713. clog << OutputInDepth(Depth) << "Because of conflict knot, removing " << ConflictPkg.FullName() << " temporarily" << endl;
  714. }
  715. if (EarlyRemove(ConflictPkg, &End) == false)
  716. return _error->Error("Internal Error, Could not early remove %s (2)",ConflictPkg.FullName().c_str());
  717. SomethingBad = true;
  718. continue;
  719. }
  720. if (Cache[ConflictPkg].Delete() == false)
  721. {
  722. if (Debug)
  723. {
  724. clog << OutputInDepth(Depth) << "Unpacking " << ConflictPkg.FullName() << " to avoid " << End;
  725. if (PkgLoop == true)
  726. clog << " (Looping)";
  727. clog << std::endl;
  728. }
  729. // we would like to avoid temporary removals and all that at best via a simple unpack
  730. _error->PushToStack();
  731. if (NonLoopingSmart(UNPACK, Pkg, ConflictPkg, Depth, PkgLoop, NULL, &Changed) == false)
  732. {
  733. // but if it fails ignore this failure and look for alternative ways of solving
  734. if (Debug)
  735. {
  736. clog << OutputInDepth(Depth) << "Avoidance unpack of " << ConflictPkg.FullName() << " failed for " << End << std::endl;
  737. _error->DumpErrors(std::clog);
  738. }
  739. _error->RevertToStack();
  740. // ignorance can only happen if a) one of the offenders is already gone
  741. if (List->IsFlag(ConflictPkg,pkgOrderList::Removed) == true)
  742. {
  743. if (Debug)
  744. clog << OutputInDepth(Depth) << "But " << ConflictPkg.FullName() << " was temporarily removed in the meantime to satisfy " << End << endl;
  745. }
  746. else if (List->IsFlag(Pkg,pkgOrderList::Removed) == true)
  747. {
  748. if (Debug)
  749. clog << OutputInDepth(Depth) << "But " << Pkg.FullName() << " was temporarily removed in the meantime to satisfy " << End << endl;
  750. }
  751. // or b) we can make one go (removal or dpkg auto-deconfigure)
  752. else
  753. {
  754. if (Debug)
  755. clog << OutputInDepth(Depth) << "So temprorary remove/deconfigure " << ConflictPkg.FullName() << " to satisfy " << End << endl;
  756. if (EarlyRemove(ConflictPkg, &End) == false)
  757. return _error->Error("Internal Error, Could not early remove %s (2)",ConflictPkg.FullName().c_str());
  758. }
  759. }
  760. else
  761. _error->MergeWithStack();
  762. }
  763. else
  764. {
  765. if (Debug)
  766. clog << OutputInDepth(Depth) << "Removing " << ConflictPkg.FullName() << " now to avoid " << End << endl;
  767. // no earlyremove() here as user has already agreed to the permanent removal
  768. if (SmartRemove(Pkg) == false)
  769. return _error->Error("Internal Error, Could not early remove %s (1)",ConflictPkg.FullName().c_str());
  770. }
  771. }
  772. }
  773. }
  774. if (i++ > max_loops)
  775. return _error->Error("Internal error: APT::pkgPackageManager::MaxLoopCount reached in SmartConfigure for %s, aborting", Pkg.FullName().c_str());
  776. } while (Changed == true);
  777. if (SomethingBad == true)
  778. return _error->Error("Couldn't configure %s, probably a dependency cycle.", Pkg.FullName().c_str());
  779. if (couldBeTemporaryRemoved == true && List->IsFlag(Pkg,pkgOrderList::Removed) == true)
  780. {
  781. if (Debug)
  782. std::clog << OutputInDepth(Depth) << "Prevent unpack as " << Pkg << " is currently temporarily removed" << std::endl;
  783. return true;
  784. }
  785. // Check for reverse conflicts.
  786. if (CheckRConflicts(Pkg,Pkg.RevDependsList(),
  787. instVer.VerStr()) == false)
  788. return false;
  789. for (PrvIterator P = instVer.ProvidesList();
  790. P.end() == false; ++P)
  791. if (Pkg->Group != P.OwnerPkg()->Group)
  792. CheckRConflicts(Pkg,P.ParentPkg().RevDependsList(),P.ProvideVersion());
  793. if (PkgLoop)
  794. return true;
  795. List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States);
  796. if (Immediate == true && (instVer->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same)
  797. {
  798. /* Do lockstep M-A:same unpacking in two phases:
  799. First unpack all installed architectures, then the not installed.
  800. This way we avoid that M-A: enabled packages are installed before
  801. their older non-M-A enabled packages are replaced by newer versions */
  802. bool const installed = Pkg->CurrentVer != 0;
  803. if (installed == true &&
  804. (instVer != Pkg.CurrentVer() ||
  805. ((Cache[Pkg].iFlags & pkgDepCache::ReInstall) == pkgDepCache::ReInstall)) &&
  806. Install(Pkg,FileNames[Pkg->ID]) == false)
  807. return false;
  808. for (PkgIterator P = Pkg.Group().PackageList();
  809. P.end() == false; P = Pkg.Group().NextPkg(P))
  810. {
  811. if (P->CurrentVer == 0 || P == Pkg || List->IsFlag(P,pkgOrderList::UnPacked) == true ||
  812. Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer &&
  813. (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall))
  814. continue;
  815. if (SmartUnPack(P, false, Depth + 1) == false)
  816. return false;
  817. }
  818. if (installed == false && Install(Pkg,FileNames[Pkg->ID]) == false)
  819. return false;
  820. for (PkgIterator P = Pkg.Group().PackageList();
  821. P.end() == false; P = Pkg.Group().NextPkg(P))
  822. {
  823. if (P->CurrentVer != 0 || P == Pkg || List->IsFlag(P,pkgOrderList::UnPacked) == true ||
  824. List->IsFlag(P,pkgOrderList::Configured) == true ||
  825. Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer &&
  826. (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall))
  827. continue;
  828. if (SmartUnPack(P, false, Depth + 1) == false)
  829. return false;
  830. }
  831. }
  832. // packages which are already unpacked don't need to be unpacked again
  833. else if ((instVer != Pkg.CurrentVer() ||
  834. ((Cache[Pkg].iFlags & pkgDepCache::ReInstall) == pkgDepCache::ReInstall)) &&
  835. Install(Pkg,FileNames[Pkg->ID]) == false)
  836. return false;
  837. if (Immediate == true) {
  838. // Perform immedate configuration of the package.
  839. if (SmartConfigure(Pkg, Depth + 1) == false)
  840. _error->Error(_("Could not perform immediate configuration on '%s'. "
  841. "Please see man 5 apt.conf under APT::Immediate-Configure for details. (%d)"),Pkg.FullName().c_str(),2);
  842. }
  843. return true;
  844. }
  845. /*}}}*/
  846. // PM::OrderInstall - Installation ordering routine /*{{{*/
  847. // ---------------------------------------------------------------------
  848. /* */
  849. pkgPackageManager::OrderResult pkgPackageManager::OrderInstall()
  850. {
  851. if (CreateOrderList() == false)
  852. return Failed;
  853. Reset();
  854. if (Debug == true)
  855. clog << "Beginning to order" << endl;
  856. bool const ordering =
  857. _config->FindB("PackageManager::UnpackAll",true) ?
  858. List->OrderUnpack(FileNames) : List->OrderCritical();
  859. if (ordering == false)
  860. {
  861. _error->Error("Internal ordering error");
  862. return Failed;
  863. }
  864. if (Debug == true)
  865. clog << "Done ordering" << endl;
  866. bool DoneSomething = false;
  867. for (pkgOrderList::iterator I = List->begin(); I != List->end(); ++I)
  868. {
  869. PkgIterator Pkg(Cache,*I);
  870. if (List->IsNow(Pkg) == false)
  871. {
  872. if (Debug == true)
  873. clog << "Skipping already done " << Pkg.FullName() << endl;
  874. continue;
  875. }
  876. if (List->IsMissing(Pkg) == true)
  877. {
  878. if (Debug == true)
  879. clog << "Sequence completed at " << Pkg.FullName() << endl;
  880. if (DoneSomething == false)
  881. {
  882. _error->Error("Internal Error, ordering was unable to handle the media swap");
  883. return Failed;
  884. }
  885. return Incomplete;
  886. }
  887. // Sanity check
  888. if (Cache[Pkg].Keep() == true &&
  889. Pkg.State() == pkgCache::PkgIterator::NeedsNothing &&
  890. (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall)
  891. {
  892. _error->Error("Internal Error, trying to manipulate a kept package (%s)",Pkg.FullName().c_str());
  893. return Failed;
  894. }
  895. // Perform a delete or an install
  896. if (Cache[Pkg].Delete() == true)
  897. {
  898. if (SmartRemove(Pkg) == false)
  899. return Failed;
  900. }
  901. else
  902. if (SmartUnPack(Pkg,List->IsFlag(Pkg,pkgOrderList::Immediate),0) == false)
  903. return Failed;
  904. DoneSomething = true;
  905. if (ImmConfigureAll) {
  906. /* ConfigureAll here to pick up and packages left unconfigured because they were unpacked in the
  907. "PreUnpack Checks" section */
  908. if (!ConfigureAll())
  909. return Failed;
  910. }
  911. }
  912. // Final run through the configure phase
  913. if (ConfigureAll() == false)
  914. return Failed;
  915. // Sanity check
  916. for (pkgOrderList::iterator I = List->begin(); I != List->end(); ++I)
  917. {
  918. if (List->IsFlag(*I,pkgOrderList::Configured) == false)
  919. {
  920. _error->Error("Internal error, packages left unconfigured. %s",
  921. PkgIterator(Cache,*I).FullName().c_str());
  922. return Failed;
  923. }
  924. }
  925. return Completed;
  926. }
  927. // PM::DoInstallPostFork - compat /*{{{*/
  928. // ---------------------------------------------------------------------
  929. /*}}}*/
  930. #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
  931. pkgPackageManager::OrderResult
  932. pkgPackageManager::DoInstallPostFork(int statusFd)
  933. {
  934. APT::Progress::PackageManager *progress = new
  935. APT::Progress::PackageManagerProgressFd(statusFd);
  936. pkgPackageManager::OrderResult res = DoInstallPostFork(progress);
  937. delete progress;
  938. return res;
  939. }
  940. /*}}}*/
  941. // PM::DoInstallPostFork - Does install part that happens after the fork /*{{{*/
  942. // ---------------------------------------------------------------------
  943. pkgPackageManager::OrderResult
  944. pkgPackageManager::DoInstallPostFork(APT::Progress::PackageManager *progress)
  945. {
  946. bool goResult = Go(progress);
  947. if(goResult == false)
  948. return Failed;
  949. return Res;
  950. };
  951. #else
  952. pkgPackageManager::OrderResult
  953. pkgPackageManager::DoInstallPostFork(int statusFd)
  954. {
  955. bool goResult = Go(statusFd);
  956. if(goResult == false)
  957. return Failed;
  958. return Res;
  959. }
  960. #endif
  961. /*}}}*/
  962. // PM::DoInstall - Does the installation /*{{{*/
  963. // ---------------------------------------------------------------------
  964. /* compat */
  965. #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
  966. pkgPackageManager::OrderResult
  967. pkgPackageManager::DoInstall(int statusFd)
  968. {
  969. APT::Progress::PackageManager *progress = new
  970. APT::Progress::PackageManagerProgressFd(statusFd);
  971. OrderResult res = DoInstall(progress);
  972. delete progress;
  973. return res;
  974. }
  975. #else
  976. pkgPackageManager::OrderResult pkgPackageManager::DoInstall(int statusFd)
  977. {
  978. if(DoInstallPreFork() == Failed)
  979. return Failed;
  980. return DoInstallPostFork(statusFd);
  981. }
  982. #endif
  983. /*}}}*/
  984. // PM::DoInstall - Does the installation /*{{{*/
  985. // ---------------------------------------------------------------------
  986. /* This uses the filenames in FileNames and the information in the
  987. DepCache to perform the installation of packages.*/
  988. #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
  989. pkgPackageManager::OrderResult
  990. pkgPackageManager::DoInstall(APT::Progress::PackageManager *progress)
  991. {
  992. if(DoInstallPreFork() == Failed)
  993. return Failed;
  994. return DoInstallPostFork(progress);
  995. }
  996. #endif
  997. /*}}}*/