2 * Copyright (c) 2007-2009, Novell Inc.
4 * This program is licensed under the BSD license, read LICENSE.BSD
5 * for further information
13 #ifndef LIBSOLV_TRANSACTION_H
14 #define LIBSOLV_TRANSACTION_H
20 #include "pooltypes.h"
26 struct _TransactionOrderdata;
28 typedef struct _Transaction {
29 struct _Pool *pool; /* back pointer to pool */
31 Queue steps; /* the transaction steps */
33 Map noobsmap; /* public for now */
35 #ifdef LIBSOLV_INTERNAL
36 Queue transaction_info;
37 Id *transaction_installed;
40 struct _TransactionOrderdata *orderdata;
47 #define SOLVER_TRANSACTION_IGNORE 0x00
49 #define SOLVER_TRANSACTION_ERASE 0x10
50 #define SOLVER_TRANSACTION_REINSTALLED 0x11
51 #define SOLVER_TRANSACTION_DOWNGRADED 0x12
52 #define SOLVER_TRANSACTION_CHANGED 0x13
53 #define SOLVER_TRANSACTION_UPGRADED 0x14
54 #define SOLVER_TRANSACTION_OBSOLETED 0x15
56 #define SOLVER_TRANSACTION_INSTALL 0x20
57 #define SOLVER_TRANSACTION_REINSTALL 0x21
58 #define SOLVER_TRANSACTION_DOWNGRADE 0x22
59 #define SOLVER_TRANSACTION_CHANGE 0x23
60 #define SOLVER_TRANSACTION_UPGRADE 0x24
61 #define SOLVER_TRANSACTION_OBSOLETES 0x25
63 #define SOLVER_TRANSACTION_MULTIINSTALL 0x30
64 #define SOLVER_TRANSACTION_MULTIREINSTALL 0x31
66 #define SOLVER_TRANSACTION_MAXTYPE 0x3f
69 #define SOLVER_TRANSACTION_SHOW_ACTIVE (1 << 0)
70 #define SOLVER_TRANSACTION_SHOW_ALL (1 << 1)
71 #define SOLVER_TRANSACTION_SHOW_OBSOLETES (1 << 2)
72 #define SOLVER_TRANSACTION_SHOW_MULTIINSTALL (1 << 3)
73 #define SOLVER_TRANSACTION_CHANGE_IS_REINSTALL (1 << 4)
74 #define SOLVER_TRANSACTION_MERGE_VENDORCHANGES (1 << 5)
75 #define SOLVER_TRANSACTION_MERGE_ARCHCHANGES (1 << 6)
77 #define SOLVER_TRANSACTION_RPM_ONLY (1 << 7)
79 /* extra classifications */
80 #define SOLVER_TRANSACTION_ARCHCHANGE 0x100
81 #define SOLVER_TRANSACTION_VENDORCHANGE 0x101
84 #define SOLVER_TRANSACTION_KEEP_ORDERDATA (1 << 0)
86 extern Transaction *transaction_create(struct _Pool *pool);
87 extern Transaction *transaction_create_decisionq(struct _Pool *pool, Queue *decisionq, Map *noobsmap);
88 extern Transaction *transaction_create_clone(Transaction *srctrans);
89 extern void transaction_free(Transaction *trans);
90 extern void transaction_free_orderdata(Transaction *trans);
92 /* if p is installed, returns with pkg(s) obsolete p */
93 /* if p is not installed, returns with pkg(s) we obsolete */
94 extern Id transaction_obs_pkg(Transaction *trans, Id p);
95 extern void transaction_all_obs_pkgs(Transaction *trans, Id p, Queue *pkgs);
97 /* return step type of a transaction element */
98 extern Id transaction_type(Transaction *trans, Id p, int mode);
100 /* return sorted collection of all step types */
101 /* classify_pkgs can be used to return all packages of a type */
102 extern void transaction_classify(Transaction *trans, int mode, Queue *classes);
103 extern void transaction_classify_pkgs(Transaction *trans, int mode, Id type, Id from, Id to, Queue *pkgs);
105 /* return all packages that will be installed after the transaction is run*/
106 /* The new packages are put at the head of the queue, the number of new
107 packages is returned */
108 extern int transaction_installedresult(Transaction *trans, Queue *installedq);
110 int transaction_calc_installsizechange(Transaction *trans);
111 void transaction_calc_duchanges(Transaction *trans, struct _DUChanges *mps, int nmps);
113 /* order a transaction */
114 extern void transaction_order(Transaction *trans, int flags);
116 /* roll your own order funcion:
117 * add pkgs free for installation to queue choices after chosen was
118 * installed. start with chosen = 0
119 * needs an ordered transaction created with SOLVER_TRANSACTION_KEEP_ORDERDATA */
120 extern int transaction_order_add_choices(Transaction *trans, Id chosen, Queue *choices);
121 /* add obsoleted packages into transaction steps */
122 extern void transaction_add_obsoleted(Transaction *trans);
124 /* debug function, report problems found in the order */
125 extern void transaction_check_order(Transaction *trans);