return out;
}
-static unsigned int
-makedeps(Repo *repo, char *deps, unsigned int olddeps, Id marker)
+static Id
+parseonedep(Pool *pool, char *p)
{
- Pool *pool = repo->pool;
- char *p, *n, *ne, *e, *ee;
- Id id, name, evr;
+ char *n, *ne, *e, *ee;
+ Id name, evr;
int flags;
- while ((p = strchr(deps, ',')) != 0)
+ while (*p == ' ' || *p == '\t' || *p == '\n')
+ p++;
+ if (!*p || *p == '(')
+ return 0;
+ n = p;
+ /* find end of name */
+ while (*p && *p != ' ' && *p != '\t' && *p != '\n' && *p != '(' && *p != '|')
+ p++;
+ ne = p;
+ while (*p == ' ' || *p == '\t' || *p == '\n')
+ p++;
+ evr = 0;
+ flags = 0;
+ e = ee = 0;
+ if (*p == '(')
{
- *p++ = 0;
- olddeps = makedeps(repo, deps, olddeps, marker);
- deps = p;
- }
- id = 0;
- p = deps;
- for (;;)
- {
- while (*p == ' ' || *p == '\t' || *p == '\n')
- p++;
- if (!*p || *p == '(')
- break;
- n = p;
- while (*p && *p != ' ' && *p != '\t' && *p != '\n' && *p != '(' && *p != '|')
- p++;
- ne = p;
+ p++;
while (*p == ' ' || *p == '\t' || *p == '\n')
p++;
- evr = 0;
- flags = 0;
- e = ee = 0;
- if (*p == '(')
+ if (*p == '>')
+ flags |= REL_GT;
+ else if (*p == '=')
+ flags |= REL_EQ;
+ else if (*p == '<')
+ flags |= REL_LT;
+ if (flags)
{
p++;
- while (*p == ' ' || *p == '\t' || *p == '\n')
- p++;
if (*p == '>')
flags |= REL_GT;
else if (*p == '=')
flags |= REL_EQ;
else if (*p == '<')
flags |= REL_LT;
- if (flags)
- {
- p++;
- if (*p == '>')
- flags |= REL_GT;
- else if (*p == '=')
- flags |= REL_EQ;
- else if (*p == '<')
- flags |= REL_LT;
- else
- p--;
- p++;
- }
- while (*p == ' ' || *p == '\t' || *p == '\n')
- p++;
- e = p;
- while (*p && *p != ' ' && *p != '\t' && *p != '\n' && *p != ')')
- p++;
- ee = p;
- while (*p && *p != ')')
- p++;
- if (*p)
- p++;
- while (*p == ' ' || *p == '\t' || *p == '\n')
- p++;
- }
- name = strn2id(pool, n, ne - n, 1);
- if (e)
- {
- evr = strn2id(pool, e, ee - e, 1);
- name = rel2id(pool, name, evr, flags, 1);
+ else
+ p--;
+ p++;
}
- if (!id)
- id = name;
- else
- id = rel2id(pool, id, name, REL_OR, 1);
- if (*p != '|')
- break;
- p++;
+ while (*p == ' ' || *p == '\t' || *p == '\n')
+ p++;
+ e = p;
+ while (*p && *p != ' ' && *p != '\t' && *p != '\n' && *p != ')')
+ p++;
+ ee = p;
+ while (*p && *p != ')')
+ p++;
+ if (*p)
+ p++;
+ while (*p == ' ' || *p == '\t' || *p == '\n')
+ p++;
+ }
+ name = strn2id(pool, n, ne - n, 1);
+ if (e)
+ {
+ evr = strn2id(pool, e, ee - e, 1);
+ name = rel2id(pool, name, evr, flags, 1);
+ }
+ if (*p == '|')
+ {
+ Id id = parseonedep(pool, p + 1);
+ if (id)
+ name = rel2id(pool, name, id, REL_OR, 1);
+ }
+ return name;
+}
+
+static unsigned int
+makedeps(Repo *repo, char *deps, unsigned int olddeps, Id marker)
+{
+ Pool *pool = repo->pool;
+ char *p;
+ Id id;
+
+ while ((p = strchr(deps, ',')) != 0)
+ {
+ *p = 0;
+ olddeps = makedeps(repo, deps, olddeps, marker);
+ *p = ',';
+ deps = p + 1;
}
+ id = parseonedep(pool, deps);
if (!id)
return olddeps;
return repo_addid_dep(repo, olddeps, id, marker);
Pool *pool = repo->pool;
char *p, *q, *end, *tag;
int x, l;
+ int havesource = 0;
p = control;
while (*p)
else if (!strcasecmp(tag, "recommends"))
s->recommends = makedeps(repo, q, s->recommends, 0);
break;
+ case 'S' << 8 | 'O':
+ if (!strcasecmp(tag, "source"))
+ {
+ if (s->name && !strcmp(q, id2str(pool, s->name)))
+ repodata_set_void(data, s - pool->solvables, SOLVABLE_SOURCENAME);
+ else
+ repodata_set_id(data, s - pool->solvables, SOLVABLE_SOURCENAME, str2id(pool, q, 1));
+ havesource = 1;
+ }
+ break;
case 'S' << 8 | 'U':
if (!strcasecmp(tag, "suggests"))
s->suggests = makedeps(repo, q, s->suggests, 0);
s->evr = ID_EMPTY;
if (s->name)
s->provides = repo_addid_dep(repo, s->provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
+ if (s->name && !havesource)
+ repodata_set_void(data, s - pool->solvables, SOLVABLE_SOURCENAME);
}
void
#include "pool.h"
-#ifdef DEBIAN_SEMANTICS
+#if defined(DEBIAN_SEMANTICS) || defined(MULTI_SEMANTICS)
+
+#ifdef MULTI_SEMANTICS
+# define vercmp vercmp_deb
+#endif
+
+/* debian type version compare */
int
vercmp(const char *s1, const char *q1, const char *s2, const char *q2)
{
}
}
-#else
+#ifdef MULTI_SEMANTICS
+# undef vercmp
+#endif
+
+#endif
+
+#if !defined(DEBIAN_SEMANTICS) || defined(MULTI_SEMANTICS)
+/* rpm type version compare */
int
vercmp(const char *s1, const char *q1, const char *s2, const char *q2)
{
#endif
+#if defined(MULTI_SEMANTICS)
+# define vercmp (*(pool->disttype == DISTTYPE_DEB ? &vercmp_deb : &ver##cmp))
+#endif
/* edition (e:v-r) compare */
int
sat_free(pool);
}
+#ifdef MULTI_SEMANTICS
+void
+pool_setdisttype(Pool *pool, int disttype)
+{
+ pool->disttype = disttype;
+}
+#endif
+
Id
pool_add_solvable(Pool *pool)
{
/*************************************************************************/
+#if defined(MULTI_SEMANTICS)
+# define EVRCMP_DEPCMP (pool->disttype == DISTTYPE_DEB ? EVRCMP_COMPARE : EVRCMP_MATCH_RELEASE)
+#elif defined(DEBIAN_SEMANTICS)
+# define EVRCMP_DEPCMP EVRCMP_COMPARE
+#else
+# define EVRCMP_DEPCMP EVRCMP_MATCH_RELEASE
+#endif
+
/* check if a package's nevr matches a dependency */
int
return 1;
if (flags != 2 && flags != 5)
flags ^= 5;
-#ifdef DEBIAN_SEMANTICS
- if ((flags & (1 << (1 + evrcmp(pool, s->evr, evr, EVRCMP_COMPARE)))) != 0)
- return 1;
-#else
- if ((flags & (1 << (1 + evrcmp(pool, s->evr, evr, EVRCMP_MATCH_RELEASE)))) != 0)
+ if ((flags & (1 << (1 + evrcmp(pool, s->evr, evr, EVRCMP_DEPCMP)))) != 0)
return 1;
-#endif
return 0;
}
else
{
int f = flags == 5 ? 5 : flags == 2 ? pflags : (flags ^ 5) & (pflags | 5);
-#ifdef DEBIAN_SEMANTICS
- if ((f & (1 << (1 + evrcmp(pool, rd1->evr, rd2->evr, EVRCMP_COMPARE)))) != 0)
+ if ((f & (1 << (1 + evrcmp(pool, rd1->evr, rd2->evr, EVRCMP_DEPCMP)))) != 0)
return 1;
-#else
- if ((f & (1 << (1 + evrcmp(pool, rd1->evr, rd2->evr, EVRCMP_MATCH_RELEASE)))) != 0)
- return 1;
-#endif
}
return 0;
}
if (pid == name)
{
-#ifdef DEBIAN_SEMANTICS
+#if defined(MULTI_SEMANTICS)
+ if (pool->disttype == DISTTYPE_DEB)
+ continue;
+ else
+ break;
+#elif defined(DEBIAN_SEMANTICS)
continue; /* unversioned provides can
* never match versioned deps */
#else
else
{
int f = flags == 5 ? 5 : flags == 2 ? pflags : (flags ^ 5) & (pflags | 5);
-#ifdef DEBIAN_SEMANTICS
- if ((f & (1 << (1 + evrcmp(pool, pevr, evr, EVRCMP_COMPARE)))) != 0)
- break;
-#else
- if ((f & (1 << (1 + evrcmp(pool, pevr, evr, EVRCMP_MATCH_RELEASE)))) != 0)
+ if ((f & (1 << (1 + evrcmp(pool, pevr, evr, EVRCMP_DEPCMP)))) != 0)
break;
-#endif
}
}
if (!pid)
int obsoleteusescolors; /* true: obsoletes check arch color */
int novirtualconflicts; /* true: conflicts on names, not on provides */
int allowselfconflicts; /* true: packages which conflict with itself are installable */
+#ifdef MULTI_SEMANTICS
+ int disttype;
+#endif
Id *id2arch; /* map arch ids to scores */
unsigned char *id2color; /* map arch ids to colors */
Repopos pos;
};
+#ifdef MULTI_SEMANTICS
+# define DISTTYPE_RPM 0
+# define DISTTYPE_DEB 1
+#endif
+
#define SAT_FATAL (1<<0)
#define SAT_ERROR (1<<1)
#define SAT_WARN (1<<2)
*/
extern void pool_free(Pool *pool);
+extern void pool_setdebuglevel(Pool *pool, int level);
+#ifdef MULTI_SEMANTICS
+extern void pool_setdisttype(Pool *pool, int disttype);
+#endif
+
extern void pool_debug(Pool *pool, int type, const char *format, ...) __attribute__((format(printf, 3, 4)));
extern char *pool_alloctmpspace(Pool *pool, int len);
return pool->whatprovidesdata + off;
}
-extern void pool_setdebuglevel(Pool *pool, int level);
-
static inline void pool_setdebugcallback(Pool *pool, void (*debugcallback)(struct _Pool *, void *data, int type, const char *str), void *debugcallbackdata)
{
pool->debugcallback = debugcallback;
data->attriddata[data->attriddatalen++] = 0;
}
+void
+repodata_delete_uninternalized(Repodata *data, Id solvid, Id keyname)
+{
+ Id *pp, *ap, **app;
+ app = repodata_get_attrp(data, solvid);
+ ap = *app;
+ if (!ap)
+ return;
+ for (; *ap; ap += 2)
+ if (data->keys[*ap].name == keyname)
+ break;
+ if (!*ap)
+ return;
+ pp = ap;
+ ap += 2;
+ for (; *ap; ap += 2)
+ {
+ if (data->keys[*ap].name == keyname)
+ continue;
+ *pp++ = ap[0];
+ *pp++ = ap[1];
+ }
+ *pp = 0;
+}
+
/* add all attrs from src to dest */
void
repodata_merge_attrs(Repodata *data, Id dest, Id src)
void repodata_add_fixarray(Repodata *data, Id solvid, Id keyname, Id ghandle);
void repodata_add_flexarray(Repodata *data, Id solvid, Id keyname, Id ghandle);
+void repodata_delete_uninternalized(Repodata *data, Id solvid, Id keyname);
+
/*
merge attributes from one solvable to another
works only if the data is not yet internalized
Id rpmid, rpmarch, rpmrel, archlock;
int status = 0;
int nocheck = 0;
+ int withsrc = 0;
exclude_pat = 0;
archlock = 0;
FILE *fp;
int l;
+ if (!strcmp(argv[i], "--withsrc"))
+ {
+ withsrc++;
+ continue;
+ }
if (!strcmp(argv[i], "--nocheck"))
{
if (!nocheck)
Solvable *s = pool->solvables + p;
if (!s->repo)
continue;
+ if (withsrc && (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC))
+ {
+ queue_push(&cand, p);
+ continue;
+ }
if (!pool_installable(pool, s))
continue;
if (rpmrel && s->arch != rpmarch)