Split rpm problem type + its "methods" to separate source + header
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 25 Mar 2010 14:46:39 +0000 (16:46 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Thu, 25 Mar 2010 14:46:39 +0000 (16:46 +0200)
- rpmps is just something that stores rpm problems, problems themselves
  are individual and opaque "objects", deserving their own module

Makefile.am
lib/Makefile.am
lib/rpmprob.c [new file with mode: 0644]
lib/rpmprob.h [new file with mode: 0644]
lib/rpmps.c
lib/rpmps.h
po/POTFILES.in
preinstall.am

index 6cd0bdd..9daf00a 100644 (file)
@@ -60,6 +60,7 @@ pkginclude_HEADERS += lib/rpmds.h
 pkginclude_HEADERS += lib/rpmfi.h
 pkginclude_HEADERS += lib/rpmlegacy.h
 pkginclude_HEADERS += lib/rpmps.h
+pkginclude_HEADERS += lib/rpmprob.h
 pkginclude_HEADERS += lib/rpmtag.h
 pkginclude_HEADERS += lib/rpmtd.h
 pkginclude_HEADERS += lib/rpmte.h
index 7d183f7..0f2ab34 100644 (file)
@@ -28,7 +28,7 @@ librpm_la_SOURCES = \
        poptALL.c poptI.c poptQV.c psm.c psm.h query.c \
        rpmal.c rpmal.h rpmchecksig.c rpmds.c rpmfi.c rpmfi_internal.h \
        rpmgi.h rpmgi.c rpminstall.c rpmts_internal.h \
-       rpmlead.c rpmlead.h rpmps.c rpmrc.c \
+       rpmlead.c rpmlead.h rpmps.c rpmprob.c rpmrc.c \
        rpmte.c rpmte_internal.h rpmts.c rpmfs.h rpmfs.c \
        rpmvercmp.c signature.c signature.h transaction.c \
        verify.c rpmlock.c rpmlock.h misc.h \
diff --git a/lib/rpmprob.c b/lib/rpmprob.c
new file mode 100644 (file)
index 0000000..1a5eef2
--- /dev/null
@@ -0,0 +1,217 @@
+/**
+ * \file lib/rpmps.c
+ */
+
+#include "system.h"
+
+#include <inttypes.h>
+#include <stdlib.h>
+
+#include <rpm/rpmstring.h>
+#include <rpm/rpmprob.h>
+
+#include "debug.h"
+
+struct rpmProblem_s {
+    char * pkgNEVR;
+    char * altNEVR;
+    fnpyKey key;
+    rpmProblemType type;
+    char * str1;
+    uint64_t num1;
+    int nrefs;
+};
+
+rpmProblem rpmProblemCreate(rpmProblemType type,
+                            const char * pkgNEVR,
+                            fnpyKey key,
+                            const char * dn, const char * bn,
+                            const char * altNEVR,
+                            uint64_t number)
+{
+    rpmProblem p = xcalloc(1, sizeof(*p));
+    char *t;
+
+    p->type = type;
+    p->key = key;
+    p->num1 = number;
+
+    p->pkgNEVR = (pkgNEVR ? xstrdup(pkgNEVR) : NULL);
+    p->altNEVR = (altNEVR ? xstrdup(altNEVR) : NULL);
+
+    p->str1 = NULL;
+    if (dn != NULL || bn != NULL) {
+        t = xcalloc(1,  (dn != NULL ? strlen(dn) : 0) +
+                        (bn != NULL ? strlen(bn) : 0) + 1);
+        p->str1 = t;
+        if (dn != NULL) t = stpcpy(t, dn);
+        if (bn != NULL) t = stpcpy(t, bn);
+    }
+    return rpmProblemLink(p);
+}
+
+rpmProblem rpmProblemFree(rpmProblem prob)
+{
+    if (prob == NULL) return NULL;
+
+    if (prob->nrefs > 1) {
+       return rpmProblemUnlink(prob);
+    }
+    prob->pkgNEVR = _free(prob->pkgNEVR);
+    prob->altNEVR = _free(prob->altNEVR);
+    prob->str1 = _free(prob->str1);
+    free(prob);
+    return NULL;
+}
+
+rpmProblem rpmProblemLink(rpmProblem prob)
+{
+    if (prob) {
+       prob->nrefs++;
+    }
+    return prob;
+}
+
+rpmProblem rpmProblemUnlink(rpmProblem prob)
+{
+    if (prob) {
+       prob->nrefs--;
+    }
+    return NULL;
+}
+
+const char * rpmProblemGetPkgNEVR(rpmProblem p)
+{
+    return (p->pkgNEVR);
+}
+
+const char * rpmProblemGetAltNEVR(rpmProblem p)
+{
+    return (p->altNEVR);
+}
+
+fnpyKey rpmProblemGetKey(rpmProblem p)
+{
+    return (p->key);
+}
+
+rpmProblemType rpmProblemGetType(rpmProblem p)
+{
+    return (p->type);
+}
+
+const char * rpmProblemGetStr(rpmProblem p)
+{
+    return (p->str1);
+}
+
+rpm_loff_t rpmProblemGetDiskNeed(rpmProblem p)
+{
+    return (p->num1);
+}
+
+char * rpmProblemString(rpmProblem prob)
+{
+    const char * pkgNEVR = (prob->pkgNEVR ? prob->pkgNEVR : "?pkgNEVR?");
+    const char * altNEVR = (prob->altNEVR ? prob->altNEVR : "? ?altNEVR?");
+    const char * str1 = (prob->str1 ? prob->str1 : N_("different"));
+    char * buf = NULL;
+    int rc;
+
+    switch (prob->type) {
+    case RPMPROB_BADARCH:
+       rc = rasprintf(&buf, _("package %s is intended for a %s architecture"),
+               pkgNEVR, str1);
+       break;
+    case RPMPROB_BADOS:
+       rc = rasprintf(&buf,
+               _("package %s is intended for a %s operating system"),
+               pkgNEVR, str1);
+       break;
+    case RPMPROB_PKG_INSTALLED:
+       rc = rasprintf(&buf, _("package %s is already installed"),
+               pkgNEVR);
+       break;
+    case RPMPROB_BADRELOCATE:
+       rc = rasprintf(&buf, _("path %s in package %s is not relocatable"),
+               str1, pkgNEVR);
+       break;
+    case RPMPROB_NEW_FILE_CONFLICT:
+       rc = rasprintf(&buf, 
+               _("file %s conflicts between attempted installs of %s and %s"),
+               str1, pkgNEVR, altNEVR);
+       break;
+    case RPMPROB_FILE_CONFLICT:
+       rc = rasprintf(&buf,
+           _("file %s from install of %s conflicts with file from package %s"),
+               str1, pkgNEVR, altNEVR);
+       break;
+    case RPMPROB_OLDPACKAGE:
+       rc = rasprintf(&buf,
+               _("package %s (which is newer than %s) is already installed"),
+               altNEVR, pkgNEVR);
+       break;
+    case RPMPROB_DISKSPACE:
+       rc = rasprintf(&buf,
+           _("installing package %s needs %" PRIu64 "%cB on the %s filesystem"),
+               pkgNEVR,
+               prob->num1 > (1024*1024)
+                   ? (prob->num1 + 1024 * 1024 - 1) / (1024 * 1024)
+                   : (prob->num1 + 1023) / 1024,
+               prob->num1 > (1024*1024) ? 'M' : 'K',
+               str1);
+       break;
+    case RPMPROB_DISKNODES:
+       rc = rasprintf(&buf,
+           _("installing package %s needs %" PRIu64 " inodes on the %s filesystem"),
+               pkgNEVR, prob->num1, str1);
+       break;
+    case RPMPROB_REQUIRES:
+       rc = rasprintf(&buf, _("%s is needed by %s%s"),
+               altNEVR+2,
+               (prob->num1 ? "" : _("(installed) ")), pkgNEVR);
+       break;
+    case RPMPROB_CONFLICT:
+       rc = rasprintf(&buf, _("%s conflicts with %s%s"),
+               altNEVR+2,
+               (prob->num1 ? "" : _("(installed) ")), pkgNEVR);
+       break;
+    case RPMPROB_OBSOLETES:
+       rc = rasprintf(&buf, _("%s is obsoleted by %s%s"),
+               altNEVR+2,
+               (prob->num1 ? "" : _("(installed) ")), pkgNEVR);
+       break;
+    default:
+       rc = rasprintf(&buf,
+               _("unknown error %d encountered while manipulating package %s"),
+               prob->type, pkgNEVR);
+       break;
+    }
+
+    return buf;
+}
+
+static int cmpStr(const char *s1, const char *s2)
+{
+    if (s1 == s2) return 0;
+    if (s1 && s2) return strcmp(s1, s2);
+    return 1;
+}
+
+int rpmProblemCompare(rpmProblem ap, rpmProblem bp)
+{
+    if (ap->type != bp->type)
+       return 1;
+    if (ap->key != bp->key)
+       return 1;
+    if (ap->num1 != bp->num1)
+       return 1;
+    if (cmpStr(ap->pkgNEVR, bp->pkgNEVR))
+       return 1;
+    if (cmpStr(ap->altNEVR, bp->altNEVR))
+       return 1;
+    if (cmpStr(ap->str1, bp->str1))
+       return 1;
+
+    return 0;
+}
diff --git a/lib/rpmprob.h b/lib/rpmprob.h
new file mode 100644 (file)
index 0000000..e23e839
--- /dev/null
@@ -0,0 +1,156 @@
+#ifndef _RPMPROB_H
+#define _RPMPROB_H
+
+/** \ingroup rpmprob
+ * \file lib/rpmprob.h
+ * Structures and prototypes used for an rpm problem item.
+ */
+
+#include <stdio.h>
+#include <rpm/rpmtypes.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct rpmProblem_s * rpmProblem;
+
+/** \ingroup rpmprob
+ * @todo Generalize filter mechanism.
+ */
+typedef enum rpmprobFilterFlags_e {
+    RPMPROB_FILTER_NONE                = 0,
+    RPMPROB_FILTER_IGNOREOS    = (1 << 0),     /*!< from --ignoreos */
+    RPMPROB_FILTER_IGNOREARCH  = (1 << 1),     /*!< from --ignorearch */
+    RPMPROB_FILTER_REPLACEPKG  = (1 << 2),     /*!< from --replacepkgs */
+    RPMPROB_FILTER_FORCERELOCATE= (1 << 3),    /*!< from --badreloc */
+    RPMPROB_FILTER_REPLACENEWFILES= (1 << 4),  /*!< from --replacefiles */
+    RPMPROB_FILTER_REPLACEOLDFILES= (1 << 5),  /*!< from --replacefiles */
+    RPMPROB_FILTER_OLDPACKAGE  = (1 << 6),     /*!< from --oldpackage */
+    RPMPROB_FILTER_DISKSPACE   = (1 << 7),     /*!< from --ignoresize */
+    RPMPROB_FILTER_DISKNODES   = (1 << 8)      /*!< from --ignoresize */
+} rpmprobFilterFlags;
+
+/** \ingroup rpmprob
+ * Enumerate transaction set problem types.
+ */
+typedef enum rpmProblemType_e {
+    RPMPROB_BADARCH,   /*!< package ... is for a different architecture */
+    RPMPROB_BADOS,     /*!< package ... is for a different operating system */
+    RPMPROB_PKG_INSTALLED, /*!< package ... is already installed */
+    RPMPROB_BADRELOCATE,/*!< path ... is not relocatable for package ... */
+    RPMPROB_REQUIRES,  /*!< package ... has unsatisfied Requires: ... */
+    RPMPROB_CONFLICT,  /*!< package ... has unsatisfied Conflicts: ... */
+    RPMPROB_NEW_FILE_CONFLICT, /*!< file ... conflicts between attemped installs of ... */
+    RPMPROB_FILE_CONFLICT,/*!< file ... from install of ... conflicts with file from package ... */
+    RPMPROB_OLDPACKAGE,        /*!< package ... (which is newer than ...) is already installed */
+    RPMPROB_DISKSPACE, /*!< installing package ... needs ... on the ... filesystem */
+    RPMPROB_DISKNODES, /*!< installing package ... needs ... on the ... filesystem */
+    RPMPROB_OBSOLETES, /*!< package ... is obsoleted by ... */
+ } rpmProblemType;
+
+/** \ingroup rpmprob
+ * Create a problem item.
+ * @param type         type of problem
+ * @param pkgNEVR      package name
+ * @param key          filename or python object address
+ * @param dn           directory name
+ * @param bn           file base name
+ * @param altNEVR      related (e.g. through a dependency) package name
+ * @param number       generic number attribute
+ * @return             rpmProblem
+ */
+rpmProblem rpmProblemCreate(rpmProblemType type,
+                            const char * pkgNEVR,
+                            fnpyKey key,
+                            const char * dn, const char * bn,
+                            const char * altNEVR,
+                            uint64_t number);
+
+/** \ingroup rpmprob
+ * Destroy a problem item.
+ * @param prob         rpm problem
+ * @return             rpm problem (NULL)
+ */
+rpmProblem rpmProblemFree(rpmProblem prob);
+
+/** \ingroup rpmprob
+ * Reference an rpmProblem instance
+ * @param prob         rpm problem
+ * @return             rpm problem
+ */
+rpmProblem rpmProblemLink(rpmProblem prob);
+
+/** \ingroup rpmprob
+ * Unreference an rpmProblem instance
+ * @param prob         rpm problem
+ * @return             rpm problem
+ */
+rpmProblem rpmProblemUnlink(rpmProblem prob);
+
+/** \ingroup rpmprob
+ * Compare two problems for equality.
+ * @param ap           1st problem
+ * @param bp           2nd problem
+ * @return             1 if the problems differ, 0 otherwise
+ */
+int rpmProblemCompare(rpmProblem ap, rpmProblem bp);
+
+/** \ingroup rpmprob
+ * Return package NEVR
+ * @param prob         rpm problem
+ * @return             package NEVR
+ */
+
+const char * rpmProblemGetPkgNEVR(rpmProblem prob);
+/** \ingroup rpmprob
+ * Return related (e.g. through a dependency) package NEVR
+ * @param prob         rpm problem
+ * @return             related (e.g. through a dependency) package NEVR
+ */
+const char * rpmProblemGetAltNEVR(rpmProblem prob);
+
+/** \ingroup rpmprob
+ * Return type of problem (dependency, diskpace etc)
+ * @param prob         rpm problem
+ * @return             type of problem
+ */
+
+rpmProblemType rpmProblemGetType(rpmProblem prob);
+
+/** \ingroup rpmprob
+ * Return filename or python object address of a problem
+ * @param prob         rpm problem
+ * @return             filename or python object address
+ */
+fnpyKey rpmProblemGetKey(rpmProblem prob);
+
+/** \ingroup rpmprob
+ * Return a generic data string from a problem
+ * @param prob         rpm problem
+ * @return             a generic data string
+ * @todo               needs a better name
+ */
+const char * rpmProblemGetStr(rpmProblem prob);
+
+/** \ingroup rpmprob
+ * Return disk requirement (needed disk space / number of inodes)
+ * depending on problem type. On problem types other than RPMPROB_DISKSPACE
+ * and RPMPROB_DISKNODES return value is undefined.
+ * @param prob         rpm problem
+ * @return             disk requirement
+ */
+rpm_loff_t rpmProblemGetDiskNeed(rpmProblem prob);
+
+/** \ingroup rpmprob
+ * Return formatted string representation of a problem.
+ * @param prob         rpm problem
+ * @return             formatted string (malloc'd)
+ */
+char * rpmProblemString(rpmProblem prob);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RPMPROB_H */
index 031a5a0..46e4a08 100644 (file)
 
 #include "debug.h"
 
-/**
- */
-struct rpmProblem_s {
-    char * pkgNEVR;
-    char * altNEVR;
-    fnpyKey key;
-    rpmProblemType type;
-    char * str1;
-    uint64_t num1;
-    int nrefs;
-};
-
-/**
- */
 struct rpmps_s {
     int numProblems;           /*!< Current probs array size. */
     int numProblemsAlloced;    /*!< Allocated probs array size. */
@@ -198,200 +184,6 @@ int rpmpsTrim(rpmps ps, rpmps filter)
     return gotProblems;
 }
 
-rpmProblem rpmProblemCreate(rpmProblemType type,
-                            const char * pkgNEVR,
-                            fnpyKey key,
-                            const char * dn, const char * bn,
-                            const char * altNEVR,
-                            uint64_t number)
-{
-    rpmProblem p = xcalloc(1, sizeof(*p));
-    char *t;
-
-    p->type = type;
-    p->key = key;
-    p->num1 = number;
-
-    p->pkgNEVR = (pkgNEVR ? xstrdup(pkgNEVR) : NULL);
-    p->altNEVR = (altNEVR ? xstrdup(altNEVR) : NULL);
-
-    p->str1 = NULL;
-    if (dn != NULL || bn != NULL) {
-        t = xcalloc(1,  (dn != NULL ? strlen(dn) : 0) +
-                        (bn != NULL ? strlen(bn) : 0) + 1);
-        p->str1 = t;
-        if (dn != NULL) t = stpcpy(t, dn);
-        if (bn != NULL) t = stpcpy(t, bn);
-    }
-    return rpmProblemLink(p);
-}
-
-rpmProblem rpmProblemFree(rpmProblem prob)
-{
-    if (prob == NULL) return NULL;
-
-    if (prob->nrefs > 1) {
-       return rpmProblemUnlink(prob);
-    }
-    prob->pkgNEVR = _free(prob->pkgNEVR);
-    prob->altNEVR = _free(prob->altNEVR);
-    prob->str1 = _free(prob->str1);
-    free(prob);
-    return NULL;
-}
-
-rpmProblem rpmProblemLink(rpmProblem prob)
-{
-    if (prob) {
-       prob->nrefs++;
-    }
-    return prob;
-}
-
-rpmProblem rpmProblemUnlink(rpmProblem prob)
-{
-    if (prob) {
-       prob->nrefs--;
-    }
-    return NULL;
-}
-
-const char * rpmProblemGetPkgNEVR(const rpmProblem p)
-{
-    return (p->pkgNEVR);
-}
-
-const char * rpmProblemGetAltNEVR(const rpmProblem p)
-{
-    return (p->altNEVR);
-}
-
-fnpyKey rpmProblemGetKey(const rpmProblem p)
-{
-    return (p->key);
-}
-
-rpmProblemType rpmProblemGetType(const rpmProblem p)
-{
-    return (p->type);
-}
-
-const char * rpmProblemGetStr(const rpmProblem p)
-{
-    return (p->str1);
-}
-
-rpm_loff_t rpmProblemGetDiskNeed(const rpmProblem p)
-{
-    return (p->num1);
-}
-
-char * rpmProblemString(const rpmProblem prob)
-{
-    const char * pkgNEVR = (prob->pkgNEVR ? prob->pkgNEVR : "?pkgNEVR?");
-    const char * altNEVR = (prob->altNEVR ? prob->altNEVR : "? ?altNEVR?");
-    const char * str1 = (prob->str1 ? prob->str1 : N_("different"));
-    char * buf = NULL;
-    int rc;
-
-    switch (prob->type) {
-    case RPMPROB_BADARCH:
-       rc = rasprintf(&buf, _("package %s is intended for a %s architecture"),
-               pkgNEVR, str1);
-       break;
-    case RPMPROB_BADOS:
-       rc = rasprintf(&buf,
-               _("package %s is intended for a %s operating system"),
-               pkgNEVR, str1);
-       break;
-    case RPMPROB_PKG_INSTALLED:
-       rc = rasprintf(&buf, _("package %s is already installed"),
-               pkgNEVR);
-       break;
-    case RPMPROB_BADRELOCATE:
-       rc = rasprintf(&buf, _("path %s in package %s is not relocatable"),
-               str1, pkgNEVR);
-       break;
-    case RPMPROB_NEW_FILE_CONFLICT:
-       rc = rasprintf(&buf, 
-               _("file %s conflicts between attempted installs of %s and %s"),
-               str1, pkgNEVR, altNEVR);
-       break;
-    case RPMPROB_FILE_CONFLICT:
-       rc = rasprintf(&buf,
-           _("file %s from install of %s conflicts with file from package %s"),
-               str1, pkgNEVR, altNEVR);
-       break;
-    case RPMPROB_OLDPACKAGE:
-       rc = rasprintf(&buf,
-               _("package %s (which is newer than %s) is already installed"),
-               altNEVR, pkgNEVR);
-       break;
-    case RPMPROB_DISKSPACE:
-       rc = rasprintf(&buf,
-           _("installing package %s needs %" PRIu64 "%cB on the %s filesystem"),
-               pkgNEVR,
-               prob->num1 > (1024*1024)
-                   ? (prob->num1 + 1024 * 1024 - 1) / (1024 * 1024)
-                   : (prob->num1 + 1023) / 1024,
-               prob->num1 > (1024*1024) ? 'M' : 'K',
-               str1);
-       break;
-    case RPMPROB_DISKNODES:
-       rc = rasprintf(&buf,
-           _("installing package %s needs %" PRIu64 " inodes on the %s filesystem"),
-               pkgNEVR, prob->num1, str1);
-       break;
-    case RPMPROB_REQUIRES:
-       rc = rasprintf(&buf, _("%s is needed by %s%s"),
-               altNEVR+2,
-               (prob->num1 ? "" : _("(installed) ")), pkgNEVR);
-       break;
-    case RPMPROB_CONFLICT:
-       rc = rasprintf(&buf, _("%s conflicts with %s%s"),
-               altNEVR+2,
-               (prob->num1 ? "" : _("(installed) ")), pkgNEVR);
-       break;
-    case RPMPROB_OBSOLETES:
-       rc = rasprintf(&buf, _("%s is obsoleted by %s%s"),
-               altNEVR+2,
-               (prob->num1 ? "" : _("(installed) ")), pkgNEVR);
-       break;
-    default:
-       rc = rasprintf(&buf,
-               _("unknown error %d encountered while manipulating package %s"),
-               prob->type, pkgNEVR);
-       break;
-    }
-
-    return buf;
-}
-
-static int cmpStr(const char *s1, const char *s2)
-{
-    if (s1 == s2) return 0;
-    if (s1 && s2) return strcmp(s1, s2);
-    return 1;
-}
-
-int rpmProblemCompare(rpmProblem ap, rpmProblem bp)
-{
-    if (ap->type != bp->type)
-       return 1;
-    if (ap->key != bp->key)
-       return 1;
-    if (ap->num1 != bp->num1)
-       return 1;
-    if (cmpStr(ap->pkgNEVR, bp->pkgNEVR))
-       return 1;
-    if (cmpStr(ap->altNEVR, bp->altNEVR))
-       return 1;
-    if (cmpStr(ap->str1, bp->str1))
-       return 1;
-
-    return 0;
-}
-
 void rpmpsPrint(FILE *fp, rpmps ps)
 {
     char * msg = NULL;
index fa9d145..526b24a 100644 (file)
 
 #include <stdio.h>
 #include <rpm/rpmtypes.h>
+#include <rpm/rpmprob.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /** \ingroup rpmps
- * @todo Generalize filter mechanism.
- */
-typedef enum rpmprobFilterFlags_e {
-    RPMPROB_FILTER_NONE                = 0,
-    RPMPROB_FILTER_IGNOREOS    = (1 << 0),     /*!< from --ignoreos */
-    RPMPROB_FILTER_IGNOREARCH  = (1 << 1),     /*!< from --ignorearch */
-    RPMPROB_FILTER_REPLACEPKG  = (1 << 2),     /*!< from --replacepkgs */
-    RPMPROB_FILTER_FORCERELOCATE= (1 << 3),    /*!< from --badreloc */
-    RPMPROB_FILTER_REPLACENEWFILES= (1 << 4),  /*!< from --replacefiles */
-    RPMPROB_FILTER_REPLACEOLDFILES= (1 << 5),  /*!< from --replacefiles */
-    RPMPROB_FILTER_OLDPACKAGE  = (1 << 6),     /*!< from --oldpackage */
-    RPMPROB_FILTER_DISKSPACE   = (1 << 7),     /*!< from --ignoresize */
-    RPMPROB_FILTER_DISKNODES   = (1 << 8)      /*!< from --ignoresize */
-} rpmprobFilterFlags;
-
-/**
- * Raw data for an element of a problem set.
- */
-typedef struct rpmProblem_s * rpmProblem;
-
-/** \ingroup rpmps
  * Problem set iterator
  */
 typedef struct rpmpsi_s * rpmpsi;
 
 /** \ingroup rpmps
- * Enumerate transaction set problem types.
- */
-typedef enum rpmProblemType_e {
-    RPMPROB_BADARCH,   /*!< package ... is for a different architecture */
-    RPMPROB_BADOS,     /*!< package ... is for a different operating system */
-    RPMPROB_PKG_INSTALLED, /*!< package ... is already installed */
-    RPMPROB_BADRELOCATE,/*!< path ... is not relocatable for package ... */
-    RPMPROB_REQUIRES,  /*!< package ... has unsatisfied Requires: ... */
-    RPMPROB_CONFLICT,  /*!< package ... has unsatisfied Conflicts: ... */
-    RPMPROB_NEW_FILE_CONFLICT, /*!< file ... conflicts between attemped installs of ... */
-    RPMPROB_FILE_CONFLICT,/*!< file ... from install of ... conflicts with file from package ... */
-    RPMPROB_OLDPACKAGE,        /*!< package ... (which is newer than ...) is already installed */
-    RPMPROB_DISKSPACE, /*!< installing package ... needs ... on the ... filesystem */
-    RPMPROB_DISKNODES, /*!< installing package ... needs ... on the ... filesystem */
-    RPMPROB_OBSOLETES, /*!< package ... is obsoleted by ... */
- } rpmProblemType;
-
-/** \ingroup rpmps
- * Create a problem item.
- * @param type         type of problem
- * @param pkgNEVR      package name
- * @param key          filename or python object address
- * @param dn           directory name
- * @param bn           file base name
- * @param altNEVR      related (e.g. through a dependency) package name
- * @param number       generic number attribute
- * @return             rpmProblem
- */
-rpmProblem rpmProblemCreate(rpmProblemType type,
-                            const char * pkgNEVR,
-                            fnpyKey key,
-                            const char * dn, const char * bn,
-                            const char * altNEVR,
-                            uint64_t number);
-
-/** \ingroup rpmps
- * Destroy a problem item.
- * @param prob         rpm problem
- * @return             rpm problem (NULL)
- */
-rpmProblem rpmProblemFree(rpmProblem prob);
-
-/** \ingroup rpmps
- * Reference an rpmProblem instance
- * @param prob         rpm problem
- * @return             rpm problem
- */
-rpmProblem rpmProblemLink(rpmProblem prob);
-
-/** \ingroup rpmps
- * Unreference an rpmProblem instance
- * @param prob         rpm problem
- * @return             rpm problem
- */
-rpmProblem rpmProblemUnlink(rpmProblem prob);
-
-/** \ingroup rpmps
- * Compare two problems for equality.
- * @param ap           1st problem
- * @param bp           2nd problem
- * @return             1 if the problems differ, 0 otherwise
- */
-int rpmProblemCompare(rpmProblem ap, rpmProblem bp);
-
-/** \ingroup rpmps
- * Return package NEVR
- * @param prob         rpm problem
- * @return             package NEVR
- */
-const char * rpmProblemGetPkgNEVR(const rpmProblem prob);
-/** \ingroup rpmps
- * Return related (e.g. through a dependency) package NEVR
- * @param prob         rpm problem
- * @return             related (e.g. through a dependency) package NEVR
- */
-const char * rpmProblemGetAltNEVR(const rpmProblem prob);
-
-/** \ingroup rpmps
- * Return type of problem (dependency, diskpace etc)
- * @param prob         rpm problem
- * @return             type of problem
- */
-
-rpmProblemType rpmProblemGetType(const rpmProblem prob);
-
-/** \ingroup rpmps
- * Return filename or python object address of a problem
- * @param prob         rpm problem
- * @return             filename or python object address
- */
-fnpyKey rpmProblemGetKey(const rpmProblem prob);
-
-/** \ingroup rpmps
- * Return a generic data string from a problem
- * @param prob         rpm problem
- * @return             a generic data string
- * @todo               needs a better name
- */
-const char * rpmProblemGetStr(const rpmProblem prob);
-
-/** \ingroup rpmps
- * Return disk requirement (needed disk space / number of inodes)
- * depending on problem type. On problem types other than RPMPROB_DISKSPACE
- * and RPMPROB_DISKNODES return value is undefined.
- * @param prob         rpm problem
- * @return             disk requirement
- */
-rpm_loff_t rpmProblemGetDiskNeed(const rpmProblem prob);
-
-/** \ingroup rpmps
- * Return formatted string representation of a problem.
- * @param prob         rpm problem
- * @return             formatted string (malloc'd)
- */
-char * rpmProblemString(const rpmProblem prob);
-
-/** \ingroup rpmps
  * Unreference a problem set instance.
  * @param ps           problem set
  * @return             problem set
index 7d0af6f..f36da0d 100644 (file)
@@ -46,6 +46,7 @@ lib/rpmgi.c
 lib/rpminstall.c
 lib/rpmlead.c
 lib/rpmlock.c
+lib/rpmprob.c
 lib/rpmps.c
 lib/rpmrc.c
 lib/rpmtd.c
index eca2f28..ab3a072 100644 (file)
@@ -82,6 +82,10 @@ include/rpm/rpmps.h: lib/rpmps.h include/rpm/$(dirstamp)
        $(INSTALL_DATA) $(top_srcdir)/lib/rpmps.h include/rpm/rpmps.h
 BUILT_SOURCES += include/rpm/rpmps.h
 CLEANFILES += include/rpm/rpmps.h
+include/rpm/rpmprob.h: lib/rpmprob.h include/rpm/$(dirstamp)
+       $(INSTALL_DATA) $(top_srcdir)/lib/rpmprob.h include/rpm/rpmprob.h
+BUILT_SOURCES += include/rpm/rpmprob.h
+CLEANFILES += include/rpm/rpmprob.h
 include/rpm/rpmtag.h: lib/rpmtag.h include/rpm/$(dirstamp)
        $(INSTALL_DATA) $(top_srcdir)/lib/rpmtag.h include/rpm/rpmtag.h
 BUILT_SOURCES += include/rpm/rpmtag.h