]>
git.saurik.com Git - apt-legacy.git/blob - apt-pkg/depcache.cc
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: depcache.cc,v 1.25 2001/05/27 05:36:04 jgg Exp $
4 /* ######################################################################
6 Dependency Cache - Caches Dependency information.
8 ##################################################################### */
10 // Include Files /*{{{*/
12 #pragma implementation "apt-pkg/depcache.h"
14 #include <apt-pkg/depcache.h>
15 #include <apt-pkg/version.h>
16 #include <apt-pkg/error.h>
17 #include <apt-pkg/sptr.h>
18 #include <apt-pkg/algorithms.h>
19 #include <apt-pkg/configuration.h>
24 // DepCache::pkgDepCache - Constructors /*{{{*/
25 // ---------------------------------------------------------------------
27 pkgDepCache::pkgDepCache(pkgCache
*pCache
,Policy
*Plcy
) :
28 Cache(pCache
), PkgState(0), DepState(0)
33 delLocalPolicy
= LocalPolicy
= new Policy
;
36 // DepCache::~pkgDepCache - Destructor /*{{{*/
37 // ---------------------------------------------------------------------
39 pkgDepCache::~pkgDepCache()
43 delete delLocalPolicy
;
46 // DepCache::Init - Generate the initial extra structures. /*{{{*/
47 // ---------------------------------------------------------------------
48 /* This allocats the extension buffers and initializes them. */
49 bool pkgDepCache::Init(OpProgress
*Prog
)
53 PkgState
= new StateCache
[Head().PackageCount
];
54 DepState
= new unsigned char[Head().DependsCount
];
55 memset(PkgState
,0,sizeof(*PkgState
)*Head().PackageCount
);
56 memset(DepState
,0,sizeof(*DepState
)*Head().DependsCount
);
60 Prog
->OverallProgress(0,2*Head().PackageCount
,Head().PackageCount
,
61 _("Building dependency tree"));
62 Prog
->SubProgress(Head().PackageCount
,_("Candidate versions"));
65 /* Set the current state of everything. In this state all of the
66 packages are kept exactly as is. See AllUpgrade */
68 for (PkgIterator I
= PkgBegin(); I
.end() != true; I
++,Done
++)
73 // Find the proper cache slot
74 StateCache
&State
= PkgState
[I
->ID
];
77 // Figure out the install version
78 State
.CandidateVer
= GetCandidateVer(I
);
79 State
.InstallVer
= I
.CurrentVer();
80 State
.Mode
= ModeKeep
;
82 State
.Update(I
,*this);
88 Prog
->OverallProgress(Head().PackageCount
,2*Head().PackageCount
,
90 _("Building dependency tree"));
91 Prog
->SubProgress(Head().PackageCount
,_("Dependency generation"));
103 // DepCache::CheckDep - Checks a single dependency /*{{{*/
104 // ---------------------------------------------------------------------
105 /* This first checks the dependency against the main target package and
106 then walks along the package provides list and checks if each provides
107 will be installed then checks the provides against the dep. Res will be
108 set to the package which was used to satisfy the dep. */
109 bool pkgDepCache::CheckDep(DepIterator Dep
,int Type
,PkgIterator
&Res
)
111 Res
= Dep
.TargetPkg();
113 /* Check simple depends. A depends -should- never self match but
114 we allow it anyhow because dpkg does. Technically it is a packaging
115 bug. Conflicts may never self match */
116 if (Dep
.TargetPkg() != Dep
.ParentPkg() ||
117 (Dep
->Type
!= Dep::Conflicts
&& Dep
->Type
!= Dep::Obsoletes
))
119 PkgIterator Pkg
= Dep
.TargetPkg();
120 // Check the base package
121 if (Type
== NowVersion
&& Pkg
->CurrentVer
!= 0)
122 if (VS().CheckDep(Pkg
.CurrentVer().VerStr(),Dep
->CompareOp
,
123 Dep
.TargetVer()) == true)
126 if (Type
== InstallVersion
&& PkgState
[Pkg
->ID
].InstallVer
!= 0)
127 if (VS().CheckDep(PkgState
[Pkg
->ID
].InstVerIter(*this).VerStr(),
128 Dep
->CompareOp
,Dep
.TargetVer()) == true)
131 if (Type
== CandidateVersion
&& PkgState
[Pkg
->ID
].CandidateVer
!= 0)
132 if (VS().CheckDep(PkgState
[Pkg
->ID
].CandidateVerIter(*this).VerStr(),
133 Dep
->CompareOp
,Dep
.TargetVer()) == true)
137 if (Dep
->Type
== Dep::Obsoletes
)
140 // Check the providing packages
141 PrvIterator P
= Dep
.TargetPkg().ProvidesList();
142 PkgIterator Pkg
= Dep
.ParentPkg();
143 for (; P
.end() != true; P
++)
145 /* Provides may never be applied against the same package if it is
146 a conflicts. See the comment above. */
147 if (P
.OwnerPkg() == Pkg
&& Dep
->Type
== Dep::Conflicts
)
150 // Check if the provides is a hit
151 if (Type
== NowVersion
)
153 if (P
.OwnerPkg().CurrentVer() != P
.OwnerVer())
157 if (Type
== InstallVersion
)
159 StateCache
&State
= PkgState
[P
.OwnerPkg()->ID
];
160 if (State
.InstallVer
!= (Version
*)P
.OwnerVer())
164 if (Type
== CandidateVersion
)
166 StateCache
&State
= PkgState
[P
.OwnerPkg()->ID
];
167 if (State
.CandidateVer
!= (Version
*)P
.OwnerVer())
171 // Compare the versions.
172 if (VS().CheckDep(P
.ProvideVersion(),Dep
->CompareOp
,Dep
.TargetVer()) == true)
182 // DepCache::AddSizes - Add the packages sizes to the counters /*{{{*/
183 // ---------------------------------------------------------------------
184 /* Call with Mult = -1 to preform the inverse opration */
185 void pkgDepCache::AddSizes(const PkgIterator
&Pkg
,signed long Mult
)
187 StateCache
&P
= PkgState
[Pkg
->ID
];
189 if (Pkg
->VersionList
== 0)
192 if (Pkg
.State() == pkgCache::PkgIterator::NeedsConfigure
&&
196 // Compute the size data
197 if (P
.NewInstall() == true)
199 iUsrSize
+= (signed)(Mult
*P
.InstVerIter(*this)->InstalledSize
);
200 iDownloadSize
+= (signed)(Mult
*P
.InstVerIter(*this)->Size
);
205 if (Pkg
->CurrentVer
!= 0 &&
206 (P
.InstallVer
!= (Version
*)Pkg
.CurrentVer() ||
207 (P
.iFlags
& ReInstall
) == ReInstall
) && P
.InstallVer
!= 0)
209 iUsrSize
+= (signed)(Mult
*((signed)P
.InstVerIter(*this)->InstalledSize
-
210 (signed)Pkg
.CurrentVer()->InstalledSize
));
211 iDownloadSize
+= (signed)(Mult
*P
.InstVerIter(*this)->Size
);
216 if (Pkg
.State() == pkgCache::PkgIterator::NeedsUnpack
&&
219 iDownloadSize
+= (signed)(Mult
*P
.InstVerIter(*this)->Size
);
224 if (Pkg
->CurrentVer
!= 0 && P
.InstallVer
== 0)
226 iUsrSize
-= (signed)(Mult
*Pkg
.CurrentVer()->InstalledSize
);
231 // DepCache::AddStates - Add the package to the state counter /*{{{*/
232 // ---------------------------------------------------------------------
233 /* This routine is tricky to use, you must make sure that it is never
234 called twice for the same package. This means the Remove/Add section
235 should be as short as possible and not encompass any code that will
236 calld Remove/Add itself. Remember, dependencies can be circular so
237 while processing a dep for Pkg it is possible that Add/Remove
238 will be called on Pkg */
239 void pkgDepCache::AddStates(const PkgIterator
&Pkg
,int Add
)
241 StateCache
&State
= PkgState
[Pkg
->ID
];
243 // The Package is broken
244 if ((State
.DepState
& DepInstMin
) != DepInstMin
)
248 if (Pkg
.State() != PkgIterator::NeedsNothing
)
252 if (Pkg
->CurrentVer
== 0)
254 if (State
.Mode
== ModeDelete
&&
255 (State
.iFlags
| Purge
) == Purge
&& Pkg
.Purge() == false)
258 if (State
.Mode
== ModeInstall
)
263 // Installed, no upgrade
264 if (State
.Status
== 0)
266 if (State
.Mode
== ModeDelete
)
269 if ((State
.iFlags
& ReInstall
) == ReInstall
)
275 // Alll 3 are possible
276 if (State
.Mode
== ModeDelete
)
278 if (State
.Mode
== ModeKeep
)
280 if (State
.Mode
== ModeInstall
)
284 // DepCache::BuildGroupOrs - Generate the Or group dep data /*{{{*/
285 // ---------------------------------------------------------------------
286 /* The or group results are stored in the last item of the or group. This
287 allows easy detection of the state of a whole or'd group. */
288 void pkgDepCache::BuildGroupOrs(VerIterator
const &V
)
290 unsigned char Group
= 0;
292 for (DepIterator D
= V
.DependsList(); D
.end() != true; D
++)
294 // Build the dependency state.
295 unsigned char &State
= DepState
[D
->ID
];
297 /* Invert for Conflicts. We have to do this twice to get the
298 right sense for a conflicts group */
299 if (D
->Type
== Dep::Conflicts
|| D
->Type
== Dep::Obsoletes
)
302 // Add to the group if we are within an or..
306 if ((D
->CompareOp
& Dep::Or
) != Dep::Or
)
309 // Invert for Conflicts
310 if (D
->Type
== Dep::Conflicts
|| D
->Type
== Dep::Obsoletes
)
315 // DepCache::VersionState - Perform a pass over a dependency list /*{{{*/
316 // ---------------------------------------------------------------------
317 /* This is used to run over a dependency list and determine the dep
318 state of the list, filtering it through both a Min check and a Policy
319 check. The return result will have SetMin/SetPolicy low if a check
320 fails. It uses the DepState cache for it's computations. */
321 unsigned char pkgDepCache::VersionState(DepIterator D
,unsigned char Check
,
322 unsigned char SetMin
,
323 unsigned char SetPolicy
)
325 unsigned char Dep
= 0xFF;
327 while (D
.end() != true)
329 // Compute a single dependency element (glob or)
330 DepIterator Start
= D
;
331 unsigned char State
= 0;
332 for (bool LastOR
= true; D
.end() == false && LastOR
== true; D
++)
334 State
|= DepState
[D
->ID
];
335 LastOR
= (D
->CompareOp
& Dep::Or
) == Dep::Or
;
338 // Minimum deps that must be satisfied to have a working package
339 if (Start
.IsCritical() == true)
340 if ((State
& Check
) != Check
)
343 // Policy deps that must be satisfied to install the package
344 if (IsImportantDep(Start
) == true &&
345 (State
& Check
) != Check
)
352 // DepCache::DependencyState - Compute the 3 results for a dep /*{{{*/
353 // ---------------------------------------------------------------------
354 /* This is the main dependency computation bit. It computes the 3 main
355 results for a dependencys, Now, Install and Candidate. Callers must
356 invert the result if dealing with conflicts. */
357 unsigned char pkgDepCache::DependencyState(DepIterator
&D
)
359 unsigned char State
= 0;
361 if (CheckDep(D
,NowVersion
) == true)
363 if (CheckDep(D
,InstallVersion
) == true)
365 if (CheckDep(D
,CandidateVersion
) == true)
371 // DepCache::UpdateVerState - Compute the Dep member of the state /*{{{*/
372 // ---------------------------------------------------------------------
373 /* This determines the combined dependency representation of a package
374 for its two states now and install. This is done by using the pre-generated
375 dependency information. */
376 void pkgDepCache::UpdateVerState(PkgIterator Pkg
)
378 // Empty deps are always true
379 StateCache
&State
= PkgState
[Pkg
->ID
];
380 State
.DepState
= 0xFF;
382 // Check the Current state
383 if (Pkg
->CurrentVer
!= 0)
385 DepIterator D
= Pkg
.CurrentVer().DependsList();
386 State
.DepState
&= VersionState(D
,DepNow
,DepNowMin
,DepNowPolicy
);
389 /* Check the candidate state. We do not compare against the whole as
390 a candidate state but check the candidate version against the
392 if (State
.CandidateVer
!= 0)
394 DepIterator D
= State
.CandidateVerIter(*this).DependsList();
395 State
.DepState
&= VersionState(D
,DepInstall
,DepCandMin
,DepCandPolicy
);
398 // Check target state which can only be current or installed
399 if (State
.InstallVer
!= 0)
401 DepIterator D
= State
.InstVerIter(*this).DependsList();
402 State
.DepState
&= VersionState(D
,DepInstall
,DepInstMin
,DepInstPolicy
);
406 // DepCache::Update - Figure out all the state information /*{{{*/
407 // ---------------------------------------------------------------------
408 /* This will figure out the state of all the packages and all the
409 dependencies based on the current policy. */
410 void pkgDepCache::Update(OpProgress
*Prog
)
420 // Perform the depends pass
422 for (PkgIterator I
= PkgBegin(); I
.end() != true; I
++,Done
++)
424 if (Prog
!= 0 && Done%20
== 0)
425 Prog
->Progress(Done
);
426 for (VerIterator V
= I
.VersionList(); V
.end() != true; V
++)
428 unsigned char Group
= 0;
430 for (DepIterator D
= V
.DependsList(); D
.end() != true; D
++)
432 // Build the dependency state.
433 unsigned char &State
= DepState
[D
->ID
];
434 State
= DependencyState(D
);
436 // Add to the group if we are within an or..
439 if ((D
->CompareOp
& Dep::Or
) != Dep::Or
)
442 // Invert for Conflicts
443 if (D
->Type
== Dep::Conflicts
|| D
->Type
== Dep::Obsoletes
)
448 // Compute the pacakge dependency state and size additions
455 Prog
->Progress(Done
);
458 // DepCache::Update - Update the deps list of a package /*{{{*/
459 // ---------------------------------------------------------------------
460 /* This is a helper for update that only does the dep portion of the scan.
461 It is mainly ment to scan reverse dependencies. */
462 void pkgDepCache::Update(DepIterator D
)
464 // Update the reverse deps
465 for (;D
.end() != true; D
++)
467 unsigned char &State
= DepState
[D
->ID
];
468 State
= DependencyState(D
);
470 // Invert for Conflicts
471 if (D
->Type
== Dep::Conflicts
|| D
->Type
== Dep::Obsoletes
)
474 RemoveStates(D
.ParentPkg());
475 BuildGroupOrs(D
.ParentVer());
476 UpdateVerState(D
.ParentPkg());
477 AddStates(D
.ParentPkg());
481 // DepCache::Update - Update the related deps of a package /*{{{*/
482 // ---------------------------------------------------------------------
483 /* This is called whenever the state of a package changes. It updates
484 all cached dependencies related to this package. */
485 void pkgDepCache::Update(PkgIterator
const &Pkg
)
487 // Recompute the dep of the package
492 // Update the reverse deps
493 Update(Pkg
.RevDependsList());
495 // Update the provides map for the current ver
496 if (Pkg
->CurrentVer
!= 0)
497 for (PrvIterator P
= Pkg
.CurrentVer().ProvidesList();
498 P
.end() != true; P
++)
499 Update(P
.ParentPkg().RevDependsList());
501 // Update the provides map for the candidate ver
502 if (PkgState
[Pkg
->ID
].CandidateVer
!= 0)
503 for (PrvIterator P
= PkgState
[Pkg
->ID
].CandidateVerIter(*this).ProvidesList();
504 P
.end() != true; P
++)
505 Update(P
.ParentPkg().RevDependsList());
510 // DepCache::MarkKeep - Put the package in the keep state /*{{{*/
511 // ---------------------------------------------------------------------
513 void pkgDepCache::MarkKeep(PkgIterator
const &Pkg
,bool Soft
)
515 // Simplifies other routines.
516 if (Pkg
.end() == true)
519 /* Reject an attempt to keep a non-source broken installed package, those
521 if (Pkg
.State() == PkgIterator::NeedsUnpack
&&
522 Pkg
.CurrentVer().Downloadable() == false)
525 /* We changed the soft state all the time so the UI is a bit nicer
527 StateCache
&P
= PkgState
[Pkg
->ID
];
529 P
.iFlags
|= AutoKept
;
531 P
.iFlags
&= ~AutoKept
;
533 // Check that it is not already kept
534 if (P
.Mode
== ModeKeep
)
537 // We dont even try to keep virtual packages..
538 if (Pkg
->VersionList
== 0)
541 P
.Flags
&= ~Flag::Auto
;
546 if (Pkg
->CurrentVer
== 0)
549 P
.InstallVer
= Pkg
.CurrentVer();
558 // DepCache::MarkDelete - Put the package in the delete state /*{{{*/
559 // ---------------------------------------------------------------------
561 void pkgDepCache::MarkDelete(PkgIterator
const &Pkg
, bool rPurge
)
563 // Simplifies other routines.
564 if (Pkg
.end() == true)
567 // Check that it is not already marked for delete
568 StateCache
&P
= PkgState
[Pkg
->ID
];
569 P
.iFlags
&= ~(AutoKept
| Purge
);
573 if ((P
.Mode
== ModeDelete
|| P
.InstallVer
== 0) &&
574 (Pkg
.Purge() == true || rPurge
== false))
577 // We dont even try to delete virtual packages..
578 if (Pkg
->VersionList
== 0)
584 if (Pkg
->CurrentVer
== 0 && (Pkg
.Purge() == true || rPurge
== false))
589 P
.Flags
&= Flag::Auto
;
596 // DepCache::MarkInstall - Put the package in the install state /*{{{*/
597 // ---------------------------------------------------------------------
599 void pkgDepCache::MarkInstall(PkgIterator
const &Pkg
,bool AutoInst
,
605 // Simplifies other routines.
606 if (Pkg
.end() == true)
609 /* Check that it is not already marked for install and that it can be
611 StateCache
&P
= PkgState
[Pkg
->ID
];
612 P
.iFlags
&= ~AutoKept
;
613 if (P
.InstBroken() == false && (P
.Mode
== ModeInstall
||
614 P
.CandidateVer
== (Version
*)Pkg
.CurrentVer()))
616 if (P
.CandidateVer
== (Version
*)Pkg
.CurrentVer() && P
.InstallVer
== 0)
621 // See if there is even any possible instalation candidate
622 if (P
.CandidateVer
== 0)
625 // We dont even try to install virtual packages..
626 if (Pkg
->VersionList
== 0)
629 /* Target the candidate version and remove the autoflag. We reset the
630 autoflag below if this was called recursively. Otherwise the user
631 should have the ability to de-auto a package by changing its state */
635 P
.Mode
= ModeInstall
;
636 P
.InstallVer
= P
.CandidateVer
;
637 P
.Flags
&= ~Flag::Auto
;
638 if (P
.CandidateVer
== (Version
*)Pkg
.CurrentVer())
645 if (AutoInst
== false)
648 DepIterator Dep
= P
.InstVerIter(*this).DependsList();
649 for (; Dep
.end() != true;)
652 DepIterator Start
= Dep
;
655 for (bool LastOR
= true; Dep
.end() == false && LastOR
== true; Dep
++,Ors
++)
657 LastOR
= (Dep
->CompareOp
& Dep::Or
) == Dep::Or
;
659 if ((DepState
[Dep
->ID
] & DepInstall
) == DepInstall
)
663 // Dep is satisfied okay.
667 /* Check if this dep should be consider for install. If it is a user
668 defined important dep and we are installed a new package then
669 it will be installed. Otherwise we only worry about critical deps */
670 if (IsImportantDep(Start
) == false)
672 if (Pkg
->CurrentVer
!= 0 && Start
.IsCritical() == false)
675 /* If we are in an or group locate the first or that can
676 succeed. We have already cached this.. */
677 for (; Ors
> 1 && (DepState
[Start
->ID
] & DepCVer
) != DepCVer
; Ors
--)
680 /* This bit is for processing the possibilty of an install/upgrade
681 fixing the problem */
682 SPtrArray
<Version
*> List
= Start
.AllTargets();
683 if ((DepState
[Start
->ID
] & DepCVer
) == DepCVer
)
685 // Right, find the best version to install..
686 Version
**Cur
= List
;
687 PkgIterator P
= Start
.TargetPkg();
688 PkgIterator
InstPkg(*Cache
,0);
690 // See if there are direct matches (at the start of the list)
691 for (; *Cur
!= 0 && (*Cur
)->ParentPkg
== P
.Index(); Cur
++)
693 PkgIterator
Pkg(*Cache
,Cache
->PkgP
+ (*Cur
)->ParentPkg
);
694 if (PkgState
[Pkg
->ID
].CandidateVer
!= *Cur
)
700 // Select the highest priority providing package
701 if (InstPkg
.end() == true)
703 pkgPrioSortList(*Cache
,Cur
);
704 for (; *Cur
!= 0; Cur
++)
706 PkgIterator
Pkg(*Cache
,Cache
->PkgP
+ (*Cur
)->ParentPkg
);
707 if (PkgState
[Pkg
->ID
].CandidateVer
!= *Cur
)
714 if (InstPkg
.end() == false)
716 if(_config
->FindB("Debug::pkgDepCache::AutoInstall",false) == true)
717 std::clog
<< "Installing " << InstPkg
.Name()
718 << " as dep of " << Pkg
.Name()
720 MarkInstall(InstPkg
,true,Depth
+ 1);
722 // Set the autoflag, after MarkInstall because MarkInstall unsets it
723 if (P
->CurrentVer
== 0)
724 PkgState
[InstPkg
->ID
].Flags
|= Flag::Auto
;
730 /* For conflicts we just de-install the package and mark as auto,
731 Conflicts may not have or groups */
732 if (Start
->Type
== Dep::Conflicts
|| Start
->Type
== Dep::Obsoletes
)
734 for (Version
**I
= List
; *I
!= 0; I
++)
736 VerIterator
Ver(*this,*I
);
737 PkgIterator Pkg
= Ver
.ParentPkg();
740 PkgState
[Pkg
->ID
].Flags
|= Flag::Auto
;
747 // DepCache::SetReInstall - Set the reinstallation flag /*{{{*/
748 // ---------------------------------------------------------------------
750 void pkgDepCache::SetReInstall(PkgIterator
const &Pkg
,bool To
)
755 StateCache
&P
= PkgState
[Pkg
->ID
];
757 P
.iFlags
|= ReInstall
;
759 P
.iFlags
&= ~ReInstall
;
765 // DepCache::SetCandidateVersion - Change the candidate version /*{{{*/
766 // ---------------------------------------------------------------------
768 void pkgDepCache::SetCandidateVersion(VerIterator TargetVer
)
770 pkgCache::PkgIterator Pkg
= TargetVer
.ParentPkg();
771 StateCache
&P
= PkgState
[Pkg
->ID
];
776 if (P
.CandidateVer
== P
.InstallVer
)
777 P
.InstallVer
= (Version
*)TargetVer
;
778 P
.CandidateVer
= (Version
*)TargetVer
;
786 // StateCache::Update - Compute the various static display things /*{{{*/
787 // ---------------------------------------------------------------------
788 /* This is called whenever the Candidate version changes. */
789 void pkgDepCache::StateCache::Update(PkgIterator Pkg
,pkgCache
&Cache
)
792 VerIterator Ver
= CandidateVerIter(Cache
);
794 // Use a null string or the version string
795 if (Ver
.end() == true)
798 CandVersion
= Ver
.VerStr();
800 // Find the current version
802 if (Pkg
->CurrentVer
!= 0)
803 CurVersion
= Pkg
.CurrentVer().VerStr();
805 // Strip off the epochs for display
806 CurVersion
= StripEpoch(CurVersion
);
807 CandVersion
= StripEpoch(CandVersion
);
809 // Figure out if its up or down or equal
810 Status
= Ver
.CompareVer(Pkg
.CurrentVer());
811 if (Pkg
->CurrentVer
== 0 || Pkg
->VersionList
== 0 || CandidateVer
== 0)
815 // StateCache::StripEpoch - Remove the epoch specifier from the version /*{{{*/
816 // ---------------------------------------------------------------------
818 const char *pkgDepCache::StateCache::StripEpoch(const char *Ver
)
824 for (const char *I
= Ver
; *I
!= 0; I
++)
831 // Policy::GetCandidateVer - Returns the Candidate install version /*{{{*/
832 // ---------------------------------------------------------------------
833 /* The default just returns the highest available version that is not
834 a source and automatic. */
835 pkgCache::VerIterator
pkgDepCache::Policy::GetCandidateVer(PkgIterator Pkg
)
837 /* Not source/not automatic versions cannot be a candidate version
838 unless they are already installed */
839 VerIterator
Last(*(pkgCache
*)this,0);
841 for (VerIterator I
= Pkg
.VersionList(); I
.end() == false; I
++)
843 if (Pkg
.CurrentVer() == I
)
846 for (VerFileIterator J
= I
.FileList(); J
.end() == false; J
++)
848 if ((J
.File()->Flags
& Flag::NotSource
) != 0)
851 /* Stash the highest version of a not-automatic source, we use it
852 if there is nothing better */
853 if ((J
.File()->Flags
& Flag::NotAutomatic
) != 0)
855 if (Last
.end() == true)
867 // Policy::IsImportantDep - True if the dependency is important /*{{{*/
868 // ---------------------------------------------------------------------
870 bool pkgDepCache::Policy::IsImportantDep(DepIterator Dep
)
872 return Dep
.IsCritical();