From f73593a4034d9eec0ec4466b8e173d4a4daece1f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 26 Dec 2024 19:41:53 +0000 Subject: Drop usage of macro APT_OVERRIDE for simple override We were rather inconsistent in using it and as our public headers contain deduction guides (a c++17 feature) it seems silly to try to hide a c++11 feature in a macro, so lets stop this charade and drop the macro and while we are changing all these lines lets apply [[nodiscard]] (another c++17 feature) and other suggestions from clang-tidy and formatting for a little more consistency. --- methods/gpgv.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'methods/gpgv.cc') diff --git a/methods/gpgv.cc b/methods/gpgv.cc index e5554b1e2..736cfbde2 100644 --- a/methods/gpgv.cc +++ b/methods/gpgv.cc @@ -130,7 +130,7 @@ class GPGVMethod : public aptMethod SignersStorage &Signers); protected: - virtual bool URIAcquire(std::string const &Message, FetchItem *Itm) APT_OVERRIDE; + bool URIAcquire(std::string const &Message, FetchItem *Itm) override; public: GPGVMethod() : aptMethod("gpgv", "1.1", SingleInstance | SendConfig | SendURIEncoded){}; }; -- cgit v1.2.3-70-g09d2 From 1e2b5197ee350a36fbad006f198bbf8e9a5c8e53 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 26 Dec 2024 20:46:23 +0000 Subject: Drop the remaining usage of APT_ARRAY_SIZE That macro is not that useful as it might perhaps once was. Lets prepare dropping it now in favour of more standard ways of working with arrays now. --- apt-pkg/contrib/macros.h | 5 +---- apt-pkg/pkgcache.cc | 2 +- methods/gpgv.cc | 13 +++++-------- 3 files changed, 7 insertions(+), 13 deletions(-) (limited to 'methods/gpgv.cc') diff --git a/apt-pkg/contrib/macros.h b/apt-pkg/contrib/macros.h index e0c23b99b..807733927 100644 --- a/apt-pkg/contrib/macros.h +++ b/apt-pkg/contrib/macros.h @@ -17,10 +17,6 @@ #ifndef MACROS_H #define MACROS_H -/* Useful count macro, use on an array of things and it will return the - number of items in the array */ -#define APT_ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) - // Flag Macros #define FLAG(f) (1L << (f)) #define SETFLAG(v,f) ((v) |= FLAG(f)) @@ -141,6 +137,7 @@ AptScopeWrapper(F) -> AptScopeWrapper; #else #define APT_OVERRIDE /* no c++11 standard */ #endif +#define APT_ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) #endif #endif #endif diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 57c6d2b22..1f5f12885 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -245,7 +245,7 @@ uint32_t pkgCache::CacheHash() XXH3_64bits_update(state, reinterpret_cast(PACKAGE_VERSION), - APT_ARRAY_SIZE(PACKAGE_VERSION)); + strlen(PACKAGE_VERSION)); XXH3_64bits_update(state, reinterpret_cast(&header), diff --git a/methods/gpgv.cc b/methods/gpgv.cc index 736cfbde2..8eda8d67f 100644 --- a/methods/gpgv.cc +++ b/methods/gpgv.cc @@ -68,7 +68,7 @@ struct Digest { } }; -static constexpr Digest Digests[] = { +static constexpr std::array Digests = {{ {Digest::State::Untrusted, "Invalid digest"}, {Digest::State::Untrusted, "MD5"}, {Digest::State::Untrusted, "SHA1"}, @@ -81,17 +81,14 @@ static constexpr Digest Digests[] = { {Digest::State::Trusted, "SHA384"}, {Digest::State::Trusted, "SHA512"}, {Digest::State::Trusted, "SHA224"}, -}; +}}; -static Digest FindDigest(std::string const & Digest) +static Digest FindDigest(std::string const &Digest) { int id = atoi(Digest.c_str()); - if (id >= 0 && static_cast(id) < APT_ARRAY_SIZE(Digests)) - { + if (id >= 0 && static_cast(id) < Digests.size()) return Digests[id]; - } else { - return Digests[0]; - } + return Digests[0]; } struct Signer { -- cgit v1.2.3-70-g09d2 From 25cd3ded69a79c2a7eb3d858e041f1509f5f5ed8 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 27 Dec 2024 02:16:56 +0000 Subject: Remove leftovers of the apt-key removal References: a00fbbdb28cc31e78882301c2efe7218583ab4cb --- .gitignore | 1 - README.md | 1 - apt-pkg/contrib/gpgv.cc | 2 -- apt-pkg/deb/debmetaindex.cc | 2 +- debian/control | 1 - doc/apt-verbatim.ent | 23 ----------------------- doc/apt.ent | 4 ---- doc/po/apt-doc.pot | 7 ------- doc/po/de.po | 12 +++++------- doc/po/es.po | 9 --------- doc/po/fr.po | 12 +++++------- doc/po/it.po | 16 +++++++--------- doc/po/ja.po | 16 +++++++--------- doc/po/nl.po | 16 +++++++--------- doc/po/pl.po | 16 +++++++--------- doc/po/pt.po | 16 +++++++--------- doc/po/pt_BR.po | 7 ------- methods/gpgv.cc | 8 ++++---- methods/sqv.cc | 2 +- prepare-release | 4 ---- vendor/README | 11 +++++------ vendor/blankon/apt-vendor.ent | 4 ---- vendor/debian/apt-vendor.ent | 4 ---- vendor/getinfo | 2 +- vendor/procursus/apt-vendor.ent | 4 ---- vendor/raspbian/apt-vendor.ent | 4 ---- vendor/steamos/apt-vendor.ent | 4 ---- vendor/ubuntu/apt-vendor.ent | 4 ---- 28 files changed, 57 insertions(+), 155 deletions(-) (limited to 'methods/gpgv.cc') diff --git a/.gitignore b/.gitignore index aeab4a372..e6f4ed2f4 100644 --- a/.gitignore +++ b/.gitignore @@ -44,7 +44,6 @@ docbook-text-style.xsl **/cmdline/apt-extracttemplates **/cmdline/apt-get **/cmdline/apt-helper -**/cmdline/apt-key **/cmdline/apt-mark **/cmdline/apt-sortpkgs **/cmdline/planners diff --git a/README.md b/README.md index b2a0fdb2b..58c349713 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ Included tools are: as well as available packages * **apt-cdrom** to use removable media as a source for packages * **apt-config** as an interface to the configuration settings -* **apt-key** as an interface to manage authentication keys * **apt-extracttemplates** to be used by debconf to prompt for configuration questions before installation * **apt-ftparchive** creates Packages and other index files diff --git a/apt-pkg/contrib/gpgv.cc b/apt-pkg/contrib/gpgv.cc index 59301fa0c..237ddc856 100644 --- a/apt-pkg/contrib/gpgv.cc +++ b/apt-pkg/contrib/gpgv.cc @@ -111,8 +111,6 @@ static bool operator!=(LineBuffer const &buf, std::string_view const exp) noexce clear-signed files (=the complete content of the file is signed and the content isn't encoded) we do a divide and conquer approach here and split up the clear-signed file in message and signature for gpg. - And as a cherry on the cake, we use our apt-key wrapper to do part - of the lifting in regards to merging keyrings. Fun for the whole family. */ #define apt_error(...) apt_msg("ERROR", __VA_ARGS__) #define apt_warning(...) apt_msg("WARNING", __VA_ARGS__) diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 191be05d6..c53b00881 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -75,7 +75,7 @@ static std::string NormalizeSignedBy(std::string SignedBy, bool const Introducer return os.str(); } - // we could go all fancy and allow short/long/string matches as gpgv/apt-key does, + // we could go all fancy and allow short/long/string matches as gpgv does, // but fingerprints are harder to fake than the others and this option is set once, // not interactively all the time so easy to type is not really a concern. std::transform(SignedBy.begin(), SignedBy.end(), SignedBy.begin(), [](char const c) { diff --git a/debian/control b/debian/control index 1022efa37..a51da4456 100644 --- a/debian/control +++ b/debian/control @@ -69,7 +69,6 @@ Description: commandline package manager as well as installable packages * apt-cdrom to use removable media as a source for packages * apt-config as an interface to the configuration settings - * apt-key as an interface to manage authentication keys Package: libapt-pkg6.0t64 Replaces: libapt-pkg6.0 diff --git a/doc/apt-verbatim.ent b/doc/apt-verbatim.ent index 67977ccc8..61db5888b 100644 --- a/doc/apt-verbatim.ent +++ b/doc/apt-verbatim.ent @@ -69,12 +69,6 @@ " > - - apt-key - 8 - " -> - apt-secure 8 @@ -424,23 +418,6 @@ &synopsis-help; "> -&synopsis-keyid;"> - - apt-key - - - add &synopsis-param-filename; - del &synopsis-param-keyid; - export &synopsis-param-keyid; - exportall - list - finger - adv - update - net-update - &synopsis-help; - -"> apt-mark diff --git a/doc/apt.ent b/doc/apt.ent index b502073a9..9034d2e66 100644 --- a/doc/apt.ent +++ b/doc/apt.ent @@ -258,7 +258,3 @@ or further configured by the configuration option an - - - - diff --git a/doc/po/apt-doc.pot b/doc/po/apt-doc.pot index dfed6c4d5..bb7a2180e 100644 --- a/doc/po/apt-doc.pot +++ b/doc/po/apt-doc.pot @@ -525,13 +525,6 @@ msgid "" "generate section --> " msgstr "" -#. type: Plain text -#: apt.ent -msgid "" -" " -msgstr "" - #. type: Content of: #: apt.8.xml apt-get.8.xml apt-cache.8.xml apt-mark.8.xml apt-secure.8.xml #: apt-cdrom.8.xml apt-config.8.xml diff --git a/doc/po/de.po b/doc/po/de.po index 71b7ead94..7268e5d8c 100644 --- a/doc/po/de.po +++ b/doc/po/de.po @@ -697,13 +697,6 @@ msgid "" "generate section --> " msgstr "" -#. type: Plain text -#: apt.ent -msgid "" -" " -msgstr "" - #. type: Content of: #: apt.8.xml apt-get.8.xml apt-cache.8.xml apt-mark.8.xml apt-secure.8.xml #: apt-cdrom.8.xml apt-config.8.xml @@ -14080,6 +14073,11 @@ msgstr "" "fortfahren, wodurch die bereits auf der Platte heruntergeladenen Archive " "benutzt werden." +#~ msgid "" +#~ " " +#~ msgstr "" + #, fuzzy #~| msgid "APT key management utility" #~ msgid "Deprecated APT key management utility" diff --git a/doc/po/es.po b/doc/po/es.po index 0eb8a0cbe..bf6f153f3 100644 --- a/doc/po/es.po +++ b/doc/po/es.po @@ -777,15 +777,6 @@ msgstr "" " " -#. type: Plain text -#: apt.ent -msgid "" -" " -msgstr "" -" " - #. type: Content of: #: apt.8.xml apt-get.8.xml apt-cache.8.xml apt-mark.8.xml apt-secure.8.xml #: apt-cdrom.8.xml apt-config.8.xml diff --git a/doc/po/fr.po b/doc/po/fr.po index b020c08be..df70ce2b8 100644 --- a/doc/po/fr.po +++ b/doc/po/fr.po @@ -692,13 +692,6 @@ msgid "" "generate section --> " msgstr "" -#. type: Plain text -#: apt.ent -msgid "" -" " -msgstr "" - #. type: Content of: #: apt.8.xml apt-get.8.xml apt-cache.8.xml apt-mark.8.xml apt-secure.8.xml #: apt-cdrom.8.xml apt-config.8.xml @@ -13911,6 +13904,11 @@ msgstr " # apt-get -o dir::cache::archives=\"/disc/\" dist-upgrade\n" msgid "Which will use the already fetched archives on the disc." msgstr "Cette commande utilisera les fichiers récupérés sur le disque." +#~ msgid "" +#~ " " +#~ msgstr "" + #, fuzzy #~| msgid "APT key management utility" #~ msgid "Deprecated APT key management utility" diff --git a/doc/po/it.po b/doc/po/it.po index 75751dadb..5fa78e1e8 100644 --- a/doc/po/it.po +++ b/doc/po/it.po @@ -736,15 +736,6 @@ msgstr "" " " -#. type: Plain text -#: apt.ent -msgid "" -" " -msgstr "" -" " - #. type: Content of: #: apt.8.xml apt-get.8.xml apt-cache.8.xml apt-mark.8.xml apt-secure.8.xml #: apt-cdrom.8.xml apt-config.8.xml @@ -13695,6 +13686,13 @@ msgstr " # apt-get -o dir::cache::archives=\"/disc/\" dist-upgrade\n" msgid "Which will use the already fetched archives on the disc." msgstr "che userà gli archivi già scaricati e presenti sul disco." +#~ msgid "" +#~ " " +#~ msgstr "" +#~ " " + #, fuzzy #~| msgid "APT key management utility" #~ msgid "Deprecated APT key management utility" diff --git a/doc/po/ja.po b/doc/po/ja.po index e223cbd6e..783e29c32 100644 --- a/doc/po/ja.po +++ b/doc/po/ja.po @@ -739,15 +739,6 @@ msgstr "" " " -#. type: Plain text -#: apt.ent -msgid "" -" " -msgstr "" -" " - #. type: Content of: #: apt.8.xml apt-get.8.xml apt-cache.8.xml apt-mark.8.xml apt-secure.8.xml #: apt-cdrom.8.xml apt-config.8.xml @@ -13143,6 +13134,13 @@ msgstr " # apt-get -o dir::cache::archives=\"/disc/\" dist-upgrade\n" msgid "Which will use the already fetched archives on the disc." msgstr "これで、ディスクにある取得済みのアーカイブを使用するようになります。" +#~ msgid "" +#~ " " +#~ msgstr "" +#~ " " + #, fuzzy #~| msgid "APT key management utility" #~ msgid "Deprecated APT key management utility" diff --git a/doc/po/nl.po b/doc/po/nl.po index 56b8207f2..e265e318a 100644 --- a/doc/po/nl.po +++ b/doc/po/nl.po @@ -705,15 +705,6 @@ msgstr "" " " -#. type: Plain text -#: apt.ent -msgid "" -" " -msgstr "" -" " - #. type: Content of: #: apt.8.xml apt-get.8.xml apt-cache.8.xml apt-mark.8.xml apt-secure.8.xml #: apt-cdrom.8.xml apt-config.8.xml @@ -14249,6 +14240,13 @@ msgid "Which will use the already fetched archives on the disc." msgstr "" "En dit zal gebruik maken van de reeds opgehaalde archieven op de schijf." +#~ msgid "" +#~ " " +#~ msgstr "" +#~ " " + #~ msgid "Deprecated APT key management utility" #~ msgstr "Verouderd hulpprogramma voor het beheer van de sleutels van APT" diff --git a/doc/po/pl.po b/doc/po/pl.po index db3391fd6..c8c38c448 100644 --- a/doc/po/pl.po +++ b/doc/po/pl.po @@ -735,15 +735,6 @@ msgstr "" " " -#. type: Plain text -#: apt.ent -msgid "" -" " -msgstr "" -" " - #. type: Content of: #: apt.8.xml apt-get.8.xml apt-cache.8.xml apt-mark.8.xml apt-secure.8.xml #: apt-cdrom.8.xml apt-config.8.xml @@ -12517,6 +12508,13 @@ msgstr " # apt-get -o dir::cache::archives=\"/disc/\" dist-upgrade\n" msgid "Which will use the already fetched archives on the disc." msgstr "Które użyje pobranych uprzednio archiwów z dysku." +#~ msgid "" +#~ " " +#~ msgstr "" +#~ " " + # #, fuzzy #~| msgid "APT key management utility" diff --git a/doc/po/pt.po b/doc/po/pt.po index 0a5832611..083a16f37 100644 --- a/doc/po/pt.po +++ b/doc/po/pt.po @@ -700,15 +700,6 @@ msgstr "" " " -#. type: Plain text -#: apt.ent -msgid "" -" " -msgstr "" -" " - #. type: Content of: #: apt.8.xml apt-get.8.xml apt-cache.8.xml apt-mark.8.xml apt-secure.8.xml #: apt-cdrom.8.xml apt-config.8.xml @@ -13868,6 +13859,13 @@ msgstr " # apt-get -o dir::cache::archives=\"/disc/\" dist-upgrade\n" msgid "Which will use the already fetched archives on the disc." msgstr "O qual irá usar os arquivos já obtidos e que estão no disco." +#~ msgid "" +#~ " " +#~ msgstr "" +#~ " " + #~ msgid "Deprecated APT key management utility" #~ msgstr "Utilitário de gestão de chaves do APT descontinuado" diff --git a/doc/po/pt_BR.po b/doc/po/pt_BR.po index f36008f8c..f685f4026 100644 --- a/doc/po/pt_BR.po +++ b/doc/po/pt_BR.po @@ -501,13 +501,6 @@ msgid "" "generate section --> " msgstr "" -#. type: Plain text -#: apt.ent -msgid "" -" " -msgstr "" - #. type: Content of: #: apt.8.xml apt-get.8.xml apt-cache.8.xml apt-mark.8.xml apt-secure.8.xml #: apt-cdrom.8.xml apt-config.8.xml diff --git a/methods/gpgv.cc b/methods/gpgv.cc index 8eda8d67f..1a6356dee 100644 --- a/methods/gpgv.cc +++ b/methods/gpgv.cc @@ -211,7 +211,7 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile, FILE *pipein = fdopen(fd[0], "r"); - // Loop over the output of apt-key (which really is gnupg), and check the signatures. + // Loop over the output of gpgv, and check the signatures. std::vector ErrSigners; std::map> SubKeyMapping; size_t buffersize = 0; @@ -337,7 +337,7 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile, for (auto errSigner : ErrSigners) Signers.Worthless.push_back({errSigner, ""}); - // apt-key has a --keyid parameter, but this requires gpg, so we call it without it + // gpgv has no --keyid parameter, so we call it without it // and instead check after the fact which keyids where used for verification if (keyFpts.empty() == false) { @@ -562,7 +562,7 @@ bool GPGVMethod::URIAcquire(std::string const &Message, FetchItem *Itm) keyFpts.emplace_back(std::move(key)); } - // Run apt-key on file, extract contents and get the key ID of the signer + // Run gpgv on file, extract contents and get the key ID of the signer string const msg = VerifyGetSignersWithLegacy(Path.c_str(), Itm->DestFile.c_str(), keyFpts, keyFiles, Signers); if (_error->PendingError()) return false; @@ -657,7 +657,7 @@ bool GPGVMethod::URIAcquire(std::string const &Message, FetchItem *Itm) Dequeue(); if (DebugEnabled()) - std::clog << "apt-key succeeded\n"; + std::clog << "gpgv succeeded\n"; return true; } diff --git a/methods/sqv.cc b/methods/sqv.cc index 45d001af1..ce7e36657 100644 --- a/methods/sqv.cc +++ b/methods/sqv.cc @@ -296,7 +296,7 @@ bool SQVMethod::URIAcquire(std::string const &Message, FetchItem *Itm) if (_error->PendingError()) return false; - // Run apt-key on file, extract contents and get the key ID of the signer + // Run sqv on file, extract contents and get the key ID of the signer VerifyGetSigners(Path.c_str(), Itm->DestFile.c_str(), keyFiles, Signers); if (_error->PendingError()) { diff --git a/prepare-release b/prepare-release index fe9628fd0..c5d6ac81b 100755 --- a/prepare-release +++ b/prepare-release @@ -233,7 +233,6 @@ elif [ "$1" = 'spellcheckers' -o "$1" = 'lint' ]; then -e '^.*apt-pkg/pkgcache\.h.*mmaped.*==>.*mapped.*$' \ -e '^.*apt-pkg/pkgcachegen\.cc.*mmaped.*==>.*mapped.*$' \ -e '^.*apt-pkg/contrib/mmap\.h.*mmaped.*==>.*mapped.*$' \ - -e '^.*cmdline/apt-key\.in.*dashs.*==>.*dashes.*$' \ -e '^.*methods/aptmethod\.h.*creat.*==>.*create.*$' \ -e '^.*dselect/install.*ans.*==>.*and.*$' \ -e '^.*ftparchive/writer\.h.*Delink.*==>.*Unlink.*$' \ @@ -276,9 +275,6 @@ elif [ "$1" = 'spellcheckers' -o "$1" = 'lint' ]; then -e '^./ftparchive/byhash.cc: ByHash ByHash (duplicate word) -> ByHash$' \ -e '^./ftparchive/writer.cc: this Packages -> these packages$' \ -e '^./ftparchive/byhash.h: ByHash ByHash (duplicate word) -> ByHash$' \ - -e '^./cmdline/apt-key.in: done done (duplicate word) -> done$' \ - -e '^./cmdline/apt-key.in: fi fi (duplicate word) -> fi$' \ - -e '^./cmdline/apt-key.in: echo echo (duplicate word) -> echo$' \ -e '^./triehash/.travis.yml: perl perl (duplicate word) -> perl$' \ -e '^./triehash/README.md: Performance Performance (duplicate word) -> Performance$' \ -e '^./debian/apt.apt-compat.cron.daily: fi fi (duplicate word) -> fi$' \ diff --git a/vendor/README b/vendor/README index 6846c8455..3b344d5ad 100644 --- a/vendor/README +++ b/vendor/README @@ -2,10 +2,10 @@ The vendor system in APT is an experiment to help distributions ship a stock apt release instead of applying documentation patches to it, increasing maintenance burden for everyone and hiding 'interesting' patches in the mix. -The provided information is used in the apt-key script and in documentation -like manpages and example configuration files. If you have patches modifying -additional bits and pieces currently not covered by this system please -contact us so we can change this! +The provided information is used in documentation like man pages and +example configuration files. If you have patches modifying additional +bits and pieces currently not covered by this system please contact us +so we can change this! == Adding a new vendor @@ -39,8 +39,7 @@ by opening a bug in the Debian BTS against apt with a patch attached. The format used is the one DocBook XML uses. The file is included as an entity file in the manpages xml source, so the syntax has to be valid! -The keyring-* settings are additionally used also in the creation of the -apt-key script and the keyring-package in particular as a dependency for apt. +The keyring-package setting is used as a dependency for apt. The field current-codename is optional and can be used in sources.list.in. diff --git a/vendor/blankon/apt-vendor.ent b/vendor/blankon/apt-vendor.ent index ea7625f90..a2d0d640b 100644 --- a/vendor/blankon/apt-vendor.ent +++ b/vendor/blankon/apt-vendor.ent @@ -1,10 +1,6 @@ blankon-keyring"> -/usr/share/keyrings/blankon-archive-keyring.gpg"> -/usr/share/keyrings/blankon-archive-removed-keys.gpg"> - - debian-archive-keyring"> - - - - procursus-keyring"> - - - - diff --git a/vendor/raspbian/apt-vendor.ent b/vendor/raspbian/apt-vendor.ent index 96d9fb71b..e3b960381 100644 --- a/vendor/raspbian/apt-vendor.ent +++ b/vendor/raspbian/apt-vendor.ent @@ -1,10 +1,6 @@ raspbian-archive-keyring"> -/usr/share/keyrings/raspbian-archive-keyring.gpg"> -/usr/share/keyrings/raspbian-archive-removed-keys.gpg"> - - valve-archive-keyring"> -/usr/share/keyrings/valve-archive-keyring.gpg"> -/usr/share/keyrings/valve-archive-removed-keys.gpg"> - - ubuntu-keyring"> -/usr/share/keyrings/ubuntu-archive-keyring.gpg"> -/usr/share/keyrings/ubuntu-archive-removed-keys.gpg"> - -