2 * Copyright (c) 2007-2009, Novell Inc.
4 * This program is licensed under the BSD license, read LICENSE.BSD
5 * for further information
11 * The pool contains information about solvables
12 * stored optimized for memory consumption and fast retrieval.
24 #include "poolid_private.h"
30 #define SOLVABLE_BLOCK 255
32 #define KNOWNID_INITIALIZE
34 #undef KNOWNID_INITIALIZE
43 pool = (Pool *)solv_calloc(1, sizeof(*pool));
45 stringpool_init (&pool->ss, initpool_data);
47 /* alloc space for RelDep 0 */
48 pool->rels = solv_extend_resize(0, 1, sizeof(Reldep), REL_BLOCK);
50 memset(pool->rels, 0, sizeof(Reldep));
52 /* alloc space for Solvable 0 and system solvable */
53 pool->solvables = solv_extend_resize(0, 2, sizeof(Solvable), SOLVABLE_BLOCK);
55 memset(pool->solvables, 0, 2 * sizeof(Solvable));
57 /* initialize the system solvable */
58 s = pool->solvables + SYSTEMSOLVABLE;
59 s->name = SYSTEM_SYSTEM;
60 s->arch = ARCH_NOARCH;
63 queue_init(&pool->vendormap);
65 pool->debugmask = SOLV_DEBUG_RESULT; /* FIXME */
67 pool->allowselfconflicts = 1;
70 pool->obsoleteusescolors = 1;
73 pool->disttype = DISTTYPE_DEB;
76 pool->obsoleteusesprovides = 1;
77 pool->implicitobsoleteusesprovides = 1;
83 /* free all the resources of our pool */
89 pool_freewhatprovides(pool);
90 pool_freeidhashes(pool);
91 pool_freeallrepos(pool, 1);
92 solv_free(pool->id2arch);
93 solv_free(pool->id2color);
94 solv_free(pool->solvables);
95 stringpool_free(&pool->ss);
96 solv_free(pool->rels);
97 pool_setvendorclasses(pool, 0);
98 queue_free(&pool->vendormap);
99 for (i = 0; i < POOL_TMPSPACEBUF; i++)
100 solv_free(pool->tmpspace.buf[i]);
101 for (i = 0; i < pool->nlanguages; i++)
102 free((char *)pool->languages[i]);
103 solv_free(pool->languages);
104 solv_free(pool->languagecache);
109 pool_freeallrepos(Pool *pool, int reuseids)
113 pool_freewhatprovides(pool);
114 for (i = 1; i < pool->nrepos; i++)
116 repo_freedata(pool->repos[i]);
117 pool->repos = solv_free(pool->repos);
120 /* the first two solvables don't belong to a repo */
121 pool_free_solvable_block(pool, 2, pool->nsolvables - 2, reuseids);
124 #ifdef MULTI_SEMANTICS
126 pool_setdisttype(Pool *pool, int disttype)
128 pool->disttype = disttype;
133 pool_get_flag(Pool *pool, int flag)
137 case POOL_FLAG_PROMOTEEPOCH:
138 return pool->promoteepoch;
139 case POOL_FLAG_ALLOWSELFCONFLICTS:
140 return pool->allowselfconflicts;
141 case POOL_FLAG_OBSOLETEUSESPROVIDES:
142 return pool->obsoleteusesprovides;
143 case POOL_FLAG_IMPLICITOBSOLETEUSESPROVIDES:
144 return pool->implicitobsoleteusesprovides;
145 case POOL_FLAG_OBSOLETEUSESCOLORS:
146 return pool->obsoleteusescolors;
147 case POOL_FLAG_NOINSTALLEDOBSOLETES:
148 return pool->noinstalledobsoletes;
156 pool_set_flag(Pool *pool, int flag, int value)
158 int old = pool_get_flag(pool, flag);
161 case POOL_FLAG_PROMOTEEPOCH:
162 pool->promoteepoch = value;
164 case POOL_FLAG_ALLOWSELFCONFLICTS:
165 pool->allowselfconflicts = value;
167 case POOL_FLAG_OBSOLETEUSESPROVIDES:
168 pool->obsoleteusesprovides = value;
170 case POOL_FLAG_IMPLICITOBSOLETEUSESPROVIDES:
171 pool->implicitobsoleteusesprovides = value;
173 case POOL_FLAG_OBSOLETEUSESCOLORS:
174 pool->obsoleteusescolors = value;
176 case POOL_FLAG_NOINSTALLEDOBSOLETES:
177 pool->noinstalledobsoletes = value;
187 pool_add_solvable(Pool *pool)
189 pool->solvables = solv_extend(pool->solvables, pool->nsolvables, 1, sizeof(Solvable), SOLVABLE_BLOCK);
190 memset(pool->solvables + pool->nsolvables, 0, sizeof(Solvable));
191 return pool->nsolvables++;
195 pool_add_solvable_block(Pool *pool, int count)
197 Id nsolvables = pool->nsolvables;
200 pool->solvables = solv_extend(pool->solvables, pool->nsolvables, count, sizeof(Solvable), SOLVABLE_BLOCK);
201 memset(pool->solvables + nsolvables, 0, sizeof(Solvable) * count);
202 pool->nsolvables += count;
207 pool_free_solvable_block(Pool *pool, Id start, int count, int reuseids)
211 if (reuseids && start + count == pool->nsolvables)
213 /* might want to shrink solvable array */
214 pool->nsolvables = start;
217 memset(pool->solvables + start, 0, sizeof(Solvable) * count);
222 pool_set_installed(Pool *pool, Repo *installed)
224 if (pool->installed == installed)
226 pool->installed = installed;
227 pool_freewhatprovides(pool);
231 pool_shrink_whatprovides_sortcmp(const void *ap, const void *bp, void *dp)
236 oa = pool->whatprovides[*(Id *)ap];
237 ob = pool->whatprovides[*(Id *)bp];
239 return *(Id *)ap - *(Id *)bp;
244 da = pool->whatprovidesdata + oa;
245 db = pool->whatprovidesdata + ob;
247 if ((r = (*da++ - *db++)) != 0)
251 return *(Id *)ap - *(Id *)bp;
255 * pool_shrink_whatprovides - unify whatprovides data
257 * whatprovides_rel must be empty for this to work!
261 pool_shrink_whatprovides(Pool *pool)
265 Id lastid, *last, *dp, *lp;
269 if (pool->ss.nstrings < 3)
271 sorted = solv_malloc2(pool->ss.nstrings, sizeof(Id));
272 for (id = 0; id < pool->ss.nstrings; id++)
274 solv_sort(sorted + 1, pool->ss.nstrings - 1, sizeof(Id), pool_shrink_whatprovides_sortcmp, pool);
277 for (i = 1; i < pool->ss.nstrings; i++)
280 o = pool->whatprovides[id];
281 if (o == 0 || o == 1)
283 dp = pool->whatprovidesdata + o;
297 pool->whatprovides[id] = -lastid;
301 last = pool->whatprovidesdata + o;
305 dp = pool->whatprovidesdata + 2;
306 for (id = 1; id < pool->ss.nstrings; id++)
308 o = pool->whatprovides[id];
309 if (o == 0 || o == 1)
316 pool->whatprovides[id] = pool->whatprovides[i];
319 lp = pool->whatprovidesdata + o;
322 pool->whatprovides[id] = dp - pool->whatprovidesdata;
323 while ((*dp++ = *lp++) != 0)
326 o = dp - pool->whatprovidesdata;
327 POOL_DEBUG(SOLV_DEBUG_STATS, "shrunk whatprovidesdata from %d to %d\n", pool->whatprovidesdataoff, o);
328 if (pool->whatprovidesdataoff == o)
330 r = pool->whatprovidesdataoff - o;
331 pool->whatprovidesdataoff = o;
332 pool->whatprovidesdata = solv_realloc(pool->whatprovidesdata, (o + pool->whatprovidesdataleft) * sizeof(Id));
333 if (r > pool->whatprovidesdataleft)
334 r = pool->whatprovidesdataleft;
335 memset(pool->whatprovidesdata + o, 0, r * sizeof(Id));
340 * pool_createwhatprovides()
342 * create hashes over pool of solvables to ease provide lookups
346 pool_createwhatprovides(Pool *pool)
348 int i, num, np, extra;
353 Offset *whatprovides;
354 Id *whatprovidesdata, *d;
355 Repo *installed = pool->installed;
358 now = solv_timems(0);
359 POOL_DEBUG(SOLV_DEBUG_STATS, "number of solvables: %d\n", pool->nsolvables);
360 POOL_DEBUG(SOLV_DEBUG_STATS, "number of ids: %d + %d\n", pool->ss.nstrings, pool->nrels);
362 pool_freeidhashes(pool); /* XXX: should not be here! */
363 pool_freewhatprovides(pool);
364 num = pool->ss.nstrings;
365 pool->whatprovides = whatprovides = solv_calloc_block(num, sizeof(Offset), WHATPROVIDES_BLOCK);
366 pool->whatprovides_rel = solv_calloc_block(pool->nrels, sizeof(Offset), WHATPROVIDES_BLOCK);
368 /* count providers for each name */
369 for (i = pool->nsolvables - 1; i > 0; i--)
372 s = pool->solvables + i;
373 if (!s->provides || !s->repo || s->repo->disabled)
375 /* we always need the installed solvable in the whatprovides data,
376 otherwise obsoletes/conflicts on them won't work */
377 if (s->repo != installed && !pool_installable(pool, s))
379 pp = s->repo->idarraydata + s->provides;
380 while ((id = *pp++) != 0)
384 Reldep *rd = GETRELDEP(pool, id);
387 whatprovides[id]++; /* inc count of providers */
391 off = 2; /* first entry is undef, second is empty list */
392 np = 0; /* number of names provided */
393 for (i = 0, idp = whatprovides; i < num; i++, idp++)
396 if (!n) /* no providers */
398 off += n; /* make space for all providers */
399 *idp = off++; /* now idp points to terminating zero */
400 np++; /* inc # of provider 'slots' for stats */
403 POOL_DEBUG(SOLV_DEBUG_STATS, "provide ids: %d\n", np);
405 /* reserve some space for relation data */
406 extra = 2 * pool->nrels;
410 POOL_DEBUG(SOLV_DEBUG_STATS, "provide space needed: %d + %d\n", off, extra);
412 /* alloc space for all providers + extra */
413 whatprovidesdata = solv_calloc(off + extra, sizeof(Id));
415 /* now fill data for all provides */
416 for (i = pool->nsolvables - 1; i > 0; i--)
419 s = pool->solvables + i;
420 if (!s->provides || !s->repo || s->repo->disabled)
422 if (s->repo != installed && !pool_installable(pool, s))
425 /* for all provides of this solvable */
426 pp = s->repo->idarraydata + s->provides;
427 while ((id = *pp++) != 0)
431 Reldep *rd = GETRELDEP(pool, id);
434 d = whatprovidesdata + whatprovides[id]; /* offset into whatprovidesdata */
435 if (*d != i) /* don't add same solvable twice */
442 pool->whatprovidesdata = whatprovidesdata;
443 pool->whatprovidesdataoff = off;
444 pool->whatprovidesdataleft = extra;
445 pool_shrink_whatprovides(pool);
446 POOL_DEBUG(SOLV_DEBUG_STATS, "whatprovides memory used: %d K id array, %d K data\n", (pool->ss.nstrings + pool->nrels + WHATPROVIDES_BLOCK) / (int)(1024/sizeof(Id)), (pool->whatprovidesdataoff + pool->whatprovidesdataleft) / (int)(1024/sizeof(Id)));
447 POOL_DEBUG(SOLV_DEBUG_STATS, "createwhatprovides took %d ms\n", solv_timems(now));
451 * free all of our whatprovides data
452 * be careful, everything internalized with pool_queuetowhatprovides is
456 pool_freewhatprovides(Pool *pool)
458 pool->whatprovides = solv_free(pool->whatprovides);
459 pool->whatprovides_rel = solv_free(pool->whatprovides_rel);
460 pool->whatprovidesdata = solv_free(pool->whatprovidesdata);
461 pool->whatprovidesdataoff = 0;
462 pool->whatprovidesdataleft = 0;
466 /******************************************************************************/
469 * pool_queuetowhatprovides - add queue contents to whatprovidesdata
471 * on-demand filling of provider information
472 * move queue data into whatprovidesdata
474 * returns: Offset into whatprovides
478 pool_queuetowhatprovides(Pool *pool, Queue *q)
481 int count = q->count;
483 if (count == 0) /* queue empty -> 1 */
486 /* extend whatprovidesdata if needed, +1 for ID_NULL-termination */
487 if (pool->whatprovidesdataleft < count + 1)
489 POOL_DEBUG(SOLV_DEBUG_STATS, "growing provides hash data...\n");
490 pool->whatprovidesdata = solv_realloc(pool->whatprovidesdata, (pool->whatprovidesdataoff + count + 4096) * sizeof(Id));
491 pool->whatprovidesdataleft = count + 4096;
494 /* copy queue to next free slot */
495 off = pool->whatprovidesdataoff;
496 memcpy(pool->whatprovidesdata + pool->whatprovidesdataoff, q->elements, count * sizeof(Id));
498 /* adapt count and ID_NULL-terminate */
499 pool->whatprovidesdataoff += count;
500 pool->whatprovidesdata[pool->whatprovidesdataoff++] = ID_NULL;
501 pool->whatprovidesdataleft -= count + 1;
507 /*************************************************************************/
509 #if defined(MULTI_SEMANTICS)
510 # define EVRCMP_DEPCMP (pool->disttype == DISTTYPE_DEB ? EVRCMP_COMPARE : EVRCMP_MATCH_RELEASE)
511 #elif defined(DEBIAN_SEMANTICS)
512 # define EVRCMP_DEPCMP EVRCMP_COMPARE
514 # define EVRCMP_DEPCMP EVRCMP_MATCH_RELEASE
517 /* check if a package's nevr matches a dependency */
520 pool_match_nevr_rel(Pool *pool, Solvable *s, Id d)
522 Reldep *rd = GETRELDEP(pool, d);
525 int flags = rd->flags;
534 return pool_match_nevr(pool, s, name);
536 if (pool_match_nevr(pool, s, name))
538 return pool_match_nevr(pool, s, evr);
541 if (!pool_match_nevr(pool, s, name))
543 return pool_match_nevr(pool, s, evr);
548 if (!pool_match_nevr(pool, s, name))
551 return flags & 2 ? 1 : 0;
556 if (flags != 2 && flags != 5)
558 if ((flags & (1 << (1 + pool_evrcmp(pool, s->evr, evr, EVRCMP_DEPCMP)))) != 0)
563 /* match (flags, evr) against provider (pflags, pevr) */
565 pool_match_flags_evr(Pool *pool, int pflags, Id pevr, int flags, int evr)
567 if (!pflags || !flags || pflags >= 8 || flags >= 8)
569 if (flags == 7 || pflags == 7)
570 return 1; /* rel provides every version */
571 if ((pflags & flags & 5) != 0)
572 return 1; /* both rels show in the same direction */
575 if ((pflags & flags & 2) != 0)
576 return 1; /* both have '=', match */
580 int f = flags == 5 ? 5 : flags == 2 ? pflags : (flags ^ 5) & (pflags | 5);
581 if ((f & (1 << (1 + pool_evrcmp(pool, pevr, evr, EVRCMP_DEPCMP)))) != 0)
587 /* match two dependencies (d1 = provider) */
590 pool_match_dep(Pool *pool, Id d1, Id d2)
600 rd2 = GETRELDEP(pool, d2);
601 return pool_match_dep(pool, d1, rd2->name);
603 rd1 = GETRELDEP(pool, d1);
606 return pool_match_dep(pool, rd1->name, d2);
608 rd2 = GETRELDEP(pool, d2);
609 /* first match name */
610 if (!pool_match_dep(pool, rd1->name, rd2->name))
612 /* name matches, check flags and evr */
613 return pool_match_flags_evr(pool, rd1->flags, rd1->evr, rd2->flags, rd2->evr);
619 * add packages fulfilling the relation to whatprovides array
620 * no exact providers, do range match
625 pool_addrelproviders(Pool *pool, Id d)
627 Reldep *rd = GETRELDEP(pool, d);
633 int flags = rd->flags;
638 queue_init_buffer(&plist, buf, sizeof(buf)/sizeof(*buf));
642 /* special relation */
650 wp = pool_whatprovides(pool, name);
651 pp2 = pool_whatprovides_ptr(pool, evr);
652 pp = pool->whatprovidesdata + wp;
653 while ((p = *pp++) != 0)
655 for (pp3 = pp2; *pp3; pp3++)
659 queue_push(&plist, p); /* found it */
665 wp = pool_whatprovides(pool, name);
666 pp = pool->whatprovidesdata + wp;
668 wp = pool_whatprovides(pool, evr);
672 while ((p = *pp++) != 0)
673 queue_push(&plist, p);
675 pp = pool_whatprovides_ptr(pool, evr);
676 while ((p = *pp++) != 0)
677 queue_pushunique(&plist, p);
678 if (plist.count != cnt)
683 if (name == NAMESPACE_OTHERPROVIDERS)
685 wp = pool_whatprovides(pool, evr);
688 if (pool->nscallback)
690 /* ask callback which packages provide the dependency
692 * 1: the system (aka SYSTEMSOLVABLE)
693 * >1: set of packages, stored as offset on whatprovidesdata
695 p = pool->nscallback(pool, pool->nscallbackdata, name, evr);
699 queue_push(&plist, SYSTEMSOLVABLE);
703 /* small hack: make it possible to match <pkg>.src
704 * we have to iterate over the solvables as src packages do not
705 * provide anything, thus they are not indexed in our
706 * whatprovides hash */
710 for (p = 1, s = pool->solvables + p; p < pool->nsolvables; p++, s++)
712 if (s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
714 if (pool_match_nevr(pool, s, name))
715 queue_push(&plist, p);
719 wp = pool_whatprovides(pool, name);
720 pp = pool->whatprovidesdata + wp;
721 while ((p = *pp++) != 0)
723 Solvable *s = pool->solvables + p;
725 queue_push(&plist, p);
730 case REL_FILECONFLICT:
731 pp = pool_whatprovides_ptr(pool, name);
732 while ((p = *pp++) != 0)
734 Id origd = MAKERELDEP(d);
735 Solvable *s = pool->solvables + p;
738 pidp = s->repo->idarraydata + s->provides;
739 while ((pid = *pidp++) != 0)
743 queue_push(&plist, p);
751 /* we can reuse an existing entry */
753 pool->whatprovides_rel[d] = wp;
759 /* simple version comparison relation */
761 POOL_DEBUG(SOLV_DEBUG_STATS, "addrelproviders: what provides %s?\n", pool_dep2str(pool, name));
763 pp = pool_whatprovides_ptr(pool, name);
764 while (ISRELDEP(name))
766 rd = GETRELDEP(pool, name);
769 while ((p = *pp++) != 0)
771 Solvable *s = pool->solvables + p;
774 /* no provides - check nevr */
775 if (pool_match_nevr_rel(pool, s, MAKERELDEP(d)))
776 queue_push(&plist, p);
779 /* solvable p provides name in some rels */
780 pidp = s->repo->idarraydata + s->provides;
781 while ((pid = *pidp++) != 0)
785 if (pool->disttype == DISTTYPE_DEB)
786 continue; /* unversioned provides can never match versioned deps */
790 continue; /* wrong provides name */
791 prd = GETRELDEP(pool, pid);
792 if (prd->name != name)
793 continue; /* wrong provides name */
794 /* right package, both deps are rels. check flags/evr */
795 if (pool_match_flags_evr(pool, prd->flags, prd->evr, flags, evr))
799 continue; /* none of the providers matched */
800 queue_push(&plist, p);
802 /* make our system solvable provide all unknown rpmlib() stuff */
803 if (plist.count == 0 && !strncmp(pool_id2str(pool, name), "rpmlib(", 7))
804 queue_push(&plist, SYSTEMSOLVABLE);
806 /* add providers to whatprovides */
808 POOL_DEBUG(SOLV_DEBUG_STATS, "addrelproviders: adding %d packages to %d\n", plist.count, d);
810 pool->whatprovides_rel[d] = pool_queuetowhatprovides(pool, &plist);
813 return pool->whatprovides_rel[d];
816 /*************************************************************************/
819 pool_debug(Pool *pool, int type, const char *format, ...)
824 if ((type & (SOLV_FATAL|SOLV_ERROR)) == 0)
826 if ((pool->debugmask & type) == 0)
829 va_start(args, format);
830 if (!pool->debugcallback)
832 if ((type & (SOLV_FATAL|SOLV_ERROR)) == 0 && !(pool->debugmask & SOLV_DEBUG_TO_STDERR))
833 vprintf(format, args);
835 vfprintf(stderr, format, args);
838 vsnprintf(buf, sizeof(buf), format, args);
839 pool->debugcallback(pool, pool->debugcallbackdata, type, buf);
843 pool_setdebuglevel(Pool *pool, int level)
845 int mask = SOLV_DEBUG_RESULT;
847 mask |= SOLV_DEBUG_STATS|SOLV_DEBUG_ANALYZE|SOLV_DEBUG_UNSOLVABLE|SOLV_DEBUG_SOLVER|SOLV_DEBUG_TRANSACTION;
849 mask |= SOLV_DEBUG_JOB|SOLV_DEBUG_SOLUTIONS|SOLV_DEBUG_POLICY;
851 mask |= SOLV_DEBUG_PROPAGATE;
853 mask |= SOLV_DEBUG_RULE_CREATION;
854 mask |= pool->debugmask & SOLV_DEBUG_TO_STDERR; /* keep bit */
855 pool->debugmask = mask;
858 void pool_setdebugcallback(Pool *pool, void (*debugcallback)(struct _Pool *, void *data, int type, const char *str), void *debugcallbackdata)
860 pool->debugcallback = debugcallback;
861 pool->debugcallbackdata = debugcallbackdata;
864 void pool_setdebugmask(Pool *pool, int mask)
866 pool->debugmask = mask;
869 void pool_setloadcallback(Pool *pool, int (*cb)(struct _Pool *, struct _Repodata *, void *), void *loadcbdata)
871 pool->loadcallback = cb;
872 pool->loadcallbackdata = loadcbdata;
875 /*************************************************************************/
885 #define SEARCHFILES_BLOCK 127
888 pool_addfileprovides_dep(Pool *pool, Id *ida, struct searchfiles *sf, struct searchfiles *isf)
892 struct searchfiles *csf;
894 while ((dep = *ida++) != 0)
897 while (ISRELDEP(dep))
900 sid = pool->ss.nstrings + GETRELID(dep);
901 if (MAPTST(&csf->seen, sid))
906 MAPSET(&csf->seen, sid);
907 rd = GETRELDEP(pool, dep);
910 else if (rd->flags == REL_NAMESPACE)
912 if (rd->name == NAMESPACE_INSTALLED || rd->name == NAMESPACE_SPLITPROVIDES)
915 if (!csf || MAPTST(&csf->seen, sid))
920 MAPSET(&csf->seen, sid);
924 else if (rd->flags == REL_FILECONFLICT)
934 pool_addfileprovides_dep(pool, ids, csf, isf);
940 if (MAPTST(&csf->seen, dep))
942 MAPSET(&csf->seen, dep);
943 s = pool_id2str(pool, dep);
946 csf->ids = solv_extend(csf->ids, csf->nfiles, 1, sizeof(Id), SEARCHFILES_BLOCK);
947 csf->dirs = solv_extend(csf->dirs, csf->nfiles, 1, sizeof(const char *), SEARCHFILES_BLOCK);
948 csf->names = solv_extend(csf->names, csf->nfiles, 1, sizeof(const char *), SEARCHFILES_BLOCK);
949 csf->ids[csf->nfiles] = dep;
950 sr = strrchr(s, '/');
951 csf->names[csf->nfiles] = solv_strdup(sr + 1);
952 csf->dirs[csf->nfiles] = solv_malloc(sr - s + 1);
954 strncpy(csf->dirs[csf->nfiles], s, sr - s);
955 csf->dirs[csf->nfiles][sr - s] = 0;
960 struct addfileprovides_cbdata {
974 addfileprovides_cb(void *cbdata, Solvable *s, Repodata *data, Repokey *key, KeyValue *value)
976 struct addfileprovides_cbdata *cbd = cbdata;
979 if (!cbd->useddirs.size)
981 map_init(&cbd->useddirs, data->dirpool.ndirs + 1);
982 for (i = 0; i < cbd->nfiles; i++)
985 if (MAPTST(&cbd->providedids, cbd->ids[i]))
990 did = repodata_str2dir(data, cbd->dirs[i], 0);
993 MAPSET(&cbd->useddirs, did);
995 repodata_free_dircache(data);
997 if (value->id >= data->dirpool.ndirs || !MAPTST(&cbd->useddirs, value->id))
999 for (i = 0; i < cbd->nfiles; i++)
1001 if (cbd->dids[i] != value->id)
1003 if (!strcmp(cbd->names[i], value->str))
1006 if (i == cbd->nfiles)
1008 s->provides = repo_addid_dep(s->repo, s->provides, cbd->ids[i], SOLVABLE_FILEMARKER);
1013 pool_addfileprovides_search(Pool *pool, struct addfileprovides_cbdata *cbd, struct searchfiles *sf, Repo *repoonly)
1018 Queue fileprovidesq;
1019 int i, j, repoid, repodataid;
1020 int provstart, provend;
1022 int ndone, incomplete;
1027 cbd->nfiles = sf->nfiles;
1029 cbd->dirs = sf->dirs;
1030 cbd->names = sf->names;
1031 cbd->dids = solv_realloc2(cbd->dids, sf->nfiles, sizeof(Id));
1032 map_init(&cbd->providedids, pool->ss.nstrings);
1035 repo = repoonly ? repoonly : pool->repos[repoid];
1036 map_init(&donemap, pool->nsolvables);
1037 queue_init(&fileprovidesq);
1038 provstart = provend = 0;
1041 if (!repo || repo->disabled)
1043 if (repoonly || ++repoid == pool->nrepos)
1045 repo = pool->repos[repoid];
1049 FOR_REPODATAS(repo, repodataid, data)
1051 if (ndone >= repo->nsolvables)
1054 if (repodata_lookup_idarray(data, SOLVID_META, REPOSITORY_ADDEDFILEPROVIDES, &fileprovidesq))
1056 map_empty(&cbd->providedids);
1057 for (i = 0; i < fileprovidesq.count; i++)
1058 MAPSET(&cbd->providedids, fileprovidesq.elements[i]);
1059 provstart = data->start;
1060 provend = data->end;
1061 for (i = 0; i < cbd->nfiles; i++)
1062 if (!MAPTST(&cbd->providedids, cbd->ids[i]))
1064 if (i == cbd->nfiles)
1066 /* great! no need to search files */
1067 for (p = data->start; p < data->end; p++)
1068 if (pool->solvables[p].repo == repo)
1070 if (MAPTST(&donemap, p))
1072 MAPSET(&donemap, p);
1079 if (!repodata_has_keyname(data, SOLVABLE_FILELIST))
1082 if (data->start < provstart || data->end > provend)
1084 map_empty(&cbd->providedids);
1085 provstart = provend = 0;
1088 /* check if the data is incomplete */
1090 if (data->state == REPODATA_AVAILABLE)
1092 for (j = 1; j < data->nkeys; j++)
1093 if (data->keys[j].name != REPOSITORY_SOLVABLES && data->keys[j].name != SOLVABLE_FILELIST)
1095 if (j < data->nkeys)
1098 for (i = 0; i < cbd->nfiles; i++)
1099 if (!MAPTST(&cbd->providedids, cbd->ids[i]) && !repodata_filelistfilter_matches(data, pool_id2str(pool, cbd->ids[i])))
1100 printf("need complete filelist because of %s\n", pool_id2str(pool, cbd->ids[i]));
1102 for (i = 0; i < cbd->nfiles; i++)
1103 if (!MAPTST(&cbd->providedids, cbd->ids[i]) && !repodata_filelistfilter_matches(data, pool_id2str(pool, cbd->ids[i])))
1105 if (i < cbd->nfiles)
1111 map_init(&cbd->useddirs, 0);
1112 for (p = data->start; p < data->end; p++)
1113 if (pool->solvables[p].repo == repo)
1115 if (MAPTST(&donemap, p))
1117 repodata_search(data, p, SOLVABLE_FILELIST, 0, addfileprovides_cb, cbd);
1120 MAPSET(&donemap, p);
1124 map_free(&cbd->useddirs);
1127 if (repoonly || ++repoid == pool->nrepos)
1129 repo = pool->repos[repoid];
1132 queue_free(&fileprovidesq);
1133 map_free(&cbd->providedids);
1137 pool_addfileprovides_queue(Pool *pool, Queue *idq)
1140 Repo *installed, *repo;
1141 struct searchfiles sf, isf, *isfp;
1142 struct addfileprovides_cbdata cbd;
1146 installed = pool->installed;
1147 now = solv_timems(0);
1148 memset(&sf, 0, sizeof(sf));
1149 map_init(&sf.seen, pool->ss.nstrings + pool->nrels);
1150 memset(&isf, 0, sizeof(isf));
1151 map_init(&isf.seen, pool->ss.nstrings + pool->nrels);
1155 isfp = installed ? &isf : 0;
1156 for (i = 1, s = pool->solvables + i; i < pool->nsolvables; i++, s++)
1162 pool_addfileprovides_dep(pool, repo->idarraydata + s->obsoletes, &sf, isfp);
1164 pool_addfileprovides_dep(pool, repo->idarraydata + s->conflicts, &sf, isfp);
1166 pool_addfileprovides_dep(pool, repo->idarraydata + s->requires, &sf, isfp);
1168 pool_addfileprovides_dep(pool, repo->idarraydata + s->recommends, &sf, isfp);
1170 pool_addfileprovides_dep(pool, repo->idarraydata + s->suggests, &sf, isfp);
1172 pool_addfileprovides_dep(pool, repo->idarraydata + s->supplements, &sf, isfp);
1174 pool_addfileprovides_dep(pool, repo->idarraydata + s->enhances, &sf, isfp);
1177 map_free(&isf.seen);
1178 POOL_DEBUG(SOLV_DEBUG_STATS, "found %d file dependencies, %d installed file dependencies\n", sf.nfiles, isf.nfiles);
1183 for (i = 0; i < sf.nfiles; i++)
1184 POOL_DEBUG(SOLV_DEBUG_STATS, "looking up %s in filelist\n", pool_id2str(pool, sf.ids[i]));
1186 pool_addfileprovides_search(pool, &cbd, &sf, 0);
1188 for (i = 0; i < sf.nfiles; i++)
1189 queue_push(idq, sf.ids[i]);
1191 for (i = 0; i < sf.nfiles; i++)
1193 solv_free(sf.dirs[i]);
1194 solv_free(sf.names[i]);
1197 solv_free(sf.names);
1202 for (i = 0; i < isf.nfiles; i++)
1203 POOL_DEBUG(SOLV_DEBUG_STATS, "looking up %s in installed filelist\n", pool_id2str(pool, isf.ids[i]));
1206 pool_addfileprovides_search(pool, &cbd, &isf, installed);
1208 for (i = 0; i < isf.nfiles; i++)
1210 solv_free(isf.dirs[i]);
1211 solv_free(isf.names[i]);
1213 solv_free(isf.dirs);
1214 solv_free(isf.names);
1216 solv_free(cbd.dids);
1217 pool_freewhatprovides(pool); /* as we have added provides */
1218 POOL_DEBUG(SOLV_DEBUG_STATS, "addfileprovides took %d ms\n", solv_timems(now));
1222 pool_addfileprovides(Pool *pool)
1224 pool_addfileprovides_queue(pool, 0);
1228 pool_search(Pool *pool, Id p, Id key, const char *match, int flags, int (*callback)(void *cbdata, Solvable *s, struct _Repodata *data, struct _Repokey *key, struct _KeyValue *kv), void *cbdata)
1232 if (pool->solvables[p].repo)
1233 repo_search(pool->solvables[p].repo, p, key, match, flags, callback, cbdata);
1236 /* FIXME: obey callback return value! */
1237 for (p = 1; p < pool->nsolvables; p++)
1238 if (pool->solvables[p].repo)
1239 repo_search(pool->solvables[p].repo, p, key, match, flags, callback, cbdata);
1243 pool_clear_pos(Pool *pool)
1245 memset(&pool->pos, 0, sizeof(pool->pos));
1250 pool_set_languages(Pool *pool, const char **languages, int nlanguages)
1254 pool->languagecache = solv_free(pool->languagecache);
1255 pool->languagecacheother = 0;
1256 if (pool->nlanguages)
1258 for (i = 0; i < pool->nlanguages; i++)
1259 free((char *)pool->languages[i]);
1260 free(pool->languages);
1262 pool->nlanguages = nlanguages;
1265 pool->languages = solv_calloc(nlanguages, sizeof(const char **));
1266 for (i = 0; i < pool->nlanguages; i++)
1267 pool->languages[i] = solv_strdup(languages[i]);
1271 pool_id2langid(Pool *pool, Id id, const char *lang, int create)
1277 if (!lang || !*lang)
1279 n = pool_id2str(pool, id);
1280 l = strlen(n) + strlen(lang) + 2;
1281 if (l > sizeof(buf))
1282 p = solv_malloc(strlen(n) + strlen(lang) + 2);
1285 sprintf(p, "%s:%s", n, lang);
1286 id = pool_str2id(pool, p, create);
1293 pool_alloctmpspace(Pool *pool, int len)
1295 int n = pool->tmpspace.n;
1298 if (len > pool->tmpspace.len[n])
1300 pool->tmpspace.buf[n] = solv_realloc(pool->tmpspace.buf[n], len + 32);
1301 pool->tmpspace.len[n] = len + 32;
1303 pool->tmpspace.n = (n + 1) % POOL_TMPSPACEBUF;
1304 return pool->tmpspace.buf[n];
1308 pool_alloctmpspace_free(Pool *pool, const char *space, int len)
1313 n = oldn = pool->tmpspace.n;
1317 n = POOL_TMPSPACEBUF - 1;
1320 if (pool->tmpspace.buf[n] != space)
1322 if (len > pool->tmpspace.len[n])
1324 pool->tmpspace.buf[n] = solv_realloc(pool->tmpspace.buf[n], len + 32);
1325 pool->tmpspace.len[n] = len + 32;
1327 return pool->tmpspace.buf[n];
1334 pool_freetmpspace(Pool *pool, const char *space)
1336 int n = pool->tmpspace.n;
1339 n = (n + (POOL_TMPSPACEBUF - 1)) % POOL_TMPSPACEBUF;
1340 if (pool->tmpspace.buf[n] == space)
1341 pool->tmpspace.n = n;
1345 pool_tmpjoin(Pool *pool, const char *str1, const char *str2, const char *str3)
1349 l1 = str1 ? strlen(str1) : 0;
1350 l2 = str2 ? strlen(str2) : 0;
1351 l3 = str3 ? strlen(str3) : 0;
1352 s = str = pool_alloctmpspace(pool, l1 + l2 + l3 + 1);
1373 pool_tmpappend(Pool *pool, const char *str1, const char *str2, const char *str3)
1378 l1 = str1 ? strlen(str1) : 0;
1379 l2 = str2 ? strlen(str2) : 0;
1380 l3 = str3 ? strlen(str3) : 0;
1381 str = pool_alloctmpspace_free(pool, str1, l1 + l2 + l3 + 1);
1385 str = pool_alloctmpspace(pool, l1 + l2 + l3 + 1);
1408 pool_bin2hex(Pool *pool, const unsigned char *buf, int len)
1413 s = pool_alloctmpspace(pool, 2 * len + 1);
1414 solv_bin2hex(buf, len, s);
1418 /*******************************************************************/
1430 struct mptree *mptree;
1441 solver_fill_DU_cb(void *cbdata, Solvable *s, Repodata *data, Repokey *key, KeyValue *value)
1443 struct ducbdata *cbd = cbdata;
1446 if (data != cbd->olddata)
1448 Id dn, mp, comp, *dirmap, *dirs;
1450 const char *compstr;
1451 struct mptree *mptree;
1453 /* create map from dir to mptree */
1454 cbd->dirmap = solv_free(cbd->dirmap);
1456 dirmap = solv_calloc(data->dirpool.ndirs, sizeof(Id));
1457 mptree = cbd->mptree;
1459 for (dn = 2, dirs = data->dirpool.dirs + dn; dn < data->dirpool.ndirs; dn++)
1473 if (!mptree[mp].child)
1478 if (data->localpool)
1479 compstr = stringpool_id2str(&data->spool, comp);
1481 compstr = pool_id2str(data->repo->pool, comp);
1482 compl = strlen(compstr);
1483 for (i = mptree[mp].child; i; i = mptree[i].sibling)
1484 if (mptree[i].compl == compl && !strncmp(mptree[i].comp, compstr, compl))
1486 dirmap[dn] = i ? i : -mp;
1488 /* change dirmap to point to mountpoint instead of mptree */
1489 for (dn = 0; dn < data->dirpool.ndirs; dn++)
1492 dirmap[dn] = mptree[mp > 0 ? mp : -mp].mountpoint;
1494 cbd->dirmap = dirmap;
1495 cbd->nmap = data->dirpool.ndirs;
1496 cbd->olddata = data;
1499 if (value->id < 0 || value->id >= cbd->nmap)
1501 mp = cbd->dirmap[value->id];
1504 if (cbd->addsub > 0)
1506 cbd->mps[mp].kbytes += value->num;
1507 cbd->mps[mp].files += value->num2;
1511 cbd->mps[mp].kbytes -= value->num;
1512 cbd->mps[mp].files -= value->num2;
1518 propagate_mountpoints(struct mptree *mptree, int pos, Id mountpoint)
1521 if (mptree[pos].mountpoint == -1)
1522 mptree[pos].mountpoint = mountpoint;
1524 mountpoint = mptree[pos].mountpoint;
1525 for (i = mptree[pos].child; i; i = mptree[i].sibling)
1526 propagate_mountpoints(mptree, i, mountpoint);
1529 #define MPTREE_BLOCK 15
1532 pool_calc_duchanges(Pool *pool, Map *installedmap, DUChanges *mps, int nmps)
1535 const char *path, *compstr;
1536 struct mptree *mptree;
1540 struct ducbdata cbd;
1544 Repo *oldinstalled = pool->installed;
1546 memset(&ignoredu, 0, sizeof(ignoredu));
1553 mptree = solv_extend_resize(0, 1, sizeof(struct mptree), MPTREE_BLOCK);
1556 mptree[0].sibling = 0;
1557 mptree[0].child = 0;
1559 mptree[0].compl = 0;
1560 mptree[0].mountpoint = -1;
1563 /* create component tree */
1564 for (mp = 0; mp < nmps; mp++)
1569 path = mps[mp].path;
1574 if ((p = strchr(path, '/')) == 0)
1577 compl = strlen(compstr);
1588 for (i = mptree[pos].child; i; i = mptree[i].sibling)
1589 if (mptree[i].compl == compl && !strncmp(mptree[i].comp, compstr, compl))
1593 /* create new node */
1594 mptree = solv_extend(mptree, nmptree, 1, sizeof(struct mptree), MPTREE_BLOCK);
1596 mptree[i].sibling = mptree[pos].child;
1597 mptree[i].child = 0;
1598 mptree[i].comp = compstr;
1599 mptree[i].compl = compl;
1600 mptree[i].mountpoint = -1;
1601 mptree[pos].child = i;
1605 mptree[pos].mountpoint = mp;
1608 propagate_mountpoints(mptree, 0, mptree[0].mountpoint);
1611 for (i = 0; i < nmptree; i++)
1613 printf("#%d sibling: %d\n", i, mptree[i].sibling);
1614 printf("#%d child: %d\n", i, mptree[i].child);
1615 printf("#%d comp: %s\n", i, mptree[i].comp);
1616 printf("#%d compl: %d\n", i, mptree[i].compl);
1617 printf("#%d mountpont: %d\n", i, mptree[i].mountpoint);
1621 cbd.mptree = mptree;
1623 for (sp = 1, s = pool->solvables + sp; sp < pool->nsolvables; sp++, s++)
1625 if (!s->repo || (oldinstalled && s->repo == oldinstalled))
1627 if (!MAPTST(installedmap, sp))
1630 repo_search(s->repo, sp, SOLVABLE_DISKUSAGE, 0, 0, solver_fill_DU_cb, &cbd);
1631 if (!cbd.hasdu && oldinstalled)
1634 /* no du data available, ignore data of all installed solvables we obsolete */
1636 map_init(&ignoredu, oldinstalled->end - oldinstalled->start);
1639 Id obs, *obsp = s->repo->idarraydata + s->obsoletes;
1640 while ((obs = *obsp++) != 0)
1641 FOR_PROVIDES(op, opp, obs)
1642 if (op >= oldinstalled->start && op < oldinstalled->end)
1643 MAPSET(&ignoredu, op - oldinstalled->start);
1645 FOR_PROVIDES(op, opp, s->name)
1646 if (pool->solvables[op].name == s->name)
1647 if (op >= oldinstalled->start && op < oldinstalled->end)
1648 MAPSET(&ignoredu, op - oldinstalled->start);
1654 /* assumes we allways have du data for installed solvables */
1655 FOR_REPO_SOLVABLES(oldinstalled, sp, s)
1657 if (MAPTST(installedmap, sp))
1659 if (ignoredu.map && MAPTST(&ignoredu, sp - oldinstalled->start))
1661 repo_search(oldinstalled, sp, SOLVABLE_DISKUSAGE, 0, 0, solver_fill_DU_cb, &cbd);
1665 map_free(&ignoredu);
1666 solv_free(cbd.dirmap);
1671 pool_calc_installsizechange(Pool *pool, Map *installedmap)
1676 Repo *oldinstalled = pool->installed;
1678 for (sp = 1, s = pool->solvables + sp; sp < pool->nsolvables; sp++, s++)
1680 if (!s->repo || (oldinstalled && s->repo == oldinstalled))
1682 if (!MAPTST(installedmap, sp))
1684 change += solvable_lookup_num(s, SOLVABLE_INSTALLSIZE, 0);
1688 FOR_REPO_SOLVABLES(oldinstalled, sp, s)
1690 if (MAPTST(installedmap, sp))
1692 change -= solvable_lookup_num(s, SOLVABLE_INSTALLSIZE, 0);
1700 * 2: conflicts with installed
1701 * 8: interesting (only true if installed)
1705 static inline Id dep2name(Pool *pool, Id dep)
1707 while (ISRELDEP(dep))
1709 Reldep *rd = rd = GETRELDEP(pool, dep);
1715 static int providedbyinstalled_multiversion(Pool *pool, unsigned char *map, Id n, Id con)
1718 Solvable *sn = pool->solvables + n;
1720 FOR_PROVIDES(p, pp, sn->name)
1722 Solvable *s = pool->solvables + p;
1723 if (s->name != sn->name || s->arch != sn->arch)
1725 if ((map[p] & 9) != 9)
1727 if (pool_match_nevr(pool, pool->solvables + p, con))
1729 return 1; /* found installed package that doesn't conflict */
1734 static inline int providedbyinstalled(Pool *pool, unsigned char *map, Id dep, int ispatch, Map *noobsoletesmap)
1738 FOR_PROVIDES(p, pp, dep)
1740 if (p == SYSTEMSOLVABLE)
1741 return 1; /* always boring, as never constraining */
1742 if (ispatch && !pool_match_nevr(pool, pool->solvables + p, dep))
1744 if (ispatch && noobsoletesmap && noobsoletesmap->size && MAPTST(noobsoletesmap, p) && ISRELDEP(dep))
1745 if (providedbyinstalled_multiversion(pool, map, p, dep))
1747 if ((map[p] & 9) == 9)
1755 * pool_trivial_installable - calculate if a set of solvables is
1756 * trivial installable without any other installs/deinstalls of
1757 * packages not belonging to the set.
1759 * the state is returned in the result queue:
1760 * 1: solvable is installable without any other package changes
1761 * 0: solvable is not installable
1762 * -1: solvable is installable, but doesn't constrain any installed packages
1766 pool_trivial_installable_noobsoletesmap(Pool *pool, Map *installedmap, Queue *pkgs, Queue *res, Map *noobsoletesmap)
1769 Id p, *dp, con, *conp, req, *reqp;
1773 map = solv_calloc(pool->nsolvables, 1);
1774 for (p = 1; p < pool->nsolvables; p++)
1776 if (!MAPTST(installedmap, p))
1779 s = pool->solvables + p;
1782 conp = s->repo->idarraydata + s->conflicts;
1783 while ((con = *conp++) != 0)
1785 dp = pool_whatprovides_ptr(pool, con);
1787 map[p] |= 2; /* XXX: self conflict ? */
1790 for (i = 0; i < pkgs->count; i++)
1791 map[pkgs->elements[i]] = 16;
1793 for (i = 0, did = 0; did < pkgs->count; i++, did++)
1795 if (i == pkgs->count)
1797 p = pkgs->elements[i];
1798 if ((map[p] & 16) == 0)
1800 if ((map[p] & 2) != 0)
1805 s = pool->solvables + p;
1809 reqp = s->repo->idarraydata + s->requires;
1810 while ((req = *reqp++) != 0)
1812 if (req == SOLVABLE_PREREQMARKER)
1814 r = providedbyinstalled(pool, map, req, 0, 0);
1817 /* decided and miss */
1821 m |= r; /* 1 | 9 | 16 | 17 */
1830 int ispatch = 0; /* see solver.c patch handling */
1832 if (!strncmp("patch:", pool_id2str(pool, s->name), 6))
1834 conp = s->repo->idarraydata + s->conflicts;
1835 while ((con = *conp++) != 0)
1837 if ((providedbyinstalled(pool, map, con, ispatch, noobsoletesmap) & 1) != 0)
1842 if ((m == 1 || m == 17) && ISRELDEP(con))
1844 con = dep2name(pool, con);
1845 if ((providedbyinstalled(pool, map, con, ispatch, noobsoletesmap) & 1) != 0)
1850 continue; /* found a conflict */
1853 if (s->repo && s->repo != oldinstalled)
1855 Id p2, obs, *obsp, *pp;
1859 obsp = s->repo->idarraydata + s->obsoletes;
1860 while ((obs = *obsp++) != 0)
1862 if ((providedbyinstalled(pool, map, obs, 0, 0) & 1) != 0)
1871 FOR_PROVIDES(p2, pp, s->name)
1873 s2 = pool->solvables + p2;
1874 if (s2->name == s->name && (map[p2] & 1) != 0)
1891 queue_init_clone(res, pkgs);
1892 for (i = 0; i < pkgs->count; i++)
1894 m = map[pkgs->elements[i]];
1901 res->elements[i] = r;
1907 pool_trivial_installable(Pool *pool, Map *installedmap, Queue *pkgs, Queue *res)
1909 pool_trivial_installable_noobsoletesmap(pool, installedmap, pkgs, res, 0);
1913 pool_lookup_str(Pool *pool, Id entry, Id keyname)
1915 if (entry == SOLVID_POS && pool->pos.repo)
1916 return repodata_lookup_str(pool->pos.repo->repodata + pool->pos.repodataid, SOLVID_POS, keyname);
1919 return solvable_lookup_str(pool->solvables + entry, keyname);
1923 pool_lookup_id(Pool *pool, Id entry, Id keyname)
1925 if (entry == SOLVID_POS && pool->pos.repo)
1927 Repodata *data = pool->pos.repo->repodata + pool->pos.repodataid;
1928 Id id = repodata_lookup_id(data, SOLVID_POS, keyname);
1929 return data->localpool ? repodata_globalize_id(data, id, 1) : id;
1933 return solvable_lookup_id(pool->solvables + entry, keyname);
1937 pool_lookup_num(Pool *pool, Id entry, Id keyname, unsigned int notfound)
1939 if (entry == SOLVID_POS && pool->pos.repo)
1942 if (repodata_lookup_num(pool->pos.repo->repodata + pool->pos.repodataid, SOLVID_POS, keyname, &value))
1948 return solvable_lookup_num(pool->solvables + entry, keyname, notfound);
1952 pool_lookup_void(Pool *pool, Id entry, Id keyname)
1954 if (entry == SOLVID_POS && pool->pos.repo)
1955 return repodata_lookup_void(pool->pos.repo->repodata + pool->pos.repodataid, SOLVID_POS, keyname);
1958 return solvable_lookup_void(pool->solvables + entry, keyname);
1961 const unsigned char *
1962 pool_lookup_bin_checksum(Pool *pool, Id entry, Id keyname, Id *typep)
1964 if (entry == SOLVID_POS && pool->pos.repo)
1965 return repodata_lookup_bin_checksum(pool->pos.repo->repodata + pool->pos.repodataid, SOLVID_POS, keyname, typep);
1968 return solvable_lookup_bin_checksum(pool->solvables + entry, keyname, typep);
1972 pool_lookup_checksum(Pool *pool, Id entry, Id keyname, Id *typep)
1974 if (entry == SOLVID_POS && pool->pos.repo)
1976 const unsigned char *chk = repodata_lookup_bin_checksum(pool->pos.repo->repodata + pool->pos.repodataid, SOLVID_POS, keyname, typep);
1977 return chk ? repodata_chk2str(pool->pos.repo->repodata + pool->pos.repodataid, *typep, chk) : 0;
1981 return solvable_lookup_checksum(pool->solvables + entry, keyname, typep);
1985 pool_add_fileconflicts_deps(Pool *pool, Queue *conflicts)
1987 int hadhashes = pool->relhashtbl ? 1 : 0;
1993 if (!conflicts->count)
1995 pool_freewhatprovides(pool);
1996 for (i = 0; i < conflicts->count; i += 5)
1998 fn = conflicts->elements[i];
1999 p = conflicts->elements[i + 1];
2000 md5 = conflicts->elements[i + 2];
2001 q = conflicts->elements[i + 3];
2002 id = pool_rel2id(pool, fn, md5, REL_FILECONFLICT, 1);
2003 s = pool->solvables + p;
2006 s->provides = repo_addid_dep(s->repo, s->provides, id, SOLVABLE_FILEMARKER);
2007 s = pool->solvables + q;
2010 s->conflicts = repo_addid_dep(s->repo, s->conflicts, id, 0);
2013 pool_freeidhashes(pool);