Esempio n. 1
0
static void
handle_install_error (PkBackend *backend, int err)
{
	switch (err)
	{
/*	case OPKG_NO_ERROR:
		break;
	case OPKG_PACKAGE_NOT_INSTALLED:
		pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED, NULL);
		break;
	case OPKG_PACKAGE_ALREADY_INSTALLED:
		pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_ALREADY_INSTALLED, NULL);
		break;
	case OPKG_GPG_ERROR:
		pk_backend_error_code (backend, PK_ERROR_ENUM_GPG_FAILURE, NULL);
		break;
	case OPKG_DOWNLOAD_FAILED:
		pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED, NULL);
		break;
	case OPKG_DEPENDENCIES_FAILED:
		pk_backend_error_code (backend, PK_ERROR_ENUM_DEP_RESOLUTION_FAILED, NULL);
		break;
	case OPKG_MD5_ERROR:
		pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_CORRUPT, NULL);
		break;
	case OPKG_PACKAGE_NOT_AVAILABLE:
		pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, NULL);
		break;*/
	default:
		opkg_unknown_error (backend, err, "Update package");
	}
}
Esempio n. 2
0
static void
backend_update_system_thread (PkBackendJob *job, GVariant *params, gpointer user_data)
{
	gint err;

	/* FIXME: support only_trusted */
	err = opkg_upgrade_all (pk_opkg_progress_cb, backend);

	if (err)
		opkg_unknown_error (backend, err, "Upgrading system");

	pk_backend_job_finished (job);
}
Esempio n. 3
0
static gboolean
backend_update_system_thread (PkBackend *backend)
{
	gint err;

	/* FIXME: support only_trusted */
	err = opkg_upgrade_all (pk_opkg_progress_cb, backend);

	if (err)
		opkg_unknown_error (backend, err, "Upgrading system");

	pk_backend_finished (backend);
	return (err != 0);
}
Esempio n. 4
0
static gboolean
backend_remove_packages_thread (PkBackend *backend)
{
	gint err, i;
	gchar **package_ids;
	gchar **parts;
	gboolean allow_deps;
	gboolean autoremove;
	gpointer *data;

	data = pk_backend_get_pointer (backend, "remove-params");

	package_ids = (gchar**) data[0];
	allow_deps = GPOINTER_TO_INT (data[1]);
	autoremove = GPOINTER_TO_INT (data[2]);
	g_free (data);

	opkg_set_option ((char *)"autoremove", &autoremove);
	opkg_set_option ((char *)"force_removal_of_dependent_packages", &allow_deps);

	err = 0;

	for (i = 0; package_ids[i]; i++)
	{
		pk_backend_package (backend, PK_INFO_ENUM_REMOVING, package_ids[i], NULL);

		parts = pk_package_id_split (package_ids[i]);

		err = opkg_remove_package (parts[PK_PACKAGE_ID_NAME], pk_opkg_progress_cb, backend);

		switch (err)
		{
		//case OPKG_NO_ERROR:
		//	break;
		//case OPKG_PACKAGE_NOT_INSTALLED:
		//	pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED, NULL);
		//	break;
		default:
			opkg_unknown_error (backend, err, "Remove");
		}
		g_strfreev (parts);

		if (err != 0)
			break;
	}

	pk_backend_finished (backend);
	return (err == 0);
}
Esempio n. 5
0
static void
backend_refresh_cache_thread (PkBackendJob *job, GVariant *params, gpointer user_data)
{
	int ret;

	ret = opkg_update_package_lists (pk_opkg_progress_cb, backend);

	if (ret) {
//		if (ret == OPKG_DOWNLOAD_FAILED)
//			pk_backend_job_error_code (job, PK_ERROR_ENUM_REPO_NOT_AVAILABLE, NULL);
//		else
			opkg_unknown_error (backend, ret, "Refreshing cache");
	}
	pk_backend_job_finished (job);
}
Esempio n. 6
0
static gboolean
backend_refresh_cache_thread (PkBackend *backend)
{
	int ret;

	ret = opkg_update_package_lists (pk_opkg_progress_cb, backend);

	if (ret) {
//		if (ret == OPKG_DOWNLOAD_FAILED)
//			pk_backend_error_code (backend, PK_ERROR_ENUM_REPO_NOT_AVAILABLE, NULL);
//		else
			opkg_unknown_error (backend, ret, "Refreshing cache");
	}
	pk_backend_finished (backend);

	return (ret == 0);
}