Example #1
0
static int validate_deltas(alpm_handle_t *handle, alpm_list_t *deltas,
		alpm_list_t **data)
{
	int errors = 0, ret = 0;
	alpm_list_t *i;
	alpm_trans_t *trans = handle->trans;

	if(!deltas) {
		return 0;
	}

	/* Check integrity of deltas */
	EVENT(trans, ALPM_TRANS_EVT_DELTA_INTEGRITY_START, NULL, NULL);

	for(i = deltas; i; i = i->next) {
		alpm_delta_t *d = alpm_list_getdata(i);
		char *filepath = _alpm_filecache_find(handle, d->delta);

		if(test_md5sum(trans, filepath, d->delta_md5) != 0) {
			errors++;
			*data = alpm_list_add(*data, strdup(d->delta));
		}
		FREE(filepath);
	}
	if(errors) {
		handle->pm_errno = ALPM_ERR_DLT_INVALID;
		return -1;
	}
	EVENT(trans, ALPM_TRANS_EVT_DELTA_INTEGRITY_DONE, NULL, NULL);

	/* Use the deltas to generate the packages */
	EVENT(trans, ALPM_TRANS_EVT_DELTA_PATCHES_START, NULL, NULL);
	ret = apply_deltas(handle);
	EVENT(trans, ALPM_TRANS_EVT_DELTA_PATCHES_DONE, NULL, NULL);
	return ret;
}
Example #2
0
int
main (int argc, char **argv)
{
	test_init (argc, argv, xmlrpc_entries);

	if (!uri) {
		apache_init ();
		uri = default_uri;
	}

	srand (time (NULL));

	session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);

	if (!test_sum ())
		errors++;
	if (!test_countBools ())
		errors++;
	if (!test_md5sum ())
		errors++;
	if (!test_dateChange ())
		errors++;
	if (!test_echo ())
		errors++;
	if (!test_fault_malformed ())
		errors++;
	if (!test_fault_method ())
		errors++;
	if (!test_fault_args ())
		errors++;

	soup_test_session_abort_unref (session);

	test_cleanup ();
	return errors != 0;
}