#ifndef H_RPMTE
#define H_RPMTE
-/** \ingroup rpmdep rpmtrans
+/** \ingroup rpmts rpmte
* \file lib/rpmte.h
- * Structures used for a transactionElement.
- */
-
-typedef /*@abstract@*/ struct tsortInfo_s * tsortInfo;
-
-typedef /*@abstract@*/ struct teIterator_s * teIterator;
-
-/*@unchecked@*/
-/*@-exportlocal@*/
-extern int _te_debug;
-/*@=exportlocal@*/
-
-/** \ingroup rpmdep
- * Dependncy ordering information.
- */
-/*@-fielduse@*/ /* LCL: confused by union? */
-struct tsortInfo_s {
- union {
- int count;
- /*@exposed@*/ /*@dependent@*/ /*@null@*/
- transactionElement suc;
- } tsi_u;
-#define tsi_count tsi_u.count
-#define tsi_suc tsi_u.suc
-/*@owned@*/ /*@null@*/
- struct tsortInfo_s * tsi_next;
-/*@exposed@*/ /*@dependent@*/ /*@null@*/
- transactionElement tsi_chain;
- int tsi_reqx;
- int tsi_qcnt;
-};
-/*@=fielduse@*/
-
-/** \ingroup rpmdep
- */
-typedef enum rpmTransactionType_e {
- TR_ADDED, /*!< Package will be installed. */
- TR_REMOVED /*!< Package will be removed. */
-} rpmTransactionType;
-
-/** \ingroup rpmdep
- * A single package instance to be installed/removed atomically.
- */
-struct transactionElement_s {
- rpmTransactionType type; /*!< Package disposition (installed/removed). */
-
-/*@refcounted@*/ /*@null@*/
- Header h; /*!< Package header. */
-/*@only@*/
- const char * NEVR; /*!< Package name-version-release. */
-/*@owned@*/
- const char * name; /*!< Name: */
-/*@only@*/ /*@null@*/
- char * epoch;
-/*@dependent@*/ /*@null@*/
- char * version; /*!< Version: */
-/*@dependent@*/ /*@null@*/
- char * release; /*!< Release: */
-/*@only@*/ /*@null@*/
- const char * arch; /*!< Architecture hint. */
-/*@only@*/ /*@null@*/
- const char * os; /*!< Operating system hint. */
-
- int npreds; /*!< No. of predecessors. */
- int depth; /*!< Max. depth in dependency tree. */
-/*@owned@*/
- tsortInfo tsi; /*!< Dependency ordering chains. */
-
-/*@refcounted@*/ /*@null@*/
- rpmDepSet this; /*!< This package's provided NEVR. */
-/*@refcounted@*/ /*@null@*/
- rpmDepSet provides; /*!< Provides: dependencies. */
-/*@refcounted@*/ /*@null@*/
- rpmDepSet requires; /*!< Requires: dependencies. */
-/*@refcounted@*/ /*@null@*/
- rpmDepSet conflicts; /*!< Conflicts: dependencies. */
-/*@refcounted@*/ /*@null@*/
- rpmDepSet obsoletes; /*!< Obsoletes: dependencies. */
-/*@refcounted@*/ /*@null@*/
- TFI_t fi; /*!< File information. */
-
- uint_32 multiLib; /*!< (TR_ADDED) MULTILIB */
-
-/*@exposed@*/ /*@dependent@*/ /*@null@*/
- fnpyKey key; /*!< (TR_ADDED) Retrieval key. */
-/*@owned@*/ /*@null@*/
- rpmRelocation * relocs; /*!< (TR_ADDED) Payload file relocations. */
-/*@refcounted@*/ /*@null@*/
- FD_t fd; /*!< (TR_ADDED) Payload file descriptor. */
-
-/*@-fielduse@*/ /* LCL: confused by union? */
- union {
-/*@unused@*/ alKey addedKey;
-/*@unused@*/ struct {
- alKey dependsOnKey;
- int dboffset;
- } removed;
- } u;
-/*@=fielduse@*/
-
-};
-
-#if defined(_NEED_TEITERATOR)
-/**
- * Iterator across transaction elements, forward on install, backward on erase.
- */
-struct teIterator_s {
-/*@refcounted@*/
- rpmTransactionSet ts; /*!< transaction set. */
- int reverse; /*!< reversed traversal? */
- int ocsave; /*!< last returned iterator index. */
- int oc; /*!< iterator index. */
-};
-#endif
+ * Structures used for an "rpmte" transaction element.
+ */
+
+#include <rpm/rpmtypes.h>
+#include <rpm/argv.h>
#ifdef __cplusplus
extern "C" {
#endif
-/**
- * Destroy a transaction element.
+/** \ingroup rpmte
+ * Transaction element type.
+ */
+typedef enum rpmElementType_e {
+ TR_ADDED = (1 << 0), /*!< Package will be installed. */
+ TR_REMOVED = (1 << 1) /*!< Package will be removed. */
+} rpmElementType;
+
+typedef rpmFlags rpmElementTypes;
+
+/** \ingroup rpmte
+ * Retrieve header from transaction element.
* @param te transaction element
- * @return NULL always
+ * @return header (new reference)
*/
-/*@null@*/
-transactionElement teFree(/*@only@*/ /*@null@*/ transactionElement te)
- /*@modifies te@*/;
-/**
- * Create a transaction element.
- * @param ts transaction set
+Header rpmteHeader(rpmte te);
+
+/** \ingroup rpmte
+ * Save header into transaction element.
+ * @param te transaction element
* @param h header
- * @param key package retrieval key (e.g. file name)
- * @param relocs package file relocations
- * @return new transaction element
+ * @return NULL always
*/
-/*@only@*/ /*@null@*/
-transactionElement teNew(const rpmTransactionSet ts, Header h,
- /*@exposed@*/ /*@null@*/ fnpyKey key,
- /*@null@*/ rpmRelocation * relocs)
- /*@modifies ts, h @*/;
+Header rpmteSetHeader(rpmte te, Header h);
-/**
+/** \ingroup rpmte
* Retrieve type of transaction element.
* @param te transaction element
* @return type
*/
-rpmTransactionType teGetType(transactionElement te)
- /*@*/;
+rpmElementType rpmteType(rpmte te);
-/**
+/** \ingroup rpmte
* Retrieve name string of transaction element.
* @param te transaction element
* @return name string
*/
-/*@observer@*/
-const char * teGetN(transactionElement te)
- /*@*/;
+const char * rpmteN(rpmte te);
-/**
+/** \ingroup rpmte
* Retrieve epoch string of transaction element.
* @param te transaction element
* @return epoch string
*/
-/*@observer@*/ /*@null@*/
-const char * teGetE(transactionElement te)
- /*@*/;
+const char * rpmteE(rpmte te);
-/**
+/** \ingroup rpmte
* Retrieve version string of transaction element.
* @param te transaction element
* @return version string
*/
-/*@observer@*/ /*@null@*/
-const char * teGetV(transactionElement te)
- /*@*/;
+const char * rpmteV(rpmte te);
-/**
+/** \ingroup rpmte
* Retrieve release string of transaction element.
* @param te transaction element
* @return release string
*/
-/*@observer@*/ /*@null@*/
-const char * teGetR(transactionElement te)
- /*@*/;
+const char * rpmteR(rpmte te);
-/**
+/** \ingroup rpmte
* Retrieve arch string of transaction element.
* @param te transaction element
* @return arch string
*/
-/*@observer@*/ /*@null@*/
-const char * teGetA(transactionElement te)
- /*@*/;
+const char * rpmteA(rpmte te);
-/**
+/** \ingroup rpmte
* Retrieve os string of transaction element.
* @param te transaction element
* @return os string
*/
-/*@observer@*/ /*@null@*/
-const char * teGetO(transactionElement te)
- /*@*/;
+const char * rpmteO(rpmte te);
+
+/** \ingroup rpmte
+ * Retrieve isSource attribute of transaction element.
+ * @param te transaction element
+ * @return isSource attribute
+ */
+int rpmteIsSource(rpmte te);
+
+/** \ingroup rpmte
+ * Retrieve color bits of transaction element.
+ * @param te transaction element
+ * @return color bits
+ */
+rpm_color_t rpmteColor(rpmte te);
+
+/** \ingroup rpmte
+ * Set color bits of transaction element.
+ * @param te transaction element
+ * @param color new color bits
+ * @return previous color bits
+ */
+rpm_color_t rpmteSetColor(rpmte te, rpm_color_t color);
+
+/** \ingroup rpmte
+ * Retrieve last instance installed to the database.
+ * @param te transaction element
+ * @return last install instance.
+ */
+unsigned int rpmteDBInstance(rpmte te);
+
+/** \ingroup rpmte
+ * Set last instance installed to the database.
+ * @param te transaction element
+ * @param instance Database instance of last install element.
+ * @return last install instance.
+ */
+void rpmteSetDBInstance(rpmte te, unsigned int instance);
+
+/** \ingroup rpmte
+ * Retrieve size in bytes of package file.
+ * @todo Signature header is estimated at 256b.
+ * @param te transaction element
+ * @return size in bytes of package file.
+ */
+rpm_loff_t rpmtePkgFileSize(rpmte te);
+
+/** \ingroup rpmte
+ * Retrieve parent transaction element.
+ * @param te transaction element
+ * @return parent transaction element
+ */
+rpmte rpmteParent(rpmte te);
+
+/** \ingroup rpmte
+ * Set parent transaction element.
+ * @param te transaction element
+ * @param pte new parent transaction element
+ * @return previous parent transaction element
+ */
+rpmte rpmteSetParent(rpmte te, rpmte pte);
-/**
- * Retrieve multlib flags of transaction element.
+/** \ingroup rpmte
+ * Return problem set info of transaction element.
* @param te transaction element
- * @return multilib flags
+ * @return problem set (or NULL if none)
*/
-int teGetMultiLib(transactionElement te)
- /*@*/;
+rpmps rpmteProblems(rpmte te);
-/**
- * Retrieve tsort info for transaction element.
+/** \ingroup rpmte
+ * Destroy problem set info of transaction element.
* @param te transaction element
- * @return tsort info
*/
-tsortInfo teGetTSI(transactionElement te)
- /*@*/;
+void rpmteCleanProblems(rpmte te);
-/**
- * Retrieve pkgKey of TR_ADDED transaction element.
+/** \ingroup rpmte
+ * Destroy dependency set info of transaction element.
* @param te transaction element
- * @return pkgKey
*/
-/*@exposed@*/
-alKey teGetAddedKey(transactionElement te)
- /*@*/;
+void rpmteCleanDS(rpmte te);
-/**
- * Retrieve dependent pkgKey of TR_REMOVED transaction element.
+/** \ingroup rpmte
+ * Set dependent element of TR_REMOVED transaction element.
* @param te transaction element
- * @return dependent pkgKey
+ * @param depends dependent transaction element
*/
-/*@exposed@*/
-alKey teGetDependsOnKey(transactionElement te)
- /*@*/;
+void rpmteSetDependsOn(rpmte te, rpmte depends);
-/**
+/** \ingroup rpmte
+ * Retrieve dependent element of TR_REMOVED transaction element.
+ * @param te transaction element
+ * @return dependent transaction element
+ */
+rpmte rpmteDependsOn(rpmte te);
+
+/** \ingroup rpmte
* Retrieve rpmdb instance of TR_REMOVED transaction element.
* @param te transaction element
* @return rpmdb instance
*/
-int teGetDBOffset(transactionElement te)
- /*@*/;
+int rpmteDBOffset(rpmte te);
+
+/** \ingroup rpmte
+ * Retrieve [epoch:]version-release string from transaction element.
+ * @param te transaction element
+ * @return [epoch:]version-release string
+ */
+const char * rpmteEVR(rpmte te);
-/**
- * Retrieve name-version-release string from transaction element.
+/** \ingroup rpmte
+ * Retrieve name-[epoch:]version-release string from transaction element.
* @param te transaction element
- * @return name-version-release string
+ * @return name-[epoch:]version-release string
*/
-/*@observer@*/
-const char * teGetNEVR(transactionElement te)
- /*@*/;
+const char * rpmteNEVR(rpmte te);
-/**
- * Retrieve file handle from transaction element.
+/** \ingroup rpmte
+ * Retrieve name-[epoch:]version-release.arch string from transaction element.
* @param te transaction element
- * @return file handle
+ * @return name-[epoch:]version-release.arch string
*/
-FD_t teGetFd(transactionElement te)
- /*@*/;
+const char * rpmteNEVRA(rpmte te);
-/**
+/** \ingroup rpmte
* Retrieve key from transaction element.
* @param te transaction element
* @return key
*/
-/*@exposed@*/
-fnpyKey teGetKey(transactionElement te)
- /*@*/;
+fnpyKey rpmteKey(rpmte te);
-#if defined(_NEED_TEITERATOR)
-/**
- * Return transaction element index.
- * @param tei transaction element iterator
- * @return transaction element index
+/** \ingroup rpmte
+ * Return failure status of transaction element.
+ * If the element itself failed, this is 1, larger count means one of
+ * it's parents failed.
+ * @param te transaction element
+ * @return number of failures for this transaction element
*/
-int teiGetOc(teIterator tei)
- /*@*/;
+int rpmteFailed(rpmte te);
-/**
- * Destroy transaction element iterator.
- * @param tei transaction element iterator
- * @return NULL always
+/** \ingroup rpmte
+ * Retrieve dependency tag set from transaction element.
+ * @param te transaction element
+ * @param tag dependency tag
+ * @return dependency tag set
*/
-/*@null@*/
-teIterator teFreeIterator(/*@only@*//*@null@*/ teIterator tei)
- /*@*/;
+rpmds rpmteDS(rpmte te, rpmTagVal tag);
-/**
- * Create transaction element iterator.
- * @param ts transaction set
- * @return transaction element iterator
+/** \ingroup rpmte
+ * Retrieve file info tag set from transaction element.
+ * @param te transaction element
+ * @return file info tag set
*/
-/*@only@*/
-teIterator teInitIterator(rpmTransactionSet ts)
- /*@modifies ts @*/;
+rpmfi rpmteFI(rpmte te);
-/**
- * Return next transaction element
- * @param tei transaction element iterator
- * @return transaction element, NULL on termination
+/** \ingroup rpmte
+ * Retrieve list of collections
+ * @param te transaction element
+ * @return list of collections
*/
-/*@dependent@*/ /*@null@*/
-transactionElement teNextIterator(teIterator tei)
- /*@modifies tei @*/;
+ARGV_const_t rpmteCollections(rpmte te);
-/**
- * Return next transaction element of type.
- * @param tei transaction element iterator
- * @param type transaction element type selector
- * @return next transaction element of type, NULL on termination
+/** \ingroup rpmte
+ * Determine a transaction element is part of a collection
+ * @param te transaction element
+ * @param collname collection name
+ * @return 1 if collname is part of a collection, 0 if not
*/
-/*@dependent@*/ /*@null@*/
-transactionElement teNext(teIterator tei, rpmTransactionType type)
- /*@modifies tei @*/;
+int rpmteHasCollection(rpmte te, const char * collname);
-#endif /* defined(_NEED_TEITERATOR) */
#ifdef __cplusplus
}