]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
libpakfire: Rename pakfire_action_type to pakfire_action_type_t
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 15 Jan 2018 17:25:40 +0000 (18:25 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 15 Jan 2018 17:25:40 +0000 (18:25 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/include/pakfire/step.h
src/libpakfire/include/pakfire/types.h
src/libpakfire/include/pakfire/util.h
src/libpakfire/step.c
src/libpakfire/transaction.c
src/libpakfire/util.c

index b42c6b576814647cd982540079c3abc232d7be37..03053cb4a8a5028e8fbdb4c9287c7498093c5224 100644 (file)
@@ -55,7 +55,7 @@ typedef enum _pakfire_script_types {
        PAKFIRE_SCRIPT_POSTTRANSUP,
 } pakfire_script_type;
 
-int pakfire_step_run(PakfireStep step, pakfire_action_type action);
+int pakfire_step_run(PakfireStep step, pakfire_action_type_t action);
 
 #endif
 
index b5d6f17dd2fca9e38eb0744d19a5f774d97aedd2..86e92a74c2fa61138d56def7f6b20d639809a82c 100644 (file)
@@ -72,7 +72,7 @@ typedef enum _pakfire_action_types {
        PAKFIRE_ACTION_EXECUTE   = 1 << 1,
        PAKFIRE_ACTION_PRETRANS  = 1 << 2,
        PAKFIRE_ACTION_POSTTRANS = 1 << 3,
-} pakfire_action_type;
+} pakfire_action_type_t;
 
 typedef enum _pakfire_step_types {
        PAKFIRE_STEP_IGNORE = 0,
index 3574ff999f51ccfa4741b983b41b75daaa9ab5ba..b9318d59a3a60df03ae2c77e8f67ad459e24d550 100644 (file)
@@ -25,6 +25,8 @@
 #include <sys/types.h>
 #include <time.h>
 
+#include <pakfire/types.h>
+
 void pakfire_oom(size_t num, size_t len);
 
 void* pakfire_malloc(size_t len);
@@ -48,6 +50,8 @@ int pakfire_mkdir(const char* path, mode_t mode);
 char* pakfire_sgets(char* str, int num, char** input);
 char* pakfire_remove_trailing_newline(char* str);
 
+const char* pakfire_action_type_string(pakfire_action_type_t type);
+
 void init_libgcrypt();
 
 #endif /* PAKFIRE_UTIL_H */
index 25a48ec80a9fbdc2bec56c3057b2ad43e61c3ea5..3921286d092025894f6beaad950b1a4dfbcf634f 100644 (file)
@@ -243,8 +243,8 @@ static int pakfire_step_erase(PakfireStep step) {
        return 0; // TODO
 }
 
-PAKFIRE_EXPORT int pakfire_step_run(PakfireStep step, const pakfire_action_type action) {
-       DEBUG("Running Step %p (%d)\n", step, action);
+PAKFIRE_EXPORT int pakfire_step_run(PakfireStep step, const pakfire_action_type_t action) {
+       DEBUG("Running Step %p (%s)\n", step, pakfire_action_type_string(action));
 
        pakfire_step_type_t type = pakfire_step_get_type(step);
 
index b7cc29af918b2da6ef487cb92e2cf9c35b99ccba..406e1f700c0320223bd5bf16fc1a35aa0e37d5f4 100644 (file)
@@ -311,7 +311,7 @@ PAKFIRE_EXPORT char* pakfire_transaction_dump(PakfireTransaction transaction, si
        return string;
 }
 
-static int pakfire_transaction_run_steps(PakfireTransaction transaction, const pakfire_action_type action) {
+static int pakfire_transaction_run_steps(PakfireTransaction transaction, const pakfire_action_type_t action) {
        int r = 0;
 
        // Walk through all steps
index 6f373ebb072d1ba46981610a3a4ca02c3cd1e772..6b7c5218d7cd4fc032442ed68ff8afe832078a9d 100644 (file)
@@ -35,6 +35,7 @@
 #include <pakfire/constants.h>
 #include <pakfire/logging.h>
 #include <pakfire/private.h>
+#include <pakfire/types.h>
 
 void pakfire_oom(size_t num, size_t len) {
        if (num)
@@ -253,3 +254,24 @@ void init_libgcrypt() {
        // Tell libgcrypt that initialization has completed
        gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
 }
+
+PAKFIRE_EXPORT const char* pakfire_action_type_string(pakfire_action_type_t type) {
+       switch (type) {
+               case PAKFIRE_ACTION_NOOP:
+                       return "NOOP";
+
+               case PAKFIRE_ACTION_VERIFY:
+                       return "VERIFY";
+
+               case PAKFIRE_ACTION_EXECUTE:
+                       return "EXECUTE";
+
+               case PAKFIRE_ACTION_PRETRANS:
+                       return "PRETRANS";
+
+               case PAKFIRE_ACTION_POSTTRANS:
+                       return "POSTTRANS";
+       }
+
+       return NULL;
+}