12 #define _RPMPS_INTERNAL
32 if (_rpmpsPool == NULL) {
44 numProblems = ps->numProblems;
74 if (psi != NULL && ++psi->ix >= 0) {
88 p = psi->ps->probs + psi->ix;
105 if (ps == NULL)
return NULL;
106 yarnPossess(ps->_item.use);
109 fprintf(stderr,
"--> ps %p -- %ld %s at %s:%u\n", ps, yarnPeekLock(ps->_item.use),
"rpmpsFree", __FILE__, __LINE__);
111 if (yarnPeekLock(ps->_item.use) <= 1
L) {
114 for (i = 0; i < ps->numProblems; i++) {
116 p->pkgNEVR =
_free(p->pkgNEVR);
117 p->altNEVR =
_free(p->altNEVR);
118 p->str1 =
_free(p->str1);
120 ps->probs =
_free(ps->probs);
124 yarnTwist(ps->_item.use, BY, -1);
129 const char * pkgNEVR,
fnpyKey key,
130 const char * dn,
const char * bn,
136 if (ps == NULL)
return;
138 if (ps->numProblems == ps->numProblemsAlloced) {
139 if (ps->numProblemsAlloced)
140 ps->numProblemsAlloced *= 2;
142 ps->numProblemsAlloced = 2;
144 ps->numProblemsAlloced *
sizeof(*ps->probs));
147 p = ps->probs + ps->numProblems;
149 memset(p, 0,
sizeof(*p));
154 p->ignoreProblem = 0;
156 p->pkgNEVR = (pkgNEVR ?
xstrdup(pkgNEVR) : NULL);
157 p->altNEVR = (altNEVR ?
xstrdup(altNEVR) : NULL);
160 if (dn != NULL || bn != NULL) {
161 t =
xcalloc(1, (dn != NULL ? strlen(dn) : 0) +
162 (bn != NULL ? strlen(bn) : 0) + 1);
164 if (dn != NULL) t =
stpcpy(t, dn);
165 if (bn != NULL) t =
stpcpy(t, bn);
169 #define XSTRCMP(a, b) ((!(a) && !(b)) || ((a) && (b) && !strcmp((a), (b))))
177 if (ps == NULL || ps->numProblems == 0)
181 return (ps->numProblems == 0 ? 0 : 1);
186 while ((f - filter->probs) < filter->numProblems) {
187 if (!f->ignoreProblem) {
191 while ((t - ps->probs) < ps->numProblems) {
193 if (f->type == t->type && t->key == f->key &&
202 if ((t - ps->probs) == ps->numProblems)
205 t->ignoreProblem = f->ignoreProblem;
209 if ((t - ps->probs) < ps->numProblems)
215 #if !defined(HAVE_VSNPRINTF)
218 const char * fmt, va_list ap)
220 return vsprintf(buf, fmt, ap);
224 #if !defined(HAVE_SNPRINTF)
225 static inline int snprintf(
char * buf,
int nb,
const char * fmt, ...)
239 const char * pkgNEVR = (prob->pkgNEVR ? prob->pkgNEVR :
"?pkgNEVR?");
241 const char * altNEVR = (prob->altNEVR ? prob->altNEVR :
"? ?altNEVR?");
243 const char * str1 = (prob->str1 ? prob->str1 :
N_(
"different"));
244 size_t nb = strlen(pkgNEVR) + strlen(str1) + strlen(altNEVR) + 1024;
248 switch (prob->type) {
251 _(
"package %s is intended for a %s platform"),
256 _(
"package %s is already installed"),
261 _(
"re-packaged package with %s: %s is missing"),
266 _(
"path %s in package %s is not relocatable"),
271 _(
"file %s conflicts between attempted installs of %s and %s"),
272 str1, pkgNEVR, altNEVR);
276 _(
"file %s from install of %s conflicts with file from package %s"),
277 str1, pkgNEVR, altNEVR);
281 _(
"package %s (which is newer than %s) is already installed"),
286 _(
"installing package %s needs %lu%cB on the %s filesystem"),
288 (
unsigned long) (prob->ulong1 > (1024*1024)
289 ? (prob->ulong1 + 1024 * 1024 - 1) / (1024 * 1024)
290 : (prob->ulong1 + 1023) / 1024),
291 prob->ulong1 > (1024*1024) ?
'M' :
'K',
296 _(
"installing package %s needs %lu inodes on the %s filesystem"),
297 pkgNEVR, (
unsigned long)prob->ulong1, str1);
301 _(
"package %s pre-transaction syscall(s): %s failed: %s"),
302 pkgNEVR, str1, strerror((
int)(prob->ulong1)));
305 rc =
snprintf(buf, nb,
_(
"%s is needed by %s%s"),
307 (prob->ulong1 ?
"" :
_(
"(installed) ")), pkgNEVR);
310 rc =
snprintf(buf, nb,
_(
"%s conflicts with %s%s"),
312 (prob->ulong1 ?
"" :
_(
"(installed) ")), pkgNEVR);
316 _(
"installing package %s on %s rdonly filesystem"),
321 _(
"unknown error %d encountered while manipulating package %s"),
322 prob->type, pkgNEVR);
333 if (ap->type != bp->type)
336 if (bp->pkgNEVR && strcmp(ap->pkgNEVR, bp->pkgNEVR))
339 if (bp->altNEVR && strcmp(ap->altNEVR, bp->altNEVR))
342 if (bp->str1 && strcmp(ap->str1, bp->str1))
345 if (ap->ulong1 != bp->ulong1)
357 if (ps == NULL || ps->probs == NULL || ps->numProblems <= 0)
369 if (p->ignoreProblem)
384 fprintf(fp,
"\t%s\n", msg);
397 num = ps->numProblems - 1;
398 if (num >= ps->numProblems)
400 return (ps->probs + num);
405 return prob->pkgNEVR;
410 return prob->altNEVR;