]> git.ipfire.org Git - pakfire.git/commitdiff
repo: Introduce the concept of virtual repositories
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 30 Jan 2025 10:50:35 +0000 (10:50 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 30 Jan 2025 10:50:35 +0000 (10:50 +0000)
These repos can import packages, but they won't copy them but rather
leave them where they were before.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/build.c
src/pakfire/repo.c

index 1c508416eabd8a76e892a4795ef93ddec2046595..9f29e0ecd09c87fb9a547c6bfa3432261e397455 100644 (file)
@@ -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;
 
index ce348e17a8b157319148692d0391fcde78abfada..554332869bdb9ae1c15712bc5e296e8bd2b4f992 100644 (file)
@@ -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;