diff options
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/acquire-item.cc | 25 | ||||
-rw-r--r-- | apt-pkg/contrib/configuration.cc | 2 | ||||
-rw-r--r-- | apt-pkg/deb/debsrcrecords.cc | 2 | ||||
-rw-r--r-- | apt-pkg/depcache.cc | 37 | ||||
-rw-r--r-- | apt-pkg/init.cc | 8 | ||||
-rw-r--r-- | apt-pkg/init.h | 4 | ||||
-rw-r--r-- | apt-pkg/makefile | 2 |
7 files changed, 47 insertions, 33 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 1b9120586..4f5d644ab 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -271,7 +271,7 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile) if(found) { // queue the diffs - int last_space = Description.rfind(" "); + unsigned 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, @@ -688,8 +688,10 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5, { // The files timestamp matches if (StringToBool(LookupTag(Message,"Alt-IMS-Hit"),false) == true) + { + unlink(FileName.c_str()); return; - + } Decompression = true; Local = true; DestFile += ".decomp"; @@ -708,7 +710,10 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5, // The files timestamp matches if (StringToBool(LookupTag(Message,"IMS-Hit"),false) == true) + { + unlink(FileName.c_str()); return; + } if (FileName == DestFile) Erase = true; @@ -884,8 +889,8 @@ pkgAcqMetaIndex::pkgAcqMetaIndex(pkgAcquire *Owner, string SigFile, const vector<struct IndexTarget*>* IndexTargets, indexRecords* MetaIndexParser) : - Item(Owner), RealURI(URI), SigFile(SigFile), AuthPass(false), - MetaIndexParser(MetaIndexParser), IndexTargets(IndexTargets), IMSHit(false) + Item(Owner), RealURI(URI), SigFile(SigFile), IndexTargets(IndexTargets), + MetaIndexParser(MetaIndexParser), AuthPass(false), IMSHit(false) { DestFile = _config->FindDir("Dir::State::lists") + "partial/"; DestFile += URItoFileName(URI); @@ -980,18 +985,18 @@ void pkgAcqMetaIndex::RetrievalDone(string Message) // see if the download was a IMSHit IMSHit = StringToBool(LookupTag(Message,"IMS-Hit"),false); - Complete = true; string FinalFile = _config->FindDir("Dir::State::lists"); FinalFile += URItoFileName(RealURI); - // The files timestamp matches - if (StringToBool(LookupTag(Message,"IMS-Hit"),false) == false) - { - // Move it into position + // If we get a IMS hit we can remove the empty file in partial + // othersie we move the file in place + if (IMSHit) + unlink(DestFile.c_str()); + else Rename(DestFile,FinalFile); - } + chmod(FinalFile.c_str(),0644); DestFile = FinalFile; } diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 7914bd07b..3109fd7a5 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -507,7 +507,7 @@ bool ReadConfigFile(Configuration &Conf,const string &FName,bool AsSectional, CurLine++; // This should be made to work instead, but this is better than looping if (F.fail() && !F.eof()) - return _error->Error(_("Line %d too long (max %lu)"), CurLine, sizeof(Buffer)); + return _error->Error(_("Line %d too long (max %u)"), CurLine, sizeof(Buffer)); _strtabexpand(Buffer,sizeof(Buffer)); _strstrip(Buffer); diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc index fcd9bb901..ace4e00b5 100644 --- a/apt-pkg/deb/debsrcrecords.cc +++ b/apt-pkg/deb/debsrcrecords.cc @@ -137,7 +137,7 @@ bool debSrcRecordParser::Files(vector<pkgSrcRecords::File> &List) break; F.Type = string(F.Path,Tmp+1,Pos-Tmp); - if (F.Type == "gz" || F.Type == "bz2") + if (F.Type == "gz" || F.Type == "bz2" || F.Type == "lzma") { Pos = Tmp-1; continue; diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 7f5719454..c21872449 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -27,6 +27,27 @@ #include <apti18n.h> +// helper for Install-Recommends-Sections and Never-MarkAuto-Sections +static bool +ConfigValueInSubTree(const char* SubTree, const char *needle) +{ + Configuration::Item const *Opts; + Opts = _config->Tree(SubTree); + if (Opts != 0 && Opts->Child != 0) + { + Opts = Opts->Child; + for (; Opts != 0; Opts = Opts->Next) + { + if (Opts->Value.empty() == true) + continue; + if (strcmp(needle, Opts->Value.c_str()) == 0) + return true; + } + } + return false; +} + + pkgDepCache::ActionGroup::ActionGroup(pkgDepCache &cache) : cache(cache), released(false) { @@ -954,11 +975,10 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, << " as dep of " << Pkg.Name() << std::endl; // now check if we should consider it a automatic dependency or not - string sec = _config->Find("APT::Never-MarkAuto-Section",""); - if(Pkg.Section() && (string(Pkg.Section()) == sec)) + if(Pkg.Section() && ConfigValueInSubTree("APT::Never-MarkAuto-Sections", Pkg.Section())) { if(_config->FindB("Debug::pkgDepCache::AutoInstall",false) == true) - std::clog << "Setting NOT as auto-installed because its a direct dep of a package in section " << sec << std::endl; + std::clog << "Setting NOT as auto-installed (direct dep of pkg in APT::Never-MarkAuto-Section)" << std::endl; MarkInstall(InstPkg,true,Depth + 1, true); } else @@ -1131,6 +1151,7 @@ pkgCache::VerIterator pkgDepCache::Policy::GetCandidateVer(PkgIterator Pkg) return Last; } /*}}}*/ + // Policy::IsImportantDep - True if the dependency is important /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -1146,13 +1167,9 @@ bool pkgDepCache::Policy::IsImportantDep(DepIterator Dep) // sections // FIXME: this is a meant as a temporarly solution until the // recommends are cleaned up - string s = _config->Find("APT::Install-Recommends-Section",""); - if(s.size() > 0) - { - const char *sec = Dep.ParentVer().Section(); - if (sec && strcmp(sec, s.c_str()) == 0) - return true; - } + const char *sec = Dep.ParentVer().Section(); + if (sec && ConfigValueInSubTree("APT::Install-Recommends-Sections", sec)) + return true; } else if(Dep->Type == pkgCache::Dep::Suggests) return _config->FindB("APT::Install-Suggests", false); diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc index 2617603ec..0aff882b6 100644 --- a/apt-pkg/init.cc +++ b/apt-pkg/init.cc @@ -24,8 +24,6 @@ const char *pkgVersion = VERSION; const char *pkgLibVersion = Stringfy(APT_PKG_MAJOR) "." Stringfy(APT_PKG_MINOR) "." Stringfy(APT_PKG_RELEASE); -const char *pkgCPU = COMMON_CPU; -const char *pkgOS = COMMON_OS; // pkgInitConfig - Initialize the configuration class /*{{{*/ // --------------------------------------------------------------------- @@ -35,11 +33,7 @@ const char *pkgOS = COMMON_OS; bool pkgInitConfig(Configuration &Cnf) { // General APT things - if (strcmp(COMMON_OS,"linux") == 0 || - strcmp(COMMON_OS,"unknown") == 0) - Cnf.Set("APT::Architecture",COMMON_CPU); - else - Cnf.Set("APT::Architecture",COMMON_OS "-" COMMON_CPU); + Cnf.Set("APT::Architecture", COMMON_ARCH); Cnf.Set("APT::Build-Essential::", "build-essential"); Cnf.Set("APT::Install-Recommends", false); Cnf.Set("APT::Install-Suggests", false); diff --git a/apt-pkg/init.h b/apt-pkg/init.h index bc0e55036..23e951eff 100644 --- a/apt-pkg/init.h +++ b/apt-pkg/init.h @@ -18,13 +18,11 @@ // See the makefile #define APT_PKG_MAJOR 4 -#define APT_PKG_MINOR 4 +#define APT_PKG_MINOR 5 #define APT_PKG_RELEASE 0 extern const char *pkgVersion; extern const char *pkgLibVersion; -extern const char *pkgOS; -extern const char *pkgCPU; bool pkgInitConfig(Configuration &Cnf); bool pkgInitSystem(Configuration &Cnf,pkgSystem *&Sys); diff --git a/apt-pkg/makefile b/apt-pkg/makefile index 8dd50b8c2..b327dbf64 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=4.4 +MAJOR=4.5 MINOR=0 SLIBS=$(PTHREADLIB) $(INTLLIBS) -lutil APT_DOMAIN:=libapt-pkg$(MAJOR) |