Solvable *s = $self->pool->solvables + $self->id;
Queue r;
queue_init(&r);
- if (marker == -1 || marker == 1) {
- if (keyname == SOLVABLE_PROVIDES)
- marker = marker < 0 ? -SOLVABLE_FILEMARKER : SOLVABLE_FILEMARKER;
- else if (keyname == SOLVABLE_REQUIRES)
- marker = marker < 0 ? -SOLVABLE_PREREQMARKER : SOLVABLE_PREREQMARKER;
- else
- marker = 0;
- }
solvable_lookup_deparray(s, keyname, &r, marker);
return r;
}
Solvable *s = $self->pool->solvables + $self->id;
Queue r;
queue_init(&r);
- if (marker == -1 || marker == 1) {
- if (keyname == SOLVABLE_PROVIDES)
- marker = marker < 0 ? -SOLVABLE_FILEMARKER : SOLVABLE_FILEMARKER;
- else if (keyname == SOLVABLE_REQUIRES)
- marker = marker < 0 ? -SOLVABLE_PREREQMARKER : SOLVABLE_PREREQMARKER;
- else
- marker = 0;
- }
solvable_lookup_deparray(s, keyname, &r, marker);
return r;
}
/* old interface, please use the generic add_deparray instead */
void add_provides(DepId id, Id marker = -1) {
Solvable *s = $self->pool->solvables + $self->id;
- if (marker == -1 || marker == 1)
- marker = marker < 0 ? -SOLVABLE_FILEMARKER : SOLVABLE_FILEMARKER;
+ marker = solv_depmarker(SOLVABLE_PROVIDES, marker);
s->provides = repo_addid_dep(s->repo, s->provides, id, marker);
}
void add_obsoletes(DepId id) {
}
void add_requires(DepId id, Id marker = -1) {
Solvable *s = $self->pool->solvables + $self->id;
- if (marker == -1 || marker == 1)
- marker = marker < 0 ? -SOLVABLE_PREREQMARKER : SOLVABLE_PREREQMARKER;
+ marker = solv_depmarker(SOLVABLE_REQUIRES, marker);
s->requires = repo_addid_dep(s->repo, s->requires, id, marker);
}
void add_recommends(DepId id) {
void add_deparray(Id keyname, DepId id, Id marker = -1) {
Solvable *s = $self->pool->solvables + $self->id;
- if (marker == -1 || marker == 1) {
- if (keyname == SOLVABLE_PROVIDES)
- marker = marker < 0 ? -SOLVABLE_FILEMARKER : SOLVABLE_FILEMARKER;
- else if (keyname == SOLVABLE_REQUIRES)
- marker = marker < 0 ? -SOLVABLE_PREREQMARKER : SOLVABLE_PREREQMARKER;
- else
- marker = 0;
- }
solvable_add_deparray(s, keyname, id, marker);
}
solv_chksum_len;
solv_chksum_str2type;
solv_chksum_type2str;
+ solv_depmarker;
solv_dupappend;
solv_dupjoin;
solv_free;
return repo_addid(repo, olddeps, id);
}
+/* return standard marker for the keyname dependency.
+ * 1: return positive marker, -1: return negative marker
+ */
+Id
+solv_depmarker(Id keyname, Id marker)
+{
+ if (marker != 1 && marker != -1)
+ return marker;
+ if (keyname == SOLVABLE_PROVIDES)
+ return marker < 0 ? -SOLVABLE_FILEMARKER : SOLVABLE_FILEMARKER;
+ if (keyname == SOLVABLE_REQUIRES)
+ return marker < 0 ? -SOLVABLE_PREREQMARKER : SOLVABLE_PREREQMARKER;
+ return 0;
+}
/*
* reserve Ids
*
* reserved ids will always begin at offset idarraysize
*/
-
Offset
repo_reserve_ids(Repo *repo, Offset olddeps, int num)
{
repo_lookup_deparray(Repo *repo, Id entry, Id keyname, Queue *q, Id marker)
{
int r = repo_lookup_idarray(repo, entry, keyname, q);
- if (r && marker && q->count)
+ if (!r)
+ return 0;
+ if (marker == -1 || marker == 1)
+ marker = solv_depmarker(keyname, marker);
+ if (marker && q->count)
{
int i;
if (marker < 0)
repo_add_deparray(Repo *repo, Id p, Id keyname, Id dep, Id marker)
{
Repodata *data;
+ if (marker == -1 || marker == 1)
+ marker = solv_depmarker(keyname, marker);
if (p >= 0)
{
Solvable *s = repo->pool->solvables + p;
repo_set_deparray(Repo *repo, Id p, Id keyname, Queue *q, Id marker)
{
Repodata *data;
+ if (marker == -1 || marker == 1)
+ marker = solv_depmarker(keyname, marker);
if (marker)
{
/* complex case, splice old and new arrays */
const char *repo_lookup_checksum(Repo *repo, Id entry, Id keyname, Id *typep);
const unsigned char *repo_lookup_bin_checksum(Repo *repo, Id entry, Id keyname, Id *typep);
const void *repo_lookup_binary(Repo *repo, Id entry, Id keyname, int *lenp);
+Id solv_depmarker(Id keyname, Id marker);
void repo_set_id(Repo *repo, Id p, Id keyname, Id id);
void repo_set_num(Repo *repo, Id p, Id keyname, unsigned long long num);