]>
git.saurik.com Git - apt.git/blob - apt-pkg/orderlist.cc
7cdea188ea647d43c7581f3d8e1a38de4bff5bd6
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: orderlist.cc,v 1.5 1999/07/04 23:22:53 jgg Exp $
4 /* ######################################################################
6 Order List - Represents and Manipulates an ordered list of packages.
8 A list of packages can be ordered by a number of conflicting criteria
9 each given a specific priority. Each package also has a set of flags
10 indicating some usefull things about it that are derived in the
11 course of sorting. The pkgPackageManager class uses this class for
12 all of it's installation ordering needs.
14 This is a modified version of Manoj's Routine B. It consists of four
15 independent ordering algorithms that can be applied at for different
16 points in the ordering. By appling progressivly fewer ordering
17 operations it is possible to give each consideration it's own
18 priority and create an order that satisfies the lowest applicable
21 The rules for unpacking ordering are:
22 1) Unpacking ignores Depends: on all packages
23 2) Unpacking requires Conflicts: on -ALL- packages to be satisfied
24 3) Unpacking requires PreDepends: on this package only to be satisfied
25 4) Removing requires that no packages depend on the package to be
28 And the rule for configuration ordering is:
29 1) Configuring requires that the Depends: of the package be satisfied
30 Conflicts+PreDepends are ignored because unpacking says they are
31 already correct [exageration, it does check but we need not be
34 And some features that are valuable for unpacking ordering.
35 f1) Unpacking a new package should advoid breaking dependencies of
37 f2) Removal should not require a force, corrolory of f1
38 f3) Unpacking should order by depends rather than fall back to random
41 Each of the features can be enabled in the sorting routine at an
42 arbitary priority to give quite abit of control over the final unpacking
45 The rules listed above may never be violated and are called Critical.
46 When a critical rule is violated then a loop condition is recorded
47 and will have to be delt with in the caller.
49 ##################################################################### */
51 // Include Files /*{{{*/
53 #pragma implementation "apt-pkg/orderlist.h"
55 #include <apt-pkg/orderlist.h>
56 #include <apt-pkg/depcache.h>
57 #include <apt-pkg/error.h>
58 #include <apt-pkg/version.h>
61 pkgOrderList
*pkgOrderList::Me
= 0;
63 // OrderList::pkgOrderList - Constructor /*{{{*/
64 // ---------------------------------------------------------------------
66 pkgOrderList::pkgOrderList(pkgDepCache
&Cache
) : Cache(Cache
)
75 /* Construct the arrays, egcs 1.0.1 bug requires the package count
77 unsigned long Size
= Cache
.HeaderP
->PackageCount
;
78 Flags
= new unsigned char[Size
];
79 End
= List
= new Package
*[Size
];
80 memset(Flags
,0,sizeof(*Flags
)*Size
);
83 // OrderList::~pkgOrderList - Destructor /*{{{*/
84 // ---------------------------------------------------------------------
86 pkgOrderList::~pkgOrderList()
92 // OrderList::IsMissing - Check if a file is missing /*{{{*/
93 // ---------------------------------------------------------------------
95 bool pkgOrderList::IsMissing(PkgIterator Pkg
)
97 // Skip packages to erase
98 if (Cache
[Pkg
].Delete() == true)
101 // Skip Packages that need configure only.
102 if (Pkg
.State() == pkgCache::PkgIterator::NeedsConfigure
&&
103 Cache
[Pkg
].Keep() == true)
106 if (FileList
!= 0 && FileList
[Pkg
->ID
].empty() == false)
112 // OrderList::DoRun - Does an order run /*{{{*/
113 // ---------------------------------------------------------------------
114 /* The caller is expeted to have setup the desired probe state */
115 bool pkgOrderList::DoRun()
118 unsigned long Size
= Cache
.HeaderP
->PackageCount
;
119 Package
**NList
= new Package
*[Size
];
122 WipeFlags(Added
| AddPending
| Loop
| InList
);
124 for (iterator I
= List
; I
!= End
; I
++)
127 // Rebuild the main list into the temp list.
128 iterator OldEnd
= End
;
130 for (iterator I
= List
; I
!= OldEnd
; I
++)
131 if (VisitNode(PkgIterator(Cache
,*I
)) == false)
138 // Swap the main list to the new list
144 // OrderList::OrderCritical - Perform critical unpacking ordering /*{{{*/
145 // ---------------------------------------------------------------------
146 /* This performs predepends and immediate configuration ordering only.
147 This is termed critical unpacking ordering. Any loops that form are
148 fatal and indicate that the packages cannot be installed. */
149 bool pkgOrderList::OrderCritical()
153 Primary
= &DepUnPackPre
;
161 qsort(List
,End
- List
,sizeof(*List
),&OrderCompareB
);
163 if (DoRun() == false)
167 return _error
->Error("Fatal, predepends looping detected");
171 // OrderList::OrderUnpack - Perform complete unpacking ordering /*{{{*/
172 // ---------------------------------------------------------------------
173 /* This performs complete unpacking ordering and creates an order that is
174 suitable for unpacking */
175 bool pkgOrderList::OrderUnpack(string
*FileList
)
177 this->FileList
= FileList
;
179 Primary
= &DepUnPackCrit
;
180 Secondary
= &DepConfigure
;
181 RevDepends
= &DepUnPackDep
;
187 qsort(List
,End
- List
,sizeof(*List
),&OrderCompareA
);
189 if (DoRun() == false)
193 if (DoRun() == false)
198 Remove
= 0; // Otherwise the libreadline remove problem occures
199 if (DoRun() == false)
203 Primary
= &DepUnPackPre
;
204 if (DoRun() == false)
207 /* cout << "----------END" << endl;
209 for (iterator I = List; I != End; I++)
211 PkgIterator P(Cache,*I);
212 cout << P.Name() << endl;
218 // OrderList::OrderConfigure - Perform configuration ordering /*{{{*/
219 // ---------------------------------------------------------------------
220 /* This orders by depends only and produces an order which is suitable
222 bool pkgOrderList::OrderConfigure()
225 Primary
= &DepConfigure
;
234 // OrderList::Score - Score the package for sorting /*{{{*/
235 // ---------------------------------------------------------------------
236 /* Higher scores order earlier */
237 int pkgOrderList::Score(PkgIterator Pkg
)
239 // Removal is always done first
240 if (Cache
[Pkg
].Delete() == true)
243 // This should never happen..
244 if (Cache
[Pkg
].InstVerIter(Cache
).end() == true)
248 if ((Pkg
->Flags
& pkgCache::Flag::Essential
) == pkgCache::Flag::Essential
)
251 for (DepIterator D
= Cache
[Pkg
].InstVerIter(Cache
).DependsList();
252 D
.end() == false; D
++)
253 if (D
->Type
== pkgCache::Dep::PreDepends
)
259 // Important Required Standard Optional Extra
260 signed short PrioMap
[] = {0,5,4,3,1,0};
261 if (Cache
[Pkg
].InstVerIter(Cache
)->Priority
<= 5)
262 Score
+= PrioMap
[Cache
[Pkg
].InstVerIter(Cache
)->Priority
];
266 // OrderList::FileCmp - Compare by package file /*{{{*/
267 // ---------------------------------------------------------------------
268 /* This compares by the package file that the install version is in. */
269 int pkgOrderList::FileCmp(PkgIterator A
,PkgIterator B
)
271 if (Cache
[A
].Delete() == true && Cache
[B
].Delete() == true)
273 if (Cache
[A
].Delete() == true)
275 if (Cache
[B
].Delete() == true)
278 if (Cache
[A
].InstVerIter(Cache
).FileList().end() == true)
280 if (Cache
[B
].InstVerIter(Cache
).FileList().end() == true)
283 pkgCache::PackageFile
*FA
= Cache
[A
].InstVerIter(Cache
).FileList().File();
284 pkgCache::PackageFile
*FB
= Cache
[B
].InstVerIter(Cache
).FileList().File();
292 // BoolCompare - Comparison function for two booleans /*{{{*/
293 // ---------------------------------------------------------------------
295 static int BoolCompare(bool A
,bool B
)
304 // OrderList::OrderCompareA - Order the installation by op /*{{{*/
305 // ---------------------------------------------------------------------
306 /* This provides a first-pass sort of the list and gives a decent starting
307 point for further complete ordering. It is used by OrderUnpack only */
308 int pkgOrderList::OrderCompareA(const void *a
, const void *b
)
310 PkgIterator
A(Me
->Cache
,*(Package
**)a
);
311 PkgIterator
B(Me
->Cache
,*(Package
**)b
);
313 // We order packages with a set state toward the front
315 if ((Res
= BoolCompare(Me
->IsNow(A
),Me
->IsNow(B
))) == 0)
318 // We order missing files to toward the end
319 if (Me
->FileList
!= 0)
321 if ((Res
= BoolCompare(Me
->IsMissing(A
),
322 Me
->IsMissing(B
))) == 0)
326 if (A
.State() != pkgCache::PkgIterator::NeedsNothing
&&
327 B
.State() == pkgCache::PkgIterator::NeedsNothing
)
330 if (A
.State() == pkgCache::PkgIterator::NeedsNothing
&&
331 B
.State() != pkgCache::PkgIterator::NeedsNothing
)
334 int ScoreA
= Me
->Score(A
);
335 int ScoreB
= Me
->Score(B
);
342 return strcmp(A
.Name(),B
.Name());
345 // OrderList::OrderCompareB - Order the installation by source /*{{{*/
346 // ---------------------------------------------------------------------
347 /* This orders by installation source. This is usefull to handle
348 inter-source breaks */
349 int pkgOrderList::OrderCompareB(const void *a
, const void *b
)
351 PkgIterator
A(Me
->Cache
,*(Package
**)a
);
352 PkgIterator
B(Me
->Cache
,*(Package
**)b
);
354 if (A
.State() != pkgCache::PkgIterator::NeedsNothing
&&
355 B
.State() == pkgCache::PkgIterator::NeedsNothing
)
358 if (A
.State() == pkgCache::PkgIterator::NeedsNothing
&&
359 B
.State() != pkgCache::PkgIterator::NeedsNothing
)
362 int F
= Me
->FileCmp(A
,B
);
370 int ScoreA
= Me
->Score(A
);
371 int ScoreB
= Me
->Score(B
);
378 return strcmp(A
.Name(),B
.Name());
382 // OrderList::VisitDeps - Visit forward install dependencies /*{{{*/
383 // ---------------------------------------------------------------------
384 /* This calls the dependency function for the normal forwards dependencies
386 bool pkgOrderList::VisitDeps(DepFunc F
,PkgIterator Pkg
)
388 if (F
== 0 || Pkg
.end() == true || Cache
[Pkg
].InstallVer
== 0)
391 return (this->*F
)(Cache
[Pkg
].InstVerIter(Cache
).DependsList());
394 // OrderList::VisitRDeps - Visit reverse dependencies /*{{{*/
395 // ---------------------------------------------------------------------
396 /* This calls the dependency function for all of the normal reverse depends
398 bool pkgOrderList::VisitRDeps(DepFunc F
,PkgIterator Pkg
)
400 if (F
== 0 || Pkg
.end() == true)
403 return (this->*F
)(Pkg
.RevDependsList());
406 // OrderList::VisitRProvides - Visit provides reverse dependencies /*{{{*/
407 // ---------------------------------------------------------------------
408 /* This calls the dependency function for all reverse dependencies
409 generated by the provides line on the package. */
410 bool pkgOrderList::VisitRProvides(DepFunc F
,VerIterator Ver
)
412 if (F
== 0 || Ver
.end() == true)
416 for (PrvIterator P
= Ver
.ProvidesList(); P
.end() == false; P
++)
417 Res
&= (this->*F
)(P
.ParentPkg().RevDependsList());
421 // OrderList::VisitProvides - Visit all of the providing packages /*{{{*/
422 // ---------------------------------------------------------------------
423 /* This routine calls visit on all providing packages. */
424 bool pkgOrderList::VisitProvides(DepIterator D
)
426 Version
**List
= D
.AllTargets();
427 for (Version
**I
= List
; *I
!= 0; I
++)
429 VerIterator
Ver(Cache
,*I
);
430 PkgIterator Pkg
= Ver
.ParentPkg();
432 if (Cache
[Pkg
].Keep() == true)
435 if (D
->Type
!= pkgCache::Dep::Conflicts
&& Cache
[Pkg
].InstallVer
!= *I
)
438 if (D
->Type
== pkgCache::Dep::Conflicts
&& (Version
*)Pkg
.CurrentVer() != *I
)
441 if (VisitNode(Pkg
) == false)
451 // OrderList::VisitNode - Recursive ordering director /*{{{*/
452 // ---------------------------------------------------------------------
453 /* This is the core ordering routine. It calls the set dependency
454 consideration functions which then potentialy call this again. Finite
455 depth is achived through the colouring mechinism. */
456 bool pkgOrderList::VisitNode(PkgIterator Pkg
)
458 // Looping or irrelevent.
459 // This should probably trancend not installed packages
460 if (Pkg
.end() == true || IsFlag(Pkg
,Added
) == true ||
461 IsFlag(Pkg
,AddPending
) == true || IsFlag(Pkg
,InList
) == false)
464 /* for (int j = 0; j != Depth; j++) cout << ' ';
465 cout << "Visit " << Pkg.Name() << endl;*/
469 Flag(Pkg
,AddPending
);
471 DepFunc Old
= Primary
;
473 // Perform immedate configuration of the package if so flagged.
474 if (IsFlag(Pkg
,Immediate
) == true && Primary
!= &DepUnPackPre
)
475 Primary
= &DepUnPackPreD
;
477 if (IsNow(Pkg
) == true)
480 if (Cache
[Pkg
].Delete() == false)
483 Res
&= Res
&& VisitDeps(Primary
,Pkg
);
484 Res
&= Res
&& VisitRDeps(Primary
,Pkg
);
485 Res
&= Res
&& VisitRProvides(Primary
,Pkg
.CurrentVer());
486 Res
&= Res
&& VisitRProvides(Primary
,Cache
[Pkg
].InstVerIter(Cache
));
489 Res
&= Res
&& VisitRDeps(RevDepends
,Pkg
);
490 Res
&= Res
&& VisitRProvides(RevDepends
,Pkg
.CurrentVer());
491 Res
&= Res
&& VisitRProvides(RevDepends
,Cache
[Pkg
].InstVerIter(Cache
));
494 Res
&= Res
&& VisitDeps(Secondary
,Pkg
);
495 Res
&= Res
&& VisitRDeps(Secondary
,Pkg
);
496 Res
&= Res
&& VisitRProvides(Secondary
,Pkg
.CurrentVer());
497 Res
&= Res
&& VisitRProvides(Secondary
,Cache
[Pkg
].InstVerIter(Cache
));
502 Res
&= Res
&& VisitRDeps(Remove
,Pkg
);
503 Res
&= Res
&& VisitRProvides(Remove
,Pkg
.CurrentVer());
507 if (IsFlag(Pkg
,Added
) == false)
509 Flag(Pkg
,Added
,Added
| AddPending
);
517 /* for (int j = 0; j != Depth; j++) cout << ' ';
518 cout << "Leave " << Pkg.Name() << ' ' << IsFlag(Pkg,Added) << ',' << IsFlag(Pkg,AddPending) << endl;*/
524 // OrderList::DepUnPackCrit - Critical UnPacking ordering /*{{{*/
525 // ---------------------------------------------------------------------
526 /* Critical unpacking ordering strives to satisfy Conflicts: and
527 PreDepends: only. When a prdepends is encountered the Primary
528 DepFunc is changed to be DepUnPackPreD.
530 Loops are preprocessed and logged. */
531 bool pkgOrderList::DepUnPackCrit(DepIterator D
)
533 for (; D
.end() == false; D
++)
535 if (D
.Reverse() == true)
537 /* Reverse depenanices are only interested in conflicts,
538 predepend breakage is ignored here */
539 if (D
->Type
!= pkgCache::Dep::Conflicts
)
542 // Duplication elimination, consider only the current version
543 if (D
.ParentPkg().CurrentVer() != D
.ParentVer())
546 /* For reverse dependencies we wish to check if the
547 dependency is satisifed in the install state. The
548 target package (caller) is going to be in the installed
550 if (CheckDep(D
) == true)
553 if (VisitNode(D
.ParentPkg()) == false)
558 /* Forward critical dependencies MUST be correct before the
559 package can be unpacked. */
560 if (D
->Type
!= pkgCache::Dep::Conflicts
&& D
->Type
!= pkgCache::Dep::PreDepends
)
563 /* We wish to check if the dep is okay in the now state of the
564 target package against the install state of this package. */
565 if (CheckDep(D
) == true)
567 /* We want to catch predepends loops with the code below.
568 Conflicts loops that are Dep OK are ignored */
569 if (IsFlag(D
.TargetPkg(),AddPending
) == false ||
570 D
->Type
!= pkgCache::Dep::PreDepends
)
574 // This is the loop detection
575 if (IsFlag(D
.TargetPkg(),Added
) == true ||
576 IsFlag(D
.TargetPkg(),AddPending
) == true)
578 if (IsFlag(D
.TargetPkg(),AddPending
) == true)
583 /* Predepends require a special ordering stage, they must have
584 all dependents installed as well */
585 DepFunc Old
= Primary
;
587 if (D
->Type
== pkgCache::Dep::PreDepends
)
588 Primary
= &DepUnPackPreD
;
589 Res
= VisitProvides(D
);
598 // OrderList::DepUnPackPreD - Critical UnPacking ordering with depends /*{{{*/
599 // ---------------------------------------------------------------------
600 /* Critical PreDepends (also configure immediate and essential) strives to
601 ensure not only that all conflicts+predepends are met but that this
602 package will be immediately configurable when it is unpacked.
604 Loops are preprocessed and logged. */
605 bool pkgOrderList::DepUnPackPreD(DepIterator D
)
607 if (D
.Reverse() == true)
608 return DepUnPackCrit(D
);
610 for (; D
.end() == false; D
++)
612 if (D
.IsCritical() == false)
615 /* We wish to check if the dep is okay in the now state of the
616 target package against the install state of this package. */
617 if (CheckDep(D
) == true)
619 /* We want to catch predepends loops with the code below.
620 Conflicts loops that are Dep OK are ignored */
621 if (IsFlag(D
.TargetPkg(),AddPending
) == false ||
622 D
->Type
!= pkgCache::Dep::PreDepends
)
626 // This is the loop detection
627 if (IsFlag(D
.TargetPkg(),Added
) == true ||
628 IsFlag(D
.TargetPkg(),AddPending
) == true)
630 if (IsFlag(D
.TargetPkg(),AddPending
) == true)
635 if (VisitProvides(D
) == false)
641 // OrderList::DepUnPackPre - Critical Predepends ordering /*{{{*/
642 // ---------------------------------------------------------------------
643 /* Critical PreDepends (also configure immediate and essential) strives to
644 ensure not only that all conflicts+predepends are met but that this
645 package will be immediately configurable when it is unpacked.
647 Loops are preprocessed and logged. All loops will be fatal. */
648 bool pkgOrderList::DepUnPackPre(DepIterator D
)
650 if (D
.Reverse() == true)
653 for (; D
.end() == false; D
++)
655 /* Only consider the PreDepends or Depends. Depends are only
656 considered at the lowest depth or in the case of immediate
658 if (D
->Type
!= pkgCache::Dep::PreDepends
)
660 if (D
->Type
== pkgCache::Dep::Depends
)
662 if (Depth
== 1 && IsFlag(D
.ParentPkg(),Immediate
) == false)
669 /* We wish to check if the dep is okay in the now state of the
670 target package against the install state of this package. */
671 if (CheckDep(D
) == true)
673 /* We want to catch predepends loops with the code below.
674 Conflicts loops that are Dep OK are ignored */
675 if (IsFlag(D
.TargetPkg(),AddPending
) == false)
679 // This is the loop detection
680 if (IsFlag(D
.TargetPkg(),Added
) == true ||
681 IsFlag(D
.TargetPkg(),AddPending
) == true)
683 if (IsFlag(D
.TargetPkg(),AddPending
) == true)
688 if (VisitProvides(D
) == false)
694 // OrderList::DepUnPackDep - Reverse dependency considerations /*{{{*/
695 // ---------------------------------------------------------------------
696 /* Reverse dependencies are considered to determine if unpacking this
697 package will break any existing dependencies. If so then those
698 packages are ordered before this one so that they are in the
701 The forwards depends loop is designed to bring the packages dependents
702 close to the package. This helps reduce deconfigure time.
704 Loops are irrelevent to this. */
705 bool pkgOrderList::DepUnPackDep(DepIterator D
)
708 for (; D
.end() == false; D
++)
709 if (D
.IsCritical() == true)
711 if (D
.Reverse() == true)
713 /* Duplication prevention. We consider rev deps only on
714 the current version, a not installed package
716 if (D
.ParentPkg()->CurrentVer
== 0 ||
717 D
.ParentPkg().CurrentVer() != D
.ParentVer())
720 // The dep will not break so it is irrelevent.
721 if (CheckDep(D
) == true)
724 if (VisitNode(D
.ParentPkg()) == false)
728 if (D
->Type
== pkgCache::Dep::Depends
)
729 if (VisitProvides(D
) == false)
735 // OrderList::DepConfigure - Configuration ordering /*{{{*/
736 // ---------------------------------------------------------------------
737 /* Configuration only ordering orders by the Depends: line only. It
738 orders configuration so that when a package comes to be configured it's
739 dependents are configured.
741 Loops are ingored. Depends loop entry points are chaotic. */
742 bool pkgOrderList::DepConfigure(DepIterator D
)
744 // Never consider reverse configuration dependencies.
745 if (D
.Reverse() == true)
748 for (; D
.end() == false; D
++)
749 if (D
->Type
== pkgCache::Dep::Depends
)
750 if (VisitProvides(D
) == false)
755 // OrderList::DepRemove - Removal ordering /*{{{*/
756 // ---------------------------------------------------------------------
757 /* Removal visits all reverse depends. It considers if the dependency
758 of the Now state version to see if it is okay with removing this
759 package. This check should always fail, but is provided for symetery
760 with the other critical handlers.
762 Loops are preprocessed and logged. Removal loops can also be
763 detected in the critical handler. They are characterized by an
764 old version of A depending on B but the new version of A conflicting
765 with B, thus either A or B must break to install. */
766 bool pkgOrderList::DepRemove(DepIterator D
)
768 if (D
.Reverse() == false)
770 for (; D
.end() == false; D
++)
771 if (D
->Type
== pkgCache::Dep::Depends
|| D
->Type
== pkgCache::Dep::PreDepends
)
773 // Duplication elimination, consider the current version only
774 if (D
.ParentPkg().CurrentVer() != D
.ParentVer())
777 /* We wish to see if the dep on the parent package is okay
778 in the removed (install) state of the target pkg. */
779 if (CheckDep(D
) == true)
781 // We want to catch loops with the code below.
782 if (IsFlag(D
.ParentPkg(),AddPending
) == false)
786 // This is the loop detection
787 if (IsFlag(D
.ParentPkg(),Added
) == true ||
788 IsFlag(D
.ParentPkg(),AddPending
) == true)
790 if (IsFlag(D
.ParentPkg(),AddPending
) == true)
795 if (VisitNode(D
.ParentPkg()) == false)
803 // OrderList::AddLoop - Add a loop to the loop list /*{{{*/
804 // ---------------------------------------------------------------------
805 /* We record the loops. This is a relic since loop breaking is done
806 genericaly as part of the safety routines. */
807 bool pkgOrderList::AddLoop(DepIterator D
)
809 if (LoopCount
< 0 || LoopCount
>= 20)
815 if (Loops
[LoopCount
- 1].ParentPkg() == D
.ParentPkg() ||
816 Loops
[LoopCount
- 1].TargetPkg() == D
.ParentPkg())
820 Loops
[LoopCount
++] = D
;
822 // Mark the packages as being part of a loop.
823 Flag(D
.TargetPkg(),Loop
);
824 Flag(D
.ParentPkg(),Loop
);
828 // OrderList::WipeFlags - Unset the given flags from all packages /*{{{*/
829 // ---------------------------------------------------------------------
831 void pkgOrderList::WipeFlags(unsigned long F
)
833 unsigned long Size
= Cache
.HeaderP
->PackageCount
;
834 for (unsigned long I
= 0; I
!= Size
; I
++)
838 // OrderList::CheckDep - Check a dependency for truth /*{{{*/
839 // ---------------------------------------------------------------------
840 /* This performs a complete analysis of the dependency wrt to the
841 current add list. It returns true if after all events are
842 performed it is still true. This sort of routine can be approximated
843 by examining the DepCache, however in convoluted cases of provides
844 this fails to produce a suitable result. */
845 bool pkgOrderList::CheckDep(DepIterator D
)
847 Version
**List
= D
.AllTargets();
848 for (Version
**I
= List
; *I
!= 0; I
++)
850 VerIterator
Ver(Cache
,*I
);
851 PkgIterator Pkg
= Ver
.ParentPkg();
853 /* The meaning of Added and AddPending is subtle. AddPending is
854 an indication that the package is looping. Because of the
855 way ordering works Added means the package will be unpacked
856 before this one and AddPending means after. It is therefore
857 correct to ignore AddPending in all cases, but that exposes
858 reverse-ordering loops which should be ignore. */
859 if (IsFlag(Pkg
,Added
) == true ||
860 (IsFlag(Pkg
,AddPending
) == true && D
.Reverse() == true))
862 if (Cache
[Pkg
].InstallVer
!= *I
)
866 if ((Version
*)Pkg
.CurrentVer() != *I
||
867 Pkg
.State() != PkgIterator::NeedsNothing
)
872 /* Conflicts requires that all versions are not present, depends
874 if (D
->Type
!= pkgCache::Dep::Conflicts
)
881 /* Conflicts requires that all versions are not present, depends
883 if (D
->Type
== pkgCache::Dep::Conflicts
)