diff options
| author | Julian Andres Klode <jak@debian.org> | 2025-01-28 18:49:12 +0000 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2025-01-28 18:49:12 +0000 |
| commit | 37916ecaa4718350a3c66130b356a076a24ca6e2 (patch) | |
| tree | 5307e3c7111d8db56608767806f68b0d97a489ee /apt-pkg | |
| parent | d9f7d2c37023d186be4a21a4d714e032be48e315 (diff) | |
| parent | 827d60f3cf1ffe0a11b17ce9d1f22bb4a1c6aded (diff) | |
Merge branch 'modernize-sources' into 'main'
apt: Introduce the modernize-sources command
See merge request apt-team/apt!438
Diffstat (limited to 'apt-pkg')
| -rw-r--r-- | apt-pkg/metaindex.cc | 13 | ||||
| -rw-r--r-- | apt-pkg/metaindex.h | 5 |
2 files changed, 18 insertions, 0 deletions
diff --git a/apt-pkg/metaindex.cc b/apt-pkg/metaindex.cc index f3df9b159..10c93de15 100644 --- a/apt-pkg/metaindex.cc +++ b/apt-pkg/metaindex.cc @@ -1,6 +1,7 @@ // Include Files /*{{{*/ #include <config.h> +#include <apt-pkg/fileutl.h> #include <apt-pkg/indexfile.h> #include <apt-pkg/metaindex.h> #include <apt-pkg/pkgcachegen.h> @@ -151,3 +152,15 @@ bool metaIndex::HasSupportForComponent(std::string const &) const/*{{{*/ return true; } /*}}}*/ +bool metaIndex::Load(std::string *ErrorText) /*{{{*/ +{ + auto debmeta = dynamic_cast<debReleaseIndex *>(this); + if (not debmeta) + return false; + if (auto f = debmeta->MetaIndexFile("InRelease"); FileExists(f)) + return Load(f, ErrorText); + if (auto f = debmeta->MetaIndexFile("Release"); FileExists(f)) + return Load(f, ErrorText); + return false; +} + /*}}}*/ diff --git a/apt-pkg/metaindex.h b/apt-pkg/metaindex.h index e2a773c31..e6c8b7c64 100644 --- a/apt-pkg/metaindex.h +++ b/apt-pkg/metaindex.h @@ -96,6 +96,7 @@ public: virtual std::vector<pkgIndexFile *> *GetIndexFiles() = 0; virtual bool IsTrusted() const = 0; virtual bool Load(std::string const &Filename, std::string * const ErrorText) = 0; + bool Load(std::string *const ErrorText); /** @return a new metaIndex object based on this one, but without information from #Load */ virtual metaIndex * UnloadedClone() const = 0; // the given metaIndex is potentially invalid after this call and should be deleted @@ -120,6 +121,10 @@ public: virtual bool IsArchitectureSupported(std::string const &arch) const; virtual bool IsArchitectureAllSupportedFor(IndexTarget const &target) const; virtual bool HasSupportForComponent(std::string const &component) const; + +#ifdef APT_COMPILING_APT + bool IsTrustedSet() { return Trusted == TRI_YES; } +#endif }; #endif |
