summaryrefslogtreecommitdiff
path: root/apt-pkg/packagemanager.cc
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:51:32 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:51:32 +0000
commit30e1eab53324523297a24c18819b27aba7ce1fb4 (patch)
treea783232e885e67e7d4e2850be380015a1ab9b648 /apt-pkg/packagemanager.cc
parent94235cfb1980f4056638fe9abaef162f8c6fe38c (diff)
downloadapt-30e1eab53324523297a24c18819b27aba7ce1fb4.tar.gz
By gosh, I think it works
Author: jgg Date: 1998-11-22 03:20:30 GMT By gosh, I think it works
Diffstat (limited to 'apt-pkg/packagemanager.cc')
-rw-r--r--apt-pkg/packagemanager.cc30
1 files changed, 16 insertions, 14 deletions
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index 2b47d425..e6222f00 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.5 1998/11/13 04:23:30 jgg Exp $
+// $Id: packagemanager.cc,v 1.6 1998/11/22 03:20:33 jgg Exp $
/* ######################################################################
Package Manager - Abstacts the package manager
@@ -22,6 +22,8 @@
#include <apt-pkg/error.h>
#include <apt-pkg/version.h>
#include <apt-pkg/acquire-item.h>
+#include <apt-pkg/algorithms.h>
+#include <apt-pkg/configuration.h>
/*}}}*/
// PM::PackageManager - Constructor /*{{{*/
@@ -31,6 +33,7 @@ pkgPackageManager::pkgPackageManager(pkgDepCache &Cache) : Cache(Cache)
{
FileNames = new string[Cache.Head().PackageCount];
List = 0;
+ Debug = _config->FindB("Debug::pkgPackageManager",false);
}
/*}}}*/
// PM::PackageManager - Destructor /*{{{*/
@@ -57,7 +60,8 @@ bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
Cache[I].Delete() == true)
continue;
- new pkgAcqArchive(Owner,Sources,Recs,Cache[I].InstVerIter(Cache));
+ new pkgAcqArchive(Owner,Sources,Recs,Cache[I].InstVerIter(Cache),
+ FileNames[I->ID]);
}
return true;
}
@@ -68,16 +72,11 @@ bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
be downloaded. */
bool pkgPackageManager::FixMissing()
{
- unsigned char *Touch = new unsigned char[Cache.Head().PackageCount];
+ pkgProblemResolver Resolve(Cache);
+
for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
{
- // Create the status list that ResolveConflicts needs
- if ((Cache[I].DepState & pkgDepCache::DepNowMin) == pkgDepCache::DepNowMin)
- Touch[I->ID] = (1 << 0) | (1 << 1);
- else
- Touch[I->ID] = 1 << 1;
-
- if (Cache[I].Keep() == true)
+ if (Cache[I].Keep() == true)
continue;
if (FileNames[I->ID].empty() == false || Cache[I].Delete() == true)
continue;
@@ -85,10 +84,7 @@ bool pkgPackageManager::FixMissing()
}
// Now downgrade everything that is broken
-// Cache.ResolveConflicts(Touch);
- delete [] Touch;
-
- return Cache.BrokenCount() == 0;
+ return Resolve.ResolveByKeep() == true && Cache.BrokenCount() == 0;
}
/*}}}*/
@@ -450,10 +446,16 @@ bool pkgPackageManager::OrderInstall()
if ((I->Flags & pkgCache::Flag::ImmediateConf) == pkgCache::Flag::ImmediateConf)
List->Flag(I,pkgOrderList::Immediate);
}
+
+ if (Debug == true)
+ clog << "Begining to order" << endl;
if (List->OrderUnpack() == false)
return _error->Error("Internal ordering error");
+ if (Debug == true)
+ clog << "Done ordering" << endl;
+
for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++)
{
PkgIterator Pkg(Cache,*I);