return NULL;
}
+/*
+ Destroys the package (i.e. removes its membership from any repository)
+*/
+int pakfire_package_destroy(struct pakfire_package* self) {
+ Solvable* s = get_solvable(self);
+
+ // Remove the reference to the repository
+ s->repo = NULL;
+
+ // If we have a cached repository, drop it, too
+ if (self->repo) {
+ pakfire_repo_unref(self->repo);
+ self->repo = NULL;
+ }
+
+ return 0;
+}
+
struct pakfire* pakfire_package_get_pakfire(struct pakfire_package* pkg) {
return pakfire_ref(pkg->pakfire);
}
struct pakfire_package* pakfire_package_ref(struct pakfire_package* pkg);
struct pakfire_package* pakfire_package_unref(struct pakfire_package* pkg);
+
+// Destroy
+int pakfire_package_destroy(struct pakfire_package* self);
+
struct pakfire* pakfire_package_get_pakfire(struct pakfire_package* pkg);
int pakfire_package_eq(struct pakfire_package* pkg1, struct pakfire_package* pkg2);
if (r < 0)
goto ERROR;
-ERROR:
-
- // XXX REMOVE THE PACKAGE METDATA FROM THIS REPOSITORY
-
END:
// Return the package if requested
if (package)
*package = pakfire_package_ref(pkg);
+ goto CLEANUP;
+
+ERROR:
+ // Destroy the package if the import wasn't successful
+ if (pkg)
+ pakfire_package_destroy(pkg);
+
+CLEANUP:
if (pkg)
pakfire_package_unref(pkg);