return 0;
}
+static int pakfire_repo_cleanup_metadata(struct pakfire_repo* self) {
+ char path[PATH_MAX];
+ int r;
+
+ // Make sure we are running only on local repositories
+ if (!pakfire_repo_is_local(self))
+ return -ENOTSUP;
+
+ // Make the path
+ r = pakfire_repo_path(self, path, "%s", "repodata");
+ if (r < 0)
+ return r;
+
+ // Remove it all
+ return pakfire_rmtree(path, 0);
+}
+
static int pakfire_repo_metadata_add_file(struct pakfire_repo* self,
struct json_object* repomd, const char* type, const char* path) {
struct pakfire_digests digests = {};
if (!pakfire_repo_is_local(self))
return -ENOTSUP;
+ // Cleanup any previous metadata
+ r = pakfire_repo_cleanup_metadata(self);
+ if (r < 0)
+ goto ERROR;
+
// Make path to repomd.json
r = pakfire_repo_path(self, repomd_path, "%s", "repodata/repomd.json");
if (r < 0)