pool->nsolvables = 2;
memset(pool->solvables, 0, 2 * sizeof(Solvable));
+ queue_init(&pool->vendormap);
+
+#if defined(DEBIAN)
+ pool->disttype = DISTTYPE_DEB;
+ pool->noarchid = ARCH_ALL;
+#elif defined(ARCHLINUX)
+ pool->disttype = DISTTYPE_ARCH;
+ pool->noarchid = ARCH_ANY;
+#else
+ pool->disttype = DISTTYPE_RPM;
+ pool->noarchid = ARCH_NOARCH;
+#endif
+
/* initialize the system solvable */
s = pool->solvables + SYSTEMSOLVABLE;
s->name = SYSTEM_SYSTEM;
- s->arch = ARCH_NOARCH;
+ s->arch = pool->noarchid;
s->evr = ID_EMPTY;
- queue_init(&pool->vendormap);
-
pool->debugmask = SOLV_DEBUG_RESULT; /* FIXME */
#ifdef FEDORA
pool->obsoleteusescolors = 1;
#endif
-#ifdef DEBIAN
- pool->disttype = DISTTYPE_DEB;
-#endif
#ifdef RPM5
pool->forbidselfconflicts = 1;
pool->obsoleteusesprovides = 1;
free((char *)pool->languages[i]);
solv_free(pool->languages);
solv_free(pool->languagecache);
+ solv_free(pool->errstr);
+ solv_free(pool->rootdir);
solv_free(pool);
}
pool_setdisttype(Pool *pool, int disttype)
{
pool->disttype = disttype;
+ if (disttype == DISTTYPE_RPM)
+ pool->noarchid = ARCH_NOARCH;
+ if (disttype == DISTTYPE_DEB)
+ pool->noarchid = ARCH_ALL;
+ if (disttype == DISTTYPE_ARCH)
+ pool->noarchid = ARCH_ANY;
+ pool->solvables[SYSTEMSOLVABLE].arch = pool->noarchid;
}
#endif
#if defined(MULTI_SEMANTICS)
# define EVRCMP_DEPCMP (pool->disttype == DISTTYPE_DEB ? EVRCMP_COMPARE : EVRCMP_MATCH_RELEASE)
-#elif defined(DEBIAN_SEMANTICS)
+#elif defined(DEBIAN)
# define EVRCMP_DEPCMP EVRCMP_COMPARE
#else
# define EVRCMP_DEPCMP EVRCMP_MATCH_RELEASE
{
case REL_ARCH:
if (s->arch != evr)
- return 0;
+ {
+ if (evr != ARCH_SRC || s->arch != ARCH_NOSRC)
+ return 0;
+ }
return pool_match_nevr(pool, s, name);
case REL_OR:
if (pool_match_nevr(pool, s, name))
* we have to iterate over the solvables as src packages do not
* provide anything, thus they are not indexed in our
* whatprovides hash */
- if (evr == ARCH_SRC)
+ if (evr == ARCH_SRC || evr == ARCH_NOSRC)
{
Solvable *s;
for (p = 1, s = pool->solvables + p; p < pool->nsolvables; p++, s++)
{
- if (s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
+ if (!s->repo)
+ continue;
+ if (s->arch != evr && s->arch != ARCH_NOSRC)
continue;
if (pool_match_nevr(pool, s, name))
queue_push(&plist, p);
return;
}
vsnprintf(buf, sizeof(buf), format, args);
+ va_end(args);
pool->debugcallback(pool, pool->debugcallbackdata, type, buf);
}
+int
+pool_error(Pool *pool, int ret, const char *format, ...)
+{
+ va_list args;
+ int l;
+ va_start(args, format);
+ if (!pool->errstr)
+ {
+ pool->errstra = 1024;
+ pool->errstr = solv_malloc(pool->errstra);
+ }
+ if (!*format)
+ {
+ *pool->errstr = 0;
+ l = 0;
+ }
+ else
+ l = vsnprintf(pool->errstr, pool->errstra, format, args);
+ va_end(args);
+ if (l >= 0 && l + 1 > pool->errstra)
+ {
+ pool->errstra = l + 256;
+ pool->errstr = solv_realloc(pool->errstr, pool->errstra);
+ va_start(args, format);
+ l = vsnprintf(pool->errstr, pool->errstra, format, args);
+ va_end(args);
+ }
+ if (l < 0)
+ strcpy(pool->errstr, "unknown error");
+ if (pool->debugmask & SOLV_ERROR)
+ pool_debug(pool, SOLV_ERROR, "%s\n", pool->errstr);
+ return ret;
+}
+
+char *
+pool_errstr(Pool *pool)
+{
+ return pool->errstr ? pool->errstr : "no error";
+}
+
void
pool_setdebuglevel(Pool *pool, int level)
{
int mask = SOLV_DEBUG_RESULT;
if (level > 0)
- mask |= SOLV_DEBUG_STATS|SOLV_DEBUG_ANALYZE|SOLV_DEBUG_UNSOLVABLE|SOLV_DEBUG_SOLVER|SOLV_DEBUG_TRANSACTION;
+ mask |= SOLV_DEBUG_STATS|SOLV_DEBUG_ANALYZE|SOLV_DEBUG_UNSOLVABLE|SOLV_DEBUG_SOLVER|SOLV_DEBUG_TRANSACTION|SOLV_ERROR;
if (level > 1)
mask |= SOLV_DEBUG_JOB|SOLV_DEBUG_SOLUTIONS|SOLV_DEBUG_POLICY;
if (level > 2)
return solvable_lookup_checksum(pool->solvables + entry, keyname, typep);
}
+const char *
+pool_lookup_deltalocation(Pool *pool, Id entry, unsigned int *medianrp)
+{
+ const char *loc;
+ if (medianrp)
+ *medianrp = 0;
+ if (entry != SOLVID_POS)
+ return 0;
+ loc = pool_lookup_str(pool, entry, DELTA_LOCATION_DIR);
+ loc = pool_tmpjoin(pool, loc, loc ? "/" : 0, pool_lookup_str(pool, entry, DELTA_LOCATION_NAME));
+ loc = pool_tmpappend(pool, loc, "-", pool_lookup_str(pool, entry, DELTA_LOCATION_EVR));
+ loc = pool_tmpappend(pool, loc, ".", pool_lookup_str(pool, entry, DELTA_LOCATION_SUFFIX));
+ return loc;
+}
+
void
pool_add_fileconflicts_deps(Pool *pool, Queue *conflicts)
{
pool_freeidhashes(pool);
}
+char *
+pool_prepend_rootdir(Pool *pool, const char *path)
+{
+ if (!path)
+ return 0;
+ if (!pool->rootdir)
+ return solv_strdup(path);
+ return solv_dupjoin(pool->rootdir, "/", *path == '/' ? path + 1 : path);
+}
+
+const char *
+pool_prepend_rootdir_tmp(Pool *pool, const char *path)
+{
+ if (!path)
+ return 0;
+ if (!pool->rootdir)
+ return path;
+ return pool_tmpjoin(pool, pool->rootdir, "/", *path == '/' ? path + 1 : path);
+}
+
+void
+pool_set_rootdir(Pool *pool, const char *rootdir)
+{
+ solv_free(pool->rootdir);
+ pool->rootdir = solv_strdup(rootdir);
+}
+
+const char *
+pool_get_rootdir(Pool *pool)
+{
+ return pool->rootdir;
+}
+
/* EOF */