From b8d5e9f9ff81fac51809ba2c38bc5cecf4a20da2 Mon Sep 17 00:00:00 2001 From: Gleb Popov <6yearold@gmail.com> Date: Sat, 25 Nov 2023 12:57:19 +0300 Subject: [PATCH] freebsd backend: Start from meta.conf when gathering repository metadata. --- src/asgen/backends/freebsd/fbsdpkgindex.d | 29 ++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/asgen/backends/freebsd/fbsdpkgindex.d b/src/asgen/backends/freebsd/fbsdpkgindex.d index 03f49b5..c79e73b 100644 --- a/src/asgen/backends/freebsd/fbsdpkgindex.d +++ b/src/asgen/backends/freebsd/fbsdpkgindex.d @@ -59,9 +59,32 @@ public: private Package[] loadPackages (string suite, string section, string arch) { auto pkgRoot = buildPath (rootDir, suite); - auto listsTarFname = buildPath (pkgRoot, "packagesite.pkg"); + auto metaFname = buildPath (pkgRoot, "meta.conf"); + string manifestFname, manifestArchive; + + if (!std.file.exists (metaFname)) { + logError ("Metadata file '%s' does not exist.", metaFname); + return []; + } + + foreach(line; std.file.slurp!(string)(metaFname, "%s")) { + if (line.startsWith("manifests_archive")) { + // manifests_archive = "packagesite"; + auto splitResult = line.split("\""); + if (splitResult.length == 3) + manifestArchive = splitResult[1]; + } + else if (line.startsWith("manifests")) { + // manifests = "packagesite.yaml"; + auto splitResult = line.split("\""); + if (splitResult.length == 3) + manifestFname = splitResult[1]; + } + } + + auto listsTarFname = buildPath (pkgRoot, manifestArchive ~ ".pkg"); if (!std.file.exists (listsTarFname)) { - logWarning ("Package lists file '%s' does not exist.", listsTarFname); + logError ("Package lists file '%s' does not exist.", listsTarFname); return []; } @@ -69,7 +92,7 @@ public: ad.open (listsTarFname); logDebug ("Opened: %s", listsTarFname); - auto d = ad.readData("packagesite.yaml"); + auto d = ad.readData(manifestFname); auto pkgs = appender!(Package[]); foreach(entry; d.split('\n')) {