rpm  4.17.0
rpmts.h
Go to the documentation of this file.
1 #ifndef H_RPMTS
2 #define H_RPMTS
3 
9 #include <sys/types.h>
10 
11 #include <rpm/rpmtypes.h>
12 #include <rpm/rpmte.h>
13 #include <rpm/rpmps.h>
14 #include <rpm/rpmsw.h>
15 #include <rpm/rpmpgp.h>
16 #include <rpm/rpmfi.h>
17 #include <rpm/rpmcallback.h>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 extern int _rpmts_stats;
24 
30  RPMTRANS_FLAG_TEST = (1 << 0),
33  RPMTRANS_FLAG_JUSTDB = (1 << 3),
35  RPMTRANS_FLAG_NODOCS = (1 << 5),
39  RPMTRANS_FLAG_NOCAPS = (1 << 9),
40  /* bits 10-15 unused */
42  RPMTRANS_FLAG_NOPRE = (1 << 17),
43  RPMTRANS_FLAG_NOPOST = (1 << 18),
46  RPMTRANS_FLAG_NOPREUN = (1 << 21),
47  RPMTRANS_FLAG_NOPOSTUN = (1 << 22),
51  /* bit 26 unused */
52  RPMTRANS_FLAG_NOMD5 = (1 << 27),
54  /* bit 28 unused */
57  RPMTRANS_FLAG_DEPLOOPS = (1 << 31)
58 };
59 
61 
62 #define _noTransScripts \
63  ( RPMTRANS_FLAG_NOPRE | \
64  RPMTRANS_FLAG_NOPOST | \
65  RPMTRANS_FLAG_NOPREUN | \
66  RPMTRANS_FLAG_NOPOSTUN | \
67  RPMTRANS_FLAG_NOPRETRANS | \
68  RPMTRANS_FLAG_NOPOSTTRANS \
69  )
70 
71 #define _noTransTriggers \
72  ( RPMTRANS_FLAG_NOTRIGGERPREIN | \
73  RPMTRANS_FLAG_NOTRIGGERIN | \
74  RPMTRANS_FLAG_NOTRIGGERUN | \
75  RPMTRANS_FLAG_NOTRIGGERPOSTUN \
76  )
77 
78 /* Avoid unnecessary breakage for stuff referring to these unused flags */
79 #define RPMTRANS_FLAG_NOPAYLOAD 0
80 #define RPMTRANS_FLAG_APPLYONLY 0
81 #define RPMTRANS_FLAG_KEEPOBSOLETE 0
82 #define RPMTRANS_FLAG_DIRSTASH 0
83 #define RPMTRANS_FLAG_REPACKAGE 0
84 #define RPMTRANS_FLAG_PKGCOMMIT 0
85 #define RPMTRANS_FLAG_PKGUNDO 0
86 #define RPMTRANS_FLAG_COMMIT 0
87 #define RPMTRANS_FLAG_UNDO 0
88 #define RPMTRANS_FLAG_REVERSE 0
89 #define RPMTRANS_FLAG_NOSUGGEST 0
90 #define RPMTRANS_FLAG_ADDINDEPS 0
91 
97  RPMVSF_NOHDRCHK = (1 << 0),
98  RPMVSF_NEEDPAYLOAD = (1 << 1),
99  /* bit(s) 2-7 unused */
102  RPMVSF_NODSAHEADER = (1 << 10),
103  RPMVSF_NORSAHEADER = (1 << 11),
104  /* bit(s) 12-15 unused */
105  RPMVSF_NOPAYLOAD = (1 << 16),
106  RPMVSF_NOMD5 = (1 << 17),
107  RPMVSF_NODSA = (1 << 18),
108  RPMVSF_NORSA = (1 << 19)
109  /* bit(s) 16-31 unused */
110 };
111 
113 
114 #define RPMVSF_MASK_NODIGESTS \
115  ( RPMVSF_NOSHA1HEADER | \
116  RPMVSF_NOSHA256HEADER | \
117  RPMVSF_NOPAYLOAD | \
118  RPMVSF_NOMD5 )
119 #define _RPMVSF_NODIGESTS RPMVSF_MASK_NODIGESTS
120 
121 #define RPMVSF_MASK_NOSIGNATURES \
122  ( RPMVSF_NODSAHEADER | \
123  RPMVSF_NORSAHEADER | \
124  RPMVSF_NODSA | \
125  RPMVSF_NORSA )
126 #define _RPMVSF_NOSIGNATURES RPMVSF_MASK_NOSIGNATURES
127 
128 #define RPMVSF_MASK_NOHEADER \
129  ( RPMVSF_NOSHA1HEADER | \
130  RPMVSF_NOSHA256HEADER | \
131  RPMVSF_NODSAHEADER | \
132  RPMVSF_NORSAHEADER )
133 #define _RPMVSF_NOHEADER RPMVSF_MASK_NOHEADER
134 
135 #define RPMVSF_MASK_NOPAYLOAD \
136  ( RPMVSF_NOMD5 | \
137  RPMVSF_NOPAYLOAD | \
138  RPMVSF_NODSA | \
139  RPMVSF_NORSA )
140 #define _RPMVSF_NOPAYLOAD RPMVSF_MASK_NOPAYLOAD
141 
142 enum {
144  RPMSIG_DIGEST_TYPE = (1 << 0),
146  RPMSIG_OTHER_TYPE = (1 << 2),
147 };
148 
149 #define RPMSIG_VERIFIABLE_TYPE (RPMSIG_DIGEST_TYPE|RPMSIG_SIGNATURE_TYPE)
150 #define RPMSIG_UNVERIFIED_TYPE (1 << 30)
151 
155 typedef enum rpmtsOpX_e {
173  RPMTS_OP_MAX = 18
175 
177  RPMTXN_READ = (1 << 0),
178  RPMTXN_WRITE = (1 << 1),
179 };
181 
182 typedef enum rpmtsEvent_e {
186 
199 typedef int (*rpmtsChangeFunction)
200  (int event, rpmte te, rpmte other, void *data);
201 
213 
231 
249 int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet);
250 
257 
264 
271 int rpmtsOpenDB(rpmts ts, int dbmode);
272 
279 int rpmtsInitDB(rpmts ts, int perms);
280 
287 
295 int rpmtsSetDBMode(rpmts ts, int dbmode);
296 
303 
310 
320  const void * keyp, size_t keylen);
321 
330 
339 rpmRC rpmtsImportPubkey(rpmts ts, const unsigned char * pkt, size_t pktlen);
340 
347 rpmKeyring rpmtsGetKeyring(rpmts ts, int autoload);
348 
358 
367  int (*solve) (rpmts ts, rpmds ds, const void * data),
368  const void * solveData);
369 
376 
382 
387 void rpmtsClean(rpmts ts);
388 
393 void rpmtsEmpty(rpmts ts);
394 
401 
408 
416 
423 
431 
438 
445 int rpmtsSetVfyLevel(rpmts ts, int vfylevel);
446 
452 const char * rpmtsRootDir(rpmts ts);
453 
460 int rpmtsSetRootDir(rpmts ts, const char * rootDir);
461 
468 
474 void rpmtsSetScriptFd(rpmts ts, FD_t scriptFd);
475 
482 
490 
497 
507 void * rpmtsNotify(rpmts ts, rpmte te,
508  rpmCallbackType what, rpm_loff_t amount, rpm_loff_t total);
509 
516 
524 
531 
538 
546 
553 
560 
568 
576 
584 
591 
604  rpmCallbackFunction notify,
605  rpmCallbackData notifyData);
606 
615 int rpmtsSetNotifyStyle(rpmts ts, int style);
616 
624 
637 
643 
658  const fnpyKey key, int upgrade,
659  rpmRelocation * relocs);
660 
670 
678 int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset);
679 
687 
694 
701 
708 
716 
717 #ifdef __cplusplus
718 }
719 #endif
720 
721 
722 #endif /* H_RPMTS */
rpmte rpmtsiNext(rpmtsi tsi, rpmElementTypes types)
Return next transaction element of type.
rpmtsi rpmtsiInit(rpmts ts)
Create transaction element iterator.
rpmtsi rpmtsiFree(rpmtsi tsi)
Destroy transaction element iterator.
int rpmtsGetNotifyStyle(rpmts ts)
Get transaction notify callback style.
rpmtxn rpmtxnBegin(rpmts ts, rpmtxnFlags flags)
Create a transaction (lock) handle.
rpmVSFlags_e
Bit(s) to control digest and signature verification.
Definition: rpmts.h:95
int rpmtsSetNotifyCallback(rpmts ts, rpmCallbackFunction notify, rpmCallbackData notifyData)
Set transaction notify callback function and argument.
rpm_color_t rpmtsSetPrefColor(rpmts ts, rpm_color_t color)
Set preferred file color.
void * rpmtsNotify(rpmts ts, rpmte te, rpmCallbackType what, rpm_loff_t amount, rpm_loff_t total)
Perform transaction progress notify callback.
rpm_color_t rpmtsSetColor(rpmts ts, rpm_color_t color)
Set color bits of transaction set.
int rpmtsAddInstallElement(rpmts ts, Header h, const fnpyKey key, int upgrade, rpmRelocation *relocs)
Add package to be installed to transaction set.
rpmtransFlags rpmtsFlags(rpmts ts)
Get transaction flags, i.e.
int rpmtsAddReinstallElement(rpmts ts, Header h, const fnpyKey key)
Add package to be reinstalled to transaction set.
rpmps rpmtsProblems(rpmts ts)
Return current transaction set problems.
rpmte rpmtsElement(rpmts ts, int ix)
Return (ordered) transaction set element.
int rpmtsSetRootDir(rpmts ts, const char *rootDir)
Set transaction rootDir, i.e.
int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
Process all package elements in a transaction set.
int rpmtsRebuildDB(rpmts ts)
Rebuild the database used by the transaction.
rpmKeyring rpmtsGetKeyring(rpmts ts, int autoload)
Retrieve handle for keyring used for this transaction set.
rpmVSFlags rpmtsSetVfyFlags(rpmts ts, rpmVSFlags vfyflags)
Set package verify flag(s).
rpmVSFlags rpmtsVSFlags(rpmts ts)
Get verify signatures flag(s).
int rpmtsGetDBMode(rpmts ts)
Return the transaction database mode.
rpmts rpmtsFree(rpmts ts)
Destroy transaction set, closing the database as well.
int rpmtsSetKeyring(rpmts ts, rpmKeyring keyring)
Set keyring to use for this transaction set.
rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
Set verify signatures flag(s).
rpm_tid_t rpmtsGetTid(rpmts ts)
Get transaction id, i.e.
rpmRC rpmtsImportHeader(rpmtxn txn, Header h, rpmFlags flags)
Import a header into the rpmdb.
rpmVSFlags rpmtsVfyFlags(rpmts ts)
Get package verify flag(s).
rpmts rpmtsLink(rpmts ts)
Reference a transaction set instance.
rpmtransFlags rpmtsSetFlags(rpmts ts, rpmtransFlags transFlags)
Set transaction flags, i.e.
rpm_tid_t rpmtsSetTid(rpmts ts, rpm_tid_t tid)
Set transaction id, i.e.
void rpmtsSetScriptFd(rpmts ts, FD_t scriptFd)
Set transaction script file handle, i.e.
int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset)
Add package to be erased to transaction set.
void rpmtsEmpty(rpmts ts)
Re-create an empty transaction set.
int rpmtsSetChangeCallback(rpmts ts, rpmtsChangeFunction notify, void *data)
Set transaction change callback function and argument.
int(* rpmtsChangeFunction)(int event, rpmte te, rpmte other, void *data)
Transaction change callback type.
Definition: rpmts.h:200
int rpmtsOpenDB(rpmts ts, int dbmode)
Open the database used by the transaction.
rpmtsOpX_e
Indices for timestamps.
Definition: rpmts.h:155
int rpmtsSetSolveCallback(rpmts ts, int(*solve)(rpmts ts, rpmds ds, const void *data), const void *solveData)
Set dependency solver callback.
rpmRC rpmtsImportPubkey(rpmts ts, const unsigned char *pkt, size_t pktlen)
Import public key packet(s).
void rpmtsCleanProblems(rpmts ts)
Clean current transaction problem set.
int rpmtsVerifyDB(rpmts ts)
Verify the database used by the transaction.
void *(* rpmCallbackFunction)(const void *h, const rpmCallbackType what, const rpm_loff_t amount, const rpm_loff_t total, fnpyKey key, rpmCallbackData data)
Function pointer type for rpmtsSetNotifyCallback() triggered by rpmtsNotify()
Definition: rpmcallback.h:61
rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, const void *keyp, size_t keylen)
Return transaction database iterator.
int rpmtsVfyLevel(rpmts ts)
Get enforced package verify level.
rpm_color_t rpmtsPrefColor(rpmts ts)
Retrieve preferred file color.
rpmprobFilterFlags rpmtsFilterFlags(rpmts ts)
Get problem ignore bit mask, i.e.
int rpmtsOrder(rpmts ts)
Determine package order in a transaction set according to dependencies.
rpmop rpmtsOp(rpmts ts, rpmtsOpX opx)
Retrieve operation timestamp from a transaction set.
int rpmtsSetVfyLevel(rpmts ts, int vfylevel)
Set enforced package verify level.
rpmtxn rpmtxnEnd(rpmtxn txn)
Destroy transaction (lock) handle.
rpmtransFlags_e
Bit(s) to control rpmtsRun() operation.
Definition: rpmts.h:28
rpmts rpmtsCreate(void)
Create an empty transaction set.
int rpmtsSetDBMode(rpmts ts, int dbmode)
Set the transaction database mode.
rpm_color_t rpmtsColor(rpmts ts)
Retrieve color bits of transaction set.
void rpmtsClean(rpmts ts)
Free memory needed only for dependency checks and ordering.
int rpmtsSetNotifyStyle(rpmts ts, int style)
Set transaction notify callback style.
int rpmtsNElements(rpmts ts)
Return number of (ordered) transaction set elements.
int rpmtsCloseDB(rpmts ts)
Close the database used by the transaction.
const char * rpmtsRootDir(rpmts ts)
Get transaction rootDir, i.e.
rpmdb rpmtsGetRdb(rpmts ts)
Get transaction set database handle.
int rpmtsCheck(rpmts ts)
Perform dependency resolution on the transaction set.
rpmPlugins rpmtsPlugins(rpmts ts)
Get the plugins associated with a transaction set.
enum rpmtsOpX_e rpmtsOpX
Indices for timestamps.
FD_t rpmtsScriptFd(rpmts ts)
Get transaction script file handle, i.e.
int rpmtsInitDB(rpmts ts, int perms)
Initialize the database used by the transaction.
@ RPMVSF_NEEDPAYLOAD
Definition: rpmts.h:98
@ RPMVSF_DEFAULT
Definition: rpmts.h:96
@ RPMVSF_NODSAHEADER
Definition: rpmts.h:102
@ RPMVSF_NOSHA256HEADER
Definition: rpmts.h:101
@ RPMVSF_NOMD5
Definition: rpmts.h:106
@ RPMVSF_NORSA
Definition: rpmts.h:108
@ RPMVSF_NORSAHEADER
Definition: rpmts.h:103
@ RPMVSF_NOHDRCHK
Definition: rpmts.h:97
@ RPMVSF_NODSA
Definition: rpmts.h:107
@ RPMVSF_NOPAYLOAD
Definition: rpmts.h:105
@ RPMVSF_NOSHA1HEADER
Definition: rpmts.h:100
@ RPMTS_OP_DBREMOVE
Definition: rpmts.h:168
@ RPMTS_OP_DBDEL
Definition: rpmts.h:171
@ RPMTS_OP_INSTALL
Definition: rpmts.h:160
@ RPMTS_OP_SCRIPTLETS
Definition: rpmts.h:162
@ RPMTS_OP_ERASE
Definition: rpmts.h:161
@ RPMTS_OP_DBADD
Definition: rpmts.h:167
@ RPMTS_OP_CHECK
Definition: rpmts.h:157
@ RPMTS_OP_FINGERPRINT
Definition: rpmts.h:159
@ RPMTS_OP_TOTAL
Definition: rpmts.h:156
@ RPMTS_OP_COMPRESS
Definition: rpmts.h:163
@ RPMTS_OP_DIGEST
Definition: rpmts.h:165
@ RPMTS_OP_DBPUT
Definition: rpmts.h:170
@ RPMTS_OP_DBGET
Definition: rpmts.h:169
@ RPMTS_OP_VERIFY
Definition: rpmts.h:172
@ RPMTS_OP_SIGNATURE
Definition: rpmts.h:166
@ RPMTS_OP_MAX
Definition: rpmts.h:173
@ RPMTS_OP_UNCOMPRESS
Definition: rpmts.h:164
@ RPMTS_OP_ORDER
Definition: rpmts.h:158
@ RPMTRANS_FLAG_NOCONFIGS
Definition: rpmts.h:56
@ RPMTRANS_FLAG_NOMD5
Definition: rpmts.h:52
@ RPMTRANS_FLAG_NOCAPS
Definition: rpmts.h:39
@ RPMTRANS_FLAG_NOPREUN
Definition: rpmts.h:46
@ RPMTRANS_FLAG_NOPLUGINS
Definition: rpmts.h:37
@ RPMTRANS_FLAG_NOFILEDIGEST
Definition: rpmts.h:53
@ RPMTRANS_FLAG_NONE
Definition: rpmts.h:29
@ RPMTRANS_FLAG_NOARTIFACTS
Definition: rpmts.h:55
@ RPMTRANS_FLAG_NOTRIGGERIN
Definition: rpmts.h:44
@ RPMTRANS_FLAG_NOTRIGGERPREIN
Definition: rpmts.h:41
@ RPMTRANS_FLAG_NOPRETRANS
Definition: rpmts.h:49
@ RPMTRANS_FLAG_NOSCRIPTS
Definition: rpmts.h:32
@ RPMTRANS_FLAG_NOPOSTUN
Definition: rpmts.h:47
@ RPMTRANS_FLAG_NOPRE
Definition: rpmts.h:42
@ RPMTRANS_FLAG_JUSTDB
Definition: rpmts.h:33
@ RPMTRANS_FLAG_NOTRIGGERPOSTUN
Definition: rpmts.h:48
@ RPMTRANS_FLAG_NOTRIGGERUN
Definition: rpmts.h:45
@ RPMTRANS_FLAG_NOPOST
Definition: rpmts.h:43
@ RPMTRANS_FLAG_NODOCS
Definition: rpmts.h:35
@ RPMTRANS_FLAG_NOCONTEXTS
Definition: rpmts.h:38
@ RPMTRANS_FLAG_NOTRIGGERS
Definition: rpmts.h:34
@ RPMTRANS_FLAG_ALLFILES
Definition: rpmts.h:36
@ RPMTRANS_FLAG_TEST
Definition: rpmts.h:30
@ RPMTRANS_FLAG_DEPLOOPS
Definition: rpmts.h:57
@ RPMTRANS_FLAG_NOPOSTTRANS
Definition: rpmts.h:50
@ RPMTRANS_FLAG_BUILD_PROBS
Definition: rpmts.h:31
struct rpmdbMatchIterator_s * rpmdbMatchIterator
Definition: rpmtypes.h:69
void * rpmCallbackData
Definition: rpmtypes.h:77
struct _FD_s * FD_t
RPM IO file descriptor type.
Definition: rpmtypes.h:99
struct rpmts_s * rpmts
The main types involved in transaction manipulation.
Definition: rpmtypes.h:63
struct rpmte_s * rpmte
Definition: rpmtypes.h:64
rpm_tag_t rpmDbiTagVal
Definition: rpmtypes.h:31
struct rpmtsi_s * rpmtsi
Definition: rpmtypes.h:70
uint32_t rpmFlags
Definition: rpmtypes.h:42
uint32_t rpm_color_t
Definition: rpmtypes.h:38
enum rpmRC_e rpmRC
Package read return codes.
struct rpmps_s * rpmps
Definition: rpmtypes.h:71
struct rpmds_s * rpmds
Definition: rpmtypes.h:65
struct rpmdb_s * rpmdb
Definition: rpmtypes.h:68
uint64_t rpm_loff_t
Definition: rpmtypes.h:51
uint32_t rpm_tid_t
Definition: rpmtypes.h:40
struct headerToken_s * Header
RPM header and data retrieval types.
Definition: rpmtypes.h:24
struct rpmtxn_s * rpmtxn
Definition: rpmtypes.h:72
const void * fnpyKey
Definition: rpmtypes.h:76
enum rpmCallbackType_e rpmCallbackType
Bit(s) to identify progress callbacks.
rpmFlags rpmprobFilterFlags
Definition: rpmprob.h:35
rpmFlags rpmElementTypes
Definition: rpmte.h:25
rpmFlags rpmtxnFlags
Definition: rpmts.h:180
rpmFlags rpmtransFlags
Definition: rpmts.h:60
rpmtxnFlags_e
Definition: rpmts.h:176
@ RPMTXN_READ
Definition: rpmts.h:177
@ RPMTXN_WRITE
Definition: rpmts.h:178
int _rpmts_stats
enum rpmtsEvent_e rpmtsEvent
rpmtsEvent_e
Definition: rpmts.h:182
@ RPMTS_EVENT_DEL
Definition: rpmts.h:184
@ RPMTS_EVENT_ADD
Definition: rpmts.h:183
@ RPMSIG_SIGNATURE_TYPE
Definition: rpmts.h:145
@ RPMSIG_OTHER_TYPE
Definition: rpmts.h:146
@ RPMSIG_DIGEST_TYPE
Definition: rpmts.h:144
@ RPMSIG_NONE_TYPE
Definition: rpmts.h:143
rpmFlags rpmVSFlags
Definition: rpmts.h:112
struct rpmPlugins_s * rpmPlugins
Definition: rpmtypes.h:87
struct rpmKeyring_s * rpmKeyring
Definition: rpmtypes.h:81
We pass these around as an array with a sentinel.
Definition: rpmfiles.h:130
Cumulative statistics for an operation.
Definition: rpmsw.h:42