This function can compare package versions without a Pakfire instance initialized.
*/
int pakfire_static_version_compare(const char* evr1, const char* evr2) {
- Pool* pool = NULL;
+ static Pool* pool = NULL;
int r;
// Initialize the pool
- pool = pool_create();
- if (!pool)
- return 0;
-
- // Set to RPM mode
- pool_setdisttype(pool, DISTTYPE_RPM);
+ if (!pool) {
+ printf("GOT HERE\n");
- // Perform comparison
- r = pool_evrcmp_str(pool, evr1, evr2, EVRCMP_COMPARE);
+ pool = pool_create();
+ if (!pool)
+ return 0;
- // Free the pool
- pool_free(pool);
+ // Set to RPM mode
+ pool_setdisttype(pool, DISTTYPE_RPM);
+ }
- return r;
+ // Perform comparison
+ return pool_evrcmp_str(pool, evr1, evr2, EVRCMP_COMPARE);
}
const char* pakfire_dep2str(struct pakfire* pakfire, Id id) {