Beispiel #1
0
/**
 * hif_goal_depsolve:
 */
gboolean
hif_goal_depsolve (HyGoal goal, GError **error)
{
	gchar *tmp;
	gint cnt;
	gint j;
	gint rc;
	_cleanup_string_free_ GString *string = NULL;

	rc = hy_goal_run_flags (goal, HY_ALLOW_UNINSTALL);
	if (rc) {
		string = g_string_new ("Could not depsolve transaction; ");
		cnt = hy_goal_count_problems (goal);
		if (cnt == 1)
			g_string_append_printf (string, "%i problem detected:\n", cnt);
		else
			g_string_append_printf (string, "%i problems detected:\n", cnt);
		for (j = 0; j < cnt; j++) {
			tmp = hy_goal_describe_problem (goal, j);
			g_string_append_printf (string, "%i. %s\n", j, tmp);
			hy_free (tmp);
		}
		g_string_truncate (string, string->len - 1);
		g_set_error_literal (error,
				     HIF_ERROR,
				     HIF_ERROR_PACKAGE_CONFLICTS,
				     string->str);
		return FALSE;
	}

	/* anything to do? */
	if (hy_goal_req_length (goal) == 0) {
		g_set_error_literal (error,
				     HIF_ERROR,
				     HIF_ERROR_NO_PACKAGES_TO_UPDATE,
				     "The transaction was empty");
		return FALSE;
	}
	return TRUE;
}
Beispiel #2
0
static PyObject *
req_length(_GoalObject *self, PyObject *unused)
{
    return PyLong_FromLong(hy_goal_req_length(self->goal));
}