rpm  4.15.1
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  /* bits 28-29 unused */
57 };
58 
60 
61 #define _noTransScripts \
62  ( RPMTRANS_FLAG_NOPRE | \
63  RPMTRANS_FLAG_NOPOST | \
64  RPMTRANS_FLAG_NOPREUN | \
65  RPMTRANS_FLAG_NOPOSTUN | \
66  RPMTRANS_FLAG_NOPRETRANS | \
67  RPMTRANS_FLAG_NOPOSTTRANS \
68  )
69 
70 #define _noTransTriggers \
71  ( RPMTRANS_FLAG_NOTRIGGERPREIN | \
72  RPMTRANS_FLAG_NOTRIGGERIN | \
73  RPMTRANS_FLAG_NOTRIGGERUN | \
74  RPMTRANS_FLAG_NOTRIGGERPOSTUN \
75  )
76 
77 /* Avoid unnecessary breakage for stuff referring to these unused flags */
78 #define RPMTRANS_FLAG_NOPAYLOAD 0
79 #define RPMTRANS_FLAG_APPLYONLY 0
80 #define RPMTRANS_FLAG_KEEPOBSOLETE 0
81 #define RPMTRANS_FLAG_DIRSTASH 0
82 #define RPMTRANS_FLAG_REPACKAGE 0
83 #define RPMTRANS_FLAG_PKGCOMMIT 0
84 #define RPMTRANS_FLAG_PKGUNDO 0
85 #define RPMTRANS_FLAG_COMMIT 0
86 #define RPMTRANS_FLAG_UNDO 0
87 #define RPMTRANS_FLAG_REVERSE 0
88 #define RPMTRANS_FLAG_NOSUGGEST 0
89 #define RPMTRANS_FLAG_ADDINDEPS 0
90 
96  RPMVSF_NOHDRCHK = (1 << 0),
97  RPMVSF_NEEDPAYLOAD = (1 << 1),
98  /* bit(s) 2-7 unused */
99  RPMVSF_NOSHA1HEADER = (1 << 8),
101  RPMVSF_NODSAHEADER = (1 << 10),
102  RPMVSF_NORSAHEADER = (1 << 11),
103  /* bit(s) 12-15 unused */
104  RPMVSF_NOPAYLOAD = (1 << 16),
105  RPMVSF_NOMD5 = (1 << 17),
106  RPMVSF_NODSA = (1 << 18),
107  RPMVSF_NORSA = (1 << 19)
108  /* bit(s) 16-31 unused */
109 };
110 
112 
113 #define RPMVSF_MASK_NODIGESTS \
114  ( RPMVSF_NOSHA1HEADER | \
115  RPMVSF_NOSHA256HEADER | \
116  RPMVSF_NOPAYLOAD | \
117  RPMVSF_NOMD5 )
118 #define _RPMVSF_NODIGESTS RPMVSF_MASK_NODIGESTS
119 
120 #define RPMVSF_MASK_NOSIGNATURES \
121  ( RPMVSF_NODSAHEADER | \
122  RPMVSF_NORSAHEADER | \
123  RPMVSF_NODSA | \
124  RPMVSF_NORSA )
125 #define _RPMVSF_NOSIGNATURES RPMVSF_MASK_NOSIGNATURES
126 
127 #define RPMVSF_MASK_NOHEADER \
128  ( RPMVSF_NOSHA1HEADER | \
129  RPMVSF_NOSHA256HEADER | \
130  RPMVSF_NODSAHEADER | \
131  RPMVSF_NORSAHEADER )
132 #define _RPMVSF_NOHEADER RPMVSF_MASK_NOHEADER
133 
134 #define RPMVSF_MASK_NOPAYLOAD \
135  ( RPMVSF_NOMD5 | \
136  RPMVSF_NOPAYLOAD | \
137  RPMVSF_NODSA | \
138  RPMVSF_NORSA )
139 #define _RPMVSF_NOPAYLOAD RPMVSF_MASK_NOPAYLOAD
140 
141 enum {
143  RPMSIG_DIGEST_TYPE = (1 << 0),
145  RPMSIG_OTHER_TYPE = (1 << 2),
146 };
147 
148 #define RPMSIG_VERIFIABLE_TYPE (RPMSIG_DIGEST_TYPE|RPMSIG_SIGNATURE_TYPE)
149 #define RPMSIG_UNVERIFIED_TYPE (1 << 30)
150 
154 typedef enum rpmtsOpX_e {
173 } rpmtsOpX;
174 
176  RPMTXN_READ = (1 << 0),
177  RPMTXN_WRITE = (1 << 1),
178 };
180 
191 int rpmtsCheck(rpmts ts);
192 
209 int rpmtsOrder(rpmts ts);
210 
228 int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet);
229 
235 rpmts rpmtsLink (rpmts ts);
236 
242 int rpmtsCloseDB(rpmts ts);
243 
250 int rpmtsOpenDB(rpmts ts, int dbmode);
251 
259 int rpmtsInitDB(rpmts ts, int dbmode);
260 
266 int rpmtsGetDBMode(rpmts ts);
267 
275 int rpmtsSetDBMode(rpmts ts, int dbmode);
276 
282 int rpmtsRebuildDB(rpmts ts);
283 
289 int rpmtsVerifyDB(rpmts ts);
290 
300  const void * keyp, size_t keylen);
301 
310 
319 rpmRC rpmtsImportPubkey(rpmts ts, const unsigned char * pkt, size_t pktlen);
320 
327 rpmKeyring rpmtsGetKeyring(rpmts ts, int autoload);
328 
337 int rpmtsSetKeyring(rpmts ts, rpmKeyring keyring);
338 
347  int (*solve) (rpmts ts, rpmds ds, const void * data),
348  const void * solveData);
349 
356 
361 void rpmtsCleanProblems(rpmts ts);
362 
367 void rpmtsClean(rpmts ts);
368 
373 void rpmtsEmpty(rpmts ts);
374 
380 rpmts rpmtsFree(rpmts ts);
381 
388 
396 
403 
411 
417 int rpmtsVfyLevel(rpmts ts);
418 
425 int rpmtsSetVfyLevel(rpmts ts, int vfylevel);
426 
432 const char * rpmtsRootDir(rpmts ts);
433 
440 int rpmtsSetRootDir(rpmts ts, const char * rootDir);
441 
448 
454 void rpmtsSetScriptFd(rpmts ts, FD_t scriptFd);
455 
462 
470 
477 
487 void * rpmtsNotify(rpmts ts, rpmte te,
488  rpmCallbackType what, rpm_loff_t amount, rpm_loff_t total);
489 
495 int rpmtsNElements(rpmts ts);
496 
503 rpmte rpmtsElement(rpmts ts, int ix);
504 
511 
518 
526 
533 
540 
548 
556 
563 rpmop rpmtsOp(rpmts ts, rpmtsOpX opx);
564 
571 
584  rpmCallbackFunction notify,
585  rpmCallbackData notifyData);
586 
591 rpmts rpmtsCreate(void);
592 
607  const fnpyKey key, int upgrade,
608  rpmRelocation * relocs);
609 
618 int rpmtsAddReinstallElement(rpmts ts, Header h, const fnpyKey key);
619 
627 int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset);
628 
636 
642 rpmtxn rpmtxnEnd(rpmtxn txn);
643 
650 
657 
665 
666 #ifdef __cplusplus
667 }
668 #endif
669 
670 
671 #endif /* H_RPMTS */
int rpmtsSetNotifyCallback(rpmts ts, rpmCallbackFunction notify, rpmCallbackData notifyData)
Set transaction notify callback function and argument.
enum rpmCallbackType_e rpmCallbackType
Bit(s) to identify progress callbacks.
rpmRC rpmtsImportPubkey(rpmts ts, const unsigned char *pkt, size_t pktlen)
Import public key packet(s).
struct rpmdbMatchIterator_s * rpmdbMatchIterator
Definition: rpmtypes.h:69
rpmop rpmtsOp(rpmts ts, rpmtsOpX opx)
Retrieve operation timestamp from a transaction set.
rpmprobFilterFlags rpmtsFilterFlags(rpmts ts)
Get problem ignore bit mask, i.e.
rpmtxn rpmtxnEnd(rpmtxn txn)
Destroy transaction (lock) handle.
struct rpmps_s * rpmps
Definition: rpmtypes.h:71
struct rpmtxn_s * rpmtxn
Definition: rpmtypes.h:72
rpm_color_t rpmtsSetColor(rpmts ts, rpm_color_t color)
Set color bits of transaction set.
struct rpmtsi_s * rpmtsi
Definition: rpmtypes.h:70
rpmtransFlags rpmtsSetFlags(rpmts ts, rpmtransFlags transFlags)
Set transaction flags, i.e.
rpmdb rpmtsGetRdb(rpmts ts)
Get transaction set database handle.
rpmts rpmtsFree(rpmts ts)
Destroy transaction set, closing the database as well.
rpmPlugins rpmtsPlugins(rpmts ts)
Get the plugins associated with a transaction set.
rpmts rpmtsLink(rpmts ts)
Reference a transaction set instance.
rpmFlags rpmtxnFlags
Definition: rpmts.h:179
int rpmtsRebuildDB(rpmts ts)
Rebuild the database used by the transaction.
rpm_tid_t rpmtsGetTid(rpmts ts)
Get transaction id, i.e.
void rpmtsEmpty(rpmts ts)
Re-create an empty transaction set.
int rpmtsSetKeyring(rpmts ts, rpmKeyring keyring)
Set keyring to use for this transaction set.
void * rpmtsNotify(rpmts ts, rpmte te, rpmCallbackType what, rpm_loff_t amount, rpm_loff_t total)
Perform transaction progress notify callback.
struct rpmts_s * rpmts
The main types involved in transaction manipulation.
Definition: rpmtypes.h:63
void * rpmCallbackData
Definition: rpmtypes.h:76
rpm_color_t rpmtsColor(rpmts ts)
Retrieve color bits of transaction set.
rpm_color_t rpmtsPrefColor(rpmts ts)
Retrieve preferred file color.
rpmFlags rpmprobFilterFlags
Definition: rpmprob.h:35
int rpmtsAddInstallElement(rpmts ts, Header h, const fnpyKey key, int upgrade, rpmRelocation *relocs)
Add package to be installed to transaction set.
We pass these around as an array with a sentinel.
Definition: rpmfiles.h:127
int rpmtsSetSolveCallback(rpmts ts, int(*solve)(rpmts ts, rpmds ds, const void *data), const void *solveData)
Set dependency solver callback.
FD_t rpmtsScriptFd(rpmts ts)
Get transaction script file handle, i.e.
rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, const void *keyp, size_t keylen)
Return transaction database iterator.
struct rpmKeyring_s * rpmKeyring
Definition: rpmtypes.h:80
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
rpmts rpmtsCreate(void)
Create an empty transaction set.
struct rpmPlugins_s * rpmPlugins
Definition: rpmtypes.h:86
int _rpmts_stats
uint32_t rpmFlags
Definition: rpmtypes.h:42
int rpmtsAddReinstallElement(rpmts ts, Header h, const fnpyKey key)
Add package to be reinstalled to transaction set.
int rpmtsInitDB(rpmts ts, int dbmode)
Initialize the database used by the transaction.
struct rpmdb_s * rpmdb
Definition: rpmtypes.h:68
rpmtransFlags_e
Bit(s) to control rpmtsRun() operation.
Definition: rpmts.h:28
enum rpmtsOpX_e rpmtsOpX
Indices for timestamps.
struct _FD_s * FD_t
RPM IO file descriptor type.
Definition: rpmtypes.h:98
int rpmtsVerifyDB(rpmts ts)
Verify the database used by the transaction.
uint32_t rpm_color_t
Definition: rpmtypes.h:38
int rpmtsCloseDB(rpmts ts)
Close the database used by the transaction.
rpmVSFlags rpmtsSetVfyFlags(rpmts ts, rpmVSFlags vfyflags)
Set package verify flag(s).
struct headerToken_s * Header
RPM header and data retrieval types.
Definition: rpmtypes.h:24
rpmVSFlags_e
Bit(s) to control digest and signature verification.
Definition: rpmts.h:94
int rpmtsSetVfyLevel(rpmts ts, int vfylevel)
Set enforced package verify level.
const char * rpmtsRootDir(rpmts ts)
Get transaction rootDir, i.e.
const void * fnpyKey
Definition: rpmtypes.h:75
rpmFlags rpmVSFlags
Definition: rpmts.h:111
struct rpmds_s * rpmds
Definition: rpmtypes.h:65
int rpmtsOpenDB(rpmts ts, int dbmode)
Open the database used by the transaction.
rpmtsi rpmtsiFree(rpmtsi tsi)
Destroy transaction element iterator.
rpmte rpmtsElement(rpmts ts, int ix)
Return (ordered) transaction set element.
rpmte rpmtsiNext(rpmtsi tsi, rpmElementTypes types)
Return next transaction element of type.
int rpmtsSetDBMode(rpmts ts, int dbmode)
Set the transaction database mode.
rpmtxnFlags_e
Definition: rpmts.h:175
struct rpmte_s * rpmte
Definition: rpmtypes.h:64
Cumulative statistics for an operation.
Definition: rpmsw.h:42
rpmRC rpmtsImportHeader(rpmtxn txn, Header h, rpmFlags flags)
Import a header into the rpmdb.
rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
Set verify signatures flag(s).
rpmKeyring rpmtsGetKeyring(rpmts ts, int autoload)
Retrieve handle for keyring used for this transaction set.
uint32_t rpm_tid_t
Definition: rpmtypes.h:40
int rpmtsOrder(rpmts ts)
Determine package order in a transaction set according to dependencies.
void rpmtsClean(rpmts ts)
Free memory needed only for dependency checks and ordering.
rpm_tag_t rpmDbiTagVal
Definition: rpmtypes.h:31
int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset)
Add package to be erased to transaction set.
int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
Process all package elements in a transaction set.
int rpmtsGetDBMode(rpmts ts)
Return the transaction database mode.
int rpmtsNElements(rpmts ts)
Return number of (ordered) transaction set elements.
rpmtransFlags rpmtsFlags(rpmts ts)
Get transaction flags, i.e.
rpmVSFlags rpmtsVfyFlags(rpmts ts)
Get package verify flag(s).
rpmFlags rpmElementTypes
Definition: rpmte.h:25
rpmVSFlags rpmtsVSFlags(rpmts ts)
Get verify signatures flag(s).
rpm_color_t rpmtsSetPrefColor(rpmts ts, rpm_color_t color)
Set preferred file color.
rpmFlags rpmtransFlags
Definition: rpmts.h:59
int rpmtsSetRootDir(rpmts ts, const char *rootDir)
Set transaction rootDir, i.e.
int rpmtsVfyLevel(rpmts ts)
Get enforced package verify level.
void rpmtsSetScriptFd(rpmts ts, FD_t scriptFd)
Set transaction script file handle, i.e.
rpmtsOpX_e
Indices for timestamps.
Definition: rpmts.h:154
int rpmtsCheck(rpmts ts)
Perform dependency resolution on the transaction set.
uint64_t rpm_loff_t
Definition: rpmtypes.h:51
void rpmtsCleanProblems(rpmts ts)
Clean current transaction problem set.
rpmtsi rpmtsiInit(rpmts ts)
Create transaction element iterator.
enum rpmRC_e rpmRC
Package read return codes.
rpmtxn rpmtxnBegin(rpmts ts, rpmtxnFlags flags)
Create a transaction (lock) handle.
rpmps rpmtsProblems(rpmts ts)
Return current transaction set problems.
rpm_tid_t rpmtsSetTid(rpmts ts, rpm_tid_t tid)
Set transaction id, i.e.