summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/algorithms.cc45
-rw-r--r--apt-pkg/cacheiterators.h5
-rw-r--r--apt-pkg/depcache.h5
-rw-r--r--apt-pkg/packagemanager.cc4
-rw-r--r--apt-pkg/pkgcache.cc14
5 files changed, 41 insertions, 32 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index e3012489d..e4bc99a28 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: algorithms.cc,v 1.1 1998/07/07 04:17:00 jgg Exp $
+// $Id: algorithms.cc,v 1.2 1998/07/12 01:25:59 jgg Exp $
/* ######################################################################
Algorithms - A set of misc algorithms
@@ -13,7 +13,6 @@
#endif
#include <pkglib/algorithms.h>
#include <pkglib/error.h>
-#include <pkglib/pkgelement.h>
#include <iostream.h>
/*}}}*/
@@ -23,7 +22,7 @@ pkgProblemResolver *pkgProblemResolver::This = 0;
// ---------------------------------------------------------------------
/* */
pkgSimulate::pkgSimulate(pkgDepCache &Cache) : pkgPackageManager(Cache),
- Sim(true,true)
+ Sim(Cache)
{
Flags = new unsigned char[Cache.HeaderP->PackageCount];
memset(Flags,0,sizeof(*Flags)*Cache.HeaderP->PackageCount);
@@ -48,12 +47,12 @@ bool pkgSimulate::Install(PkgIterator iPkg,string /*File*/)
continue;
for (DepIterator D = Sim[I].InstVerIter(Sim).DependsList(); D.end() == false; D++)
- if (D->Type == pkgDEP_Conflicts || D->Type == pkgDEP_PreDepends)
+ if (D->Type == pkgCache::Dep::Conflicts || D->Type == pkgCache::Dep::PreDepends)
{
if ((Sim[D] & pkgDepCache::DepInstall) == 0)
{
cout << " [" << I.Name() << " on " << D.TargetPkg().Name() << ']';
- if (D->Type == pkgDEP_Conflicts)
+ if (D->Type == pkgCache::Dep::Conflicts)
_error->Error("Fatal, conflicts violated %s",I.Name());
}
}
@@ -91,7 +90,7 @@ bool pkgSimulate::Configure(PkgIterator iPkg)
(Sim[D] & pkgDepCache::DepInstall) != 0)
continue;
- if (D->Type == pkgDEP_Conflicts)
+ if (D->Type == pkgCache::Dep::Conflicts)
cout << " Conflicts:" << D.TargetPkg().Name();
else
cout << " Depends:" << D.TargetPkg().Name();
@@ -162,18 +161,18 @@ bool pkgApplyStatus(pkgDepCache &Cache)
switch (I->CurrentState)
{
// This means installation failed somehow
- case pkgSTATE_UnPacked:
- case pkgSTATE_HalfConfigured:
+ case pkgCache::State::UnPacked:
+ case pkgCache::State::HalfConfigured:
Cache.MarkKeep(I);
break;
// This means removal failed
- case pkgSTATE_HalfInstalled:
+ case pkgCache::State::HalfInstalled:
Cache.MarkDelete(I);
break;
default:
- if (I->InstState != pkgSTATE_Ok)
+ if (I->InstState != pkgCache::State::Ok)
return _error->Error("The package %s is not ok and I "
"don't know how to fix it!",I.Name());
}
@@ -200,7 +199,7 @@ bool pkgFixBroken(pkgDepCache &Cache)
Cache[I].Delete() == true)
continue;
- if ((Cache[I].InstVerIter(Cache).File()->Flags & pkgFLAG_NotSource) == 0)
+ if (Cache[I].InstVerIter(Cache).Downloadable() == false)
continue;
Cache.MarkInstall(I,true);
@@ -229,7 +228,7 @@ bool pkgDistUpgrade(pkgDepCache &Cache)
/* Now, auto upgrade all essential packages - this ensures that
the essential packages are present and working */
for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
- if ((I->Flags & pkgFLAG_Essential) == pkgFLAG_Essential)
+ if ((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
Cache.MarkInstall(I,true);
/* We do it again over all previously installed packages to force
@@ -243,7 +242,7 @@ bool pkgDistUpgrade(pkgDepCache &Cache)
// Hold back held packages.
for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
{
- if (I->SelectedState == pkgSTATE_Hold)
+ if (I->SelectedState == pkgCache::State::Hold)
{
Fix.Protect(I);
Cache.MarkKeep(I);
@@ -303,7 +302,7 @@ void pkgProblemResolver::MakeScores()
essantial package above most other packages but low enough
to allow an obsolete essential packages to be removed by
a conflicts on a powerfull normal package (ie libc6) */
- if ((I->Flags & pkgFLAG_Essential) == pkgFLAG_Essential)
+ if ((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
Score += 100;
// We transform the priority
@@ -326,7 +325,7 @@ void pkgProblemResolver::MakeScores()
for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); D.end() == false; D++)
{
- if (D->Type == pkgDEP_Depends || D->Type == pkgDEP_PreDepends)
+ if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
Scores[D.TargetPkg()->ID]++;
}
}
@@ -347,7 +346,7 @@ void pkgProblemResolver::MakeScores()
{
// Only do it for the install version
if ((pkgCache::Version *)D.ParentVer() != Cache[D.ParentPkg()].InstallVer ||
- (D->Type != pkgDEP_Depends && D->Type != pkgDEP_PreDepends))
+ (D->Type != pkgCache::Dep::Depends && D->Type != pkgCache::Dep::PreDepends))
continue;
Scores[I->ID] += abs(OldScores[D.ParentPkg()->ID]);
@@ -400,7 +399,7 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
for (bool LastOR = true; D.end() == false && LastOR == true; D++)
{
State |= Cache[D];
- LastOR = (D->CompareOp & pkgOP_OR) == pkgOP_OR;
+ LastOR = (D->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or;
if (LastOR == true)
End = D;
}
@@ -437,7 +436,7 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
{
/* We let the algorithm deal with conflicts on its next iteration,
it is much smarter than us */
- if (End->Type == pkgDEP_Conflicts)
+ if (End->Type == pkgCache::Dep::Conflicts)
continue;
if (Debug == true)
@@ -586,7 +585,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
for (bool LastOR = true; D.end() == false && LastOR == true; D++)
{
State |= Cache[D];
- LastOR = (D->CompareOp & pkgOP_OR) == pkgOP_OR;
+ LastOR = (D->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or;
if (LastOR == true)
End = D;
}
@@ -624,7 +623,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
" as a solution to " << I.Name() << ' ' << (int)Scores[I->ID] << endl;
if (Scores[I->ID] <= Scores[Pkg->ID] ||
((Cache[End] & pkgDepCache::DepGNow) == 0 &&
- End->Type != pkgDEP_Conflicts))
+ End->Type != pkgCache::Dep::Conflicts))
{
if ((Flags[I->ID] & Protected) != 0)
continue;
@@ -661,13 +660,13 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
LEnd->Pkg = Pkg;
LEnd->Dep = End;
LEnd++;
- if (End->Type != pkgDEP_Conflicts)
+ if (End->Type != pkgCache::Dep::Conflicts)
break;
}
}
// Hm, nothing can possibly satisify this dep. Nuke it.
- if (VList[0] == 0 && End->Type != pkgDEP_Conflicts)
+ if (VList[0] == 0 && End->Type != pkgCache::Dep::Conflicts)
{
Cache.MarkKeep(I);
if (Cache[I].InstBroken() == false)
@@ -698,7 +697,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
Change = true;
if ((Cache[J->Dep] & pkgDepCache::DepGNow) == 0)
{
- if (J->Dep->Type == pkgDEP_Conflicts)
+ if (J->Dep->Type == pkgCache::Dep::Conflicts)
{
if (Debug == true)
cout << " Fixing " << I.Name() << " via remove of " << J->Pkg.Name() << endl;
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index f234526db..d382e4b98 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: cacheiterators.h,v 1.4 1998/07/07 04:17:00 jgg Exp $
+// $Id: cacheiterators.h,v 1.5 1998/07/12 01:26:00 jgg Exp $
/* ######################################################################
Cache Iterators - Iterators for navigating the cache structure
@@ -125,6 +125,7 @@ class pkgCache::VerIterator
inline PrvIterator ProvidesList() const;
inline VerFileIterator FileList() const;
inline unsigned long Index() const {return Ver - Owner.VerP;};
+ bool Downloadable() const;
inline VerIterator(pkgCache &Owner,Version *Trg = 0) : Ver(Trg), Owner(Owner)
{
@@ -300,7 +301,7 @@ class pkgCache::VerFileIterator
inline PkgFileIterator File() const {return PkgFileIterator(*Owner,FileP->File + Owner->PkgFileP);};
inline unsigned long Index() const {return FileP - Owner->VerFileP;};
-
+
inline VerFileIterator(pkgCache &Owner,VerFile *Trg) : Owner(&Owner), FileP(Trg) {};
};
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h
index 222e34425..39ed215b2 100644
--- a/apt-pkg/depcache.h
+++ b/apt-pkg/depcache.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: depcache.h,v 1.1 1998/07/07 04:17:01 jgg Exp $
+// $Id: depcache.h,v 1.2 1998/07/12 01:26:01 jgg Exp $
/* ######################################################################
DepCache - Dependency Extension data for the cache
@@ -167,9 +167,6 @@ class pkgDepCache : public pkgCache
// This is for debuging
void Update();
- // Dep Processing for AutoKeep
- void ResolveConflicts(unsigned char *Touched);
-
// Hook to keep the extra data in sync
virtual bool ReMap();
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index e3504f8bf..afe5fc176 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: packagemanager.cc,v 1.2 1998/07/09 05:41:12 jgg Exp $
+// $Id: packagemanager.cc,v 1.3 1998/07/12 01:26:02 jgg Exp $
/* ######################################################################
Package Manager - Abstacts the package manager
@@ -64,7 +64,7 @@ bool pkgPackageManager::FixMissing()
}
// Now downgrade everything that is broken
- Cache.ResolveConflicts(Touch);
+// Cache.ResolveConflicts(Touch);
delete [] Touch;
return Cache.BrokenCount() == 0;
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 085225031..b8af6b5e4 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: pkgcache.cc,v 1.5 1998/07/07 04:17:02 jgg Exp $
+// $Id: pkgcache.cc,v 1.6 1998/07/12 01:26:04 jgg Exp $
/* ######################################################################
Package Cache - Accessor code for the cache
@@ -358,6 +358,18 @@ int pkgCache::VerIterator::CompareVer(const VerIterator &B) const
return -1;
}
/*}}}*/
+// VerIterator::Downloadable - Checks if the version is downloadable /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool pkgCache::VerIterator::Downloadable() const
+{
+ VerFileIterator Files = FileList();
+ for (; Files.end() == false; Files++)
+ if ((Files.File()->Flags & Flag::NotSource) != Flag::NotSource)
+ return true;
+ return false;
+}
+ /*}}}*/
// PkgFileIterator::IsOk - Checks if the cache is in sync with the file /*{{{*/
// ---------------------------------------------------------------------
/* This stats the file and compares its stats with the ones that were