示例#1
0
static PyObject *
install(_GoalObject *self, PyObject *args, PyObject *kwds)
{
    DnfPackage *pkg = NULL;
    HySelector sltr = NULL;
    int flags = 0;
    g_autoptr(GError) error = NULL;
    if (!args_pkg_sltr_parse(args, kwds, &pkg, &sltr, &flags, HY_WEAK_SOLV))
        return NULL;

    if (flags & HY_WEAK_SOLV) {
        if (pkg) {
            hy_goal_install_optional(self->goal, pkg);
        } else {
            hy_goal_install_selector_optional(self->goal, sltr, &error);
        }
    } else {
        if (pkg) {
            hy_goal_install(self->goal, pkg);
        } else {
            hy_goal_install_selector(self->goal, sltr, &error);
        }
    }
    return op_error2exc(error);
}
示例#2
0
static PyObject *
distupgrade(_GoalObject *self, PyObject *args, PyObject *kwds)
{
    HifPackage *pkg = NULL;
    HySelector sltr = NULL;
    if (!args_pkg_sltr_parse(args, kwds, &pkg, &sltr, NULL, 0))
        return NULL;

    int ret = pkg ? hy_goal_distupgrade(self->goal, pkg) :
        hy_goal_distupgrade_selector(self->goal, sltr);
    return op_ret2exc(ret);
}
示例#3
0
文件: goal-py.c 项目: Tojaj/hawkey
static PyObject *
install(_GoalObject *self, PyObject *args, PyObject *kwds)
{
    HyPackage pkg = NULL;
    HySelector sltr = NULL;
    if (!args_pkg_sltr_parse(args, kwds, &pkg, &sltr, NULL, 0))
	return NULL;

    int ret = pkg ? hy_goal_install(self->goal, pkg) :
	hy_goal_install_selector(self->goal, sltr);
    return op_ret2exc(ret);
}
示例#4
0
static PyObject *
erase(_GoalObject *self, PyObject *args, PyObject *kwds)
{
    HifPackage *pkg = NULL;
    HySelector sltr = NULL;
    int flags = 0;
    if (!args_pkg_sltr_parse(args, kwds, &pkg, &sltr, &flags, HY_CLEAN_DEPS))
        return NULL;

    int ret = pkg ? hy_goal_erase_flags(self->goal, pkg, flags) :
        hy_goal_erase_selector_flags(self->goal, sltr, flags);
    return op_ret2exc(ret);
}
示例#5
0
static PyObject *
upgrade(_GoalObject *self, PyObject *args, PyObject *kwds)
{
    HifPackage *pkg = NULL;
    HySelector sltr = NULL;

    if (!args_pkg_sltr_parse(args, kwds, &pkg, &sltr, NULL, 0))
        return NULL;
    if (pkg) {
        PyErr_SetString(PyExc_NotImplementedError,
                        "Selecting a package to be upgraded is not implemented.");
        return NULL;
    }
    int ret = hy_goal_upgrade_selector(self->goal, sltr);
    return op_ret2exc(ret);
}
示例#6
0
static PyObject *
upgrade_to(_GoalObject *self, PyObject *args, PyObject *kwds)
{
    HifPackage *pkg = NULL;
    HySelector sltr = NULL;
    int ret;
    int flags = 0;

    if (!args_pkg_sltr_parse(args, kwds, &pkg, &sltr,
                              &flags, HY_CHECK_INSTALLED))
        return NULL;
    if (sltr) {
        ret = hy_goal_upgrade_to_selector(self->goal, sltr);
        return op_ret2exc(ret);
    }
    ret = hy_goal_upgrade_to_flags(self->goal, pkg, flags);
    return op_ret2exc(ret);
}