X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/f3f7e00a6269af5d3d0ce3785765dc562be7941d..1bc5d775b911e64e2f1e9e12539496ce13dd0945:/cmdline/apt-get.cc?ds=sidebyside diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index c9ec481aa..46172332f 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -63,6 +64,8 @@ #include /*}}}*/ +#define RAMFS_MAGIC 0x858458f6 + using namespace std; ostream c0out(0); @@ -835,16 +838,16 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true, if (DebBytes != FetchBytes) ioprintf(c1out,_("Need to get %sB/%sB of archives.\n"), SizeToStr(FetchBytes).c_str(),SizeToStr(DebBytes).c_str()); - else + else if (DebBytes != 0) ioprintf(c1out,_("Need to get %sB of archives.\n"), SizeToStr(DebBytes).c_str()); // Size delta if (Cache->UsrSize() >= 0) - ioprintf(c1out,_("After unpacking %sB of additional disk space will be used.\n"), + ioprintf(c1out,_("After this operation, %sB of additional disk space will be used.\n"), SizeToStr(Cache->UsrSize()).c_str()); else - ioprintf(c1out,_("After unpacking %sB disk space will be freed.\n"), + ioprintf(c1out,_("After this operation, %sB disk space will be freed.\n"), SizeToStr(-1*Cache->UsrSize()).c_str()); if (_error->PendingError() == true) @@ -861,8 +864,13 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true, return _error->Errno("statvfs",_("Couldn't determine free space in %s"), OutputDir.c_str()); if (unsigned(Buf.f_bfree) < (FetchBytes - FetchPBytes)/Buf.f_bsize) - return _error->Error(_("You don't have enough free space in %s."), - OutputDir.c_str()); + { + struct statfs Stat; + if (statfs(OutputDir.c_str(),&Stat) != 0 || + unsigned(Stat.f_type) != RAMFS_MAGIC) + return _error->Error(_("You don't have enough free space in %s."), + OutputDir.c_str()); + } } // Fail safe check @@ -1343,14 +1351,15 @@ bool DoUpdate(CommandLine &CmdL) return _error->Error(_("Unable to lock the list directory")); } - // Create the download object + // Create the progress AcqTextStatus Stat(ScreenWidth,_config->FindI("quiet",0)); - pkgAcquire Fetcher(&Stat); - - + // Just print out the uris an exit if the --print-uris flag was used if (_config->FindB("APT::Get::Print-URIs") == true) { + // get a fetcher + pkgAcquire Fetcher(&Stat); + // Populate it with the source selection and get all Indexes // (GetAll=true) if (List.GetIndexes(&Fetcher,true) == false) @@ -1363,54 +1372,14 @@ bool DoUpdate(CommandLine &CmdL) return true; } - // Populate it with the source selection - if (List.GetIndexes(&Fetcher) == false) - return false; - - // Run it - if (Fetcher.Run() == pkgAcquire::Failed) - return false; - - bool Failed = false; - bool TransientNetworkFailure = false; - for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++) - { - if ((*I)->Status == pkgAcquire::Item::StatDone) - continue; - - (*I)->Finished(); - - fprintf(stderr,_("Failed to fetch %s %s\n"),(*I)->DescURI().c_str(), - (*I)->ErrorText.c_str()); - - if ((*I)->Status == pkgAcquire::Item::StatTransientNetworkError) - { - TransientNetworkFailure = true; - continue; - } - - Failed = true; - } - - // Clean out any old list files - if (!TransientNetworkFailure && - _config->FindB("APT::Get::List-Cleanup",true) == true) - { - if (Fetcher.Clean(_config->FindDir("Dir::State::lists")) == false || - Fetcher.Clean(_config->FindDir("Dir::State::lists") + "partial/") == false) - return false; - } - - // Prepare the cache. + // do the work CacheFile Cache; + bool res = ListUpdate(Stat, List); + + // Rebuild the cache. if (Cache.BuildCaches() == false) return false; - if (TransientNetworkFailure == true) - _error->Warning(_("Some index files failed to download, they have been ignored, or old ones used instead.")); - else if (Failed == true) - return _error->Error(_("Some index files failed to download, they have been ignored, or old ones used instead.")); - return true; } /*}}}*/ @@ -1708,9 +1677,10 @@ bool DoInstall(CommandLine &CmdL) // where foo is marked automatic if(!Remove && Cache[Pkg].Install() == false && - (Cache[Pkg].Flags & pkgCache::Flag::Auto)) + (Cache[Pkg].Flags & pkgCache::Flag::Auto) && + _config->FindB("APT::Get::ReInstall",false) == false) { - ioprintf(c1out,_("%s set to manual installed.\n"), + ioprintf(c1out,_("%s set to manually installed.\n"), Pkg.Name()); Cache->MarkAuto(Pkg,false); AutoMarkChanged++; @@ -2116,6 +2086,33 @@ bool DoSource(CommandLine &CmdL) if (Last == 0) return _error->Error(_("Unable to find a source package for %s"),Src.c_str()); + string srec = Last->AsStr(); + string::size_type pos = srec.find("\nVcs-"); + while (pos != string::npos) + { + pos += strlen("\nVcs-"); + string vcs = srec.substr(pos,srec.find(":",pos)-pos); + if(vcs == "Browser") + { + pos = srec.find("\nVcs-", pos); + continue; + } + pos += vcs.length()+2; + string::size_type epos = srec.find("\n", pos); + string uri = srec.substr(pos,epos-pos).c_str(); + ioprintf(c1out, _("NOTICE: '%s' packaging is maintained in " + "the '%s' version control system at:\n" + "%s\n"), + Src.c_str(), vcs.c_str(), uri.c_str()); + if(vcs == "Bzr") + ioprintf(c1out,_("Please use:\n" + "bzr get %s\n" + "to retrieve the latest (possible unreleased) " + "updates to the package.\n"), + uri.c_str()); + break; + } + // Back track vector Lst; if (Last->Files(Lst) == false) @@ -2187,8 +2184,13 @@ bool DoSource(CommandLine &CmdL) return _error->Errno("statvfs",_("Couldn't determine free space in %s"), OutputDir.c_str()); if (unsigned(Buf.f_bfree) < (FetchBytes - FetchPBytes)/Buf.f_bsize) - return _error->Error(_("You don't have enough free space in %s"), - OutputDir.c_str()); + { + struct statfs Stat; + if (statfs(OutputDir.c_str(),&Stat) != 0 || + unsigned(Stat.f_type) != RAMFS_MAGIC) + return _error->Error(_("You don't have enough free space in %s"), + OutputDir.c_str()); + } // Number of bytes if (DebBytes != FetchBytes) @@ -2471,6 +2473,7 @@ bool DoBuildDep(CommandLine &CmdL) break; } if (CV.end() == true) + { if (hasAlternatives) { continue; @@ -2483,6 +2486,7 @@ bool DoBuildDep(CommandLine &CmdL) Last->BuildDepType((*D).Type),Src.c_str(), (*D).Package.c_str()); } + } } else { @@ -2641,6 +2645,7 @@ bool ShowHelp(CommandLine &CmdL) " upgrade - Perform an upgrade\n" " install - Install new packages (pkg is libc6 not libc6.deb)\n" " remove - Remove packages\n" + " autoremove - Remove all automatic unused packages\n" " purge - Remove and purge packages\n" " source - Download source archives\n" " build-dep - Configure build-dependencies for source packages\n" @@ -2751,7 +2756,9 @@ int main(int argc,const char *argv[]) {"upgrade",&DoUpgrade}, {"install",&DoInstall}, {"remove",&DoInstall}, + {"purge",&DoInstall}, {"autoremove",&DoInstall}, + {"purge",&DoInstall}, {"dist-upgrade",&DoDistUpgrade}, {"dselect-upgrade",&DoDSelectUpgrade}, {"build-dep",&DoBuildDep},