return pakfire_archive_make_package(archive, repo, package);
}
+int pakfire_repo_import_archive(struct pakfire_repo* self, struct pakfire_archive* archive) {
+ struct pakfire_package* pkg = NULL;
+ char path[PATH_MAX];
+ int r;
+
+ // Fetch the package
+ r = pakfire_archive_make_package(archive, NULL, &pkg);
+ if (r < 0)
+ goto ERROR;
+
+ // Fetch the filename this package should have
+ const char* filename = pakfire_package_get_filename(pkg);
+ if (!filename)
+ return -EINVAL;
+
+ // Compose the destination path
+ r = pakfire_repo_path(self, path, "%s", filename);
+ if (r < 0)
+ goto ERROR;
+
+ // Copy (or link) the archive
+ r = pakfire_archive_link_or_copy(archive, path);
+ if (r < 0)
+ goto ERROR;
+
+ERROR:
+ if (pkg)
+ pakfire_package_unref(pkg);
+
+ return r;
+}
+
struct pakfire_mirrorlist* pakfire_repo_get_mirrorlist(struct pakfire_repo* repo) {
if (!repo->mirrorlist) {
// No cache path set
int pakfire_repo_add_archive(struct pakfire_repo* repo,
struct pakfire_archive* archive, struct pakfire_package** package);
+int pakfire_repo_import_archive(struct pakfire_repo* self, struct pakfire_archive* archive);
+
int pakfire_repo_download_package(struct pakfire_xfer** xfer,
struct pakfire_repo* repo, struct pakfire_package* pkg);