]> git.ipfire.org Git - pakfire.git/commitdiff
pakfire: Create @commandline repo all the time
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 28 Sep 2021 10:29:24 +0000 (10:29 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 28 Sep 2021 10:29:24 +0000 (10:29 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/pakfire.c
src/libpakfire/request.c

index d6beabbac161e5f4a9170ef147aa45729380e9a1..b539357cef0fa990367f6ff554449a2134fa59a1 100644 (file)
@@ -407,6 +407,7 @@ static Id pakfire_namespace_callback(Pool* pool, void* data, Id ns, Id id) {
 
 static int pakfire_populate_pool(struct pakfire* pakfire) {
        struct pakfire_db* db;
+       struct pakfire_repo* commandline = NULL;
        struct pakfire_repo* dummy = NULL;
        struct pakfire_repo* system = NULL;
        int r;
@@ -453,6 +454,11 @@ static int pakfire_populate_pool(struct pakfire* pakfire) {
        // Set this repository as the installed one
        pool_set_installed(pool, pakfire_repo_get_repo(system));
 
+       // Create the command line repo
+       r = pakfire_repo_create(&commandline, pakfire, "@commandline");
+       if (r)
+               goto ERROR;
+
        // Load database content
        r = pakfire_db_load(db, system);
        if (r)
@@ -461,6 +467,8 @@ static int pakfire_populate_pool(struct pakfire* pakfire) {
 ERROR:
        if (db)
                pakfire_db_unref(db);
+       if (commandline)
+               pakfire_repo_unref(commandline);
        if (dummy)
                pakfire_repo_unref(dummy);
        if (system)
index 35708dec31edde37c098354e0caa6ee9f2bc0077..7abe90d8cf7908f0dc76913f30f62f322a71ee7b 100644 (file)
@@ -389,13 +389,12 @@ static int pakfire_request_add_job(struct pakfire_request* request, int action,
 
 static int pakfire_request_add_archive(struct pakfire_request* request, int action,
                struct pakfire_archive* archive, int extra_flags) {
-       struct pakfire_repo* repo = NULL;
        struct pakfire_package* package = NULL;
        int r;
 
-       r = pakfire_repo_create(&repo, request->pakfire, "@commandline");
-       if (r)
-               return r;
+       struct pakfire_repo* repo = pakfire_get_repo(request->pakfire, "@commandline");
+       if (!repo)
+               return 1;
 
        // Add it to the repository
        r = pakfire_repo_add_archive(repo, archive, &package);