// Compose the destination path
switch (self->appdata->fs_layout) {
case PAKFIRE_REPO_FLAT:
- return __pakfire_repo_path(self, path, length, "%s", filename);
+ return __pakfire_string_set(path, length, filename);
case PAKFIRE_REPO_UUID:
// Fetch the UUID
return -ENODATA;
}
- return __pakfire_repo_path(self, path, length, "%s/%s", uuid, filename);
+ return __pakfire_string_format(path, length, "%s/%s", uuid, filename);
// In virtual mode, we don't actually import the file
case PAKFIRE_REPO_VIRT:
int pakfire_repo_import_archive(struct pakfire_repo* self,
struct pakfire_archive* archive, struct pakfire_package** package) {
struct pakfire_package* pkg = NULL;
+ char path[PATH_MAX];
int r;
// This only works on internal or local repositories
if (r < 0)
goto ERROR;
- // Fetch package path
- const char* arc_path = pakfire_archive_get_path(archive);
- const char* pkg_path = pakfire_package_get_string(pkg, PAKFIRE_PKG_PATH);
+ // Unless this is a virtual repository, copy the archive
+ switch (self->appdata->fs_layout) {
+ case PAKFIRE_REPO_VIRT:
+ break;
- // Copy (or link) the archive
- if (!pakfire_string_equals(arc_path, pkg_path)) {
- r = pakfire_archive_link_or_copy(archive, pkg_path);
- if (r < 0)
- goto ERROR;
+ default:
+ // Make the path
+ r = pakfire_repo_path(self, path, "%s",
+ pakfire_package_get_string(pkg, PAKFIRE_PKG_PATH));
+ if (r < 0)
+ goto ERROR;
+
+ printf("PATH = %s\n", path);
+
+ // Copy (or link) the archive
+ r = pakfire_archive_link_or_copy(archive, path);
+ if (r < 0)
+ goto ERROR;
}
// Return the package if requested