예제 #1
0
파일: reldep-py.c 프로젝트: zde/hawkey
static int
reldep_init(_ReldepObject *self, PyObject *args, PyObject *kwds)
{
    PyObject *sack;
    int cmp_type = 0;
    const char *reldep_str = NULL;
    char *name, *evr = NULL;
    if (!PyArg_ParseTuple(args, "O!s", &sack_Type, &sack, &reldep_str))
	return -1;
    HySack csack = sackFromPyObject(sack);
    if (csack == NULL)
	return -1;

    if (parse_reldep_str(reldep_str, &name, &evr, &cmp_type) == -1) {
	PyErr_Format(HyExc_Value, "Wrong reldep format: %s", reldep_str);
	return -1;
    }

    self->reldep = hy_reldep_create(csack, name, cmp_type, evr);
    solv_free(name);
    solv_free(evr);
    if (self->reldep == NULL) {
	PyErr_Format(HyExc_Value, "No such reldep: %s", name);
	return -1;
    }
    return 0;
}
예제 #2
0
파일: test_query.c 프로젝트: mluscon/hawkey
END_TEST

START_TEST(test_query_conflicts)
{
    HySack sack = test_globals.sack;
    HyQuery q = hy_query_create(sack);
    HyReldep reldep = hy_reldep_create(sack, "custard", HY_GT|HY_EQ, "1.0.1");

    fail_unless(reldep != NULL);
    hy_query_filter_reldep(q, HY_PKG_CONFLICTS, reldep);
    fail_unless(query_count_results(q) == 1);
    hy_reldep_free(reldep);
    hy_query_free(q);
}
예제 #3
0
파일: test_query.c 프로젝트: mluscon/hawkey
END_TEST

START_TEST(test_query_reldep_arbitrary)
{
    HySack sack = test_globals.sack;
    HyQuery query = hy_query_create(sack);
    HyReldep reldep = hy_reldep_create(sack, "P-lib", HY_GT, "3-0");

    fail_if(reldep == NULL);
    hy_query_filter_reldep(query, HY_PKG_PROVIDES, reldep);
    fail_unless(query_count_results(query) == 3);

    hy_reldep_free(reldep);
    hy_query_free(query);
}
예제 #4
0
int hy_possibilities_next_reldep(HyPossibilities iter, HyReldep *out_reldep)
{
    if (iter->type != TYPE_RELDEP_NEW)
        return -1;
    iter->type = TYPE_RELDEP_END;
    char *name, *evr = NULL;
    int cmp_type = 0;
    if (parse_reldep_str(iter->subject, &name, &evr, &cmp_type) == -1)
        return -1;
    if (hif_sack_knows(iter->sack, name, NULL, iter->flags)) {
        *out_reldep = hy_reldep_create(iter->sack, name, cmp_type, evr);
        g_free(name);
        g_free(evr);
        if (*out_reldep == NULL)
            return -1;
        return 0;
    }
    return -1;
}