summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/orderlist.cc27
-rw-r--r--apt-pkg/orderlist.h4
-rw-r--r--apt-pkg/packagemanager.cc23
3 files changed, 32 insertions, 22 deletions
diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc
index c831e9a71..7cdea188e 100644
--- a/apt-pkg/orderlist.cc
+++ b/apt-pkg/orderlist.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: orderlist.cc,v 1.4 1999/07/03 03:10:35 jgg Exp $
+// $Id: orderlist.cc,v 1.5 1999/07/04 23:22:53 jgg Exp $
/* ######################################################################
Order List - Represents and Manipulates an ordered list of packages.
@@ -89,6 +89,25 @@ pkgOrderList::~pkgOrderList()
delete [] Flags;
}
/*}}}*/
+// OrderList::IsMissing - Check if a file is missing /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool pkgOrderList::IsMissing(PkgIterator Pkg)
+{
+ // Skip packages to erase
+ if (Cache[Pkg].Delete() == true)
+ return false;
+
+ // Skip Packages that need configure only.
+ if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure &&
+ Cache[Pkg].Keep() == true)
+ return false;
+
+ if (FileList != 0 && FileList[Pkg->ID].empty() == false)
+ return false;
+ return true;
+}
+ /*}}}*/
// OrderList::DoRun - Does an order run /*{{{*/
// ---------------------------------------------------------------------
@@ -299,9 +318,9 @@ int pkgOrderList::OrderCompareA(const void *a, const void *b)
// We order missing files to toward the end
if (Me->FileList != 0)
{
- if ((Res = BoolCompare(Me->FileList[A->ID].empty() && !Me->Cache[A].Delete(),
- Me->FileList[B->ID].empty() && !Me->Cache[B].Delete())) == 0)
- return -1*Res;
+ if ((Res = BoolCompare(Me->IsMissing(A),
+ Me->IsMissing(B))) == 0)
+ return Res;
}
if (A.State() != pkgCache::PkgIterator::NeedsNothing &&
diff --git a/apt-pkg/orderlist.h b/apt-pkg/orderlist.h
index 7a33b97cc..5456984e4 100644
--- a/apt-pkg/orderlist.h
+++ b/apt-pkg/orderlist.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: orderlist.h,v 1.3 1999/07/03 03:10:35 jgg Exp $
+// $Id: orderlist.h,v 1.4 1999/07/04 23:22:53 jgg Exp $
/* ######################################################################
Order List - Represents and Manipulates an ordered list of packages.
@@ -99,7 +99,9 @@ class pkgOrderList
inline void Flag(PkgIterator Pkg,unsigned long F) {Flags[Pkg->ID] |= F;};
inline void Flag(Package *Pkg,unsigned long F) {Flags[Pkg->ID] |= F;};
inline bool IsNow(PkgIterator Pkg) {return (Flags[Pkg->ID] & States) == 0;};
+ bool IsMissing(PkgIterator Pkg);
void WipeFlags(unsigned long F);
+ void SetFileList(string *FileList) {this->FileList = FileList;};
// Accessors
inline iterator begin() {return List;};
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index 8556687ad..9e2eee969 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.15 1999/07/03 03:10:35 jgg Exp $
+// $Id: packagemanager.cc,v 1.16 1999/07/04 23:22:53 jgg Exp $
/* ######################################################################
Package Manager - Abstacts the package manager
@@ -89,25 +89,14 @@ bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
bool pkgPackageManager::FixMissing()
{
pkgProblemResolver Resolve(Cache);
-
+ List->SetFileList(FileNames);
+
bool Bad = false;
for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
{
- // These don't need files
- if (Cache[I].Keep() == true)
- continue;
- if (Cache[I].Delete() == true)
- continue;
-
- // We have a filename
- if (FileNames[I->ID].empty() == false)
+ if (List->IsMissing(I) == false)
continue;
-
- // Skip Packages that need configure only.
- if (I.State() == pkgCache::PkgIterator::NeedsConfigure &&
- Cache[I].Keep() == true)
- continue;
-
+
// Okay, this file is missing and we need it. Mark it for keep
Bad = true;
Cache.MarkKeep(I);
@@ -526,7 +515,7 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall()
continue;
}
- if (Cache[Pkg].Delete() == false && FileNames[Pkg->ID].empty() == true)
+ if (List->IsMissing(Pkg) == true)
{
if (Debug == true)
clog << "Sequence completed at" << Pkg.Name() << endl;