diff options
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/acquire-item.h | 2 | ||||
-rw-r--r-- | apt-pkg/acquire-worker.h | 6 | ||||
-rw-r--r-- | apt-pkg/cdrom.cc | 4 | ||||
-rw-r--r-- | apt-pkg/contrib/configuration.cc | 4 | ||||
-rw-r--r-- | apt-pkg/contrib/fileutl.h | 3 | ||||
-rw-r--r-- | apt-pkg/contrib/md5.cc | 2 | ||||
-rw-r--r-- | apt-pkg/contrib/strutl.cc | 2 | ||||
-rw-r--r-- | apt-pkg/deb/deblistparser.cc | 6 | ||||
-rw-r--r-- | apt-pkg/deb/deblistparser.h | 1 | ||||
-rw-r--r-- | apt-pkg/deb/debsystem.cc | 4 | ||||
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 3 | ||||
-rw-r--r-- | apt-pkg/init.cc | 6 | ||||
-rw-r--r-- | apt-pkg/pkgcache.cc | 60 | ||||
-rw-r--r-- | apt-pkg/pkgcachegen.cc | 2 |
14 files changed, 80 insertions, 25 deletions
diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index 3a5a518c2..4a1378922 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -571,7 +571,7 @@ class APT_HIDDEN pkgAcqMetaSig : public pkgAcqTransactionItem virtual ~pkgAcqMetaSig(); }; /*}}}*/ -/** \brief An item repsonsible for downloading clearsigned metaindexes {{{*/ +/** \brief An item responsible for downloading clearsigned metaindexes {{{*/ class APT_HIDDEN pkgAcqMetaClearSig : public pkgAcqMetaIndex { void * const d; diff --git a/apt-pkg/acquire-worker.h b/apt-pkg/acquire-worker.h index f04db2b3c..11e54b060 100644 --- a/apt-pkg/acquire-worker.h +++ b/apt-pkg/acquire-worker.h @@ -3,9 +3,9 @@ /* ###################################################################### Acquire Worker - Worker process manager - - Each worker class is associated with exaclty one subprocess. - + + Each worker class is associated with exactly one subprocess. + ##################################################################### */ /*}}}*/ diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 2c8aee815..151608b28 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -438,7 +438,7 @@ bool pkgCdrom::WriteDatabase(Configuration &Cnf) /* Write out all of the configuration directives by walking the configuration tree */ - Cnf.Dump(Out, NULL, "%f \"%v\";\n", false); + Cnf.Dump(Out, NULL, "%F \"%v\";\n", false); Out.close(); @@ -721,7 +721,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log) /*{{{*/ DropRepeats(List,"Packages"); DropRepeats(SourceList,"Sources"); // FIXME: We ignore stat() errors here as we usually have only one of those in use - // This has little potencial to drop 'valid' stat() errors as we know that one of these + // This has little potential to drop 'valid' stat() errors as we know that one of these // files need to exist, but it would be better if we would check it here _error->PushToStack(); DropRepeats(SigList,"Release.gpg"); diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 76d1b9370..997ef7423 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -252,7 +252,7 @@ Configuration::Item *Configuration::Lookup(Item *Head,const char *S, if (Len != 0) { for (; I != 0; Last = &I->Next, I = I->Next) - if ((Res = stringcasecmp(I->Tag,S,S + Len)) == 0) + if (Len == I->Tag.length() && (Res = stringcasecmp(I->Tag,S,S + Len)) == 0) break; } else @@ -728,7 +728,7 @@ bool Configuration::ExistsAny(const char *Name) const /* Dump the entire configuration space */ void Configuration::Dump(ostream& str) { - Dump(str, NULL, "%f \"%v\";\n", true); + Dump(str, NULL, "%F \"%v\";\n", true); } void Configuration::Dump(ostream& str, char const * const root, char const * const formatstr, bool const emptyValue) diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index c78f1715c..c7927951f 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -183,6 +183,7 @@ class FileFd private: FileFdPrivate * d; + APT_HIDDEN FileFd(const FileFd &); APT_HIDDEN FileFd & operator=(const FileFd &); APT_HIDDEN bool OpenInternDescriptor(unsigned int const Mode, APT::Configuration::Compressor const &compressor); @@ -278,7 +279,7 @@ std::vector<std::string> Glob(std::string const &pattern, int flags=0); /** \brief Popen() implementation that execv() instead of using a shell * * \param Args the execv style command to run - * \param FileFd is a referenz to the FileFd to use for input or output + * \param FileFd is a reference to the FileFd to use for input or output * \param Child a reference to the integer that stores the child pid * Note that you must call ExecWait() or similar to cleanup * \param Mode is either FileFd::ReadOnly or FileFd::WriteOnly diff --git a/apt-pkg/contrib/md5.cc b/apt-pkg/contrib/md5.cc index 21e3f0afd..c3b529922 100644 --- a/apt-pkg/contrib/md5.cc +++ b/apt-pkg/contrib/md5.cc @@ -80,7 +80,7 @@ static void byteSwap(uint32_t *buf, unsigned words) static void MD5Transform(uint32_t buf[4], uint32_t const in[16]) { - register uint32_t a, b, c, d; + uint32_t a, b, c, d; a = buf[0]; b = buf[1]; diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index a569173af..2e3e025ec 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -772,7 +772,7 @@ std::string LookupTag(const std::string &Message, const char *TagC, const char * // StringToBool - Converts a string into a boolean /*{{{*/ // --------------------------------------------------------------------- /* This inspects the string to see if it is true or if it is false and - then returns the result. Several varients on true/false are checked. */ + then returns the result. Several variants on true/false are checked. */ int StringToBool(const string &Text,int Default) { char *ParseEnd; diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index e8dff833d..80ca10e37 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -61,6 +61,7 @@ debListParser::debListParser(FileFd *File) : else forceEssential.emplace_back("apt"); forceImportant = _config->FindVector("pkgCacheGen::ForceImportant"); + myArch = _config->Find("APT::Architecture"); } /*}}}*/ // ListParser::Package - Return the package name /*{{{*/ @@ -621,12 +622,11 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop, // We don't want to confuse library users which can't handle MultiArch if (StripMultiArch == true) { - string const arch = _config->Find("APT::Architecture"); size_t const found = Package.rfind(':'); if (found != StringView::npos && (Package.substr(found) == ":any" || Package.substr(found) == ":native" || - Package.substr(found +1) == arch)) + Package.substr(found +1) == Arch)) Package = Package.substr(0,found); } @@ -848,7 +848,7 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver, StringView Version; unsigned int Op; - Start = ParseDepends(Start, Stop, Package, Version, Op, false, false, false); + Start = ParseDepends(Start, Stop, Package, Version, Op, false, false, false, myArch); if (Start == 0) return _error->Error("Problem parsing dependency %zu",static_cast<size_t>(Key)); // TODO size_t const found = Package.rfind(':'); diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index 09b56665f..f02252d58 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -45,6 +45,7 @@ class APT_HIDDEN debListParser : public pkgCacheListParser std::vector<std::string> forceEssential; std::vector<std::string> forceImportant; std::string MD5Buffer; + std::string myArch; protected: pkgTagFile Tags; diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc index 0a9e98d6d..5df6c58a1 100644 --- a/apt-pkg/deb/debsystem.cc +++ b/apt-pkg/deb/debsystem.cc @@ -398,6 +398,10 @@ pid_t debSystem::ExecDpkg(std::vector<std::string> const &sArgs, int * const inp { setenv("DPKG_FRONTEND_LOCKED", "true", 1); } + + if (_config->Find("DPkg::Path", "").empty() == false) + setenv("PATH", _config->Find("DPkg::Path", "").c_str(), 1); + execvp(Args[0], (char**) &Args[0]); _error->WarningE("dpkg", "Can't execute dpkg!"); _exit(100); diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 074e52b3f..3c707e220 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -2017,6 +2017,9 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress) && dynamic_cast<debSystem*>(_system)->IsLocked() == true) { setenv("DPKG_FRONTEND_LOCKED", "true", 1); } + if (_config->Find("DPkg::Path", "").empty() == false) + setenv("PATH", _config->Find("DPkg::Path", "").c_str(), 1); + execvp(Args[0], (char**) &Args[0]); cerr << "Could not exec dpkg!" << endl; _exit(100); diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc index 9a51e31e7..a619368ec 100644 --- a/apt-pkg/init.cc +++ b/apt-pkg/init.cc @@ -150,6 +150,7 @@ bool pkgInitConfig(Configuration &Cnf) Cnf.CndSet("Dir::Etc::sourceparts","sources.list.d"); Cnf.CndSet("Dir::Etc::main","apt.conf"); Cnf.CndSet("Dir::Etc::netrc", "auth.conf"); + Cnf.CndSet("Dir::Etc::netrcparts", "auth.conf.d"); Cnf.CndSet("Dir::Etc::parts","apt.conf.d"); Cnf.CndSet("Dir::Etc::preferences","preferences"); Cnf.CndSet("Dir::Etc::preferencesparts","preferences.d"); @@ -205,11 +206,12 @@ bool pkgInitConfig(Configuration &Cnf) Cnf.CndSet("Acquire::IndexTargets::deb-src::Sources::Optional", false); Cnf.CndSet("Acquire::Changelogs::URI::Origin::Debian", "https://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog"); - Cnf.CndSet("Acquire::Changelogs::URI::Origin::Tanglu", "http://metadata.tanglu.org/changelogs/@CHANGEPATH@_changelog"); Cnf.CndSet("Acquire::Changelogs::URI::Origin::Ubuntu", "https://changelogs.ubuntu.com/changelogs/pool/@CHANGEPATH@/changelog"); - Cnf.CndSet("Acquire::Changelogs::URI::Origin::Ultimedia", "http://packages.ultimediaos.com/changelogs/pool/@CHANGEPATH@/changelog.txt"); Cnf.CndSet("Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu", true); + + Cnf.CndSet("DPkg::Path", "/usr/sbin:/usr/bin:/sbin:/bin"); + // Read an alternate config file _error->PushToStack(); const char *Cfg = getenv("APT_CONFIG"); diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 92f0cb777..041f0b957 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -10,7 +10,7 @@ This is the general utility functions for cache management. They provide a complete set of accessor functions for the cache. The cacheiterators header contains the STL-like iterators that can be used to easially - navigate the cache as well as seemlessly dereference the mmap'd + navigate the cache as well as seamlessly dereference the mmap'd indexes. Use these always. The main class provides for ways to get package indexes and some @@ -231,10 +231,54 @@ map_id_t pkgCache::sHash(const char *Str) const return Hash % HeaderP->GetHashTableSize(); } +#if defined(__GNUC__) && defined(__x86_64__) && defined(__ELF__) + +#if defined(__x86_64__) +__attribute__((target("sse4.2"))) static uint32_t hash32(uint32_t crc32, const unsigned char *input, size_t size) +{ + if (input == nullptr) + return 0; + + crc32 ^= 0xffffffffU; + while (size >= 8) { + crc32 = __builtin_ia32_crc32di(crc32, *(uint64_t *)input); + input += 8; + size -= 8; + } + + if (size >= 4) { + crc32 = __builtin_ia32_crc32si(crc32, *(uint32_t *)input); + input += 4; + size -= 4; + } + + if (size >= 2) { + crc32 = __builtin_ia32_crc32hi(crc32, *(uint16_t *)input); + input += 2; + size -= 2; + } + + if (size >= 1) { + crc32 = __builtin_ia32_crc32qi(crc32, *(uint8_t *)input); + input += 1; + size -= 1; + } + crc32 ^= 0xffffffffU; + return crc32; +} +#endif + +__attribute__((target("default"))) +#endif +static uint32_t hash32(uint32_t crc32, const unsigned char *input, size_t size) +{ + return adler32(crc32, input, size); +} + uint32_t pkgCache::CacheHash() { pkgCache::Header header = {}; - uLong adler = adler32(0L, Z_NULL, 0); + uLong adler = hash32(0L, Z_NULL, 0); if (Map.Size() < sizeof(header)) return adler; @@ -243,14 +287,14 @@ uint32_t pkgCache::CacheHash() header.Dirty = false; header.CacheFileSize = 0; - adler = adler32(adler, - reinterpret_cast<const unsigned char *>(&header), - sizeof(header)); + adler = hash32(adler, + reinterpret_cast<const unsigned char *>(&header), + sizeof(header)); if (Map.Size() > sizeof(header)) { - adler = adler32(adler, - static_cast<const unsigned char *>(GetMap().Data()) + sizeof(header), - GetMap().Size() - sizeof(header)); + adler = hash32(adler, + static_cast<const unsigned char *>(GetMap().Data()) + sizeof(header), + GetMap().Size() - sizeof(header)); } return adler; diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 8fe1867d7..5a3b65b3a 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -154,7 +154,7 @@ void pkgCacheGenerator::ReMap(void const * const oldMap, void const * const newM return; if (_config->FindB("Debug::pkgCacheGen", false)) - std::clog << "Remaping from " << oldMap << " to " << newMap << std::endl; + std::clog << "Remapping from " << oldMap << " to " << newMap << std::endl; Cache.ReMap(false); |