summaryrefslogtreecommitdiff
path: root/lib/tds.c
blob: 2f25b71d14224443c4a8b4488e8de05f60016548 (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
#include "system.h"

#include <rpm/rpmtag.h>
#include <rpm/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;
}