From b4e57d2dd44728929cb83113ed79c8e16405767e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 30 Nov 2005 13:53:44 +0000 Subject: * hack around local file:/ uri problem --- apt-pkg/acquire-item.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 8a9a4c5bb..ad977dde4 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -165,11 +165,15 @@ pkgAcqDiffIndex::pkgAcqDiffIndex(pkgAcquire *Owner, CurrentPackagesFile = _config->FindDir("Dir::State::lists"); CurrentPackagesFile += URItoFileName(RealURI); + // FIXME: this file:/ check is a hack to prevent fetching + // from local sources. this is really silly, and + // should be fixed cleanly as soon as possible if(!FileExists(CurrentPackagesFile) || + Desc.URI.substr(0,strlen("file:/")) == "file:/" || !_config->FindB("Acquire::Diffs",true)) { // we don't have a pkg file or we don't want to queue if(Debug) - std::clog << "No index file or canceld by user" << std::endl; + std::clog << "No index file, local or canceld by user" << std::endl; Failed("", NULL); return; } -- cgit v1.2.3 From 2ac3eeb60e9ea171cee7a05a02424e61fe50d400 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 30 Mar 2006 10:38:14 +0200 Subject: * make the code follow the apt coding standards better * change the location to turn off pdiff (APT::PDiff=false) --- apt-pkg/acquire-item.cc | 61 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 20 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index ad977dde4..d845d4605 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -170,7 +170,8 @@ pkgAcqDiffIndex::pkgAcqDiffIndex(pkgAcquire *Owner, // should be fixed cleanly as soon as possible if(!FileExists(CurrentPackagesFile) || Desc.URI.substr(0,strlen("file:/")) == "file:/" || - !_config->FindB("Acquire::Diffs",true)) { + !_config->FindB("Acquire::Diffs",true)) + { // we don't have a pkg file or we don't want to queue if(Debug) std::clog << "No index file, local or canceld by user" << std::endl; @@ -178,11 +179,10 @@ pkgAcqDiffIndex::pkgAcqDiffIndex(pkgAcquire *Owner, return; } - if(Debug) { + if(Debug) std::clog << "pkgAcqIndexDiffs::pkgAcqIndexDiffs(): " << CurrentPackagesFile << std::endl; - } - + QueueURI(Desc); } @@ -237,26 +237,32 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile) SHA1.AddFD(fd.Fd(), fd.Size()); local_sha1 = string(SHA1.Result()); - if(local_sha1 == ServerSha1) { + if(local_sha1 == ServerSha1) + { + // we have the same sha1 as the server if(Debug) std::clog << "Package file is up-to-date" << std::endl; // set found to true, this will queue a pkgAcqIndexDiffs with // a empty availabe_patches found = true; - } else { + } + else + { if(Debug) std::clog << "SHA1-Current: " << ServerSha1 << std::endl; // check the historie and see what patches we need string history = Tags.FindS("SHA1-History"); std::stringstream hist(history); - while(hist >> d.sha1 >> size >> d.file) { + while(hist >> d.sha1 >> size >> d.file) + { d.size = atoi(size.c_str()); // read until the first match is found if(d.sha1 == local_sha1) found=true; // from that point on, we probably need all diffs - if(found) { + if(found) + { if(Debug) std::clog << "Need to get diff: " << d.file << std::endl; available_patches.push_back(d); @@ -265,12 +271,15 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile) } // no information how to get the patches, bail out - if(!found) { + if(!found) + { if(Debug) std::clog << "Can't find a patch in the index file" << std::endl; // Failed will queue a big package file Failed("", NULL); - } else { + } + else + { // queue the diffs new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc, ExpectedMD5, available_patches); @@ -351,10 +360,13 @@ pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire *Owner, Desc.Owner = this; Desc.ShortDesc = ShortDesc; - if(available_patches.size() == 0) { + if(available_patches.size() == 0) + { // we are done (yeah!) Finish(true); - } else { + } + else + { // get the next diff State = StateFetchDiff; QueueNextDiff(); @@ -378,7 +390,8 @@ void pkgAcqIndexDiffs::Finish(bool allDone) { // we restore the original name, this is required, otherwise // the file will be cleaned - if(allDone) { + if(allDone) + { DestFile = _config->FindDir("Dir::State::lists"); DestFile += URItoFileName(RealURI); @@ -435,14 +448,17 @@ bool pkgAcqIndexDiffs::QueueNextDiff() // remove all patches until the next matching patch is found // this requires the Index file to be ordered for(vector::iterator I=available_patches.begin(); - available_patches.size() > 0 && I != available_patches.end() - && (*I).sha1 != local_sha1; - I++) { + available_patches.size() > 0 && + I != available_patches.end() && + (*I).sha1 != local_sha1; + I++) + { available_patches.erase(I); } // error checking and falling back if no patch was found - if(available_patches.size() == 0) { + if(available_patches.size() == 0) + { Failed("", NULL); return false; } @@ -1009,9 +1025,14 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) } } - // Queue Packages file - new pkgAcqDiffIndex(Owner, (*Target)->URI, (*Target)->Description, - (*Target)->ShortDesc, ExpectedIndexMD5); + // Queue Packages file (either diff or full packages files, depending + // on the users option) + if(_config->FindB("Acquire::PDiffs",false) == false) + new pkgAcqDiffIndex(Owner, (*Target)->URI, (*Target)->Description, + (*Target)->ShortDesc, ExpectedIndexMD5); + else + new newPkgAcqIndex(Owner, (*Target)->URI, (*Target)->Description, + (*Target)->ShortDesc, ExpectedIndexMD5); } } -- cgit v1.2.3 From 81fcf9e22b9f93896ceb644c9341d9d53da9c790 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 30 Mar 2006 10:52:32 +0200 Subject: * fix FTBFS --- apt-pkg/acquire-item.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index d845d4605..38977d2b1 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -169,8 +169,7 @@ pkgAcqDiffIndex::pkgAcqDiffIndex(pkgAcquire *Owner, // from local sources. this is really silly, and // should be fixed cleanly as soon as possible if(!FileExists(CurrentPackagesFile) || - Desc.URI.substr(0,strlen("file:/")) == "file:/" || - !_config->FindB("Acquire::Diffs",true)) + Desc.URI.substr(0,strlen("file:/")) == "file:/") { // we don't have a pkg file or we don't want to queue if(Debug) @@ -1031,7 +1030,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) new pkgAcqDiffIndex(Owner, (*Target)->URI, (*Target)->Description, (*Target)->ShortDesc, ExpectedIndexMD5); else - new newPkgAcqIndex(Owner, (*Target)->URI, (*Target)->Description, + new pkgAcqIndex(Owner, (*Target)->URI, (*Target)->Description, (*Target)->ShortDesc, ExpectedIndexMD5); } } -- cgit v1.2.3 From 8f30ca302e4235985982a0f2b1e83dfe977ed12c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sun, 2 Apr 2006 13:02:02 +0200 Subject: * fix in the log class to avoid absurdely big downloads --- apt-pkg/acquire-item.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 38977d2b1..a29063e1a 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -103,7 +103,8 @@ void pkgAcquire::Item::Done(string Message,unsigned long Size,string, { // We just downloaded something.. string FileName = LookupTag(Message,"Filename"); - if (Complete == false && FileName == DestFile) + // we only inform the Log class if it was actually not a local thing + if (Complete == false && !Local && FileName == DestFile) { if (Owner->Log != 0) Owner->Log->Fetched(Size,atoi(LookupTag(Message,"Resume-Point","0").c_str())); -- cgit v1.2.3 From b7347826732bfad84001555d51f57b99017dd8c4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sun, 2 Apr 2006 13:10:49 +0200 Subject: * apt-pkg/acquire-item.cc: pdiff unzip+rred stuff is Local=true --- apt-pkg/acquire-item.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index a29063e1a..c1f6767c0 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -500,6 +500,7 @@ void pkgAcqIndexDiffs::Done(string Message,unsigned long Size,string Md5Hash, string FileName = LookupTag(Message,"Filename"); State = StateUnzipDiff; + Local = true; Desc.URI = "gzip:" + FileName; DestFile += ".decomp"; QueueURI(Desc); @@ -518,6 +519,7 @@ void pkgAcqIndexDiffs::Done(string Message,unsigned long Size,string Md5Hash, std::clog << "Sending to rred method: " << FinalFile << std::endl; State = StateApplyDiff; + Local = true; Desc.URI = "rred:" + FinalFile; QueueURI(Desc); Mode = "rred"; -- cgit v1.2.3 From 27299daff7e00d561dabb92945a516ed34b7be47 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 11 May 2006 12:08:40 +0200 Subject: * apt-pkg/acquire-item.cc: - make Acquire::PDiffs=true get pdfiffs, =false not get them --- apt-pkg/acquire-item.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index c1f6767c0..f22daaf71 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1029,7 +1029,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) // Queue Packages file (either diff or full packages files, depending // on the users option) - if(_config->FindB("Acquire::PDiffs",false) == false) + if(_config->FindB("Acquire::PDiffs",true) == true) new pkgAcqDiffIndex(Owner, (*Target)->URI, (*Target)->Description, (*Target)->ShortDesc, ExpectedIndexMD5); else -- cgit v1.2.3 From dfa8d6b21806c76df2e53555c577e8d2029186c4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 Jun 2006 08:54:29 +0200 Subject: * apt-pkg/tagfile.cc: - fix merge bug --- apt-pkg/tagfile.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index 2eb269418..fc020436c 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -35,7 +35,7 @@ pkgTagFile::pkgTagFile(FileFd *pFd,unsigned long Size) : Fd(*pFd), Size(Size) { - if (Fd.IsOpen() == false || Fd.Size()) + if (Fd.IsOpen() == false || Fd.Size() == 0) { Buffer = 0; Start = End = Buffer = 0; -- cgit v1.2.3 From 1790e0cf6a14ba2a3ccd8a8a926ca12a44d46d97 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 14 Jun 2006 11:59:47 +0200 Subject: * apt-pkg/acquire-item.cc: - added missing chmod() calls, thanks to Bastian Blank --- apt-pkg/acquire-item.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index f22daaf71..a51b6f12d 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -540,6 +540,7 @@ void pkgAcqIndexDiffs::Done(string Message,unsigned long Size,string Md5Hash, << DestFile << " -> " << FinalFile << std::endl; } Rename(DestFile,FinalFile); + chmod(FinalFile.c_str(),0644); // see if there is more to download if(available_patches.size() > 0) { @@ -958,6 +959,7 @@ void pkgAcqMetaIndex::RetrievalDone(string Message) // Move it into position Rename(DestFile,FinalFile); } + chmod(FinalFile.c_str(),0644); DestFile = FinalFile; } -- cgit v1.2.3 From 19ec5723caa6ea6ab196a9e960c769ded4ee0d28 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 1 Dec 2006 17:03:43 +0100 Subject: * apt-pkg/deb/debsrcrecords.{cc,h}: - cast correct --- apt-pkg/deb/debsrcrecords.cc | 2 +- apt-pkg/deb/debsrcrecords.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc index e1c6427e8..7d5dab747 100644 --- a/apt-pkg/deb/debsrcrecords.cc +++ b/apt-pkg/deb/debsrcrecords.cc @@ -40,7 +40,7 @@ const char **debSrcRecordParser::Binaries() { delete [] Buffer; // allocate new size based on buffer (but never smaller than 4000) - BufSize = max((unsigned long)4000, max(Bins.length()+1,2*BufSize)); + BufSize = max((unsigned int)4000, max((unsigned int)Bins.length()+1,2*BufSize)); Buffer = new char[BufSize]; } diff --git a/apt-pkg/deb/debsrcrecords.h b/apt-pkg/deb/debsrcrecords.h index f4e2cb46c..7645dc564 100644 --- a/apt-pkg/deb/debsrcrecords.h +++ b/apt-pkg/deb/debsrcrecords.h @@ -27,7 +27,7 @@ class debSrcRecordParser : public pkgSrcRecords::Parser char *StaticBinList[400]; unsigned long iOffset; char *Buffer; - unsigned long BufSize; + unsigned int BufSize; public: -- cgit v1.2.3 From 7106240056767caad5a55fe9c542842065cb5829 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 7 Dec 2006 11:10:32 +0100 Subject: * apt-pkg/acquire-item.cc: - merged the NMU pdiff fix and make the code a bit more readable --- apt-pkg/acquire-item.cc | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index a51b6f12d..6831abd54 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -270,15 +270,8 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile) } } - // no information how to get the patches, bail out - if(!found) - { - if(Debug) - std::clog << "Can't find a patch in the index file" << std::endl; - // Failed will queue a big package file - Failed("", NULL); - } - else + // we have something, queue the next diff + if(found) { // queue the diffs new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc, @@ -290,6 +283,11 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile) } } + // Nothing found, report and return false + // Failing here is ok, if we return false later, the full + // IndexFile is queued + if(Debug) + std::clog << "Can't find a patch in the index file" << std::endl; return false; } -- cgit v1.2.3 From 14443594b5fdd5a99cb94434bddfbae098e83ecd Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 7 Dec 2006 14:42:57 +0100 Subject: * apt-pkg/acquire-item.cc - more usefull description of the downloaded patches --- apt-pkg/acquire-item.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 46c9d6c2c..0419f5ffd 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -274,6 +274,9 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile) if(found) { // queue the diffs + int last_space = Description.rfind(" "); + if(last_space != string::npos) + Description.erase(last_space, Description.size()-last_space); new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc, ExpectedMD5, available_patches); Complete = false; @@ -354,7 +357,7 @@ pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire *Owner, Debug = _config->FindB("Debug::pkgAcquire::Diffs",false); - Desc.Description = URIDesc; + Description = URIDesc; Desc.Owner = this; Desc.ShortDesc = ShortDesc; @@ -463,7 +466,7 @@ bool pkgAcqIndexDiffs::QueueNextDiff() // queue the right diff Desc.URI = string(RealURI) + ".diff/" + available_patches[0].file + ".gz"; - Desc.Description = available_patches[0].file + string(".pdiff"); + Desc.Description = Description + " " + available_patches[0].file + string(".pdiff"); DestFile = _config->FindDir("Dir::State::lists") + "partial/"; DestFile += URItoFileName(RealURI + ".diff/" + available_patches[0].file); -- cgit v1.2.3 From 07494f6580dd689c1d82d8dc2f7dbbcfedaf6e52 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 8 Dec 2006 18:21:59 +0000 Subject: 0.6.46.3ubuntu2 change as uploaded: fix dist-upgrade --- apt-pkg/algorithms.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'apt-pkg') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index f50c52a32..723c8ea3a 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -986,6 +986,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) } if (Debug) clog << " Will not break " << Pkg.Name() << " as stated in Breaks field in " << I.Name() < Date: Wed, 14 Mar 2007 14:07:51 +0100 Subject: * apt-pkg/depcache.cc: - always chmod extended_states to 0644 --- apt-pkg/depcache.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index f5673dd5d..4794d3503 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -26,6 +26,8 @@ #include #include +#include + #include pkgDepCache::ActionGroup::ActionGroup(pkgDepCache &cache) : @@ -253,8 +255,9 @@ bool pkgDepCache::writeStateFile(OpProgress *prog) } fclose(OutFile); - // move the outfile over the real file + // move the outfile over the real file and set permissions rename(outfile.c_str(), state.c_str()); + chmod(state.c_str(), 0644); return true; } -- cgit v1.2.3 From 06c46e825c6e7ec84682bf6f7fbc28b6cc7d7569 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 25 Apr 2007 00:33:56 +0200 Subject: * revert the api --- apt-pkg/init.h | 2 +- apt-pkg/makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/init.h b/apt-pkg/init.h index b584b2cce..8255b406a 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 12 +#define APT_PKG_MINOR 11 #define APT_PKG_RELEASE 0 extern const char *pkgVersion; diff --git a/apt-pkg/makefile b/apt-pkg/makefile index c493d3dd9..7e5feae53 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.12 +MAJOR=3.11 MINOR=0 SLIBS=$(PTHREADLIB) $(INTLLIBS) APT_DOMAIN:=libapt-pkg$(MAJOR) -- cgit v1.2.3 From ce86ff41e5aae49be67f0031a33b83cfde975d96 Mon Sep 17 00:00:00 2001 From: "bubulle@debian.org" <> Date: Tue, 8 May 2007 10:46:12 +0200 Subject: Add one translatable string and a newline. Closes: #394722 --- apt-pkg/cdrom.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 4d45d38a2..17a4f184b 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -680,7 +680,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log) if(log) { msg.str(""); - ioprintf(msg, "Found label '%s'\n", Name.c_str()); + ioprintf(msg, _("Found label '%s'\n"), Name.c_str()); log->Update(msg.str()); } Database.Set("CD::" + ID + "::Label",Name); @@ -804,7 +804,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log) // Unmount and finish if (_config->FindB("APT::CDROM::NoMount",false) == false) { - log->Update(_("Unmounting CD-ROM..."), STEP_LAST); + log->Update(_("Unmounting CD-ROM...\n"), STEP_LAST); UnmountCdrom(CDROM); } -- cgit v1.2.3 From c2f2b86252cec3a9ec68df2f55850067faa705d6 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 23 May 2007 09:34:18 +0200 Subject: * implement SourceVer() in pkgRecords (thanks to Daniel Burrows for the patch!) --- apt-pkg/deb/debrecords.cc | 28 +++++++++++++++++++++++++++- apt-pkg/deb/debrecords.h | 1 + apt-pkg/pkgrecords.h | 1 + 3 files changed, 29 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc index c3e579ad1..26ca36799 100644 --- a/apt-pkg/deb/debrecords.cc +++ b/apt-pkg/deb/debrecords.cc @@ -92,18 +92,44 @@ string debRecordParser::LongDesc() return Section.FindS("Description"); } /*}}}*/ + +static const char *SourceVerSeparators = " ()"; + // RecordParser::SourcePkg - Return the source package name if any /*{{{*/ // --------------------------------------------------------------------- /* */ string debRecordParser::SourcePkg() { string Res = Section.FindS("Source"); - string::size_type Pos = Res.find(' '); + string::size_type Pos = Res.find_first_of(SourceVerSeparators); if (Pos == string::npos) return Res; return string(Res,0,Pos); } /*}}}*/ +// RecordParser::SourceVer - Return the source version number if present /*{{{*/ +// --------------------------------------------------------------------- +/* */ +string debRecordParser::SourceVer() +{ + string Pkg = Section.FindS("Source"); + string::size_type Pos = Pkg.find_first_of(SourceVerSeparators); + if (Pos == string::npos) + return ""; + + string::size_type VerStart = Pkg.find_first_not_of(SourceVerSeparators, Pos); + if(VerStart == string::npos) + return ""; + + string::size_type VerEnd = Pkg.find_first_of(SourceVerSeparators, VerStart); + if(VerEnd == string::npos) + // Corresponds to the case of, e.g., "foo (1.2" without a closing + // paren. Be liberal and guess what it means. + return string(Pkg, VerStart); + else + return string(Pkg, VerStart, VerEnd - VerStart); +} + /*}}}*/ // RecordParser::GetRec - Return the whole record /*{{{*/ // --------------------------------------------------------------------- /* */ diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index efef2e588..bb72275a5 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -38,6 +38,7 @@ class debRecordParser : public pkgRecords::Parser virtual string MD5Hash(); virtual string SHA1Hash(); virtual string SourcePkg(); + virtual string SourceVer(); // These are some general stats about the package virtual string Maintainer(); diff --git a/apt-pkg/pkgrecords.h b/apt-pkg/pkgrecords.h index 08f004414..dcfec07ef 100644 --- a/apt-pkg/pkgrecords.h +++ b/apt-pkg/pkgrecords.h @@ -58,6 +58,7 @@ class pkgRecords::Parser virtual string MD5Hash() {return string();}; virtual string SHA1Hash() {return string();}; virtual string SourcePkg() {return string();}; + virtual string SourceVer() {return string();}; // These are some general stats about the package virtual string Maintainer() {return string();}; -- cgit v1.2.3 From 05aab406968ed4f08d3cace55622a62b489e5df8 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 7 Jun 2007 00:48:52 +0200 Subject: * revert bits of the acquire-item merge that broke the description display --- apt-pkg/acquire-item.cc | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 3d05e62ae..1b9120586 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -267,17 +267,13 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile) } } - // no information how to get the patches, bail out - if(!found) - { - if(Debug) - std::clog << "Can't find a patch in the index file" << std::endl; - // Failed will queue a big package file - Failed("", NULL); - } - else + // we have something, queue the next diff + if(found) { // queue the diffs + int last_space = Description.rfind(" "); + if(last_space != string::npos) + Description.erase(last_space, Description.size()-last_space); new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc, ExpectedMD5, available_patches); Complete = false; @@ -286,7 +282,12 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile) return true; } } - + + // Nothing found, report and return false + // Failing here is ok, if we return false later, the full + // IndexFile is queued + if(Debug) + std::clog << "Can't find a patch in the index file" << std::endl; return false; } @@ -353,7 +354,7 @@ pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire *Owner, Debug = _config->FindB("Debug::pkgAcquire::Diffs",false); - Desc.Description = URIDesc; + Description = URIDesc; Desc.Owner = this; Desc.ShortDesc = ShortDesc; @@ -462,8 +463,7 @@ bool pkgAcqIndexDiffs::QueueNextDiff() // queue the right diff Desc.URI = string(RealURI) + ".diff/" + available_patches[0].file + ".gz"; - Desc.Description = available_patches[0].file + string(".pdiff"); - + Desc.Description = Description + " " + available_patches[0].file + string(".pdiff"); DestFile = _config->FindDir("Dir::State::lists") + "partial/"; DestFile += URItoFileName(RealURI + ".diff/" + available_patches[0].file); @@ -602,7 +602,6 @@ 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"; -- cgit v1.2.3 From 152ab79e05f077440d76c1c423b013eaeb3fe2ff Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 8 Jun 2007 23:04:36 +0200 Subject: * fix FTBFS with gcc 4.3, closes: #417090 (thanks to Martin Michlmayr for the patch) --- apt-pkg/algorithms.cc | 2 ++ apt-pkg/cdrom.cc | 1 + apt-pkg/contrib/fileutl.cc | 1 + apt-pkg/contrib/strutl.cc | 1 + apt-pkg/init.cc | 1 + 5 files changed, 6 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 5fa16e66f..c6583f3b5 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -24,6 +24,8 @@ #include +#include +#include #include /*}}}*/ using namespace std; diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 17a4f184b..07a7b868a 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include "indexcopy.h" diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 9fd71728e..5d294c36a 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -24,6 +24,7 @@ #include +#include #include #include #include diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index d96155917..6e549bedd 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc index b47378d4a..52c8a68aa 100644 --- a/apt-pkg/init.cc +++ b/apt-pkg/init.cc @@ -14,6 +14,7 @@ #include #include +#include #include /*}}}*/ -- cgit v1.2.3 From 686d0fad160a51d8833a9429ec3a68de6f13c2d5 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sat, 9 Jun 2007 01:40:31 +0200 Subject: * merged another missing bit from the ubuntu branch --- apt-pkg/depcache.cc | 2 +- apt-pkg/depcache.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index af2fd54c7..fe981ea76 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -178,7 +178,7 @@ bool pkgDepCache::readStateFile(OpProgress *Prog) return true; } -bool pkgDepCache::writeStateFile(OpProgress *prog) +bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly) { if(_config->FindB("Debug::pkgAutoRemove",false)) std::clog << "pkgDepCache::writeStateFile()" << std::endl; diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index b2bcfb58a..84fed7f37 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -403,7 +403,7 @@ class pkgDepCache : protected pkgCache::Namespace // read persistent states bool readStateFile(OpProgress *prog); - bool writeStateFile(OpProgress *prog); + bool writeStateFile(OpProgress *prog, bool InstalledOnly=false); // Size queries inline double UsrSize() {return iUsrSize;}; -- cgit v1.2.3