]> git.ipfire.org Git - pakfire.git/commitdiff
transactions: Move PAKFIRE_ACTION_* and PAKFIRE_STEP_*
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 30 Jun 2021 17:08:52 +0000 (17:08 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 30 Jun 2021 17:08:52 +0000 (17:08 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/include/pakfire/types.h
src/libpakfire/transaction.c

index 24d50c687186de44c2d14cce29634d49aafcd359..a9a906a1f41f842855f8fb1eeb6e6a770a6c63c9 100644 (file)
@@ -35,22 +35,4 @@ typedef struct _PakfireSolution* PakfireSolution;
 typedef void (*pakfire_log_function_t)(void* data, int priority, const char* file,
                int line, const char* fn, const char* format, va_list args);
 
-typedef enum _pakfire_action_types {
-       PAKFIRE_ACTION_NOOP      = 0,
-       PAKFIRE_ACTION_VERIFY    = 1 << 0,
-       PAKFIRE_ACTION_EXECUTE   = 1 << 1,
-       PAKFIRE_ACTION_PRETRANS  = 1 << 2,
-       PAKFIRE_ACTION_POSTTRANS = 1 << 3,
-} pakfire_action_type_t;
-
-typedef enum _pakfire_step_types {
-       PAKFIRE_STEP_IGNORE = 0,
-       PAKFIRE_STEP_INSTALL,
-       PAKFIRE_STEP_REINSTALL,
-       PAKFIRE_STEP_ERASE,
-       PAKFIRE_STEP_UPGRADE,
-       PAKFIRE_STEP_DOWNGRADE,
-       PAKFIRE_STEP_OBSOLETE,
-} pakfire_step_type_t;
-
 #endif /* PAKFIRE_TYPES_H */
index a2cf3b72b719a46c74d6a0ecf260cbc72a5a48e9..097800ca887ae4a9dd5c6183296f2ae71dfa40d4 100644 (file)
@@ -52,7 +52,25 @@ struct pakfire_transaction {
        size_t num;
 };
 
-static pakfire_step_type_t pakfire_transaction_get_step_type(
+enum pakfire_actions {
+       PAKFIRE_ACTION_NOOP = 0,
+       PAKFIRE_ACTION_VERIFY,
+       PAKFIRE_ACTION_EXECUTE,
+       PAKFIRE_ACTION_PRETRANS,
+       PAKFIRE_ACTION_POSTTRANS,
+};
+
+enum pakfire_steps {
+       PAKFIRE_STEP_IGNORE = 0,
+       PAKFIRE_STEP_INSTALL,
+       PAKFIRE_STEP_REINSTALL,
+       PAKFIRE_STEP_ERASE,
+       PAKFIRE_STEP_UPGRADE,
+       PAKFIRE_STEP_DOWNGRADE,
+       PAKFIRE_STEP_OBSOLETE,
+};
+
+static enum pakfire_steps pakfire_transaction_get_step_type(
                struct pakfire_transaction* transaction, struct pakfire_package* pkg) {
        int type = transaction_type(transaction->transaction, pakfire_package_id(pkg),
                SOLVER_TRANSACTION_SHOW_ACTIVE|SOLVER_TRANSACTION_CHANGE_IS_REINSTALL);
@@ -655,7 +673,7 @@ ERROR:
        return r;
 }
 
-static const char* pakfire_action_type_string(pakfire_action_type_t type) {
+static const char* pakfire_action_type_string(enum pakfire_actions type) {
        switch (type) {
                case PAKFIRE_ACTION_NOOP:
                        return "NOOP";
@@ -695,7 +713,7 @@ static int pakfire_transaction_package_is_userinstalled(
 }
 
 static int pakfire_transaction_run_step(struct pakfire_transaction* transaction,
-               struct pakfire_db* db, const pakfire_action_type_t action, struct pakfire_package* pkg, PakfireArchive archive) {
+               struct pakfire_db* db, const enum pakfire_actions action, struct pakfire_package* pkg, PakfireArchive archive) {
        if (!pkg) {
                errno = EINVAL;
                return 1;
@@ -704,7 +722,7 @@ static int pakfire_transaction_run_step(struct pakfire_transaction* transaction,
        DEBUG(transaction->pakfire, "Running %s for %s\n",
                pakfire_action_type_string(action), pakfire_package_get_nevra(pkg));
 
-       pakfire_step_type_t type = pakfire_transaction_get_step_type(transaction, pkg);
+       enum pakfire_steps type = pakfire_transaction_get_step_type(transaction, pkg);
 
        int r = 0;
        switch (action) {
@@ -851,7 +869,7 @@ static int pakfire_transaction_run_step(struct pakfire_transaction* transaction,
 }
 
 static int pakfire_transaction_run_steps(struct pakfire_transaction* transaction,
-               struct pakfire_db* db, const pakfire_action_type_t action) {
+               struct pakfire_db* db, enum pakfire_actions action) {
        int r = 0;
 
        // Walk through all steps
@@ -874,7 +892,7 @@ static int pakfire_transaction_open_archives(struct pakfire_transaction* transac
                struct pakfire_package* pkg = transaction->packages[i];
 
                // Fetch the type
-               pakfire_step_type_t type = pakfire_transaction_get_step_type(transaction, pkg);
+               enum pakfire_steps type = pakfire_transaction_get_step_type(transaction, pkg);
 
                // Do we need the archive?
                switch (type) {
@@ -1004,7 +1022,7 @@ ERROR:
 
 static int pakfire_transaction_package_needs_download(
                struct pakfire_transaction* transaction, struct pakfire_package* pkg) {
-       pakfire_step_type_t type = pakfire_transaction_get_step_type(transaction, pkg);
+       enum pakfire_steps type = pakfire_transaction_get_step_type(transaction, pkg);
        switch (type) {
                case PAKFIRE_STEP_INSTALL:
                case PAKFIRE_STEP_REINSTALL: