#include <pakfire/util.h>
int main(int argc, const char* argv[]) {
+ struct pakfire_config* config = NULL;
struct pakfire_ctx* ctx = NULL;
struct pakfire* pakfire = NULL;
struct pakfire_parser* parser = NULL;
// Log everything to the console
pakfire_ctx_set_log_callback(ctx, pakfire_log_stderr, NULL);
+ r = pakfire_config_create(&config);
+ if (r < 0)
+ goto ERROR;
+
+ // Load the test configuration
+ r = pakfire_config_read_path(config, TEST_CONFIG_FILE);
+ if (r < 0)
+ goto ERROR;
+
// Create a pakfire instance
- r = pakfire_create(&pakfire, ctx, NULL, root, NULL, 0);
+ r = pakfire_create(&pakfire, ctx, config, root, NULL, 0);
if (r) {
fprintf(stderr, "Could not create Pakfire: %m\n");
goto ERROR;
pakfire_parser_unref(parser);
if (pakfire)
pakfire_unref(pakfire);
- if (ctx)
- pakfire_ctx_unref(ctx);
+ if (config)
+ pakfire_config_unref(config);
+ if (ctx) {
+ ctx = pakfire_ctx_unref(ctx);
+ if (ctx) {
+ fprintf(stderr, "Context was not freed\n");
+ return 1;
+ }
+ }
return r;
}