X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/5e9458e285af11c7fa4308add10d250e3546c8bf..0d29b9d4368284782862c7b507c47002b79ddb27:/apt-private/private-install.cc diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index 8d72faecc..40165af31 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -1,56 +1,49 @@ // Include Files /*{{{*/ #include -#include -#include -#include -#include -#include -#include -#include +#include #include -#include -#include -#include -#include -#include +#include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include -#include -#include -#include -#include -#include -#include +// FIXME: include of deb specific header +#include + +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include -#include "private-install.h" -#include "private-download.h" -#include "private-cachefile.h" -#include "private-output.h" -#include "private-cacheset.h" -#include "acqprogress.h" +#include +#include +#include +#include +#include +#include #include /*}}}*/ +class pkgSourceList; // InstallPackages - Actually download and install the packages /*{{{*/ // --------------------------------------------------------------------- @@ -105,12 +98,14 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety) { pkgSimulate PM(Cache); - int status_fd = _config->FindI("APT::Status-Fd",-1); - APT::Progress::PackageManager *progress = NULL; - if (status_fd > 0) - progress = new APT::Progress::PackageManagerProgressFd(status_fd); +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) + APT::Progress::PackageManager *progress = APT::Progress::PackageManagerProgressFactory(); pkgPackageManager::OrderResult Res = PM.DoInstall(progress); delete progress; +#else + int status_fd = _config->FindI("APT::Status-Fd",-1); + pkgPackageManager::OrderResult Res = PM.DoInstall(status_fd); +#endif if (Res == pkgPackageManager::Failed) return false; @@ -153,7 +148,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety) if (DebBytes != Cache->DebSize()) { c0out << DebBytes << ',' << Cache->DebSize() << std::endl; - c0out << _("How odd.. The sizes didn't match, email apt@packages.debian.org") << std::endl; + c0out << _("How odd... The sizes didn't match, email apt@packages.debian.org") << std::endl; } // Number of bytes @@ -340,22 +335,14 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety) _system->UnLock(); - // FIXME: make this a factory - // select the right progress - int status_fd = _config->FindI("APT::Status-Fd",-1); - - APT::Progress::PackageManager *progress = NULL; - if (status_fd > 0) - progress = new APT::Progress::PackageManagerProgressFd(status_fd); - else if(_config->FindB("Dpkg::Progress-Fancy", false) == true) - progress = new APT::Progress::PackageManagerFancy(); - else if (_config->FindB("Dpkg::Progress", - _config->FindB("DpkgPM::Progress", false)) == true) - progress = new APT::Progress::PackageManagerText(); - else - progress = new APT::Progress::PackageManager(); +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) + APT::Progress::PackageManager *progress = APT::Progress::PackageManagerProgressFactory(); pkgPackageManager::OrderResult Res = PM->DoInstall(progress); delete progress; +#else + int status_fd = _config->FindI("APT::Status-Fd", -1); + pkgPackageManager::OrderResult Res = PM->DoInstall(status_fd); +#endif if (Res == pkgPackageManager::Failed || _error->PendingError() == true) return false; @@ -391,7 +378,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety) // DoAutomaticRemove - Remove all automatic unused packages /*{{{*/ // --------------------------------------------------------------------- /* Remove unused automatic packages */ -bool DoAutomaticRemove(CacheFile &Cache) +static bool DoAutomaticRemove(CacheFile &Cache) { bool Debug = _config->FindI("Debug::pkgAutoRemove",false); bool doAutoRemove = _config->FindB("APT::Get::AutomaticRemove", false); @@ -686,10 +673,23 @@ bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache, bool DoInstall(CommandLine &CmdL) { CacheFile Cache; + // first check for local pkgs and add them to the cache + for (const char **I = CmdL.FileList; *I != 0; I++) + { + if(FileExists(*I)) + { + // FIMXE: direct usage of .deb specific stuff + metaIndex *mi = new debDebFileMetaIndex(*I); + pkgSourceList *sources = Cache.GetSourceList(); + sources->Add(mi); + } + } + + // then open the cache if (Cache.OpenForInstall() == false || Cache.CheckDeps(CmdL.FileSize() != 1) == false) return false; - + std::map verset; if(!DoCacheManipulationFromCommandLine(CmdL, Cache, verset))