コード例 #1
0
static gboolean
disabled_repos_configure (GHashTable *table, GError **error)
{
	const alpm_list_t *i;

	g_debug ("reading config from %s", PK_BACKEND_CONFIG_FILE);

	/* read configuration from pacman.conf file */
	if (!pk_backend_configure (PK_BACKEND_CONFIG_FILE, error)) {
		return FALSE;
	}

	/* disable disabled repos */
	for (i = alpm_option_get_syncdbs (); i != NULL;) {
		pmdb_t *db = (pmdb_t *) i->data;
		const gchar *repo = alpm_db_get_name (db);

		if (g_hash_table_lookup (table, repo) == NULL) {
			/* repo is not disabled */
			i = i->next;
			continue;
		}

		if (alpm_db_unregister (db) < 0) {
			g_set_error (error, ALPM_ERROR, pm_errno, "[%s]: %s",
				     repo, alpm_strerrorlast ());
			return FALSE;
		}

		/* start again because the list gets invalidated */
		i = alpm_option_get_syncdbs ();
	}

	return TRUE;
}
コード例 #2
0
ファイル: pk-backend-alpm.c プロジェクト: kaltsi/PackageKit
static gboolean
pk_backend_initialize_alpm (PkBackend *self, GError **error)
{
	g_return_val_if_fail (self != NULL, FALSE);

	pk_backend_configure_environment (self);

	alpm = pk_backend_configure (PK_BACKEND_CONFIG_FILE, error);
	if (alpm == NULL) {
		return FALSE;
	}

	backend = self;
	alpm_option_set_logcb (alpm, pk_backend_logcb);

	localdb = alpm_get_localdb (alpm);
	if (localdb == NULL) {
		alpm_errno_t errno = alpm_errno (alpm);
		g_set_error (error, ALPM_ERROR, errno, "[%s]: %s", "local",
			     alpm_strerror (errno));
	}

	return TRUE;
}