diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2010-03-25 16:46:39 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2010-03-25 16:46:39 +0200 |
commit | 37ed237fbea3a8df3efab0e7c09331a63d733bce (patch) | |
tree | e0b641843d3f42a22bbd421a6057aef9b3e81453 | |
parent | ae15f440b63daabe2c280086da69890b9f22bc69 (diff) | |
download | librpm-tizen-37ed237fbea3a8df3efab0e7c09331a63d733bce.tar.gz librpm-tizen-37ed237fbea3a8df3efab0e7c09331a63d733bce.tar.bz2 librpm-tizen-37ed237fbea3a8df3efab0e7c09331a63d733bce.zip |
Split rpm problem type + its "methods" to separate source + header
- rpmps is just something that stores rpm problems, problems themselves
are individual and opaque "objects", deserving their own module
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | lib/Makefile.am | 2 | ||||
-rw-r--r-- | lib/rpmprob.c | 217 | ||||
-rw-r--r-- | lib/rpmprob.h | 156 | ||||
-rw-r--r-- | lib/rpmps.c | 208 | ||||
-rw-r--r-- | lib/rpmps.h | 139 | ||||
-rw-r--r-- | po/POTFILES.in | 1 | ||||
-rw-r--r-- | preinstall.am | 4 |
8 files changed, 381 insertions, 347 deletions
diff --git a/Makefile.am b/Makefile.am index 6cd0bdd8d..9daf00a11 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/lib/Makefile.am b/lib/Makefile.am index 7d183f7a6..0f2ab34be 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -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 index 000000000..1a5eef24e --- /dev/null +++ b/lib/rpmprob.c @@ -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 index 000000000..e23e839d2 --- /dev/null +++ b/lib/rpmprob.h @@ -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 */ diff --git a/lib/rpmps.c b/lib/rpmps.c index 031a5a0ed..46e4a0866 100644 --- a/lib/rpmps.c +++ b/lib/rpmps.c @@ -12,20 +12,6 @@ #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; diff --git a/lib/rpmps.h b/lib/rpmps.h index fa9d14508..526b24ac1 100644 --- a/lib/rpmps.h +++ b/lib/rpmps.h @@ -8,155 +8,18 @@ #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 diff --git a/po/POTFILES.in b/po/POTFILES.in index 7d0af6f39..f36da0d56 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -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 diff --git a/preinstall.am b/preinstall.am index eca2f2817..ab3a072d3 100644 --- a/preinstall.am +++ b/preinstall.am @@ -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 |