static PyObject* Archive_get_package(ArchiveObject* self) {
Pakfire pakfire = pakfire_archive_get_pakfire(self->archive);
- PakfireRepo repo = pakfire_get_repo(pakfire, "@dummy");
+ struct pakfire_repo* repo = pakfire_get_repo(pakfire, "@dummy");
if (!repo)
return NULL;
}
static PyObject* Package_get_repo(PackageObject* self) {
- PakfireRepo repo = pakfire_package_get_repo(self->package);
+ struct pakfire_repo* repo = pakfire_package_get_repo(self->package);
if (!repo)
Py_RETURN_NONE;
if (!PyArg_ParseTuple(args, "s", &name))
return NULL;
- PakfireRepo repo = pakfire_get_repo(self->pakfire, name);
+ struct pakfire_repo* repo = pakfire_get_repo(self->pakfire, name);
if (!repo)
Py_RETURN_NONE;
goto ERROR;
for (unsigned int i = 0; i < l; i++) {
- PakfireRepo repo = pakfire_repolist_get(repos, i);
+ struct pakfire_repo* repo = pakfire_repolist_get(repos, i);
if (!repo)
continue;
#include "package.h"
#include "repo.h"
-PyObject* new_repo(PyTypeObject* type, PakfireRepo repo) {
+PyObject* new_repo(PyTypeObject* type, struct pakfire_repo* repo) {
RepoObject* self = (RepoObject *)type->tp_alloc(type, 0);
if (self) {
self->repo = pakfire_repo_ref(repo);
#include <Python.h>
-#include <pakfire/types.h>
+#include <pakfire/repo.h>
#include "pakfire.h"
typedef struct {
PyObject_HEAD
- PakfireRepo repo;
+ struct pakfire_repo* repo;
int clean;
} RepoObject;
extern PyTypeObject RepoType;
-PyObject* new_repo(PyTypeObject* type, PakfireRepo repo);
+PyObject* new_repo(PyTypeObject* type, struct pakfire_repo* repo);
#endif /* PYTHON_PAKFIRE_REPO_H */
static struct pakfire_package* pakfire_archive_get_package(PakfireArchive archive) {
if (!archive->package) {
- PakfireRepo repo = pakfire_get_repo(archive->pakfire, "@dummy");
+ struct pakfire_repo* repo = pakfire_get_repo(archive->pakfire, "@dummy");
if (!repo)
return NULL;
/*
Copy all metadata from this archive to the package object
*/
-PAKFIRE_EXPORT struct pakfire_package* pakfire_archive_make_package(PakfireArchive archive, PakfireRepo repo) {
+PAKFIRE_EXPORT struct pakfire_package* pakfire_archive_make_package(PakfireArchive archive, struct pakfire_repo* repo) {
char* name = pakfire_archive_get(archive, "package", "name");
char* arch = pakfire_archive_get(archive, "package", "arch");
#include <pakfire/packager.h>
#include <pakfire/parser.h>
#include <pakfire/private.h>
+#include <pakfire/repo.h>
#include <pakfire/scriptlet.h>
#include <pakfire/snapshot.h>
#include <pakfire/types.h>
static int pakfire_build_package(Pakfire pakfire, PakfireParser makefile,
const char* id, const char* buildroot, const char* namespace, const char* target) {
- PakfireRepo repo = NULL;
+ struct pakfire_repo* repo = NULL;
struct pakfire_package* pkg = NULL;
struct pakfire_packager* packager = NULL;
// The default target is the local repository path
if (!target) {
- PakfireRepo repo = pakfire_get_repo(pakfire, "@local");
+ struct pakfire_repo* repo = pakfire_get_repo(pakfire, "@local");
if (repo) {
target = pakfire_repo_get_path(repo);
pakfire_repo_unref(repo);
}
// Bind repository name
- PakfireRepo repo = pakfire_package_get_repo(pkg);
+ struct pakfire_repo* repo = pakfire_package_get_repo(pkg);
if (repo) {
const char* repo_name = pakfire_repo_get_name(repo);
pakfire_repo_unref(repo);
return scriptlet;
}
-static int pakfire_db_load_package(struct pakfire_db* db, PakfireRepo repo, sqlite3_stmt* stmt) {
+static int pakfire_db_load_package(struct pakfire_db* db, struct pakfire_repo* repo, sqlite3_stmt* stmt) {
struct pakfire_package* pkg = NULL;
int r = 1;
return r;
}
-int pakfire_db_load(struct pakfire_db* db, PakfireRepo repo) {
+int pakfire_db_load(struct pakfire_db* db, struct pakfire_repo* repo) {
sqlite3_stmt* stmt = NULL;
int r = 1;
struct pakfire_packager* packager = NULL;
struct pakfire_package* pkg = NULL;
- PakfireRepo repo = NULL;
+ struct pakfire_repo* repo = NULL;
// Load makefile
int r = pakfire_read_makefile(&makefile, pakfire, path, &error);
#include <stddef.h>
#include <pakfire/package.h>
+#include <pakfire/repo.h>
#include <pakfire/scriptlet.h>
#include <pakfire/types.h>
const char* pakfire_archive_signature_get_data(PakfireArchiveSignature signature);
size_t pakfire_archive_get_size(PakfireArchive archive);
-struct pakfire_package* pakfire_archive_make_package(PakfireArchive archive, PakfireRepo repo);
+struct pakfire_package* pakfire_archive_make_package(
+ PakfireArchive archive, struct pakfire_repo* repo);
#define PAKFIRE_ARCHIVE_FN_CHECKSUMS "chksums"
#define PAKFIRE_ARCHIVE_FN_FILELIST "filelist"
#include <sys/types.h>
#include <pakfire/package.h>
+#include <pakfire/repo.h>
#include <pakfire/scriptlet.h>
#include <pakfire/types.h>
PakfireArchive archive, int userinstalled);
int pakfire_db_remove_package(struct pakfire_db* db, struct pakfire_package* pkg);
-int pakfire_db_load(struct pakfire_db* db, PakfireRepo repo);
+int pakfire_db_load(struct pakfire_db* db, struct pakfire_repo* repo);
struct pakfire_scriptlet* pakfire_db_get_scriptlet(
struct pakfire_db* db, struct pakfire_package* pkg, const char* type);
#include <pakfire/filelist.h>
#include <pakfire/packagelist.h>
+#include <pakfire/repo.h>
#include <pakfire/types.h>
struct pakfire_package;
-struct pakfire_package* pakfire_package_create(Pakfire pakfire, PakfireRepo repo,
+struct pakfire_package* pakfire_package_create(Pakfire pakfire, struct pakfire_repo* repo,
const char* name, const char* evr, const char* arch);
struct pakfire_package* pakfire_package_ref(struct pakfire_package* pkg);
int pakfire_package_get_reverse_requires(struct pakfire_package* pkg,
struct pakfire_packagelist** list);
-PakfireRepo pakfire_package_get_repo(struct pakfire_package* pkg);
+struct pakfire_repo* pakfire_package_get_repo(struct pakfire_package* pkg);
char* pakfire_package_dump(struct pakfire_package* pkg, int flags);
#include <time.h>
#include <pakfire/parser.h>
+#include <pakfire/repo.h>
#include <pakfire/repolist.h>
#include <pakfire/types.h>
int pakfire_version_compare(Pakfire pakfire, const char* evr1, const char* evr2);
struct pakfire_repolist* pakfire_get_repos(Pakfire pakfire);
-PakfireRepo pakfire_get_repo(Pakfire pakfire, const char* name);
+struct pakfire_repo* pakfire_get_repo(Pakfire pakfire, const char* name);
int pakfire_whatprovides(Pakfire pakfire, const char* what, int flags,
struct pakfire_packagelist** list);
Pool* pakfire_get_solv_pool(Pakfire pakfire);
-PakfireRepo pakfire_get_installed_repo(Pakfire pakfire);
+struct pakfire_repo* pakfire_get_installed_repo(Pakfire pakfire);
// Archive helpers
struct archive* pakfire_make_archive_disk_reader(Pakfire pakfire, int internal);
#include <stdio.h>
#include <pakfire/package.h>
+#include <pakfire/repo.h>
#include <pakfire/types.h>
enum pakfire_parser_flags {
int pakfire_parser_set_namespace(PakfireParser parser, const char* namespace);
int pakfire_parser_create_package(PakfireParser parser,
- struct pakfire_package** pkg, PakfireRepo repo, const char* namespace, const char* default_arch);
+ struct pakfire_package** pkg, struct pakfire_repo* repo, const char* namespace, const char* default_arch);
// Errors
int pakfire_parser_error_create(struct pakfire_parser_error** error,
#include <time.h>
#include <unistd.h>
+struct pakfire_repo;
+
#include <pakfire/package.h>
#include <pakfire/types.h>
-PakfireRepo pakfire_repo_create(Pakfire pakfire, const char* name);
+struct pakfire_repo* pakfire_repo_create(Pakfire pakfire, const char* name);
-PakfireRepo pakfire_repo_ref(PakfireRepo repo);
-PakfireRepo pakfire_repo_unref(PakfireRepo repo);
-Pakfire pakfire_repo_get_pakfire(PakfireRepo repo);
+struct pakfire_repo* pakfire_repo_ref(struct pakfire_repo* repo);
+struct pakfire_repo* pakfire_repo_unref(struct pakfire_repo* repo);
+Pakfire pakfire_repo_get_pakfire(struct pakfire_repo* repo);
-int pakfire_repo_clear(PakfireRepo repo);
+int pakfire_repo_clear(struct pakfire_repo* repo);
-int pakfire_repo_identical(PakfireRepo repo1, PakfireRepo repo2);
-int pakfire_repo_cmp(PakfireRepo repo1, PakfireRepo repo2);
-int pakfire_repo_count(PakfireRepo repo);
+int pakfire_repo_identical(struct pakfire_repo* repo1, struct pakfire_repo* repo2);
+int pakfire_repo_cmp(struct pakfire_repo* repo1, struct pakfire_repo* repo2);
+int pakfire_repo_count(struct pakfire_repo* repo);
-const char* pakfire_repo_get_name(PakfireRepo repo);
+const char* pakfire_repo_get_name(struct pakfire_repo* repo);
-const char* pakfire_repo_get_description(PakfireRepo repo);
-int pakfire_repo_set_description(PakfireRepo repo, const char* description);
+const char* pakfire_repo_get_description(struct pakfire_repo* repo);
+int pakfire_repo_set_description(struct pakfire_repo* repo, const char* description);
-int pakfire_repo_get_enabled(PakfireRepo repo);
-void pakfire_repo_set_enabled(PakfireRepo repo, int enabled);
+int pakfire_repo_get_enabled(struct pakfire_repo* repo);
+void pakfire_repo_set_enabled(struct pakfire_repo* repo, int enabled);
-int pakfire_repo_get_priority(PakfireRepo repo);
-void pakfire_repo_set_priority(PakfireRepo repo, int priority);
+int pakfire_repo_get_priority(struct pakfire_repo* repo);
+void pakfire_repo_set_priority(struct pakfire_repo* repo, int priority);
-const char* pakfire_repo_get_baseurl(PakfireRepo repo);
-int pakfire_repo_set_baseurl(PakfireRepo repo, const char* baseurl);
+const char* pakfire_repo_get_baseurl(struct pakfire_repo* repo);
+int pakfire_repo_set_baseurl(struct pakfire_repo* repo, const char* baseurl);
-const char* pakfire_repo_get_keyfile(PakfireRepo repo);
-int pakfire_repo_set_keyfile(PakfireRepo repo, const char* keyfile);
+const char* pakfire_repo_get_keyfile(struct pakfire_repo* repo);
+int pakfire_repo_set_keyfile(struct pakfire_repo* repo, const char* keyfile);
-const char* pakfire_repo_get_mirrorlist_url(PakfireRepo repo);
-int pakfire_repo_set_mirrorlist_url(PakfireRepo repo, const char* url);
+const char* pakfire_repo_get_mirrorlist_url(struct pakfire_repo* repo);
+int pakfire_repo_set_mirrorlist_url(struct pakfire_repo* repo, const char* url);
-struct pakfire_mirrorlist* pakfire_repo_get_mirrors(PakfireRepo repo);
+struct pakfire_mirrorlist* pakfire_repo_get_mirrors(struct pakfire_repo* repo);
-char* pakfire_repo_get_config(PakfireRepo repo);
+char* pakfire_repo_get_config(struct pakfire_repo* repo);
-int pakfire_repo_is_installed_repo(PakfireRepo repo);
+int pakfire_repo_is_installed_repo(struct pakfire_repo* repo);
-int pakfire_repo_read_solv(PakfireRepo repo, const char* filename, int flags);
-int pakfire_repo_read_solv_fp(PakfireRepo repo, FILE *f, int flags);
+int pakfire_repo_read_solv(struct pakfire_repo* repo, const char* filename, int flags);
+int pakfire_repo_read_solv_fp(struct pakfire_repo* repo, FILE *f, int flags);
-int pakfire_repo_write_solv(PakfireRepo repo, const char* filename, int flags);
-int pakfire_repo_write_solv_fp(PakfireRepo repo, FILE *f, int flags);
+int pakfire_repo_write_solv(struct pakfire_repo* repo, const char* filename, int flags);
+int pakfire_repo_write_solv_fp(struct pakfire_repo* repo, FILE *f, int flags);
-struct pakfire_package* pakfire_repo_add_archive(PakfireRepo repo, PakfireArchive archive);
+struct pakfire_package* pakfire_repo_add_archive(struct pakfire_repo* repo, PakfireArchive archive);
// Cache
-int pakfire_repo_clean(PakfireRepo repo, int flags);
+int pakfire_repo_clean(struct pakfire_repo* repo, int flags);
// Scan
-int pakfire_repo_scan(PakfireRepo repo, int flags);
+int pakfire_repo_scan(struct pakfire_repo* repo, int flags);
// Refresh
-int pakfire_repo_refresh(PakfireRepo repo, int force);
+int pakfire_repo_refresh(struct pakfire_repo* repo, int force);
#ifdef PAKFIRE_PRIVATE
#include <pakfire/downloader.h>
int pakfire_repo_import(Pakfire pakfire, struct pakfire_config* config);
-const char* pakfire_repo_get_path(PakfireRepo repo);
+const char* pakfire_repo_get_path(struct pakfire_repo* repo);
-void pakfire_repo_internalize(PakfireRepo repo);
-Id pakfire_repo_add_solvable(PakfireRepo repo);
+void pakfire_repo_internalize(struct pakfire_repo* repo);
+Id pakfire_repo_add_solvable(struct pakfire_repo* repo);
-PakfireRepo pakfire_repo_create_from_repo(Pakfire pakfire, Repo* r);
+struct pakfire_repo* pakfire_repo_create_from_repo(Pakfire pakfire, Repo* r);
void pakfire_repo_free_all(Pakfire pakfire);
-Repo* pakfire_repo_get_repo(PakfireRepo repo);
-Repodata* pakfire_repo_get_repodata(PakfireRepo repo);
+Repo* pakfire_repo_get_repo(struct pakfire_repo* repo);
+Repodata* pakfire_repo_get_repodata(struct pakfire_repo* repo);
-struct pakfire_mirrorlist* pakfire_repo_get_mirrorlist(PakfireRepo repo);
+struct pakfire_mirrorlist* pakfire_repo_get_mirrorlist(struct pakfire_repo* repo);
#endif
size_t pakfire_repolist_size(struct pakfire_repolist* list);
int pakfire_repolist_empty(struct pakfire_repolist* list);
-PakfireRepo pakfire_repolist_get(struct pakfire_repolist* list, size_t index);
-int pakfire_repolist_append(struct pakfire_repolist* list, PakfireRepo repo);
+struct pakfire_repo* pakfire_repolist_get(struct pakfire_repolist* list, size_t index);
+int pakfire_repolist_append(struct pakfire_repolist* list, struct pakfire_repo* repo);
#endif /* PAKFIRE_REPOLIST_H */
typedef struct _PakfireFilelist* PakfireFilelist;
typedef struct _PakfireKey* PakfireKey;
typedef struct _PakfireParser* PakfireParser;
-typedef struct _PakfireRepo* PakfireRepo;
typedef struct _PakfireSolution* PakfireSolution;
#endif /* PAKFIRE_TYPES_H */
// Reference to this package in the SOLV pool
Id id;
- PakfireRepo repo;
+ struct pakfire_repo* repo;
char nevra[NAME_MAX];
return pkg;
}
-PAKFIRE_EXPORT struct pakfire_package* pakfire_package_create(Pakfire pakfire, PakfireRepo repo, const char* name, const char* evr, const char* arch) {
+PAKFIRE_EXPORT struct pakfire_package* pakfire_package_create(Pakfire pakfire, struct pakfire_repo* repo, const char* name, const char* evr, const char* arch) {
Id id = pakfire_repo_add_solvable(repo);
if (!id)
return NULL;
return ret;
// Check repositories
- PakfireRepo repo1 = pakfire_package_get_repo(pkg1);
- PakfireRepo repo2 = pakfire_package_get_repo(pkg2);
+ struct pakfire_repo* repo1 = pakfire_package_get_repo(pkg1);
+ struct pakfire_repo* repo2 = pakfire_package_get_repo(pkg2);
if (repo1 && repo2) {
ret = pakfire_repo_cmp(repo1, repo2);
}
static void pakfire_package_internalize_repo(struct pakfire_package* pkg) {
- PakfireRepo repo = pakfire_package_get_repo(pkg);
+ struct pakfire_repo* repo = pakfire_package_get_repo(pkg);
if (repo) {
pakfire_repo_internalize(repo);
pakfire_repo_unref(repo);
return r;
}
-PAKFIRE_EXPORT PakfireRepo pakfire_package_get_repo(struct pakfire_package* pkg) {
+PAKFIRE_EXPORT struct pakfire_repo* pakfire_package_get_repo(struct pakfire_package* pkg) {
if (!pkg->repo) {
Solvable* s = get_solvable(pkg);
pakfire_package_dump_add_line_size(&string, _("Download size"), downloadsize);
}
- PakfireRepo repo = pakfire_package_get_repo(pkg);
+ struct pakfire_repo* repo = pakfire_package_get_repo(pkg);
if (repo) {
const char* repo_name = pakfire_repo_get_name(repo);
pakfire_package_dump_add_line(&string, _("Repo"), repo_name);
static int pakfire_package_fetch_legacy_filelist(struct pakfire_package* pkg, PakfireFilelist filelist) {
pakfire_package_internalize_repo(pkg);
- PakfireRepo repo = pakfire_package_get_repo(pkg);
+ struct pakfire_repo* repo = pakfire_package_get_repo(pkg);
Solvable* s = get_solvable(pkg);
Pool* p = pakfire_get_solv_pool(pkg->pakfire);
Repo* r = pakfire_repo_get_repo(repo);
static int pakfire_package_append_file(struct pakfire_package* pkg, const char* path) {
// Fetch repodata
- PakfireRepo repo = pakfire_package_get_repo(pkg);
+ struct pakfire_repo* repo = pakfire_package_get_repo(pkg);
Repodata* repodata = pakfire_repo_get_repodata(repo);
pakfire_repo_unref(repo);
static int pakfire_populate_pool(Pakfire pakfire) {
struct pakfire_db* db;
- PakfireRepo repo = NULL;
- PakfireRepo dummy = NULL;
+ struct pakfire_repo* repo = NULL;
+ struct pakfire_repo* dummy = NULL;
int r;
// Initialize the pool
}
static int pakfire_foreach_repo(Pakfire pakfire,
- int (*func)(PakfireRepo repo, int flags), int flags) {
- PakfireRepo repo;
+ int (*func)(struct pakfire_repo* repo, int flags), int flags) {
+ struct pakfire_repo* repo;
Repo* solv_repo;
int i;
if (strcmp(solv_repo->name, "@dummy") == 0)
continue;
- PakfireRepo repo = pakfire_repo_create_from_repo(pakfire, solv_repo);
+ struct pakfire_repo* repo = pakfire_repo_create_from_repo(pakfire, solv_repo);
if (!repo) {
r = 1;
goto ERROR;
return NULL;
}
-PAKFIRE_EXPORT PakfireRepo pakfire_get_repo(Pakfire pakfire, const char* name) {
+PAKFIRE_EXPORT struct pakfire_repo* pakfire_get_repo(Pakfire pakfire, const char* name) {
Pool* pool = pakfire_get_solv_pool(pakfire);
Repo* repo;
return NULL;
}
-PakfireRepo pakfire_get_installed_repo(Pakfire pakfire) {
+struct pakfire_repo* pakfire_get_installed_repo(Pakfire pakfire) {
if (!pakfire->pool->installed)
return NULL;
}
PAKFIRE_EXPORT int pakfire_parser_create_package(PakfireParser parser,
- struct pakfire_package** pkg, PakfireRepo repo, const char* namespace, const char* default_arch) {
+ struct pakfire_package** pkg, struct pakfire_repo* repo, const char* namespace, const char* default_arch) {
int r = 1;
char* name = NULL;
char mirrorlist[PATH_MAX];
};
-struct _PakfireRepo {
+struct pakfire_repo {
Pakfire pakfire;
+ int nrefs;
+
Repo* repo;
struct pakfire_repo_appdata* appdata;
- int nrefs;
struct pakfire_mirrorlist* mirrorlist;
};
-static int pakfire_repo_is_internal(PakfireRepo repo) {
+static int pakfire_repo_is_internal(struct pakfire_repo* repo) {
const char* name = pakfire_repo_get_name(repo);
if (!name)
return 0;
DEBUG(pakfire, "Creating repository %s\n", name);
// Create a new repository
- PakfireRepo repo = pakfire_repo_create(pakfire, name);
+ struct pakfire_repo* repo = pakfire_repo_create(pakfire, name);
if (!repo) {
ERROR(pakfire, "Could not create repository '%s': %m\n", name);
r = 1;
return r;
}
-Id pakfire_repo_add_solvable(PakfireRepo repo) {
+Id pakfire_repo_add_solvable(struct pakfire_repo* repo) {
return repo_add_solvable(repo->repo);
}
-struct pakfire_mirrorlist* pakfire_repo_get_mirrorlist(PakfireRepo repo) {
+struct pakfire_mirrorlist* pakfire_repo_get_mirrorlist(struct pakfire_repo* repo) {
if (!repo->mirrorlist) {
// No cache path set
if (!*repo->appdata->mirrorlist)
return pakfire_mirrorlist_ref(repo->mirrorlist);
}
-static int pakfire_repo_retrieve(PakfireRepo repo, const char* title,
+static int pakfire_repo_retrieve(struct pakfire_repo* repo, const char* title,
const char* url, const char* path, enum pakfire_transfer_flags flags) {
struct pakfire_downloader* downloader;
int r = pakfire_downloader_create(&downloader, repo->pakfire);
return r;
}
-static int pakfire_repo_download_database(PakfireRepo repo, const char* database,
+static int pakfire_repo_download_database(struct pakfire_repo* repo, const char* database,
const char* cache_path) {
char title[NAME_MAX];
char database_url[PATH_MAX];
return pakfire_repo_retrieve(repo, title, database_url, cache_path, 0);
}
-static int pakfire_repo_read_metadata(PakfireRepo repo, const char* path, int refresh) {
+static int pakfire_repo_read_metadata(struct pakfire_repo* repo, const char* path, int refresh) {
int r;
struct json_object* json = pakfire_json_parse_from_file(repo->pakfire, path);
return r;
}
-static int pakfire_repo_refresh_mirrorlist(PakfireRepo repo, const int force) {
+static int pakfire_repo_refresh_mirrorlist(struct pakfire_repo* repo, const int force) {
// This repository does not have a mirrorlist
if (!repo->appdata->mirrorlist_url || !*repo->appdata->mirrorlist)
return 0;
repo->appdata->mirrorlist_url, repo->appdata->mirrorlist, PAKFIRE_TRANSFER_NOPROGRESS);
}
-static int pakfire_repo_refresh_metadata(PakfireRepo repo, const int force) {
+static int pakfire_repo_refresh_metadata(struct pakfire_repo* repo, const int force) {
// Check if this needs to be refreshed
if (!force) {
time_t age = pakfire_path_age(repo->appdata->metadata);
free(appdata);
}
-static void pakfire_repo_free(PakfireRepo repo, const int free_repo) {
+static void pakfire_repo_free(struct pakfire_repo* repo, const int free_repo) {
if (free_repo) {
free_repo_appdata(repo->repo->appdata);
repo_free(repo->repo, 0);
}
}
-PAKFIRE_EXPORT PakfireRepo pakfire_repo_create(Pakfire pakfire, const char* name) {
- PakfireRepo repo;
+PAKFIRE_EXPORT struct pakfire_repo* pakfire_repo_create(Pakfire pakfire, const char* name) {
+ struct pakfire_repo* repo;
int r;
// Return existing repositories with the same name
return NULL;
}
-PakfireRepo pakfire_repo_create_from_repo(Pakfire pakfire, Repo* r) {
- PakfireRepo repo = calloc(1, sizeof(*repo));
+struct pakfire_repo* pakfire_repo_create_from_repo(Pakfire pakfire, Repo* r) {
+ struct pakfire_repo* repo = calloc(1, sizeof(*repo));
if (repo) {
DEBUG(pakfire, "Allocated Repo at %p\n", repo);
repo->nrefs = 1;
return repo;
}
-PAKFIRE_EXPORT PakfireRepo pakfire_repo_ref(PakfireRepo repo) {
+PAKFIRE_EXPORT struct pakfire_repo* pakfire_repo_ref(struct pakfire_repo* repo) {
repo->nrefs++;
return repo;
}
-PAKFIRE_EXPORT PakfireRepo pakfire_repo_unref(PakfireRepo repo) {
+PAKFIRE_EXPORT struct pakfire_repo* pakfire_repo_unref(struct pakfire_repo* repo) {
if (--repo->nrefs > 0)
return repo;
return NULL;
}
-PAKFIRE_EXPORT Pakfire pakfire_repo_get_pakfire(PakfireRepo repo) {
+PAKFIRE_EXPORT Pakfire pakfire_repo_get_pakfire(struct pakfire_repo* repo) {
return pakfire_ref(repo->pakfire);
}
-int pakfire_repo_clear(PakfireRepo repo) {
+int pakfire_repo_clear(struct pakfire_repo* repo) {
repo_empty(repo->repo, 0);
// Allocate repodata
return 0;
}
-Repo* pakfire_repo_get_repo(PakfireRepo repo) {
+Repo* pakfire_repo_get_repo(struct pakfire_repo* repo) {
return repo->repo;
}
-Repodata* pakfire_repo_get_repodata(PakfireRepo repo) {
+Repodata* pakfire_repo_get_repodata(struct pakfire_repo* repo) {
return repo->appdata->repodata;
}
-PAKFIRE_EXPORT int pakfire_repo_identical(PakfireRepo repo1, PakfireRepo repo2) {
+PAKFIRE_EXPORT int pakfire_repo_identical(struct pakfire_repo* repo1, struct pakfire_repo* repo2) {
Repo* r1 = repo1->repo;
Repo* r2 = repo2->repo;
return strcmp(r1->name, r2->name);
}
-PAKFIRE_EXPORT int pakfire_repo_cmp(PakfireRepo repo1, PakfireRepo repo2) {
+PAKFIRE_EXPORT int pakfire_repo_cmp(struct pakfire_repo* repo1, struct pakfire_repo* repo2) {
Repo* r1 = repo1->repo;
Repo* r2 = repo2->repo;
return strcmp(r1->name, r2->name);
}
-PAKFIRE_EXPORT int pakfire_repo_count(PakfireRepo repo) {
+PAKFIRE_EXPORT int pakfire_repo_count(struct pakfire_repo* repo) {
Pool* pool = pakfire_get_solv_pool(repo->pakfire);
int cnt = 0;
return cnt;
}
-void pakfire_repo_internalize(PakfireRepo repo) {
+void pakfire_repo_internalize(struct pakfire_repo* repo) {
repo_internalize(repo->repo);
}
-PAKFIRE_EXPORT const char* pakfire_repo_get_name(PakfireRepo repo) {
+PAKFIRE_EXPORT const char* pakfire_repo_get_name(struct pakfire_repo* repo) {
return repo->repo->name;
}
-PAKFIRE_EXPORT const char* pakfire_repo_get_description(PakfireRepo repo) {
+PAKFIRE_EXPORT const char* pakfire_repo_get_description(struct pakfire_repo* repo) {
return repo->appdata->description;
}
-PAKFIRE_EXPORT int pakfire_repo_set_description(PakfireRepo repo, const char* description) {
+PAKFIRE_EXPORT int pakfire_repo_set_description(struct pakfire_repo* repo, const char* description) {
if (repo->appdata->description)
free(repo->appdata->description);
return 0;
}
-PAKFIRE_EXPORT int pakfire_repo_get_enabled(PakfireRepo repo) {
+PAKFIRE_EXPORT int pakfire_repo_get_enabled(struct pakfire_repo* repo) {
return !repo->repo->disabled;
}
-PAKFIRE_EXPORT void pakfire_repo_set_enabled(PakfireRepo repo, int enabled) {
+PAKFIRE_EXPORT void pakfire_repo_set_enabled(struct pakfire_repo* repo, int enabled) {
repo->repo->disabled = !enabled;
pakfire_pool_has_changed(repo->pakfire);
}
-PAKFIRE_EXPORT int pakfire_repo_get_priority(PakfireRepo repo) {
+PAKFIRE_EXPORT int pakfire_repo_get_priority(struct pakfire_repo* repo) {
return repo->repo->priority;
}
-PAKFIRE_EXPORT void pakfire_repo_set_priority(PakfireRepo repo, int priority) {
+PAKFIRE_EXPORT void pakfire_repo_set_priority(struct pakfire_repo* repo, int priority) {
repo->repo->priority = priority;
}
-PAKFIRE_EXPORT const char* pakfire_repo_get_baseurl(PakfireRepo repo) {
+PAKFIRE_EXPORT const char* pakfire_repo_get_baseurl(struct pakfire_repo* repo) {
return repo->appdata->baseurl;
}
-static char* pakfire_repo_url_replace(PakfireRepo repo, const char* url) {
+static char* pakfire_repo_url_replace(struct pakfire_repo* repo, const char* url) {
if (!url)
return NULL;
return buffer;
}
-PAKFIRE_EXPORT int pakfire_repo_set_baseurl(PakfireRepo repo, const char* baseurl) {
+PAKFIRE_EXPORT int pakfire_repo_set_baseurl(struct pakfire_repo* repo, const char* baseurl) {
if (repo->appdata->baseurl)
free(repo->appdata->baseurl);
return 0;
}
-static int pakfire_repo_is_local(PakfireRepo repo) {
+static int pakfire_repo_is_local(struct pakfire_repo* repo) {
if (!*repo->appdata->baseurl)
return 0;
return pakfire_string_startswith(repo->appdata->baseurl, "file://");
}
-const char* pakfire_repo_get_path(PakfireRepo repo) {
+const char* pakfire_repo_get_path(struct pakfire_repo* repo) {
if (!pakfire_repo_is_local(repo))
return NULL;
return repo->appdata->baseurl + strlen("file://");
}
-PAKFIRE_EXPORT const char* pakfire_repo_get_keyfile(PakfireRepo repo) {
+PAKFIRE_EXPORT const char* pakfire_repo_get_keyfile(struct pakfire_repo* repo) {
return repo->appdata->keyfile;
}
-PAKFIRE_EXPORT int pakfire_repo_set_keyfile(PakfireRepo repo, const char* keyfile) {
+PAKFIRE_EXPORT int pakfire_repo_set_keyfile(struct pakfire_repo* repo, const char* keyfile) {
if (repo->appdata->keyfile)
free(repo->appdata->keyfile);
return 0;
}
-PAKFIRE_EXPORT const char* pakfire_repo_get_mirrorlist_url(PakfireRepo repo) {
+PAKFIRE_EXPORT const char* pakfire_repo_get_mirrorlist_url(struct pakfire_repo* repo) {
return repo->appdata->mirrorlist_url;
}
-PAKFIRE_EXPORT int pakfire_repo_set_mirrorlist_url(PakfireRepo repo, const char* url) {
+PAKFIRE_EXPORT int pakfire_repo_set_mirrorlist_url(struct pakfire_repo* repo, const char* url) {
if (repo->appdata->mirrorlist_url)
free(repo->appdata->mirrorlist_url);
return 0;
}
-PAKFIRE_EXPORT char* pakfire_repo_get_config(PakfireRepo repo) {
+PAKFIRE_EXPORT char* pakfire_repo_get_config(struct pakfire_repo* repo) {
if (pakfire_repo_is_installed_repo(repo) == 0)
return NULL;
return strdup(buffer);
}
-PAKFIRE_EXPORT int pakfire_repo_is_installed_repo(PakfireRepo repo) {
- PakfireRepo installed_repo = pakfire_get_installed_repo(repo->pakfire);
+PAKFIRE_EXPORT int pakfire_repo_is_installed_repo(struct pakfire_repo* repo) {
+ struct pakfire_repo* installed_repo = pakfire_get_installed_repo(repo->pakfire);
if (!installed_repo)
return 1;
return r;
}
-PAKFIRE_EXPORT int pakfire_repo_read_solv(PakfireRepo repo, const char* filename, int flags) {
+PAKFIRE_EXPORT int pakfire_repo_read_solv(struct pakfire_repo* repo, const char* filename, int flags) {
FILE* f = fopen(filename, "rb");
if (!f)
return 1;
return ret;
}
-PAKFIRE_EXPORT int pakfire_repo_read_solv_fp(PakfireRepo repo, FILE *f, int flags) {
+PAKFIRE_EXPORT int pakfire_repo_read_solv_fp(struct pakfire_repo* repo, FILE *f, int flags) {
f = pakfire_xfopen(f, "r");
if (!f)
return 1;
return 0;
}
-PAKFIRE_EXPORT int pakfire_repo_write_solv(PakfireRepo repo, const char* filename, int flags) {
+PAKFIRE_EXPORT int pakfire_repo_write_solv(struct pakfire_repo* repo, const char* filename, int flags) {
FILE* f = fopen(filename, "wb");
if (!f)
return 1;
return ret;
}
-PAKFIRE_EXPORT int pakfire_repo_write_solv_fp(PakfireRepo repo, FILE *f, int flags) {
+PAKFIRE_EXPORT int pakfire_repo_write_solv_fp(struct pakfire_repo* repo, FILE *f, int flags) {
pakfire_repo_internalize(repo);
return repo_write(repo->repo, f);
}
-PAKFIRE_EXPORT struct pakfire_package* pakfire_repo_add_archive(PakfireRepo repo, PakfireArchive archive) {
+PAKFIRE_EXPORT struct pakfire_package* pakfire_repo_add_archive(struct pakfire_repo* repo, PakfireArchive archive) {
return pakfire_archive_make_package(archive, repo);
}
-PAKFIRE_EXPORT int pakfire_repo_clean(PakfireRepo repo, int flags) {
+PAKFIRE_EXPORT int pakfire_repo_clean(struct pakfire_repo* repo, int flags) {
char cache_path[PATH_MAX];
// Drop all meta-data from memory
return pakfire_rmtree(cache_path, 0);
}
-static int pakfire_repo_scan_file(PakfireRepo repo, const char* path) {
+static int pakfire_repo_scan_file(struct pakfire_repo* repo, const char* path) {
DEBUG(repo->pakfire, "Scanning %s...\n", path);
PakfireArchive archive;
return 0;
}
-PAKFIRE_EXPORT int pakfire_repo_scan(PakfireRepo repo, int flags) {
+PAKFIRE_EXPORT int pakfire_repo_scan(struct pakfire_repo* repo, int flags) {
struct pakfire_progressbar* progressbar = NULL;
const char* path = pakfire_repo_get_path(repo);
return r;
}
-PAKFIRE_EXPORT int pakfire_repo_refresh(PakfireRepo repo, int force) {
+PAKFIRE_EXPORT int pakfire_repo_refresh(struct pakfire_repo* repo, int force) {
const char* name = pakfire_repo_get_name(repo);
int r;
struct pakfire_repolist {
int nrefs;
- PakfireRepo* elements;
+ struct pakfire_repo** elements;
size_t elements_size;
size_t size;
};
static int pakfire_repolist_grow(struct pakfire_repolist* list, size_t size) {
- PakfireRepo* elements = reallocarray(list->elements,
+ struct pakfire_repo** elements = reallocarray(list->elements,
list->elements_size + size, sizeof(*list->elements));
if (!elements)
return -errno;
return list->size == 0;
}
-PAKFIRE_EXPORT PakfireRepo pakfire_repolist_get(struct pakfire_repolist* list, size_t index) {
+PAKFIRE_EXPORT struct pakfire_repo* pakfire_repolist_get(struct pakfire_repolist* list, size_t index) {
if (index >= list->size)
return NULL;
return pakfire_repo_ref(list->elements[index]);
}
-PAKFIRE_EXPORT int pakfire_repolist_append(struct pakfire_repolist* list, PakfireRepo repo) {
+PAKFIRE_EXPORT int pakfire_repolist_append(struct pakfire_repolist* list, struct pakfire_repo* repo) {
if (!repo)
return EINVAL;
static int pakfire_request_add_archive(struct pakfire_request* request, int action,
PakfireArchive archive, int extra_flags) {
- PakfireRepo repo = pakfire_repo_create(request->pakfire, "@commandline");
+ struct pakfire_repo* repo = pakfire_repo_create(request->pakfire, "@commandline");
if (!repo)
return 1;
if (r)
return r;
- PakfireRepo repo = pakfire_get_installed_repo(pakfire);
+ struct pakfire_repo* repo = pakfire_get_installed_repo(pakfire);
if (!repo)
goto ERROR;
static void pakfire_transaction_add_package(char*** lines, size_t width, struct pakfire_package* pkg) {
char size[128];
- PakfireRepo repo = pakfire_package_get_repo(pkg);
+ struct pakfire_repo* repo = pakfire_package_get_repo(pkg);
// Format size
pakfire_format_size(size, sizeof(size) - 1, pakfire_package_get_size(pkg));
}
static int pakfire_transaction_perform(struct pakfire_transaction* transaction) {
- PakfireRepo repo = NULL;
+ struct pakfire_repo* repo = NULL;
struct pakfire_db* db;
int r;
static int pakfire_transaction_download_package(struct pakfire_transaction* transaction,
struct pakfire_downloader* downloader, struct pakfire_package* pkg) {
int r = 1;
- PakfireRepo repo = NULL;
+ struct pakfire_repo* repo = NULL;
struct pakfire_mirrorlist* mirrorlist = NULL;
// Fetch the repository to download from
PakfireArchive archive;
ASSERT_SUCCESS(pakfire_archive_open(&archive, t->pakfire, path));
- PakfireRepo repo = pakfire_repo_create(t->pakfire, "tmp");
+ struct pakfire_repo* repo = pakfire_repo_create(t->pakfire, "tmp");
ASSERT(repo);
struct pakfire_package* pkg = pakfire_repo_add_archive(repo, archive);
static int test_add_package(const struct test* t) {
struct pakfire_db* db;
- PakfireRepo repo = pakfire_get_repo(t->pakfire, "@dummy");
+ struct pakfire_repo* repo = pakfire_get_repo(t->pakfire, "@dummy");
ASSERT(repo);
int r = pakfire_db_open(&db, t->pakfire, PAKFIRE_DB_READWRITE);
static int test_packages(const struct test* t) {
struct pakfire_package* pkg = NULL;
- PakfireRepo repo = pakfire_repo_create(t->pakfire, "test");
+ struct pakfire_repo* repo = pakfire_repo_create(t->pakfire, "test");
ASSERT(repo);
PakfireParser parser = pakfire_parser_create(t->pakfire, NULL, NULL,
static int test_create(const struct test* t) {
struct pakfire_packager* packager;
- PakfireRepo repo = pakfire_repo_create(t->pakfire, "test");
+ struct pakfire_repo* repo = pakfire_repo_create(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);
- PakfireRepo repo = pakfire_repo_create(t->pakfire, "test");
+ struct pakfire_repo* repo = pakfire_repo_create(t->pakfire, "test");
ASSERT(repo);
pakfire_repo_set_baseurl(repo, baseurl);