diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-10-13 15:36:54 +0200 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-10-13 15:36:54 +0200 |
commit | 61153c284c832a0d0f7faecd9ad96f6cd9591c64 (patch) | |
tree | a60d61b723bbc90b8b715a476c5f1ee5e8d6e0c2 /apt-pkg | |
parent | 940ff5d6b5634b57c2e622b5295f499a7807f3de (diff) | |
parent | 6bea738672fb503d2813ae2d998096015a81c4a2 (diff) |
merged from debian-sid branch
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/acquire-item.cc | 18 | ||||
-rw-r--r-- | apt-pkg/acquire.cc | 8 | ||||
-rw-r--r-- | apt-pkg/algorithms.cc | 29 | ||||
-rw-r--r-- | apt-pkg/contrib/fileutl.cc | 25 | ||||
-rw-r--r-- | apt-pkg/contrib/fileutl.h | 2 | ||||
-rw-r--r-- | apt-pkg/contrib/strutl.cc | 4 | ||||
-rw-r--r-- | apt-pkg/deb/debindexfile.cc | 22 | ||||
-rw-r--r-- | apt-pkg/deb/deblistparser.cc | 6 | ||||
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 2 | ||||
-rw-r--r-- | apt-pkg/depcache.cc | 13 | ||||
-rw-r--r-- | apt-pkg/depcache.h | 2 | ||||
-rw-r--r-- | apt-pkg/indexcopy.cc | 2 | ||||
-rw-r--r-- | apt-pkg/init.cc | 3 | ||||
-rw-r--r-- | apt-pkg/init.h | 2 | ||||
-rw-r--r-- | apt-pkg/packagemanager.cc | 6 | ||||
-rw-r--r-- | apt-pkg/pkgcache.cc | 1 | ||||
-rw-r--r-- | apt-pkg/pkgcache.h | 2 | ||||
-rw-r--r-- | apt-pkg/policy.cc | 9 |
18 files changed, 105 insertions, 51 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 752bc6a99..2c4ce91a0 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1060,12 +1060,6 @@ void pkgAcqMetaIndex::Done(string Message,unsigned long Size,string Hash, /*{{{* // all cool, move Release file into place Complete = true; - - string FinalFile = _config->FindDir("Dir::State::lists"); - FinalFile += URItoFileName(RealURI); - Rename(DestFile,FinalFile); - chmod(FinalFile.c_str(),0644); - DestFile = FinalFile; } else { @@ -1092,8 +1086,18 @@ void pkgAcqMetaIndex::Done(string Message,unsigned long Size,string Hash, /*{{{* Desc.URI = "gpgv:" + SigFile; QueueURI(Desc); Mode = "gpgv"; + return; } } + + if (Complete == true) + { + string FinalFile = _config->FindDir("Dir::State::lists"); + FinalFile += URItoFileName(RealURI); + Rename(DestFile,FinalFile); + chmod(FinalFile.c_str(),0644); + DestFile = FinalFile; + } } /*}}}*/ void pkgAcqMetaIndex::RetrievalDone(string Message) /*{{{*/ @@ -1323,7 +1327,7 @@ void pkgAcqMetaIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf) Status = StatTransientNetworkError; _error->Warning(_("A error occurred during the signature " "verification. The repository is not updated " - "and the previous index files will be used." + "and the previous index files will be used. " "GPG error: %s: %s\n"), Desc.Description.c_str(), LookupTag(Message,"Message").c_str()); diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 6ec557397..9478cdfb4 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -74,12 +74,12 @@ bool pkgAcquire::Setup(pkgAcquireStatus *Progress, string const &Lock) string const archivesDir = _config->FindDir("Dir::Cache::Archives"); string const partialArchivesDir = archivesDir + "partial/"; - if (CheckDirectory(_config->FindDir("Dir::State"), partialListDir) == false && - CheckDirectory(listDir, partialListDir) == false) + if (CreateAPTDirectoryIfNeeded(_config->FindDir("Dir::State"), partialListDir) == false && + CreateAPTDirectoryIfNeeded(listDir, partialListDir) == false) return _error->Errno("Acquire", _("List directory %spartial is missing."), listDir.c_str()); - if (CheckDirectory(_config->FindDir("Dir::Cache"), partialArchivesDir) == false && - CheckDirectory(archivesDir, partialArchivesDir) == false) + if (CreateAPTDirectoryIfNeeded(_config->FindDir("Dir::Cache"), partialArchivesDir) == false && + CreateAPTDirectoryIfNeeded(archivesDir, partialArchivesDir) == false) return _error->Errno("Acquire", _("Archives directory %spartial is missing."), archivesDir.c_str()); if (Lock.empty() == true || _config->FindB("Debug::NoLocking", false) == true) diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 3c8711b74..961f5c2fa 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -987,6 +987,23 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) pkgCache::VerIterator Ver(Cache,*V); pkgCache::PkgIterator Pkg = Ver.ParentPkg(); + /* This is a conflicts, and the version we are looking + at is not the currently selected version of the + package, which means it is not necessary to + remove/keep */ + if (Cache[Pkg].InstallVer != Ver && + (Start->Type == pkgCache::Dep::Conflicts || + Start->Type == pkgCache::Dep::DpkgBreaks || + Start->Type == pkgCache::Dep::Obsoletes)) + { + if (Debug) + clog << " Conflicts//Breaks against version " + << Ver.VerStr() << " for " << Pkg.Name() + << " but that is not InstVer, ignoring" + << endl; + continue; + } + if (Debug == true) clog << " Considering " << Pkg.FullName(false) << ' ' << (int)Scores[Pkg->ID] << " as a solution to " << I.FullName(false) << ' ' << (int)Scores[I->ID] << endl; @@ -1069,22 +1086,14 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) } else { - /* This is a conflicts, and the version we are looking - at is not the currently selected version of the - package, which means it is not necessary to - remove/keep */ - if (Cache[Pkg].InstallVer != Ver && - (Start->Type == pkgCache::Dep::Conflicts || - Start->Type == pkgCache::Dep::Obsoletes)) - continue; - if (Start->Type == pkgCache::Dep::DpkgBreaks) { // first, try upgradring the package, if that // does not help, the breaks goes onto the // kill list + // // FIXME: use DoUpgrade(Pkg) instead? - if (Cache[End] & pkgDepCache::DepGCVer) + if (Cache[End] & pkgDepCache::DepGCVer) { if (Debug) clog << " Upgrading " << Pkg.FullName(false) << " due to Breaks field in " << I.FullName(false) << endl; diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 94d994e8b..bf07f6008 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -251,11 +251,11 @@ bool CreateDirectory(string const &Parent, string const &Path) return true; } /*}}}*/ -// CheckDirectory - ensure that the given directory exists /*{{{*/ +// CreateAPTDirectoryIfNeeded - ensure that the given directory exists /*{{{*/ // --------------------------------------------------------------------- /* a small wrapper around CreateDirectory to check if it exists and to remove the trailing "/apt/" from the parent directory if needed */ -bool CheckDirectory(string const &Parent, string const &Path) +bool CreateAPTDirectoryIfNeeded(string const &Parent, string const &Path) { if (DirectoryExists(Path) == true) return true; @@ -915,8 +915,27 @@ unsigned long FileFd::Tell() /* */ unsigned long FileFd::Size() { - //TODO: For gz, do we need the actual file size here or the uncompressed length? struct stat Buf; + long size; + off_t orig_pos; + + if (gz) + { + /* unfortunately zlib.h doesn't provide a gzsize(), so we have to do + * this ourselves; the original (uncompressed) file size is the last 32 + * bits of the file */ + orig_pos = lseek(iFd, 0, SEEK_CUR); + if (lseek(iFd, -4, SEEK_END) < 0) + return _error->Errno("lseek","Unable to seek to end of gzipped file"); + if (read(iFd, &size, 4) != 4) + return _error->Errno("read","Unable to read original size of gzipped file"); + size &= 0xFFFFFFFF; + + if (lseek(iFd, orig_pos, SEEK_SET) < 0) + return _error->Errno("lseek","Unable to seek in gzipped file"); + return size; + } + if (fstat(iFd,&Buf) != 0) return _error->Errno("fstat","Unable to determine the file size"); return Buf.st_size; diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index f79c9032f..419506273 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -101,7 +101,7 @@ bool CreateDirectory(string const &Parent, string const &Path); * /apt/ will be removed before CreateDirectory call. * \param Path which should exist after (successful) call */ -bool CheckDirectory(string const &Parent, string const &Path); +bool CreateAPTDirectoryIfNeeded(string const &Parent, string const &Path); std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ext, bool const &SortList, bool const &AllowNoExt=false); diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index c1844de40..987f4c3a4 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -340,13 +340,13 @@ string SizeToStr(double Size) { if (ASize < 100 && I != 0) { - sprintf(S,"%'.1f%c",ASize,Ext[I]); + sprintf(S,"%'.1f %c",ASize,Ext[I]); break; } if (ASize < 10000) { - sprintf(S,"%'.0f%c",ASize,Ext[I]); + sprintf(S,"%'.0f %c",ASize,Ext[I]); break; } ASize /= 1000.0; diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index ba5b3f266..a89a2574f 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -149,10 +149,11 @@ bool debSourcesIndex::Exists() const /* */ unsigned long debSourcesIndex::Size() const { - struct stat S; - if (stat(IndexFile("Sources").c_str(),&S) != 0) + FileFd f = FileFd (IndexFile("Sources"), FileFd::ReadOnlyGzip); + + if (f.Failed()) return 0; - return S.st_size; + return f.Size(); } /*}}}*/ @@ -268,10 +269,11 @@ bool debPackagesIndex::Exists() const /* This is really only used for progress reporting. */ unsigned long debPackagesIndex::Size() const { - struct stat S; - if (stat(IndexFile("Packages").c_str(),&S) != 0) + FileFd f = FileFd (IndexFile("Packages"), FileFd::ReadOnlyGzip); + + if (f.Failed()) return 0; - return S.st_size; + return f.Size(); } /*}}}*/ // PackagesIndex::Merge - Load the index file into a cache /*{{{*/ @@ -458,10 +460,12 @@ bool debTranslationsIndex::Exists() const /* This is really only used for progress reporting. */ unsigned long debTranslationsIndex::Size() const { - struct stat S; - if (stat(IndexFile(Language).c_str(),&S) != 0) + FileFd f = FileFd (IndexFile(Language), FileFd::ReadOnlyGzip); + + if (f.Failed()) return 0; - return S.st_size; + + return f.Size(); } /*}}}*/ // TranslationsIndex::Merge - Load the index file into a cache /*{{{*/ diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 5fb737970..da8b0271b 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -815,6 +815,12 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI, if (Section.FindFlag("NotAutomatic",FileI->Flags, pkgCache::Flag::NotAutomatic) == false) _error->Warning("Bad NotAutomatic flag"); + if (Section.FindFlag("ButAutomaticUpgrades",FileI->Flags, + pkgCache::Flag::ButAutomaticUpgrades) == false) + _error->Warning("Bad ButAutomaticUpgrades flag"); + // overrule the NotAutomatic setting if needed as they are both present for compatibility + else if ((FileI->Flags & pkgCache::Flag::ButAutomaticUpgrades) == pkgCache::Flag::ButAutomaticUpgrades) + FileI->Flags &= ~pkgCache::Flag::NotAutomatic; return !_error->PendingError(); } diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index d3c432ce1..395c3fb1a 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -641,7 +641,7 @@ void pkgDPkgPM::WriteHistoryTag(string const &tag, string value) bool pkgDPkgPM::OpenLog() { string const logdir = _config->FindDir("Dir::Log"); - if(CheckDirectory(logdir, logdir) == false) + if(CreateAPTDirectoryIfNeeded(logdir, logdir) == false) // FIXME: use a better string after freeze return _error->Error(_("Directory '%s' missing"), logdir.c_str()); diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 018b05e65..0b5d6d8e6 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1192,6 +1192,16 @@ bool pkgDepCache::IsDeleteOk(PkgIterator const &Pkg,bool rPurge, std::clog << OutputInDepth(Depth) << "Hold prevents MarkDelete of " << Pkg << " FU=" << FromUser << std::endl; return false; } + else if (FromUser == false && Pkg->CurrentVer == 0) + { + StateCache &P = PkgState[Pkg->ID]; + if (P.InstallVer != 0 && P.Status == 2 && (P.Flags & Flag::Auto) != Flag::Auto) + { + if (DebugMarker == true) + std::clog << OutputInDepth(Depth) << "Manual install request prevents MarkDelete of " << Pkg << std::endl; + return false; + } + } return true; } /*}}}*/ @@ -1615,7 +1625,8 @@ pkgCache::VerIterator pkgDepCache::Policy::GetCandidateVer(PkgIterator const &Pk /* Stash the highest version of a not-automatic source, we use it if there is nothing better */ - if ((J.File()->Flags & Flag::NotAutomatic) != 0) + if ((J.File()->Flags & Flag::NotAutomatic) != 0 || + (J.File()->Flags & Flag::ButAutomaticUpgrades) != 0) { if (Last.end() == true) Last = I; diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index 08e683558..2d3dbdf77 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -189,7 +189,7 @@ class pkgDepCache : protected pkgCache::Namespace DefaultRootSetFunc() : Configuration::MatchAgainstConfig("APT::NeverAutoRemove") {}; virtual ~DefaultRootSetFunc() {}; - bool InRootSet(const pkgCache::PkgIterator &pkg) { return pkg.end() == true && Match(pkg.Name()); }; + bool InRootSet(const pkgCache::PkgIterator &pkg) { return pkg.end() == false && Match(pkg.Name()); }; }; struct StateCache diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index 3156778d4..f88d51fc5 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -666,7 +666,7 @@ bool SigVerify::RunGPGV(std::string const &File, std::string const &FileGPG, { string const gpgvpath = _config->Find("Dir::Bin::gpg", "/usr/bin/gpgv"); // FIXME: remove support for deprecated APT::GPGV setting - string const trustedFile = _config->FindFile("Dir::Etc::Trusted"); + string const trustedFile = _config->Find("APT::GPGV::TrustedKeyring", _config->FindFile("Dir::Etc::Trusted")); string const trustedPath = _config->FindDir("Dir::Etc::TrustedParts"); bool const Debug = _config->FindB("Debug::Acquire::gpgv", false); diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc index 846b27313..f0bad78df 100644 --- a/apt-pkg/init.cc +++ b/apt-pkg/init.cc @@ -70,8 +70,7 @@ bool pkgInitConfig(Configuration &Cnf) Cnf.Set("Dir::Etc::parts","apt.conf.d"); Cnf.Set("Dir::Etc::preferences","preferences"); Cnf.Set("Dir::Etc::preferencesparts","preferences.d"); - string const deprecated = _config->Find("APT::GPGV::TrustedKeyring"); - Cnf.Set("Dir::Etc::trusted", deprecated.empty() ? "trusted.gpg" : deprecated); + Cnf.Set("Dir::Etc::trusted", "trusted.gpg"); Cnf.Set("Dir::Etc::trustedparts","trusted.gpg.d"); Cnf.Set("Dir::Bin::methods","/usr/lib/apt/methods"); Cnf.Set("Dir::Media::MountPath","/media/apt"); diff --git a/apt-pkg/init.h b/apt-pkg/init.h index 6e7340dfe..15a1165b9 100644 --- a/apt-pkg/init.h +++ b/apt-pkg/init.h @@ -23,7 +23,7 @@ // See also buildlib/libversion.mak #define APT_PKG_MAJOR 4 #define APT_PKG_MINOR 10 -#define APT_PKG_RELEASE 0 +#define APT_PKG_RELEASE 1 extern const char *pkgVersion; extern const char *pkgLibVersion; diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 49776aac7..cff34058c 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -328,7 +328,7 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg) // Sanity Check if (List->IsFlag(Pkg,pkgOrderList::Configured) == false) - return _error->Error(_("Could not perform immediate configuration on '%s'." + return _error->Error(_("Could not perform immediate configuration on '%s'. " "Please see man 5 apt.conf under APT::Immediate-Configure for details. (%d)"),Pkg.Name(),1); return true; @@ -492,7 +492,7 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg) List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States); if (List->IsFlag(Pkg,pkgOrderList::Immediate) == true) if (SmartConfigure(Pkg) == false) - return _error->Error(_("Could not perform immediate configuration on already unpacked '%s'." + return _error->Error(_("Could not perform immediate configuration on already unpacked '%s'. " "Please see man 5 apt.conf under APT::Immediate-Configure for details."),Pkg.Name()); return true; } @@ -613,7 +613,7 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg) // Perform immedate configuration of the package. if (List->IsFlag(Pkg,pkgOrderList::Immediate) == true) if (SmartConfigure(Pkg) == false) - return _error->Error(_("Could not perform immediate configuration on '%s'." + return _error->Error(_("Could not perform immediate configuration on '%s'. " "Please see man 5 apt.conf under APT::Immediate-Configure for details. (%d)"),Pkg.Name(),2); return true; diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index a66a5198d..324445fa7 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -731,6 +731,7 @@ bool pkgCache::VerIterator::Automatic() const { VerFileIterator Files = FileList(); for (; Files.end() == false; Files++) + // Do not check ButAutomaticUpgrades here as it is kind of automatic… if ((Files.File()->Flags & pkgCache::Flag::NotAutomatic) != pkgCache::Flag::NotAutomatic) return true; return false; diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 799521784..82a69b2ca 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -146,7 +146,7 @@ class pkgCache /*{{{*/ struct Flag { enum PkgFlags {Auto=(1<<0),Essential=(1<<3),Important=(1<<4)}; - enum PkgFFlags {NotSource=(1<<0),NotAutomatic=(1<<1)}; + enum PkgFFlags {NotSource=(1<<0),NotAutomatic=(1<<1),ButAutomaticUpgrades=(1<<2)}; }; protected: diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index a3286391b..4f9d56775 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -16,7 +16,7 @@ 990 = Config file override package files 989 = Start for preference auto-priorities 500 = Default package files - 100 = The status file + 100 = The status file and ButAutomaticUpgrades sources 0 -> 100 = NotAutomatic sources like experimental -inf -> 0 = Never selected @@ -70,9 +70,10 @@ bool pkgPolicy::InitDefaults() PFPriority[I->ID] = 500; if ((I->Flags & pkgCache::Flag::NotSource) == pkgCache::Flag::NotSource) PFPriority[I->ID] = 100; - else - if ((I->Flags & pkgCache::Flag::NotAutomatic) == pkgCache::Flag::NotAutomatic) - PFPriority[I->ID] = 1; + else if ((I->Flags & pkgCache::Flag::ButAutomaticUpgrades) == pkgCache::Flag::ButAutomaticUpgrades) + PFPriority[I->ID] = 100; + else if ((I->Flags & pkgCache::Flag::NotAutomatic) == pkgCache::Flag::NotAutomatic) + PFPriority[I->ID] = 1; } // Apply the defaults.. |