X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/90a88b83020eb9526951eec83e3075b54653fa33..6e7c6c3f58193fd5db3d9d598ac65a1571522a58:/apt-pkg/packagemanager.cc diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 10e2858ed..304d1c653 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -25,7 +25,7 @@ #include #include - /*}}}*/ +#include using namespace std; @@ -118,6 +118,41 @@ bool pkgPackageManager::FixMissing() } /*}}}*/ +// PM::ImmediateAdd - Add the immediate flag recursivly /*{{{*/ +// --------------------------------------------------------------------- +/* This adds the immediate flag to the pkg and recursively to the + dependendies + */ +void pkgPackageManager::ImmediateAdd(PkgIterator I, bool UseInstallVer) +{ + DepIterator D; + + if(UseInstallVer) + { + if(Cache[I].InstallVer == 0) + return; + D = Cache[I].InstVerIter(Cache).DependsList(); + } else { + if (I->CurrentVer == 0) + return; + D = I.CurrentVer().DependsList(); + } + + for ( /* nothing */ ; D.end() == false; D++) + if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends) + { + if(!List->IsFlag(D.TargetPkg(), pkgOrderList::Immediate)) + { + if(Debug) + clog << "ImmediateAdd(): Adding Immediate flag to " << I.Name() << endl; + List->Flag(D.TargetPkg(),pkgOrderList::Immediate); + ImmediateAdd(D.TargetPkg(), UseInstallVer); + } + } + return; +} + /*}}}*/ + // PM::CreateOrderList - Create the ordering class /*{{{*/ // --------------------------------------------------------------------- /* This populates the ordering list with all the packages that are @@ -144,21 +179,15 @@ bool pkgPackageManager::CreateOrderList() (I->Flags & pkgCache::Flag::Important) == pkgCache::Flag::Important) && NoImmConfigure == false) { + if(Debug) + clog << "CreateOrderList(): Adding Immediate flag for " << I.Name() << endl; List->Flag(I,pkgOrderList::Immediate); - - // Look for other packages to make immediate configurea - if (Cache[I].InstallVer != 0) - for (DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); - D.end() == false; D++) - if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends) - List->Flag(D.TargetPkg(),pkgOrderList::Immediate); + + // Look for other install packages to make immediate configurea + ImmediateAdd(I, true); // And again with the current version. - if (I->CurrentVer != 0) - for (DepIterator D = I.CurrentVer().DependsList(); - D.end() == false; D++) - if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends) - List->Flag(D.TargetPkg(),pkgOrderList::Immediate); + ImmediateAdd(I, false); } // Not interesting @@ -624,6 +653,22 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall() return Completed; } /*}}}*/ +// PM::DoInstallPostFork - Does install part that happens after the fork /*{{{*/ +// --------------------------------------------------------------------- +pkgPackageManager::OrderResult +pkgPackageManager::DoInstallPostFork(int statusFd) +{ + if(statusFd > 0) + // FIXME: use SetCloseExec here once it taught about throwing + // exceptions instead of doing _exit(100) on failure + fcntl(statusFd,F_SETFD,FD_CLOEXEC); + bool goResult = Go(statusFd); + if(goResult == false) + return Failed; + + return Res; +}; + // PM::DoInstall - Does the installation /*{{{*/ // --------------------------------------------------------------------- /* This uses the filenames in FileNames and the information in the