summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2012-04-20 10:37:04 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2012-04-20 10:37:04 +0200
commit518763f630873e35398d2537ebfabf97b5aea489 (patch)
treed7b36ef50a9301ac8099edc48a0ab9e563125198 /apt-pkg
parent8c6d0ba4e25baa7b0dffc4e06e76fc63a71e656f (diff)
parente6a12579e9e5d5735eda450cf2bb3986d828ab65 (diff)
merged from lp:~donkult/apt/sid
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/aptconfiguration.cc25
-rw-r--r--apt-pkg/cacheset.cc7
-rw-r--r--apt-pkg/cacheset.h4
-rw-r--r--apt-pkg/contrib/fileutl.cc6
-rw-r--r--apt-pkg/contrib/sha2_internal.cc8
-rw-r--r--apt-pkg/deb/deblistparser.cc10
-rw-r--r--apt-pkg/packagemanager.cc4
7 files changed, 42 insertions, 22 deletions
diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc
index d72b0c5ae..f0cd8ebc0 100644
--- a/apt-pkg/aptconfiguration.cc
+++ b/apt-pkg/aptconfiguration.cc
@@ -47,6 +47,7 @@ const Configuration::getCompressionTypes(bool const &Cached) {
_config->CndSet("Acquire::CompressionTypes::gz","gzip");
setDefaultConfigurationForCompressors();
+ std::vector<APT::Configuration::Compressor> const compressors = getCompressors();
// accept non-list order as override setting for config settings on commandline
std::string const overrideOrder = _config->Find("Acquire::CompressionTypes::Order","");
@@ -63,12 +64,12 @@ const Configuration::getCompressionTypes(bool const &Cached) {
if (_config->Exists(std::string("Acquire::CompressionTypes::").append(*o)) == false)
continue;
// ignore types we have no app ready to use
- std::string const appsetting = std::string("Dir::Bin::").append(*o);
- if (_config->Exists(appsetting) == true) {
- std::string const app = _config->FindFile(appsetting.c_str(), "");
- if (app.empty() == false && FileExists(app) == false)
- continue;
- }
+ std::vector<APT::Configuration::Compressor>::const_iterator c = compressors.begin();
+ for (; c != compressors.end(); ++c)
+ if (c->Name == *o)
+ break;
+ if (c == compressors.end())
+ continue;
types.push_back(*o);
}
@@ -84,12 +85,12 @@ const Configuration::getCompressionTypes(bool const &Cached) {
if (std::find(types.begin(),types.end(),Types->Tag) != types.end())
continue;
// ignore types we have no app ready to use
- std::string const appsetting = std::string("Dir::Bin::").append(Types->Value);
- if (appsetting.empty() == false && _config->Exists(appsetting) == true) {
- std::string const app = _config->FindFile(appsetting.c_str(), "");
- if (app.empty() == false && FileExists(app) == false)
- continue;
- }
+ std::vector<APT::Configuration::Compressor>::const_iterator c = compressors.begin();
+ for (; c != compressors.end(); ++c)
+ if (c->Name == Types->Value)
+ break;
+ if (c == compressors.end())
+ continue;
types.push_back(Types->Tag);
}
diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc
index b892ab4bf..e2dbe0e57 100644
--- a/apt-pkg/cacheset.cc
+++ b/apt-pkg/cacheset.cc
@@ -217,6 +217,7 @@ bool PackageContainerInterface::FromModifierCommandLine(unsigned short &modID, P
pkgCacheFile &Cache, const char * cmdline,
std::list<Modifier> const &mods, CacheSetHelper &helper) {
std::string str = cmdline;
+ unsigned short fallback = modID;
bool modifierPresent = false;
for (std::list<Modifier>::const_iterator mod = mods.begin();
mod != mods.end(); ++mod) {
@@ -243,6 +244,7 @@ bool PackageContainerInterface::FromModifierCommandLine(unsigned short &modID, P
helper.showErrors(errors);
if (Pkg.end() == false) {
pci->insert(Pkg);
+ modID = fallback;
return true;
}
}
@@ -281,13 +283,14 @@ bool VersionContainerInterface::FromModifierCommandLine(unsigned short &modID,
modifierPresent = true;
break;
}
-
if (modifierPresent == true) {
bool const errors = helper.showErrors(false);
bool const found = VersionContainerInterface::FromString(vci, Cache, cmdline, select, helper, true);
helper.showErrors(errors);
- if (found == true)
+ if (found == true) {
+ modID = fallback;
return true;
+ }
}
return FromString(vci, Cache, str, select, helper);
}
diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h
index 6f0a0e358..5b9900603 100644
--- a/apt-pkg/cacheset.h
+++ b/apt-pkg/cacheset.h
@@ -186,7 +186,7 @@ public: /*{{{*/
pkgCache::PkgIterator getPkg(void) const { return *_iter; }
inline pkgCache::PkgIterator operator*(void) const { return *_iter; };
operator typename Container::iterator(void) const { return _iter; }
- operator typename PackageContainer<Container>::const_iterator() { return PackageContainer<Container>::const_iterator(_iter); }
+ operator typename PackageContainer<Container>::const_iterator() { return typename PackageContainer<Container>::const_iterator(_iter); }
inline iterator& operator++() { ++_iter; return *this; }
inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; }
inline bool operator!=(iterator const &i) const { return _iter != i._iter; };
@@ -506,7 +506,7 @@ public: /*{{{*/
pkgCache::VerIterator getVer(void) const { return *_iter; }
inline pkgCache::VerIterator operator*(void) const { return *_iter; };
operator typename Container::iterator(void) const { return _iter; }
- operator typename VersionContainer<Container>::const_iterator() { return VersionContainer<Container>::const_iterator(_iter); }
+ operator typename VersionContainer<Container>::const_iterator() { return typename VersionContainer<Container>::const_iterator(_iter); }
inline iterator& operator++() { ++_iter; return *this; }
inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; }
inline bool operator!=(iterator const &i) const { return _iter != i._iter; };
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 9e3611b26..e9d1ba1ce 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1098,6 +1098,12 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C
dup2(d->compressed_fd,STDIN_FILENO);
dup2(Pipe[1],STDOUT_FILENO);
}
+ int const nullfd = open("/dev/null", O_WRONLY);
+ if (nullfd != -1)
+ {
+ dup2(nullfd,STDERR_FILENO);
+ close(nullfd);
+ }
SetCloseExec(STDOUT_FILENO,false);
SetCloseExec(STDIN_FILENO,false);
diff --git a/apt-pkg/contrib/sha2_internal.cc b/apt-pkg/contrib/sha2_internal.cc
index 6d27e8f2b..83b5a98d3 100644
--- a/apt-pkg/contrib/sha2_internal.cc
+++ b/apt-pkg/contrib/sha2_internal.cc
@@ -552,7 +552,9 @@ void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) {
}
while (len >= SHA256_BLOCK_LENGTH) {
/* Process as many complete blocks as we can */
- SHA256_Transform(context, (sha2_word32*)data);
+ sha2_byte buffer[SHA256_BLOCK_LENGTH];
+ MEMCPY_BCOPY(buffer, data, SHA256_BLOCK_LENGTH);
+ SHA256_Transform(context, (sha2_word32*)buffer);
context->bitcount += SHA256_BLOCK_LENGTH << 3;
len -= SHA256_BLOCK_LENGTH;
data += SHA256_BLOCK_LENGTH;
@@ -879,7 +881,9 @@ void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) {
}
while (len >= SHA512_BLOCK_LENGTH) {
/* Process as many complete blocks as we can */
- SHA512_Transform(context, (sha2_word64*)data);
+ sha2_byte buffer[SHA512_BLOCK_LENGTH];
+ MEMCPY_BCOPY(buffer, data, SHA512_BLOCK_LENGTH);
+ SHA512_Transform(context, (sha2_word64*)buffer);
ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3);
len -= SHA512_BLOCK_LENGTH;
data += SHA512_BLOCK_LENGTH;
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 84e6c38c5..00e2bd900 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -249,8 +249,14 @@ bool debListParser::UsePackage(pkgCache::PkgIterator &Pkg,
return false;
if (strcmp(Pkg.Name(),"apt") == 0)
- Pkg->Flags |= pkgCache::Flag::Essential | pkgCache::Flag::Important;
-
+ {
+ if ((essential == "native" && Pkg->Arch != 0 && myArch == Pkg.Arch()) ||
+ essential == "all")
+ Pkg->Flags |= pkgCache::Flag::Essential | pkgCache::Flag::Important;
+ else
+ Pkg->Flags |= pkgCache::Flag::Important;
+ }
+
if (ParseStatus(Pkg,Ver) == false)
return false;
return true;
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index 093999bc2..b56619ef5 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -621,7 +621,7 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
// Look for easy targets: packages that are already okay
for (DepIterator Cur = Start; Bad == true; ++Cur)
{
- SPtrArray<Version *> VList = Start.AllTargets();
+ SPtrArray<Version *> VList = Cur.AllTargets();
for (Version **I = VList; *I != 0; ++I)
{
VerIterator Ver(Cache,*I);
@@ -644,7 +644,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)
{
- SPtrArray<Version *> VList = Start.AllTargets();
+ SPtrArray<Version *> VList = Cur.AllTargets();
for (Version **I = VList; *I != 0; ++I)
{
VerIterator Ver(Cache,*I);