From 4172c78468a04078c97146dbc2e2979e63906f5b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 18 Dec 2006 19:39:42 +0100 Subject: * apt-pkg/algorithms.cc: - only increase the score of installed applications if they are not obsolte (still downloadable) --- apt-pkg/algorithms.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 8d1e4e8e8..0d486d102 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -494,8 +494,10 @@ void pkgProblemResolver::MakeScores() Score += PrioMap[Cache[I].InstVerIter(Cache)->Priority]; /* This helps to fix oddball problems with conflicting packages - on the same level. We enhance the score of installed packages */ - if (I->CurrentVer != 0) + on the same level. We enhance the score of installed packages + if those are not obsolete + */ + if (I->CurrentVer != 0 && Cache[I].CandidateVerIter(Cache).Downloadable()) Score += 1; } -- cgit v1.2.3 From 59b46c414d5a5cebd26bdafac6b08fa4d1ba0963 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 19 Dec 2006 11:44:52 +0100 Subject: * apt-pkg/deb/debrecords.cc: - return the correct SHA1Hash() * methods/http.cc: - send VERSION of apt in the User-Agent string --- apt-pkg/deb/debrecords.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc index 6652a6ad9..c3e579ad1 100644 --- a/apt-pkg/deb/debrecords.cc +++ b/apt-pkg/deb/debrecords.cc @@ -61,7 +61,7 @@ string debRecordParser::MD5Hash() /* */ string debRecordParser::SHA1Hash() { - return Section.FindS("SHA1Sum"); + return Section.FindS("SHA1"); } /*}}}*/ // RecordParser::Maintainer - Return the maintainer email /*{{{*/ -- cgit v1.2.3 From 4cc152f93acf2eaf3ae66424cd4aaf47cad14a7b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 19 Dec 2006 20:44:54 +0100 Subject: * apt-pkg/algorithms.cc: - when encountering a or-group in pkgProblemResolver::Resolver(), check if it IsCritical(), otherwise we may do checking on weak-depends and confuse the system badly --- apt-pkg/algorithms.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 0d486d102..e1b9406e2 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -841,7 +841,12 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) OldEnd = LEnd; } else + { Start++; + // We only worry about critical deps. + if (Start.IsCritical() != true) + continue; + } // Dep is ok if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall) -- cgit v1.2.3 From 020daa7b026cf1496959ccc9d062d95cb5f8ec02 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 20 Dec 2006 10:58:57 +0100 Subject: * apt-pkg/algorithms.cc: - make sure we have a candidateVer if we check it for downloadability --- apt-pkg/algorithms.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index e1b9406e2..5fa16e66f 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -497,7 +497,7 @@ void pkgProblemResolver::MakeScores() on the same level. We enhance the score of installed packages if those are not obsolete */ - if (I->CurrentVer != 0 && Cache[I].CandidateVerIter(Cache).Downloadable()) + if (I->CurrentVer != 0 && Cache[I].CandidateVer != 0 && Cache[I].CandidateVerIter(Cache).Downloadable()) Score += 1; } -- cgit v1.2.3 From 509598772f0df89ea5e783a636fb941b1fc6675c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 Mar 2007 10:04:31 +0100 Subject: * apt-pkg/cdrom.cc, methods/cdrom.cc: - only unmount if APT::CDROM::NoMount is false --- apt-pkg/cdrom.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index ce1beb39b..4d45d38a2 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -652,7 +652,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log) if (List.size() == 0 && SourceList.size() == 0) { - UnmountCdrom(CDROM); + if (_config->FindB("APT::CDROM::NoMount",false) == false) + UnmountCdrom(CDROM); return _error->Error("Unable to locate any package files, perhaps this is not a Debian Disc"); } @@ -691,7 +692,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log) { if(!log) { - UnmountCdrom(CDROM); + if (_config->FindB("APT::CDROM::NoMount",false) == false) + UnmountCdrom(CDROM); return _error->Error("No disc name found and no way to ask for it"); } @@ -767,7 +769,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log) string::size_type Space = (*I).find(' '); if (Space == string::npos) { - UnmountCdrom(CDROM); + if (_config->FindB("APT::CDROM::NoMount",false) == false) + UnmountCdrom(CDROM); return _error->Error("Internal error"); } @@ -784,7 +787,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log) string::size_type Space = (*I).find(' '); if (Space == string::npos) { - UnmountCdrom(CDROM); + if (_config->FindB("APT::CDROM::NoMount",false) == false) + UnmountCdrom(CDROM); return _error->Error("Internal error"); } -- cgit v1.2.3 From 25a04630d6eef123a62f50703b82cc62acf1fbfb Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 Mar 2007 12:06:08 +0100 Subject: - added APT::CDROM::UnMountOnFinish to have more control over the umount/mount process --- apt-pkg/cdrom.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 4d45d38a2..241688785 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -508,8 +508,10 @@ bool pkgCdrom::Ident(string &ident, pkgCdromStatus *log) CDROM.c_str()); log->Update(msg.str()); } - if (MountCdrom(CDROM) == false) - return _error->Error("Failed to mount the cdrom."); + + if (_config->FindB("APT::CDROM::NoMount",false) == false) + if (MountCdrom(CDROM) == false) + return _error->Error("Failed to mount the cdrom."); // Hash the CD to get an ID if(log) @@ -803,7 +805,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log) // Unmount and finish - if (_config->FindB("APT::CDROM::NoMount",false) == false) { + if (_config->FindB("APT::CDROM::NoMount",false) == false && + _config->FindB("APT::CDROM::UnMountOnFinish",true) == true) { log->Update(_("Unmounting CD-ROM..."), STEP_LAST); UnmountCdrom(CDROM); } -- cgit v1.2.3 From 70dbf5f8f3e6e3526c82c72ed1795d9f2dad0338 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 Mar 2007 12:49:33 +0100 Subject: * apt-pkg/cdrom.cc: - only unmount if APT::CDROM::NoMount is false * methods/cdrom.cc: - only umount if it was mounted by the method before --- apt-pkg/cdrom.cc | 9 +++------ apt-pkg/contrib/cdromutl.h | 3 ++- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 241688785..4d45d38a2 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -508,10 +508,8 @@ bool pkgCdrom::Ident(string &ident, pkgCdromStatus *log) CDROM.c_str()); log->Update(msg.str()); } - - if (_config->FindB("APT::CDROM::NoMount",false) == false) - if (MountCdrom(CDROM) == false) - return _error->Error("Failed to mount the cdrom."); + if (MountCdrom(CDROM) == false) + return _error->Error("Failed to mount the cdrom."); // Hash the CD to get an ID if(log) @@ -805,8 +803,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log) // Unmount and finish - if (_config->FindB("APT::CDROM::NoMount",false) == false && - _config->FindB("APT::CDROM::UnMountOnFinish",true) == true) { + if (_config->FindB("APT::CDROM::NoMount",false) == false) { log->Update(_("Unmounting CD-ROM..."), STEP_LAST); UnmountCdrom(CDROM); } diff --git a/apt-pkg/contrib/cdromutl.h b/apt-pkg/contrib/cdromutl.h index 3180a03c7..db140ec02 100644 --- a/apt-pkg/contrib/cdromutl.h +++ b/apt-pkg/contrib/cdromutl.h @@ -8,7 +8,7 @@ ##################################################################### */ /*}}}*/ #ifndef PKGLIB_CDROMUTL_H -#define PKGLIB_ACQUIRE_METHOD_H +#define PKGLIB_CDROMUTL_H #include @@ -21,5 +21,6 @@ using std::string; bool MountCdrom(string Path); bool UnmountCdrom(string Path); bool IdentCdrom(string CD,string &Res,unsigned int Version = 2); +bool IsMounted(string &Path); #endif -- cgit v1.2.3 From 17ff0930e92423954b8fb4377755de7c66f097cd Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 17 Apr 2007 15:31:29 +0200 Subject: * apt-pkg/acquire-item.cc: - if decompression of a index fails, delete the index --- apt-pkg/acquire-item.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 8ec4ba2c0..f566b16b8 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -183,6 +183,7 @@ string pkgAcqIndex::Custom600Headers() void pkgAcqIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf) { + // no .bz2 found, retry with .gz if(Desc.URI.substr(Desc.URI.size()-3) == "bz2") { Desc.URI = Desc.URI.substr(0,Desc.URI.size()-3) + "gz"; @@ -194,9 +195,15 @@ void pkgAcqIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf) Complete = false; Dequeue(); return; + } + + // on decompression failure, remove bad versions in partial/ + if(Decompression && Erase) { + string s = _config->FindDir("Dir::State::lists") + "partial/"; + s += URItoFileName(RealURI); + unlink(s.c_str()); } - Item::Failed(Message,Cnf); } -- cgit v1.2.3 From c03462c6fed27e26b2bab4b3b34589fa8bf464f8 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 17 Apr 2007 15:33:19 +0200 Subject: * [ABI] apt-pkg/acquire.{cc,h}: - deal better with duplicated sources.list entries (avoid double queuing of URLs) - this fixes hangs in bzip/gzip --- apt-pkg/acquire.cc | 19 +++++++++++++------ apt-pkg/acquire.h | 2 +- apt-pkg/init.h | 2 +- apt-pkg/makefile | 2 +- 4 files changed, 16 insertions(+), 9 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index fff1b2b6a..e1dccf25a 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -193,9 +193,9 @@ void pkgAcquire::Enqueue(ItemDesc &Item) Item.Owner->Status = Item::StatIdle; // Queue it into the named queue - I->Enqueue(Item); - ToFetch++; - + if(I->Enqueue(Item)) + ToFetch++; + // Some trace stuff if (Debug == true) { @@ -549,11 +549,17 @@ pkgAcquire::Queue::~Queue() // Queue::Enqueue - Queue an item to the queue /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgAcquire::Queue::Enqueue(ItemDesc &Item) +bool pkgAcquire::Queue::Enqueue(ItemDesc &Item) { QItem **I = &Items; - for (; *I != 0; I = &(*I)->Next); - + // move to the end of the queue and check for duplicates here + for (; *I != 0; I = &(*I)->Next) + if (Item.URI == (*I)->URI) + { + Item.Owner->Status = Item::StatDone; + return false; + } + // Create a new item QItem *Itm = new QItem; *Itm = Item; @@ -563,6 +569,7 @@ void pkgAcquire::Queue::Enqueue(ItemDesc &Item) Item.Owner->QueueCounter++; if (Items->Next == 0) Cycle(); + return true; } /*}}}*/ // Queue::Dequeue - Remove an item from the queue /*{{{*/ diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index 27bb3d363..1d5daf12e 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -173,7 +173,7 @@ class pkgAcquire::Queue public: // Put an item into this queue - void Enqueue(ItemDesc &Item); + bool Enqueue(ItemDesc &Item); bool Dequeue(Item *Owner); // Find a Queued item diff --git a/apt-pkg/init.h b/apt-pkg/init.h index 8255b406a..b584b2cce 100644 --- a/apt-pkg/init.h +++ b/apt-pkg/init.h @@ -18,7 +18,7 @@ // See the makefile #define APT_PKG_MAJOR 3 -#define APT_PKG_MINOR 11 +#define APT_PKG_MINOR 12 #define APT_PKG_RELEASE 0 extern const char *pkgVersion; diff --git a/apt-pkg/makefile b/apt-pkg/makefile index 7e5feae53..c493d3dd9 100644 --- a/apt-pkg/makefile +++ b/apt-pkg/makefile @@ -13,7 +13,7 @@ include ../buildlib/defaults.mak # methods/makefile - FIXME LIBRARY=apt-pkg LIBEXT=$(GLIBC_VER)$(LIBSTDCPP_VER) -MAJOR=3.11 +MAJOR=3.12 MINOR=0 SLIBS=$(PTHREADLIB) $(INTLLIBS) APT_DOMAIN:=libapt-pkg$(MAJOR) -- cgit v1.2.3 From 1c62ab240a76122afb95c6df7de19ec5ba5cee1a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 20 Apr 2007 17:42:06 +0200 Subject: * apt-pkg/policy.cc: - allow multiple packages (thanks to David Foerster) --- apt-pkg/policy.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index d8b8825c2..35a50425b 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -36,6 +36,7 @@ #include #include +#include /*}}}*/ using namespace std; @@ -300,7 +301,13 @@ bool ReadPinFile(pkgPolicy &Plcy,string File) continue; } - Plcy.CreatePin(Type,Name,string(Word,End),priority); + istringstream s(Name); + string pkg; + while(!s.eof()) + { + s >> pkg; + Plcy.CreatePin(Type, pkg, string(Word,End),priority); + }; } Plcy.InitDefaults(); -- cgit v1.2.3