Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

freebsd backend: Start from meta.conf when gathering repository metad… #128

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions src/asgen/backends/freebsd/fbsdpkgindex.d
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,40 @@ 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("\"");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This could be

Suggested change
auto splitResult = line.split("\"");
immutable 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 [];
}

ArchiveDecompressor ad;
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')) {
Expand Down
Loading