summaryrefslogtreecommitdiff
path: root/lib/tds.c
blob: 5e4c61ac25810c71622e7f5d7957a5026b0cbc86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "system.h"

#include <rpmlib.h>

#include <rpmds.h>

#include "debug.h"

extern int _rpmds_debug;

int main(int argc, char *argv[])
{
    rpmTag tagN = RPMTAG_REQUIRENAME;
    rpmds ds = NULL;
    rpmds dsA;
    rpmds dsA1;
    rpmds dsA2;
    rpmds dsB;
    rpmds dsC;

    _rpmds_debug = 0;
    dsA = rpmdsSingle(tagN, "A", "0", RPMSENSE_EQUAL);
    dsA1 = rpmdsSingle(tagN, "A", "0", RPMSENSE_LESS);
    dsA2 = rpmdsSingle(tagN, "A", "0", RPMSENSE_GREATER);
    dsB = rpmdsSingle(tagN, "B", "1", RPMSENSE_LESS);
    dsC = rpmdsSingle(tagN, "C", "2", RPMSENSE_GREATER);

    rpmdsMerge(&ds, dsA2);
    rpmdsMerge(&ds, dsA);
    rpmdsMerge(&ds, dsC);
    rpmdsMerge(&ds, dsB);
    rpmdsMerge(&ds, dsA1);

    ds = rpmdsInit(ds);
    while (rpmdsNext(ds) >= 0)
	fprintf(stderr, "%d %s\n", rpmdsIx(ds), rpmdsDNEVR(ds)+2);

    return 0;
}