]> git.saurik.com Git - apt.git/blame - apt-pkg/packagemanager.cc
apt-pkg/deb/dpkgpm.{cc,h}:
[apt.git] / apt-pkg / packagemanager.cc
CommitLineData
6c139d6e
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
b9c0654c 3// $Id: packagemanager.cc,v 1.30 2003/04/27 03:04:15 doogie Exp $
6c139d6e
AL
4/* ######################################################################
5
6 Package Manager - Abstacts the package manager
7
8 More work is needed in the area of transitioning provides, ie exim
9 replacing smail. This can cause interesing side effects.
10
11 Other cases involving conflicts+replaces should be tested.
12
13 ##################################################################### */
14 /*}}}*/
15// Include Files /*{{{*/
094a497d
AL
16#include <apt-pkg/packagemanager.h>
17#include <apt-pkg/orderlist.h>
18#include <apt-pkg/depcache.h>
19#include <apt-pkg/error.h>
20#include <apt-pkg/version.h>
03e39e59 21#include <apt-pkg/acquire-item.h>
30e1eab5
AL
22#include <apt-pkg/algorithms.h>
23#include <apt-pkg/configuration.h>
b2e465d6
AL
24#include <apt-pkg/sptr.h>
25
26#include <apti18n.h>
5819a761 27#include <iostream>
6c139d6e
AL
28 /*}}}*/
29
5819a761
AL
30using namespace std;
31
6c139d6e
AL
32// PM::PackageManager - Constructor /*{{{*/
33// ---------------------------------------------------------------------
34/* */
b2e465d6 35pkgPackageManager::pkgPackageManager(pkgDepCache *pCache) : Cache(*pCache)
6c139d6e
AL
36{
37 FileNames = new string[Cache.Head().PackageCount];
38 List = 0;
30e1eab5 39 Debug = _config->FindB("Debug::pkgPackageManager",false);
6c139d6e
AL
40}
41 /*}}}*/
42// PM::PackageManager - Destructor /*{{{*/
43// ---------------------------------------------------------------------
44/* */
45pkgPackageManager::~pkgPackageManager()
46{
47 delete List;
48 delete [] FileNames;
49}
50 /*}}}*/
03e39e59
AL
51// PM::GetArchives - Queue the archives for download /*{{{*/
52// ---------------------------------------------------------------------
53/* */
54bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
55 pkgRecords *Recs)
56{
7a1b1f8b
AL
57 if (CreateOrderList() == false)
58 return false;
59
60 if (List->OrderUnpack() == false)
61 return _error->Error("Internal ordering error");
62
63 for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++)
64 {
65 PkgIterator Pkg(Cache,*I);
281daf46
AL
66 FileNames[Pkg->ID] = string();
67
7a1b1f8b
AL
68 // Skip packages to erase
69 if (Cache[Pkg].Delete() == true)
03e39e59 70 continue;
d38b7b3d
AL
71
72 // Skip Packages that need configure only.
9dbb421f
AL
73 if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure &&
74 Cache[Pkg].Keep() == true)
d38b7b3d 75 continue;
281daf46
AL
76
77 // Skip already processed packages
78 if (List->IsNow(Pkg) == false)
79 continue;
80
7a1b1f8b
AL
81 new pkgAcqArchive(Owner,Sources,Recs,Cache[Pkg].InstVerIter(Cache),
82 FileNames[Pkg->ID]);
03e39e59 83 }
7a1b1f8b 84
03e39e59
AL
85 return true;
86}
87 /*}}}*/
6c139d6e
AL
88// PM::FixMissing - Keep all missing packages /*{{{*/
89// ---------------------------------------------------------------------
90/* This is called to correct the installation when packages could not
91 be downloaded. */
92bool pkgPackageManager::FixMissing()
bdae53f1 93{
e6756cde 94 pkgDepCache::ActionGroup group(Cache);
b2e465d6 95 pkgProblemResolver Resolve(&Cache);
2fd65468 96 List->SetFileList(FileNames);
e6756cde 97
9dbb421f 98 bool Bad = false;
6c139d6e
AL
99 for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
100 {
2fd65468 101 if (List->IsMissing(I) == false)
9dbb421f 102 continue;
2fd65468 103
9dbb421f
AL
104 // Okay, this file is missing and we need it. Mark it for keep
105 Bad = true;
74a05226 106 Cache.MarkKeep(I, false, false);
6c139d6e 107 }
bdae53f1
AL
108
109 // We have to empty the list otherwise it will not have the new changes
110 delete List;
111 List = 0;
6c139d6e 112
9dbb421f
AL
113 if (Bad == false)
114 return true;
115
6c139d6e 116 // Now downgrade everything that is broken
30e1eab5 117 return Resolve.ResolveByKeep() == true && Cache.BrokenCount() == 0;
6c139d6e
AL
118}
119 /*}}}*/
120
7a1b1f8b
AL
121// PM::CreateOrderList - Create the ordering class /*{{{*/
122// ---------------------------------------------------------------------
123/* This populates the ordering list with all the packages that are
124 going to change. */
125bool pkgPackageManager::CreateOrderList()
126{
281daf46
AL
127 if (List != 0)
128 return true;
129
7a1b1f8b 130 delete List;
b2e465d6 131 List = new pkgOrderList(&Cache);
7a1b1f8b 132
b9c0654c 133 bool NoImmConfigure = !_config->FindB("APT::Immediate-Configure",true);
079cc404 134
7a1b1f8b
AL
135 // Generate the list of affected packages and sort it
136 for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
137 {
e7b470ee
AL
138 // Ignore no-version packages
139 if (I->VersionList == 0)
140 continue;
141
138d4b3d
AL
142 // Mark the package and its dependends for immediate configuration
143 if (((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential ||
144 (I->Flags & pkgCache::Flag::Important) == pkgCache::Flag::Important) &&
079cc404 145 NoImmConfigure == false)
7a1b1f8b
AL
146 {
147 List->Flag(I,pkgOrderList::Immediate);
d38b7b3d
AL
148
149 // Look for other packages to make immediate configurea
7a1b1f8b
AL
150 if (Cache[I].InstallVer != 0)
151 for (DepIterator D = Cache[I].InstVerIter(Cache).DependsList();
152 D.end() == false; D++)
153 if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
154 List->Flag(D.TargetPkg(),pkgOrderList::Immediate);
d38b7b3d
AL
155
156 // And again with the current version.
7a1b1f8b
AL
157 if (I->CurrentVer != 0)
158 for (DepIterator D = I.CurrentVer().DependsList();
159 D.end() == false; D++)
160 if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
161 List->Flag(D.TargetPkg(),pkgOrderList::Immediate);
162 }
163
164 // Not interesting
165 if ((Cache[I].Keep() == true ||
166 Cache[I].InstVerIter(Cache) == I.CurrentVer()) &&
d556d1a1 167 I.State() == pkgCache::PkgIterator::NeedsNothing &&
d0c59649 168 (Cache[I].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall &&
d556d1a1
AL
169 (I.Purge() != false || Cache[I].Mode != pkgDepCache::ModeDelete ||
170 (Cache[I].iFlags & pkgDepCache::Purge) != pkgDepCache::Purge))
7a1b1f8b
AL
171 continue;
172
173 // Append it to the list
138d4b3d 174 List->push_back(I);
7a1b1f8b
AL
175 }
176
177 return true;
178}
179 /*}}}*/
6c139d6e
AL
180// PM::DepAlwaysTrue - Returns true if this dep is irrelevent /*{{{*/
181// ---------------------------------------------------------------------
182/* The restriction on provides is to eliminate the case when provides
183 are transitioning between valid states [ie exim to smail] */
184bool pkgPackageManager::DepAlwaysTrue(DepIterator D)
185{
186 if (D.TargetPkg()->ProvidesList != 0)
187 return false;
188
189 if ((Cache[D] & pkgDepCache::DepInstall) != 0 &&
190 (Cache[D] & pkgDepCache::DepNow) != 0)
191 return true;
192 return false;
193}
194 /*}}}*/
195// PM::CheckRConflicts - Look for reverse conflicts /*{{{*/
196// ---------------------------------------------------------------------
197/* This looks over the reverses for a conflicts line that needs early
198 removal. */
199bool pkgPackageManager::CheckRConflicts(PkgIterator Pkg,DepIterator D,
200 const char *Ver)
201{
202 for (;D.end() == false; D++)
203 {
b2e465d6
AL
204 if (D->Type != pkgCache::Dep::Conflicts &&
205 D->Type != pkgCache::Dep::Obsoletes)
6c139d6e 206 continue;
5af32db6
AL
207
208 // The package hasnt been changed
209 if (List->IsNow(Pkg) == false)
210 continue;
6c139d6e 211
5af32db6
AL
212 // Ignore self conflicts, ignore conflicts from irrelevent versions
213 if (D.ParentPkg() == Pkg || D.ParentVer() != D.ParentPkg().CurrentVer())
6c139d6e
AL
214 continue;
215
b2e465d6 216 if (Cache.VS().CheckDep(Ver,D->CompareOp,D.TargetVer()) == false)
6c139d6e 217 continue;
b2e465d6 218
6c139d6e 219 if (EarlyRemove(D.ParentPkg()) == false)
5af32db6
AL
220 return _error->Error("Reverse conflicts early remove for package '%s' failed",
221 Pkg.Name());
222 }
6c139d6e
AL
223 return true;
224}
225 /*}}}*/
226// PM::ConfigureAll - Run the all out configuration /*{{{*/
227// ---------------------------------------------------------------------
228/* This configures every package. It is assumed they are all unpacked and
229 that the final configuration is valid. */
230bool pkgPackageManager::ConfigureAll()
231{
b2e465d6 232 pkgOrderList OList(&Cache);
6c139d6e
AL
233
234 // Populate the order list
235 for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++)
236 if (List->IsFlag(pkgCache::PkgIterator(Cache,*I),
237 pkgOrderList::UnPacked) == true)
238 OList.push_back(*I);
239
240 if (OList.OrderConfigure() == false)
241 return false;
242
243 // Perform the configuring
244 for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); I++)
245 {
246 PkgIterator Pkg(Cache,*I);
247
248 if (Configure(Pkg) == false)
249 return false;
250
251 List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States);
252 }
253
254 return true;
255}
256 /*}}}*/
257// PM::SmartConfigure - Perform immediate configuration of the pkg /*{{{*/
258// ---------------------------------------------------------------------
259/* This routine scheduals the configuration of the given package and all
260 of it's dependents. */
261bool pkgPackageManager::SmartConfigure(PkgIterator Pkg)
262{
b2e465d6 263 pkgOrderList OList(&Cache);
6c139d6e
AL
264
265 if (DepAdd(OList,Pkg) == false)
266 return false;
267
268 if (OList.OrderConfigure() == false)
269 return false;
b2e465d6 270
6c139d6e
AL
271 // Perform the configuring
272 for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); I++)
273 {
274 PkgIterator Pkg(Cache,*I);
275
276 if (Configure(Pkg) == false)
277 return false;
278
279 List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States);
280 }
281
282 // Sanity Check
283 if (List->IsFlag(Pkg,pkgOrderList::Configured) == false)
284 return _error->Error("Internal error, could not immediate configure %s",Pkg.Name());
285
286 return true;
287}
288 /*}}}*/
289// PM::DepAdd - Add all dependents to the oder list /*{{{*/
290// ---------------------------------------------------------------------
291/* This recursively adds all dependents to the order list */
292bool pkgPackageManager::DepAdd(pkgOrderList &OList,PkgIterator Pkg,int Depth)
293{
294 if (OList.IsFlag(Pkg,pkgOrderList::Added) == true)
295 return true;
296 if (List->IsFlag(Pkg,pkgOrderList::Configured) == true)
297 return true;
298 if (List->IsFlag(Pkg,pkgOrderList::UnPacked) == false)
299 return false;
b2e465d6 300
6c139d6e
AL
301 // Put the package on the list
302 OList.push_back(Pkg);
303 OList.Flag(Pkg,pkgOrderList::Added);
304 Depth++;
305
306 // Check the dependencies to see if they are all satisfied.
307 bool Bad = false;
308 for (DepIterator D = Cache[Pkg].InstVerIter(Cache).DependsList(); D.end() == false;)
309 {
b50b2c97 310 if (D->Type != pkgCache::Dep::Depends && D->Type != pkgCache::Dep::PreDepends)
6c139d6e
AL
311 {
312 D++;
313 continue;
314 }
315
316 // Grok or groups
317 Bad = true;
318 for (bool LastOR = true; D.end() == false && LastOR == true; D++)
319 {
b50b2c97 320 LastOR = (D->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or;
6c139d6e
AL
321
322 if (Bad == false)
323 continue;
324
b2e465d6 325 SPtrArray<Version *> VList = D.AllTargets();
6c139d6e
AL
326 for (Version **I = VList; *I != 0 && Bad == true; I++)
327 {
328 VerIterator Ver(Cache,*I);
329 PkgIterator Pkg = Ver.ParentPkg();
330
331 // See if the current version is ok
332 if (Pkg.CurrentVer() == Ver && List->IsNow(Pkg) == true &&
333 Pkg.State() == PkgIterator::NeedsNothing)
334 {
335 Bad = false;
336 continue;
337 }
338
339 // Not the install version
340 if (Cache[Pkg].InstallVer != *I ||
341 (Cache[Pkg].Keep() == true && Pkg.State() == PkgIterator::NeedsNothing))
342 continue;
b2e465d6 343
6c139d6e
AL
344 if (List->IsFlag(Pkg,pkgOrderList::UnPacked) == true)
345 Bad = !DepAdd(OList,Pkg,Depth);
346 if (List->IsFlag(Pkg,pkgOrderList::Configured) == true)
347 Bad = false;
348 }
6c139d6e
AL
349 }
350
351 if (Bad == true)
352 {
353 OList.Flag(Pkg,0,pkgOrderList::Added);
354 OList.pop_back();
355 Depth--;
356 return false;
357 }
358 }
359
360 Depth--;
361 return true;
362}
363 /*}}}*/
364// PM::EarlyRemove - Perform removal of packages before their time /*{{{*/
365// ---------------------------------------------------------------------
366/* This is called to deal with conflicts arising from unpacking */
367bool pkgPackageManager::EarlyRemove(PkgIterator Pkg)
368{
369 if (List->IsNow(Pkg) == false)
370 return true;
371
372 // Already removed it
373 if (List->IsFlag(Pkg,pkgOrderList::Removed) == true)
374 return true;
375
376 // Woops, it will not be re-installed!
377 if (List->IsFlag(Pkg,pkgOrderList::InList) == false)
378 return false;
9d4c8f67
AL
379
380 // Essential packages get special treatment
5af32db6 381 bool IsEssential = false;
9d4c8f67 382 if ((Pkg->Flags & pkgCache::Flag::Essential) != 0)
5af32db6
AL
383 IsEssential = true;
384
385 /* Check for packages that are the dependents of essential packages and
386 promote them too */
387 if (Pkg->CurrentVer != 0)
388 {
389 for (DepIterator D = Pkg.RevDependsList(); D.end() == false &&
390 IsEssential == false; D++)
391 if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
392 if ((D.ParentPkg()->Flags & pkgCache::Flag::Essential) != 0)
393 IsEssential = true;
394 }
395
396 if (IsEssential == true)
9d4c8f67
AL
397 {
398 if (_config->FindB("APT::Force-LoopBreak",false) == false)
b2e465d6
AL
399 return _error->Error(_("This installation run will require temporarily "
400 "removing the essential package %s due to a "
401 "Conflicts/Pre-Depends loop. This is often bad, "
402 "but if you really want to do it, activate the "
403 "APT::Force-LoopBreak option."),Pkg.Name());
9d4c8f67 404 }
6c139d6e
AL
405
406 bool Res = SmartRemove(Pkg);
407 if (Cache[Pkg].Delete() == false)
408 List->Flag(Pkg,pkgOrderList::Removed,pkgOrderList::States);
409
410 return Res;
411}
412 /*}}}*/
413// PM::SmartRemove - Removal Helper /*{{{*/
414// ---------------------------------------------------------------------
415/* */
416bool pkgPackageManager::SmartRemove(PkgIterator Pkg)
417{
418 if (List->IsNow(Pkg) == false)
419 return true;
420
421 List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States);
fc4b5c9f 422 return Remove(Pkg,(Cache[Pkg].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge);
6c139d6e
AL
423}
424 /*}}}*/
425// PM::SmartUnPack - Install helper /*{{{*/
426// ---------------------------------------------------------------------
427/* This performs the task of handling pre-depends. */
428bool pkgPackageManager::SmartUnPack(PkgIterator Pkg)
429{
430 // Check if it is already unpacked
431 if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure &&
432 Cache[Pkg].Keep() == true)
433 {
434 List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States);
435 if (List->IsFlag(Pkg,pkgOrderList::Immediate) == true)
436 if (SmartConfigure(Pkg) == false)
b2e465d6 437 return _error->Error("Internal Error, Could not perform immediate configuration (1) on %s",Pkg.Name());
6c139d6e
AL
438 return true;
439 }
981d20eb 440
6c139d6e
AL
441 /* See if this packages install version has any predependencies
442 that are not met by 'now' packages. */
443 for (DepIterator D = Cache[Pkg].InstVerIter(Cache).DependsList();
421c8d10 444 D.end() == false; )
6c139d6e 445 {
421c8d10
AL
446 // Compute a single dependency element (glob or)
447 pkgCache::DepIterator Start;
448 pkgCache::DepIterator End;
449 D.GlobOr(Start,End);
450
451 while (End->Type == pkgCache::Dep::PreDepends)
6c139d6e
AL
452 {
453 // Look for possible ok targets.
b2e465d6 454 SPtrArray<Version *> VList = Start.AllTargets();
6c139d6e
AL
455 bool Bad = true;
456 for (Version **I = VList; *I != 0 && Bad == true; I++)
457 {
458 VerIterator Ver(Cache,*I);
459 PkgIterator Pkg = Ver.ParentPkg();
460
461 // See if the current version is ok
462 if (Pkg.CurrentVer() == Ver && List->IsNow(Pkg) == true &&
463 Pkg.State() == PkgIterator::NeedsNothing)
464 {
465 Bad = false;
466 continue;
467 }
468 }
469
470 // Look for something that could be configured.
471 for (Version **I = VList; *I != 0 && Bad == true; I++)
472 {
473 VerIterator Ver(Cache,*I);
474 PkgIterator Pkg = Ver.ParentPkg();
475
476 // Not the install version
477 if (Cache[Pkg].InstallVer != *I ||
478 (Cache[Pkg].Keep() == true && Pkg.State() == PkgIterator::NeedsNothing))
479 continue;
480
481 Bad = !SmartConfigure(Pkg);
482 }
1006601e 483
421c8d10 484 /* If this or element did not match then continue on to the
1006601e 485 next or element until a matching element is found */
421c8d10 486 if (Bad == true)
1006601e
AL
487 {
488 // This triggers if someone make a pre-depends/depend loop.
421c8d10 489 if (Start == End)
1006601e
AL
490 return _error->Error("Couldn't configure pre-depend %s for %s, "
491 "probably a dependency cycle.",
492 End.TargetPkg().Name(),Pkg.Name());
421c8d10
AL
493 Start++;
494 }
495 else
496 break;
6c139d6e
AL
497 }
498
b2e465d6
AL
499 if (End->Type == pkgCache::Dep::Conflicts ||
500 End->Type == pkgCache::Dep::Obsoletes)
6c139d6e
AL
501 {
502 /* Look for conflicts. Two packages that are both in the install
503 state cannot conflict so we don't check.. */
b2e465d6 504 SPtrArray<Version *> VList = End.AllTargets();
6c139d6e
AL
505 for (Version **I = VList; *I != 0; I++)
506 {
507 VerIterator Ver(Cache,*I);
508 PkgIterator Pkg = Ver.ParentPkg();
509
510 // See if the current version is conflicting
511 if (Pkg.CurrentVer() == Ver && List->IsNow(Pkg) == true)
512 {
513 if (EarlyRemove(Pkg) == false)
514 return _error->Error("Internal Error, Could not early remove %s",Pkg.Name());
515 }
516 }
6c139d6e
AL
517 }
518 }
519
520 // Check for reverse conflicts.
5af32db6
AL
521 if (CheckRConflicts(Pkg,Pkg.RevDependsList(),
522 Cache[Pkg].InstVerIter(Cache).VerStr()) == false)
523 return false;
524
6c139d6e
AL
525 for (PrvIterator P = Cache[Pkg].InstVerIter(Cache).ProvidesList();
526 P.end() == false; P++)
527 CheckRConflicts(Pkg,P.ParentPkg().RevDependsList(),P.ProvideVersion());
528
529 if (Install(Pkg,FileNames[Pkg->ID]) == false)
530 return false;
531
532 List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States);
533
534 // Perform immedate configuration of the package.
535 if (List->IsFlag(Pkg,pkgOrderList::Immediate) == true)
536 if (SmartConfigure(Pkg) == false)
b2e465d6 537 return _error->Error("Internal Error, Could not perform immediate configuration (2) on %s",Pkg.Name());
6c139d6e
AL
538
539 return true;
540}
541 /*}}}*/
542// PM::OrderInstall - Installation ordering routine /*{{{*/
543// ---------------------------------------------------------------------
544/* */
281daf46 545pkgPackageManager::OrderResult pkgPackageManager::OrderInstall()
6c139d6e 546{
7a1b1f8b 547 if (CreateOrderList() == false)
281daf46
AL
548 return Failed;
549
550 Reset();
6c139d6e 551
30e1eab5
AL
552 if (Debug == true)
553 clog << "Begining to order" << endl;
6c139d6e 554
281daf46
AL
555 if (List->OrderUnpack(FileNames) == false)
556 {
557 _error->Error("Internal ordering error");
558 return Failed;
559 }
560
30e1eab5
AL
561 if (Debug == true)
562 clog << "Done ordering" << endl;
563
281daf46 564 bool DoneSomething = false;
6c139d6e
AL
565 for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++)
566 {
567 PkgIterator Pkg(Cache,*I);
281daf46
AL
568
569 if (List->IsNow(Pkg) == false)
570 {
571 if (Debug == true)
572 clog << "Skipping already done " << Pkg.Name() << endl;
573 continue;
574 }
575
2fd65468 576 if (List->IsMissing(Pkg) == true)
281daf46
AL
577 {
578 if (Debug == true)
a3eaf954 579 clog << "Sequence completed at " << Pkg.Name() << endl;
281daf46
AL
580 if (DoneSomething == false)
581 {
582 _error->Error("Internal Error, ordering was unable to handle the media swap");
583 return Failed;
584 }
585 return Incomplete;
586 }
6c139d6e
AL
587
588 // Sanity check
d0c59649
AL
589 if (Cache[Pkg].Keep() == true &&
590 Pkg.State() == pkgCache::PkgIterator::NeedsNothing &&
591 (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall)
281daf46 592 {
71a174ee 593 _error->Error("Internal Error, trying to manipulate a kept package (%s)",Pkg.Name());
281daf46
AL
594 return Failed;
595 }
6c139d6e
AL
596
597 // Perform a delete or an install
598 if (Cache[Pkg].Delete() == true)
599 {
600 if (SmartRemove(Pkg) == false)
281daf46 601 return Failed;
6c139d6e
AL
602 }
603 else
604 if (SmartUnPack(Pkg) == false)
281daf46
AL
605 return Failed;
606 DoneSomething = true;
6c139d6e
AL
607 }
608
609 // Final run through the configure phase
610 if (ConfigureAll() == false)
281daf46 611 return Failed;
6c139d6e
AL
612
613 // Sanity check
614 for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++)
281daf46 615 {
6c139d6e 616 if (List->IsFlag(*I,pkgOrderList::Configured) == false)
281daf46
AL
617 {
618 _error->Error("Internal error, packages left unconfigured. %s",
619 PkgIterator(Cache,*I).Name());
620 return Failed;
621 }
622 }
623
624 return Completed;
6c139d6e
AL
625}
626 /*}}}*/
2a7e07c7
MV
627// PM::DoInstall - Does the installation /*{{{*/
628// ---------------------------------------------------------------------
629/* This uses the filenames in FileNames and the information in the
630 DepCache to perform the installation of packages.*/
631pkgPackageManager::OrderResult pkgPackageManager::DoInstall(int statusFd)
632{
633 if(DoInstallPreFork() == Failed)
634 return Failed;
635
7230ad48 636 return DoInstallPostFork(statusFd);
2a7e07c7
MV
637}
638 /*}}}*/