struct pakfire_archive* archive;
ASSERT_SUCCESS(pakfire_archive_open(&archive, t->pakfire, path));
+ pakfire_archive_verify_status_t status;
+
// Verify the archive
- pakfire_archive_verify_status_t verify = pakfire_archive_verify(archive);
- ASSERT(verify == PAKFIRE_ARCHIVE_VERIFY_OK);
+ ASSERT(pakfire_archive_verify(archive, &status, NULL) == 0);
+ ASSERT(status == PAKFIRE_ARCHIVE_VERIFY_OK);
pakfire_archive_unref(archive);
struct pakfire_archive* archive;
ASSERT_SUCCESS(pakfire_archive_open(&archive, t->pakfire, path));
- struct pakfire_repo* repo = pakfire_repo_create(t->pakfire, "tmp");
+ struct pakfire_repo* repo = NULL;
+
+ // Create a new repository
+ ASSERT_SUCCESS(pakfire_repo_create(&repo, t->pakfire, "tmp"));
ASSERT(repo);
- struct pakfire_package* pkg = pakfire_repo_add_archive(repo, archive);
- ASSERT(pkg);
+ struct pakfire_package* package = NULL;
+
+ // Add the package to the repository
+ ASSERT_SUCCESS(pakfire_repo_add_archive(repo, archive, &package));
+ ASSERT(package);
pakfire_repo_unref(repo);
- pakfire_package_unref(pkg);
+ pakfire_package_unref(package);
pakfire_archive_unref(archive);
return EXIT_SUCCESS;
ASSERT_SUCCESS(pakfire_archive_open(&archive, t->pakfire, path));
ASSERT(archive);
+ struct pakfire_package* package = NULL;
+
// Get package
- struct pakfire_package* pkg = pakfire_archive_make_package(archive, repo);
- ASSERT(pkg);
+ ASSERT_SUCCESS(pakfire_archive_make_package(archive, repo, &package));
+ ASSERT(package);
// Try to add the package to the database
- r = pakfire_db_add_package(db, pkg, archive);
+ r = pakfire_db_add_package(db, package, archive, 1);
ASSERT(r == 0);
// One package should be installed
ASSERT(packages == 1);
// Remove the package again
- r = pakfire_db_remove_package(db, pkg);
+ r = pakfire_db_remove_package(db, package);
ASSERT(r == 0);
// No packages should be installed any more
// Cleanup
pakfire_archive_unref(archive);
pakfire_db_unref(db);
- pakfire_package_unref(pkg);
+ pakfire_package_unref(package);
pakfire_repo_unref(repo);
return 0;
ASSERT(r == 0);
// Retrieve a file
- r = pakfire_downloader_retrieve(d, NULL, NULL, NULL, DOWNLOAD_URL, DOWNLOAD_PATH, 0);
+ r = pakfire_downloader_retrieve(d, NULL, NULL, NULL, DOWNLOAD_URL, DOWNLOAD_PATH,
+ PAKFIRE_DIGEST_NONE, NULL, 0, 0);
ASSERT(r == 0);
// Cleanup
ASSERT(r == 0);
// Add a transfer
- r = pakfire_downloader_add_transfer(d, NULL, NULL, NULL, DOWNLOAD_URL, DOWNLOAD_PATH, 0);
+ r = pakfire_downloader_add_transfer(d, NULL, NULL, NULL, DOWNLOAD_URL, DOWNLOAD_PATH,
+ PAKFIRE_DIGEST_NONE, NULL, 0, 0);
ASSERT(r == 0);
// Retrieve a file
- r = pakfire_downloader_retrieve(d, NULL, NULL, NULL, DOWNLOAD_URL, DOWNLOAD_PATH, 0);
+ r = pakfire_downloader_retrieve(d, NULL, NULL, NULL, DOWNLOAD_URL, DOWNLOAD_PATH,
+ PAKFIRE_DIGEST_NONE, NULL, 0, 0);
ASSERT(r == 0);
// Cleanup
// Retrieve a file which exists
ASSERT_SUCCESS(pakfire_downloader_retrieve(d, NULL, m,
- NULL, "beep-1.3-2.ip3.x86_64.pfm", DOWNLOAD_PATH, 0));
+ NULL, "beep-1.3-2.ip3.x86_64.pfm", DOWNLOAD_PATH, PAKFIRE_DIGEST_NONE, NULL, 0, 0));
// Cleanup
ASSERT_NULL(pakfire_mirrorlist_unref(m));
pakfire_key_unref(key);
}
+#if 0
// Import a key
struct pakfire_key** keys = pakfire_key_import(t->pakfire, TEST_KEY_DATA);
free(data);
pakfire_key_unref(key);
+#endif
return EXIT_SUCCESS;
}
static int test_packages(const struct test* t) {
struct pakfire_package* pkg = NULL;
+ struct pakfire_repo* repo = NULL;
- struct pakfire_repo* repo = pakfire_repo_create(t->pakfire, "test");
+ ASSERT_SUCCESS(pakfire_repo_create(&repo, t->pakfire, "test"));
ASSERT(repo);
struct pakfire_parser* parser = pakfire_parser_create(t->pakfire, NULL, NULL,
static int test_create(const struct test* t) {
struct pakfire_packager* packager;
+ struct pakfire_repo* repo = NULL;
- struct pakfire_repo* repo = pakfire_repo_create(t->pakfire, "test");
+ ASSERT_SUCCESS(pakfire_repo_create(&repo, t->pakfire, "test"));
ASSERT(repo);
struct pakfire_package* pkg = pakfire_package_create(t->pakfire, repo,
char baseurl[1024];
snprintf(baseurl, sizeof(baseurl) - 1, "file://%s/data", TEST_SRC_PATH);
- struct pakfire_repo* repo = pakfire_repo_create(t->pakfire, "test");
+ struct pakfire_repo* repo = NULL;
+
+ ASSERT_SUCCESS(pakfire_repo_create(&repo, t->pakfire, "test"));
ASSERT(repo);
pakfire_repo_set_baseurl(repo, baseurl);
r = pakfire_create(&t->pakfire, root, NULL, TEST_SRC_PATH "/pakfire.conf", 0,
pakfire_log_stderr, NULL);
if (r) {
- LOG("ERROR: Could not initialize Pakfire: %m\n");
+ LOG("ERROR: Could not initialize pakfire: %m\n");
exit(1);
}
LOG("Test failed with error code: %d\n", r);
// Release pakfire
- Pakfire p = pakfire_unref(t->pakfire);
+ struct pakfire* p = pakfire_unref(t->pakfire);
// Check if Pakfire was actually released
if (p) {
struct test {
const char* name;
int (*func)(const struct test* t);
- Pakfire pakfire;
+ struct pakfire* pakfire;
};
struct testsuite {