summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/cachefilter.cc6
-rw-r--r--apt-pkg/cacheset.cc2
-rw-r--r--apt-pkg/cdrom.cc4
-rw-r--r--apt-pkg/clean.cc5
-rw-r--r--apt-pkg/contrib/fileutl.cc2
-rw-r--r--apt-pkg/contrib/mmap.cc31
-rw-r--r--apt-pkg/deb/deblistparser.cc3
-rw-r--r--apt-pkg/indexcopy.cc7
-rw-r--r--apt-pkg/packagemanager.cc2
9 files changed, 37 insertions, 25 deletions
diff --git a/apt-pkg/cachefilter.cc b/apt-pkg/cachefilter.cc
index 35f95fe22..58cc812bf 100644
--- a/apt-pkg/cachefilter.cc
+++ b/apt-pkg/cachefilter.cc
@@ -66,12 +66,6 @@ static std::string CompleteArch(std::string const &arch) {
complete = complete.substr(1, complete.size()-2);
return complete;
}
- else if (arch == "armel") return "linux-arm";
- else if (arch == "armhf") return "linux-arm";
- else if (arch == "lpia") return "linux-i386";
- else if (arch == "powerpcspe") return "linux-powerpc";
- else if (arch == "uclibc-linux-armel") return "linux-arm";
- else if (arch == "uclinux-armel") return "uclinux-arm";
else if (arch == "any") return "*-*";
else return "linux-" + arch;
}
diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc
index 784d1f0bf..1fea4f94a 100644
--- a/apt-pkg/cacheset.cc
+++ b/apt-pkg/cacheset.cc
@@ -193,6 +193,8 @@ bool PackageContainerInterface::FromGroup(PackageContainerInterface * const pci,
if (archfound != std::string::npos) {
arch = pkg.substr(archfound+1);
pkg.erase(archfound);
+ if (arch == "all" || arch == "native")
+ arch = _config->Find("APT::Architecture");
}
pkgCache::GrpIterator Grp = Cache.GetPkgCache()->FindGrp(pkg);
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc
index 8462e8286..699f66fb3 100644
--- a/apt-pkg/cdrom.cc
+++ b/apt-pkg/cdrom.cc
@@ -413,8 +413,8 @@ bool pkgCdrom::WriteDatabase(Configuration &Cnf)
Out.close();
- if (FileExists(DFile) == true && link(DFile.c_str(),string(DFile + '~').c_str()) != 0)
- return _error->Errno("link", "Failed to link %s to %s~", DFile.c_str(), DFile.c_str());
+ if (FileExists(DFile) == true)
+ rename(DFile.c_str(), string(DFile + '~').c_str());
if (rename(NewFile.c_str(),DFile.c_str()) != 0)
return _error->Errno("rename","Failed to rename %s.new to %s",
DFile.c_str(),DFile.c_str());
diff --git a/apt-pkg/clean.cc b/apt-pkg/clean.cc
index 9c167eaa5..eae419e34 100644
--- a/apt-pkg/clean.cc
+++ b/apt-pkg/clean.cc
@@ -81,12 +81,13 @@ bool pkgArchiveCleaner::Go(std::string Dir,pkgCache &Cache)
if (*I != '.')
continue;
std::string const Arch = DeQuoteString(std::string(Start,I-Start));
-
+
+ // ignore packages of unconfigured architectures
if (APT::Configuration::checkArchitecture(Arch) == false)
continue;
// Lookup the package
- pkgCache::PkgIterator P = Cache.FindPkg(Pkg);
+ pkgCache::PkgIterator P = Cache.FindPkg(Pkg, Arch);
if (P.end() != true)
{
pkgCache::VerIterator V = P.VersionList();
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 119cd1974..90e49cbfa 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1748,13 +1748,11 @@ bool FileFd::Close()
/* */
bool FileFd::Sync()
{
-#ifdef _POSIX_SYNCHRONIZED_IO
if (fsync(iFd) != 0)
{
Flags |= Fail;
return _error->Errno("sync",_("Problem syncing the file"));
}
-#endif
return true;
}
/*}}}*/
diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc
index 593bb063b..a176da636 100644
--- a/apt-pkg/contrib/mmap.cc
+++ b/apt-pkg/contrib/mmap.cc
@@ -102,6 +102,7 @@ bool MMap::Map(FileFd &Fd)
{
// for readonly, we don't need sync, so make it simple
Base = malloc(iSize);
+ SyncToFd = new FileFd();
return Fd.Read(Base, iSize);
}
// FIXME: Writing to compressed fd's ?
@@ -155,11 +156,10 @@ bool MMap::Close(bool DoSync)
/* This is done in syncronous mode - the docs indicate that this will
not return till all IO is complete */
bool MMap::Sync()
-{
+{
if ((Flags & UnMapped) == UnMapped)
return true;
-
-#ifdef _POSIX_SYNCHRONIZED_IO
+
if ((Flags & ReadOnly) != ReadOnly)
{
if (SyncToFd != NULL)
@@ -169,11 +169,12 @@ bool MMap::Sync()
}
else
{
+#ifdef _POSIX_SYNCHRONIZED_IO
if (msync((char *)Base, iSize, MS_SYNC) < 0)
return _error->Errno("msync", _("Unable to synchronize mmap"));
+#endif
}
}
-#endif
return true;
}
/*}}}*/
@@ -184,9 +185,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop)
{
if ((Flags & UnMapped) == UnMapped)
return true;
-
-#ifdef _POSIX_SYNCHRONIZED_IO
- unsigned long long PSize = sysconf(_SC_PAGESIZE);
+
if ((Flags & ReadOnly) != ReadOnly)
{
if (SyncToFd != 0)
@@ -197,11 +196,13 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop)
}
else
{
+#ifdef _POSIX_SYNCHRONIZED_IO
+ unsigned long long const PSize = sysconf(_SC_PAGESIZE);
if (msync((char *)Base+(unsigned long long)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0)
return _error->Errno("msync", _("Unable to synchronize mmap"));
+#endif
}
}
-#endif
return true;
}
/*}}}*/
@@ -216,7 +217,17 @@ DynamicMMap::DynamicMMap(FileFd &F,unsigned long Flags,unsigned long const &Work
{
if (_error->PendingError() == true)
return;
-
+
+ // disable Moveable if we don't grow
+ if (Grow == 0)
+ this->Flags &= ~Moveable;
+
+#ifndef __linux__
+ // kfreebsd doesn't have mremap, so we use the fallback
+ if ((this->Flags & Moveable) == Moveable)
+ this->Flags |= Fallback;
+#endif
+
unsigned long long EndOfFile = Fd->Size();
if (EndOfFile > WorkSpace)
WorkSpace = EndOfFile;
@@ -328,7 +339,7 @@ unsigned long DynamicMMap::RawAllocate(unsigned long long Size,unsigned long Aln
if(!Grow())
{
_error->Fatal(_("Dynamic MMap ran out of room. Please increase the size "
- "of APT::Cache-Limit. Current value: %lu. (man 5 apt.conf)"), WorkSpace);
+ "of APT::Cache-Start. Current value: %lu. (man 5 apt.conf)"), WorkSpace);
return 0;
}
}
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index e93e51af3..12c6ab4c9 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -635,7 +635,8 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver,
return _error->Error("Problem parsing dependency %s",Tag);
size_t const found = Package.rfind(':');
- if (MultiArchEnabled == true &&
+ // If negative is unspecific it needs to apply on all architectures
+ if (MultiArchEnabled == true && found == string::npos &&
(Type == pkgCache::Dep::Conflicts ||
Type == pkgCache::Dep::DpkgBreaks ||
Type == pkgCache::Dep::Replaces))
diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc
index e29e2819c..c97445326 100644
--- a/apt-pkg/indexcopy.cc
+++ b/apt-pkg/indexcopy.cc
@@ -810,9 +810,14 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name, /*{{{*/
(*I).c_str() + CDROM.length());
string TargetF = _config->FindDir("Dir::State::lists") + "partial/";
TargetF += URItoFileName(S);
+ FileFd Target;
if (_config->FindB("APT::CDROM::NoAct",false) == true)
+ {
TargetF = "/dev/null";
- FileFd Target(TargetF,FileFd::WriteAtomic);
+ Target.Open(TargetF,FileFd::WriteExists);
+ } else {
+ Target.Open(TargetF,FileFd::WriteAtomic);
+ }
FILE *TargetFl = fdopen(dup(Target.Fd()),"w");
if (_error->PendingError() == true)
return false;
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index 80369dd1a..97a3c8c88 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -643,7 +643,7 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
}
// Look for something that could be configured.
- for (DepIterator Cur = Start; Bad == true; ++Cur)
+ for (DepIterator Cur = Start; Bad == true && Cur.end() == false; ++Cur)
{
SPtrArray<Version *> VList = Cur.AllTargets();
for (Version **I = VList; *I != 0; ++I)