Пример #1
0
/**
 * dnf_package_from_solvable: (skip):
 * @pkg: a #DnfPackage instance.
 *
 * Creates a package from a solvable.
 *
 * Returns: a #HyPackage
 *
 * Since: 0.7.0
 */
DnfPackage *
dnf_package_from_solvable(DnfSack *sack, Solvable *s)
{
    if (!s)
        return NULL;

    Id p = s - s->repo->pool->solvables;
    return dnf_package_new(sack, p);
}
Пример #2
0
END_TEST

START_TEST(test_goal_kernel_protected)
{
    DnfSack *sack = test_globals.sack;
    dnf_sack_set_running_kernel_fn(sack, mock_running_kernel);
    Id kernel_id = mock_running_kernel(sack);
    DnfPackage *kernel = dnf_package_new(sack, kernel_id);

    HyGoal goal = hy_goal_create(sack);
    hy_goal_erase(goal, kernel);
    fail_unless(hy_goal_run_flags(goal, 0));

    g_object_unref(kernel);
    hy_goal_free(goal);
}
Пример #3
0
static int
package_init(_PackageObject *self, PyObject *args, PyObject *kwds)
{
    Id id;
    PyObject *sack;
    DnfSack *csack;

    if (!PyArg_ParseTuple(args, "(O!i)", &sack_Type, &sack, &id))
        return -1;
    csack = sackFromPyObject(sack);
    if (csack == NULL)
        return -1;
    self->sack = sack;
    Py_INCREF(self->sack);
    self->package = dnf_package_new(csack, id);
    return 0;
}
Пример #4
0
GPtrArray *
hy_selector_matches(HySelector sltr)
{
    DnfSack *sack = selector_sack(sltr);
    Pool *pool = dnf_sack_get_pool(sack);
    Queue job, solvables;

    queue_init(&job);
    sltr2job(sltr, &job, 0);

    queue_init(&solvables);
    selection_solvables(pool, &job, &solvables);

    GPtrArray *plist = hy_packagelist_create();
    for (int i = 0; i < solvables.count; i++)
        g_ptr_array_add(plist, dnf_package_new(sack, solvables.elements[i]));

    queue_free(&solvables);
    queue_free(&job);
    return plist;
}
Пример #5
0
/**
 * dnf_package_clone:
 * @pkg: a #DnfPackage instance.
 *
 * Clones the package.
 *
 * Returns: a #DnfPackage
 *
 * Since: 0.7.0
 */
DnfPackage *
dnf_package_clone(DnfPackage *pkg)
{
    return dnf_package_new(dnf_package_get_sack(pkg), dnf_package_get_id(pkg));
}