summaryrefslogtreecommitdiff
path: root/apt-pkg/metaindex.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2025-01-27 15:50:42 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2025-01-28 19:47:00 +0100
commite13ee75d4b20ee94e8da1b7f2be61788029b6875 (patch)
treedce11bdc985010c51aa16998ee0145cedc325dcb /apt-pkg/metaindex.cc
parentd9f7d2c37023d186be4a21a4d714e032be48e315 (diff)
metaindex: Support loading without filename
Diffstat (limited to 'apt-pkg/metaindex.cc')
-rw-r--r--apt-pkg/metaindex.cc13
1 files changed, 13 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;
+}
+ /*}}}*/