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
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,
#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);
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 */
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);
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
#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)
// 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;
+}