]> git.ipfire.org Git - pakfire.git/commitdiff
archive: Compose path after all other metadata has been set
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 30 Jan 2025 22:47:51 +0000 (22:47 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 30 Jan 2025 22:47:51 +0000 (22:47 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/archive.c

index a04aa81f45cdc7ea734570868d373d49d5148f45..decfb4730bca3d6550a609744d42f5f8870c170e 100644 (file)
@@ -1570,16 +1570,6 @@ static int pakfire_archive_make_package_from_json(struct pakfire_archive* archiv
                nevra, pkg, archive);
 #endif
 
-       // Make the path where this archive should be stored
-       r = pakfire_repo_make_path(repo, path, archive, pkg);
-       if (r < 0)
-               goto ERROR;
-
-       // Set path
-       r = pakfire_package_set_string(pkg, PAKFIRE_PKG_PATH, path);
-       if (r < 0)
-               goto ERROR;
-
        // Set digest
        switch (PAKFIRE_ARCHIVE_CHECKSUM) {
                case PAKFIRE_DIGEST_SHA2_512:
@@ -1808,6 +1798,16 @@ static int pakfire_archive_make_package_from_json(struct pakfire_archive* archiv
        if (r)
                goto ERROR;
 
+       // Make the path where this archive should be stored
+       r = pakfire_repo_make_path(repo, path, archive, pkg);
+       if (r < 0)
+               goto ERROR;
+
+       // Set path
+       r = pakfire_package_set_string(pkg, PAKFIRE_PKG_PATH, path);
+       if (r < 0)
+               goto ERROR;
+
        // Return the package (if requested)
        if (package)
                *package = pakfire_package_ref(pkg);