[4.0] Use strip (instead of eu-strip) to support --strip-debug of *.so at build time
[platform/upstream/rpm.git] / lib / rpmte.h
index 7451ee6..a66c1e9 100644 (file)
@@ -6,22 +6,12 @@
  * Structures used for an "rpmte" transaction element.
  */
 
-/**
- */
-/*@-exportlocal@*/
-/*@unchecked@*/
-extern int _rpmte_debug;
-/*@=exportlocal@*/
-
-/**
- * Transaction element ordering chain linkage.
- */
-typedef /*@abstract@*/ struct tsortInfo_s *            tsortInfo;
+#include <rpm/rpmtypes.h>
+#include <rpm/argv.h>
 
-/**
- * Transaction element iterator.
- */
-typedef /*@abstract@*/ struct rpmtsi_s *               rpmtsi;
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /** \ingroup rpmte
  * Transaction element type.
@@ -31,502 +21,239 @@ typedef enum rpmElementType_e {
     TR_REMOVED         = (1 << 1)      /*!< Package will be removed. */
 } rpmElementType;
 
-#if    defined(_RPMTE_INTERNAL)
-/** \ingroup rpmte
- * Dependncy ordering information.
- */
-/*@-fielduse@*/        /* LCL: confused by union? */
-struct tsortInfo_s {
-    union {
-       int     count;
-       /*@exposed@*/ /*@dependent@*/ /*@null@*/
-       rpmte   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@*/
-    rpmte tsi_chain;
-    int                tsi_reqx;
-    int                tsi_qcnt;
-};
-/*@=fielduse@*/
-
-/** \ingroup rpmte
- * A single package instance to be installed/removed atomically.
- */
-struct rpmte_s {
-    rpmElementType type;       /*!< Package disposition (installed/removed). */
-
-/*@refcounted@*/ /*@null@*/
-    Header h;                  /*!< Package header. */
-/*@only@*/
-    const char * NEVR;         /*!< Package name-version-release. */
-/*@only@*/
-    const char * NEVRA;                /*!< Package name-version-release.arch. */
-/*@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. */
-
-    rpmte parent;              /*!< Parent transaction element. */
-    int degree;                        /*!< No. of immediate children. */
-    int depth;                 /*!< Max. depth in dependency tree. */
-    int npreds;                        /*!< No. of predecessors. */
-    int tree;                  /*!< Tree index. */
-/*@owned@*/
-    tsortInfo tsi;             /*!< Dependency ordering chains. */
-
-/*@refcounted@*/ /*@null@*/
-    rpmds this;                        /*!< This package's provided NEVR. */
-/*@refcounted@*/ /*@null@*/
-    rpmds provides;            /*!< Provides: dependencies. */
-/*@refcounted@*/ /*@null@*/
-    rpmds requires;            /*!< Requires: dependencies. */
-/*@refcounted@*/ /*@null@*/
-    rpmds conflicts;           /*!< Conflicts: dependencies. */
-/*@refcounted@*/ /*@null@*/
-    rpmds obsoletes;           /*!< Obsoletes: dependencies. */
-/*@refcounted@*/ /*@null@*/
-    rpmfi fi;                  /*!< File information. */
-
-    uint_32 color;             /*!< Color bit(s) from package dependencies */
-
-/*@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 { 
-/*@exposed@*/ /*@dependent@*/ /*@null@*/
-       alKey addedKey;
-       struct {
-/*@exposed@*/ /*@dependent@*/ /*@null@*/
-           alKey dependsOnKey;
-           int dboffset;
-       } removed;
-    } u;
-/*@=fielduse@*/
-
-};
-
-/**
- * Iterator across transaction elements, forward on install, backward on erase.
- */
-struct rpmtsi_s {
-/*@refcounted@*/
-    rpmts ts;          /*!< transaction set. */
-    int reverse;       /*!< reversed traversal? */
-    int ocsave;                /*!< last returned iterator index. */
-    int oc;            /*!< iterator index. */
-};
-
-#endif /* _RPMTE_INTERNAL */
+typedef rpmFlags rpmElementTypes;
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+/** \ingroup rpmte
+ * Retrieve header from transaction element.
+ * @param te           transaction element
+ * @return             header (new reference)
+ */
+Header rpmteHeader(rpmte te);
 
-/**
- * Destroy a transaction element.
+/** \ingroup rpmte
+ * Save header into transaction element.
  * @param te           transaction element
+ * @param h            header
  * @return             NULL always
  */
-/*@null@*/
-rpmte rpmteFree(/*@only@*/ /*@null@*/ rpmte te)
-       /*@globals fileSystem @*/
-       /*@modifies te, fileSystem @*/;
+Header rpmteSetHeader(rpmte te, Header h);
 
-/**
- * Create a transaction element.
- * @param ts           transaction set
- * @param h            header
- * @param type         TR_ADDED/TR_REMOVED
- * @param key          (TR_ADDED) package retrieval key (e.g. file name)
- * @param relocs       (TR_ADDED) package file relocations
- * @param dboffset     (TR_REMOVED) rpmdb instance
- * @param pkgKey       associated added package (if any)
- * @return             new transaction element
- */
-/*@only@*/ /*@null@*/
-rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
-               /*@exposed@*/ /*@dependent@*/ /*@null@*/ fnpyKey key,
-               /*@null@*/ rpmRelocation * relocs,
-               int dboffset,
-               /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey pkgKey)
-       /*@globals fileSystem @*/
-       /*@modifies ts, h, fileSystem @*/;
-
-/**
+/** \ingroup rpmte
  * Retrieve type of transaction element.
  * @param te           transaction element
  * @return             type
  */
-rpmElementType rpmteType(rpmte te)
-       /*@*/;
+rpmElementType rpmteType(rpmte te);
 
-/**
+/** \ingroup rpmte
  * Retrieve name string of transaction element.
  * @param te           transaction element
  * @return             name string
  */
-/*@observer@*/
-extern const char * rpmteN(rpmte te)
-       /*@*/;
+const char * rpmteN(rpmte te);
 
-/**
+/** \ingroup rpmte
  * Retrieve epoch string of transaction element.
  * @param te           transaction element
  * @return             epoch string
  */
-/*@observer@*/ /*@null@*/
-extern const char * rpmteE(rpmte te)
-       /*@*/;
+const char * rpmteE(rpmte te);
 
-/**
+/** \ingroup rpmte
  * Retrieve version string of transaction element.
  * @param te           transaction element
  * @return             version string
  */
-/*@observer@*/ /*@null@*/
-extern const char * rpmteV(rpmte te)
-       /*@*/;
+const char * rpmteV(rpmte te);
 
-/**
+/** \ingroup rpmte
  * Retrieve release string of transaction element.
  * @param te           transaction element
  * @return             release string
  */
-/*@observer@*/ /*@null@*/
-extern const char * rpmteR(rpmte te)
-       /*@*/;
+const char * rpmteR(rpmte te);
 
-/**
+/** \ingroup rpmte
  * Retrieve arch string of transaction element.
  * @param te           transaction element
  * @return             arch string
  */
-/*@observer@*/ /*@null@*/
-extern const char * rpmteA(rpmte te)
-       /*@*/;
+const char * rpmteA(rpmte te);
 
-/**
+/** \ingroup rpmte
  * Retrieve os string of transaction element.
  * @param te           transaction element
  * @return             os string
  */
-/*@observer@*/ /*@null@*/
-extern const char * rpmteO(rpmte 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
  */
-uint_32 rpmteColor(rpmte te)
-       /*@*/;
+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
  */
-uint_32 rpmteSetColor(rpmte te, uint_32 color)
-       /*@modifies te @*/;
-
-/**
- * Retrieve tsort tree depth of transaction element.
- * @param te           transaction element
- * @return             depth
- */
-int rpmteDepth(rpmte te)
-       /*@*/;
-
-/**
- * Set tsort tree depth of transaction element.
- * @param te           transaction element
- * @param ndepth       new depth
- * @return             previous depth
- */
-int rpmteSetDepth(rpmte te, int ndepth)
-       /*@modifies te @*/;
+rpm_color_t rpmteSetColor(rpmte te, rpm_color_t color);
 
-/**
- * Retrieve tsort no. of predecessors of transaction element.
- * @param te           transaction element
- * @return             no. of predecessors
- */
-int rpmteNpreds(rpmte te)
-       /*@*/;
-
-/**
- * Set tsort no. of predecessors of transaction element.
+/** \ingroup rpmte
+ * Retrieve last instance installed to the database.
  * @param te           transaction element
- * @param npreds       new no. of predecessors
- * @return             previous no. of predecessors
+ * @return             last install instance.
  */
-int rpmteSetNpreds(rpmte te, int npreds)
-       /*@modifies te @*/;
+unsigned int rpmteDBInstance(rpmte te);
 
-/**
- * Retrieve tree index of transaction element.
+/** \ingroup rpmte
+ * Set last instance installed to the database.
  * @param te           transaction element
- * @return             tree index
+ * @param instance     Database instance of last install element.
+ * @return             last install instance.
  */
-int rpmteTree(rpmte te)
-       /*@*/;
+void rpmteSetDBInstance(rpmte te, unsigned int instance);
 
-/**
- * Set tree index of transaction element.
+/** \ingroup rpmte
+ * Retrieve size in bytes of package file.
+ * @todo Signature header is estimated at 256b.
  * @param te           transaction element
- * @param ntree                new tree index
- * @return             previous tree index
+ * @return             size in bytes of package file.
  */
-int rpmteSetTree(rpmte te, int ntree)
-       /*@modifies te @*/;
+rpm_loff_t rpmtePkgFileSize(rpmte te);
 
-/**
+/** \ingroup rpmte
  * Retrieve parent transaction element.
  * @param te           transaction element
  * @return             parent transaction element
  */
-/*@observer@*/ /*@unused@*/
-rpmte rpmteParent(rpmte te)
-       /*@*/;
+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)
-       /*@modifies te @*/;
-
-/**
- * Retrieve number of children of transaction element.
- * @param te           transaction element
- * @return             tree index
- */
-int rpmteDegree(rpmte te)
-       /*@*/;
-
-/**
- * Set number of children of transaction element.
- * @param te           transaction element
- * @param ndegree      new number of children
- * @return             previous number of children
- */
-int rpmteSetDegree(rpmte te, int ndegree)
-       /*@modifies te @*/;
-
-/**
- * Retrieve tsort info for transaction element.
- * @param te           transaction element
- * @return             tsort info
- */
-tsortInfo rpmteTSI(rpmte te)
-       /*@*/;
+rpmte rpmteSetParent(rpmte te, rpmte pte);
 
-/**
- * Destroy tsort info of transaction element.
+/** \ingroup rpmte
+ * Return problem set info of transaction element.
  * @param te           transaction element
+ * @return             problem set (or NULL if none)
  */
-void rpmteFreeTSI(rpmte te)
-       /*@modifies te @*/;
+rpmps rpmteProblems(rpmte te);
 
-/**
- * Initialize tsort info of transaction element.
+/** \ingroup rpmte
+ * Destroy problem set info of transaction element.
  * @param te           transaction element
  */
-void rpmteNewTSI(rpmte te)
-       /*@modifies te @*/;
+void rpmteCleanProblems(rpmte te);
 
-/**
+/** \ingroup rpmte
  * Destroy dependency set info of transaction element.
  * @param te           transaction element
  */
-/*@unused@*/
-void rpmteCleanDS(rpmte te)
-       /*@modifies te @*/;
+void rpmteCleanDS(rpmte te);
 
-/**
- * Retrieve pkgKey of TR_ADDED transaction element.
- * @param te           transaction element
- * @return             pkgKey
- */
-/*@exposed@*/ /*@dependent@*/ /*@null@*/
-alKey rpmteAddedKey(rpmte te)
-       /*@*/;
-
-/**
- * Set pkgKey of TR_ADDED transaction element.
+/** \ingroup rpmte
+ * Set dependent element of TR_REMOVED transaction element.
  * @param te           transaction element
- * @param npkgKey      new pkgKey
- * @return             previous pkgKey
+ * @param depends       dependent transaction element
  */
-/*@exposed@*/ /*@dependent@*/ /*@null@*/
-alKey rpmteSetAddedKey(rpmte te,
-               /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey npkgKey)
-       /*@modifies te @*/;
+void rpmteSetDependsOn(rpmte te, rpmte depends);
 
-/**
- * Retrieve dependent pkgKey of TR_REMOVED transaction element.
+/** \ingroup rpmte
+ * Retrieve dependent element of TR_REMOVED transaction element.
  * @param te           transaction element
- * @return             dependent pkgKey
+ * @return             dependent transaction element
  */
-/*@exposed@*/ /*@dependent@*/ /*@null@*/
-alKey rpmteDependsOnKey(rpmte te)
-       /*@*/;
+rpmte rpmteDependsOn(rpmte te);
 
-/**
+/** \ingroup rpmte
  * Retrieve rpmdb instance of TR_REMOVED transaction element.
  * @param te           transaction element
  * @return             rpmdb instance
  */
-int rpmteDBOffset(rpmte te)
-       /*@*/;
+int rpmteDBOffset(rpmte te);
 
-/**
- * Retrieve name-version-release string from transaction element.
+/** \ingroup rpmte
+ * Retrieve [epoch:]version-release string from transaction element.
  * @param te           transaction element
- * @return             name-version-release string
+ * @return             [epoch:]version-release string
  */
-/*@observer@*/
-extern const char * rpmteNEVR(rpmte te)
-       /*@*/;
+const char * rpmteEVR(rpmte te);
 
-/**
- * Retrieve name-version-release.arch string from transaction element.
+/** \ingroup rpmte
+ * Retrieve name-[epoch:]version-release string from transaction element.
  * @param te           transaction element
- * @return             name-version-release.arch string
+ * @return             name-[epoch:]version-release string
  */
-/*@observer@*/
-extern const char * rpmteNEVRA(rpmte 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 rpmteFd(rpmte te)
-       /*@*/;
+const char * rpmteNEVRA(rpmte te);
 
-/**
+/** \ingroup rpmte
  * Retrieve key from transaction element.
  * @param te           transaction element
  * @return             key
  */
-/*@exposed@*/
-fnpyKey rpmteKey(rpmte te)
-       /*@*/;
+fnpyKey rpmteKey(rpmte te);
 
-/**
+/** \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 rpmteFailed(rpmte te);
+
+/** \ingroup rpmte
  * Retrieve dependency tag set from transaction element.
  * @param te           transaction element
  * @param tag          dependency tag
  * @return             dependency tag set
  */
-rpmds rpmteDS(rpmte te, rpmTag tag)
-       /*@*/;
+rpmds rpmteDS(rpmte te, rpmTagVal tag);
 
-/**
+/** \ingroup rpmte
  * Retrieve file info tag set from transaction element.
  * @param te           transaction element
- * @param tag          file info tag (RPMTAG_BASENAMES)
  * @return             file info tag set
  */
-rpmfi rpmteFI(rpmte te, rpmTag tag)
-       /*@*/;
+rpmfi rpmteFI(rpmte te);
 
-/**
- * Calculate transaction element dependency colors/refs from file info.
+/** \ingroup rpmte
+ * Retrieve list of collections
  * @param te           transaction element
- * @param tag          dependency tag (RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME)
+ * @return             list of collections
  */
-/*@-exportlocal@*/
-void rpmteColorDS(rpmte te, rpmTag tag)
-        /*@modifies te @*/;
-/*@=exportlocal@*/
+ARGV_const_t rpmteCollections(rpmte te);
 
-/**
- * Return transaction element index.
- * @param tsi          transaction element iterator
- * @return             transaction element index
- */
-int rpmtsiOc(rpmtsi tsi)
-       /*@*/;
-
-/**
- * Destroy transaction element iterator.
- * @param tsi          transaction element iterator
- * @return             NULL always
+/** \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
  */
-/*@unused@*/ /*@null@*/
-rpmtsi rpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi)
-       /*@globals fileSystem @*/
-       /*@modifies fileSystem @*/;
+int rpmteHasCollection(rpmte te, const char * collname);
 
-/**
- * Destroy transaction element iterator.
- * @param tsi          transaction element iterator
- * @param fn
- * @param ln
- * @return             NULL always
- */
-/*@null@*/
-rpmtsi XrpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi,
-               const char * fn, unsigned int ln)
-       /*@globals fileSystem @*/
-       /*@modifies fileSystem @*/;
-#define        rpmtsiFree(_tsi)        XrpmtsiFree(_tsi, __FILE__, __LINE__)
-
-/**
- * Create transaction element iterator.
- * @param ts           transaction set
- * @return             transaction element iterator
- */
-/*@unused@*/ /*@only@*/
-rpmtsi rpmtsiInit(rpmts ts)
-       /*@modifies ts @*/;
-
-/**
- * Create transaction element iterator.
- * @param ts           transaction set
- * @param fn
- * @param ln
- * @return             transaction element iterator
- */
-/*@unused@*/ /*@only@*/
-rpmtsi XrpmtsiInit(rpmts ts,
-               const char * fn, unsigned int ln)
-       /*@modifies ts @*/;
-#define        rpmtsiInit(_ts)         XrpmtsiInit(_ts, __FILE__, __LINE__)
-
-/**
- * Return next transaction element of type.
- * @param tsi          transaction element iterator
- * @param type         transaction element type selector (0 for any)
- * @return             next transaction element of type, NULL on termination
- */
-/*@dependent@*/ /*@null@*/
-rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)
-        /*@modifies tsi @*/;
 
 #ifdef __cplusplus
 }