]> git.ipfire.org Git - pakfire.git/commitdiff
libpakfire: Call database routines when packages are added/removed
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 20 Jan 2021 21:23:57 +0000 (21:23 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 20 Jan 2021 21:27:57 +0000 (21:27 +0000)
These functions are empty right now and serve as placeholders

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/db.c
src/libpakfire/include/pakfire/db.h
src/libpakfire/step.c

index e18f15ef3ee0a6cbccc6c435ca9e65779057faff..8ca57aefcbf51f5f7158e1889c5de7e0caf25850 100644 (file)
@@ -127,3 +127,11 @@ struct pakfire_db* pakfire_db_unref(struct pakfire_db* db) {
 
        return NULL;
 }
+
+int pakfire_db_add_package(struct pakfire_db* db, PakfirePackage pkg) {
+       return 0; // TODO
+}
+
+int pakfire_db_remove_package(struct pakfire_db* db, PakfirePackage pkg) {
+       return 0; // TODO
+}
index 79f505d1e5c06c7d1906a43bd7aaa49ace1d768c..95a972154c329683346593234ca5ed7955584d0b 100644 (file)
@@ -37,6 +37,9 @@ int pakfire_db_open(struct pakfire_db** db, Pakfire pakfire);
 struct pakfire_db* pakfire_db_ref(struct pakfire_db* db);
 struct pakfire_db* pakfire_db_unref(struct pakfire_db* db);
 
+int pakfire_db_add_package(struct pakfire_db* db, PakfirePackage pkg);
+int pakfire_db_remove_package(struct pakfire_db* db, PakfirePackage pkg);
+
 #endif
 
 #endif /* PAKFIRE_DB_H */
index 6f2a200546ef32752221adc99bd7ca50701ffc82..35ce79096ffdaa7647f45e82398ca21f5981e7fb 100644 (file)
@@ -530,6 +530,10 @@ PAKFIRE_EXPORT int pakfire_step_run(PakfireStep step,
                                        if (r)
                                                break;
 
+                                       r = pakfire_db_add_package(db, step->package);
+                                       if (r)
+                                               break;
+
                                        r = pakfire_step_run_script(step, PAKFIRE_SCRIPT_POSTIN);
                                        break;
 
@@ -543,6 +547,10 @@ PAKFIRE_EXPORT int pakfire_step_run(PakfireStep step,
                                        if (r)
                                                break;
 
+                                       r = pakfire_db_add_package(db, step->package);
+                                       if (r)
+                                               break;
+
                                        r = pakfire_step_run_script(step, PAKFIRE_SCRIPT_POSTUP);
                                        break;
 
@@ -556,6 +564,10 @@ PAKFIRE_EXPORT int pakfire_step_run(PakfireStep step,
                                        if (r)
                                                break;
 
+                                       r = pakfire_db_remove_package(db, step->package);
+                                       if (r)
+                                               break;
+
                                        r = pakfire_step_run_script(step, PAKFIRE_SCRIPT_POSTUN);
                                        break;