From: Michael Tremer Date: Thu, 30 Jan 2025 10:50:35 +0000 (+0000) Subject: repo: Introduce the concept of virtual repositories X-Git-Tag: 0.9.30~273 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=78ce53219b4a462a9af5cf7acd3fd06b588dd2e0;p=pakfire.git repo: Introduce the concept of virtual repositories These repos can import packages, but they won't copy them but rather leave them where they were before. Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/build.c b/src/pakfire/build.c index 1c508416..9f29e0ec 100644 --- a/src/pakfire/build.c +++ b/src/pakfire/build.c @@ -1231,8 +1231,8 @@ static int pakfire_build_package(struct pakfire_build* build, struct pakfire_par if (r) goto ERROR; - // Add the package to the repository - r = pakfire_repo_add_archive(build->repo, archive, NULL); + // Import the package into the repository + r = pakfire_repo_import_archive(build->repo, archive); if (r < 0) goto ERROR; diff --git a/src/pakfire/repo.c b/src/pakfire/repo.c index ce348e17..55433286 100644 --- a/src/pakfire/repo.c +++ b/src/pakfire/repo.c @@ -80,6 +80,7 @@ struct pakfire_repo_appdata { enum pakfire_repo_filesystem_layout { PAKFIRE_REPO_UUID = (1 << 0), PAKFIRE_REPO_FLAT = (1 << 1), + PAKFIRE_REPO_VIRT = (1 << 2), } fs_layout; // Markers @@ -473,8 +474,13 @@ int pakfire_repo_import_archive(struct pakfire_repo* self, struct pakfire_archiv if (r < 0) goto ERROR; break; + + // In virtual mode, we don't actually import the file + case PAKFIRE_REPO_VIRT: + goto END; } + // Compose the path of the archive relative to the repository path r = pakfire_repo_relpath(self, relpath, path); if (r < 0) goto ERROR; @@ -490,8 +496,10 @@ int pakfire_repo_import_archive(struct pakfire_repo* self, struct pakfire_archiv goto ERROR; ERROR: + // XXX REMOVE THE PACKAGE METDATA FROM THIS REPOSITORY +END: if (pkg) pakfire_package_unref(pkg); @@ -846,10 +854,19 @@ static int pakfire_repo_setup_appdata(struct pakfire_repo* self) { // Refresh Interval: Set to invalid appdata->refresh = -1; - // The local build repository will have a flat layout, but all other - // local repositories will be using the UUID layout. - if (pakfire_string_equals(self->repo->name, PAKFIRE_REPO_LOCAL)) + // The command line repo is a virtual repository + if (pakfire_repo_is_commandline(self)) + appdata->fs_layout = PAKFIRE_REPO_VIRT; + + // The build result repository is virtual, too + else if (pakfire_string_equals(self->repo->name, PAKFIRE_REPO_RESULT)) + appdata->fs_layout = PAKFIRE_REPO_VIRT; + + // The local build repository will have a flat layout + else if (pakfire_string_equals(self->repo->name, PAKFIRE_REPO_LOCAL)) appdata->fs_layout = PAKFIRE_REPO_FLAT; + + // All other repositories follow the UUID format else appdata->fs_layout = PAKFIRE_REPO_UUID;