summaryrefslogtreecommitdiff
path: root/apt-pkg/packagemanager.cc
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:54:10 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:54:10 +0000
commit281daf46d178d4fb6f43e8b13b9b51736db84d74 (patch)
tree236d9fb0f8b1fc26b22406ba6eab54967d69f253 /apt-pkg/packagemanager.cc
parenta4e87467fe5c5d12a617a43f3115c89daa54b7cf (diff)
CD swapping support
Author: jgg Date: 1999-07-03 03:10:35 GMT CD swapping support
Diffstat (limited to 'apt-pkg/packagemanager.cc')
-rw-r--r--apt-pkg/packagemanager.cc82
1 files changed, 64 insertions, 18 deletions
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index 3b09871e5..8556687ad 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.14 1999/02/21 08:38:53 jgg Exp $
+// $Id: packagemanager.cc,v 1.15 1999/07/03 03:10:35 jgg Exp $
/* ######################################################################
Package Manager - Abstacts the package manager
@@ -60,7 +60,8 @@ bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++)
{
PkgIterator Pkg(Cache,*I);
-
+ FileNames[Pkg->ID] = string();
+
// Skip packages to erase
if (Cache[Pkg].Delete() == true)
continue;
@@ -69,7 +70,11 @@ bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure &&
Cache[Pkg].Keep() == true)
continue;
-
+
+ // Skip already processed packages
+ if (List->IsNow(Pkg) == false)
+ continue;
+
new pkgAcqArchive(Owner,Sources,Recs,Cache[Pkg].InstVerIter(Cache),
FileNames[Pkg->ID]);
}
@@ -122,6 +127,9 @@ bool pkgPackageManager::FixMissing()
going to change. */
bool pkgPackageManager::CreateOrderList()
{
+ if (List != 0)
+ return true;
+
delete List;
List = new pkgOrderList(Cache);
@@ -487,58 +495,96 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg)
// PM::OrderInstall - Installation ordering routine /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool pkgPackageManager::OrderInstall()
+pkgPackageManager::OrderResult pkgPackageManager::OrderInstall()
{
if (CreateOrderList() == false)
- return false;
+ return Failed;
+
+ Reset();
if (Debug == true)
clog << "Begining to order" << endl;
-
- if (List->OrderUnpack() == false)
- return _error->Error("Internal ordering error");
+ if (List->OrderUnpack(FileNames) == false)
+ {
+ _error->Error("Internal ordering error");
+ return Failed;
+ }
+
if (Debug == true)
clog << "Done ordering" << endl;
+ bool DoneSomething = false;
for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++)
{
PkgIterator Pkg(Cache,*I);
+
+ if (List->IsNow(Pkg) == false)
+ {
+ if (Debug == true)
+ clog << "Skipping already done " << Pkg.Name() << endl;
+ continue;
+ }
+
+ if (Cache[Pkg].Delete() == false && FileNames[Pkg->ID].empty() == true)
+ {
+ if (Debug == true)
+ clog << "Sequence completed at" << Pkg.Name() << endl;
+ if (DoneSomething == false)
+ {
+ _error->Error("Internal Error, ordering was unable to handle the media swap");
+ return Failed;
+ }
+ return Incomplete;
+ }
// Sanity check
if (Cache[Pkg].Keep() == true && Pkg.State() == pkgCache::PkgIterator::NeedsNothing)
- return _error->Error("Internal Error, trying to manipulate a kept package");
+ {
+ _error->Error("Internal Error, trying to manipulate a kept package");
+ return Failed;
+ }
// Perform a delete or an install
if (Cache[Pkg].Delete() == true)
{
if (SmartRemove(Pkg) == false)
- return false;
+ return Failed;
}
else
if (SmartUnPack(Pkg) == false)
- return false;
+ return Failed;
+ DoneSomething = true;
}
// Final run through the configure phase
if (ConfigureAll() == false)
- return false;
+ return Failed;
// Sanity check
for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++)
+ {
if (List->IsFlag(*I,pkgOrderList::Configured) == false)
- return _error->Error("Internal error, packages left unconfigured. %s",
- PkgIterator(Cache,*I).Name());
-
- return true;
+ {
+ _error->Error("Internal error, packages left unconfigured. %s",
+ PkgIterator(Cache,*I).Name());
+ return Failed;
+ }
+ }
+
+ return Completed;
}
/*}}}*/
// PM::DoInstall - Does the installation /*{{{*/
// ---------------------------------------------------------------------
/* This uses the filenames in FileNames and the information in the
DepCache to perform the installation of packages.*/
-bool pkgPackageManager::DoInstall()
+pkgPackageManager::OrderResult pkgPackageManager::DoInstall()
{
- return OrderInstall() && Go();
+ OrderResult Res = OrderInstall();
+ if (Res != Failed)
+ if (Go() == false)
+ return Failed;
+ return Res;
}
/*}}}*/