}
static PyObject* Package_repr(PackageObject* self) {
- const char* nevra = pakfire_package_get_nevra(self->package);
+ const char* nevra = pakfire_package_get_string(self->package, PAKFIRE_PKG_NEVRA);
return PyUnicode_FromFormat("<_pakfire.Package %s>", nevra);
}
static PyObject* Package_str(PackageObject* self) {
- const char* nevra = pakfire_package_get_nevra(self->package);
+ const char* nevra = pakfire_package_get_string(self->package, PAKFIRE_PKG_NEVRA);
return PyUnicode_FromString(nevra);
}
}
static PyObject* Package_get_name(PackageObject* self) {
- const char* name = pakfire_package_get_name(self->package);
+ const char* name = pakfire_package_get_string(self->package, PAKFIRE_PKG_NAME);
if (!name)
Py_RETURN_NONE;
return PyUnicode_FromString(name);
}
-static void Package_set_name(PackageObject* self, PyObject* value) {
- const char* name = PyUnicode_FromValue(value);
-
- pakfire_package_set_name(self->package, name);
-}
-
static PyObject* Package_get_evr(PackageObject* self) {
- const char* evr = pakfire_package_get_evr(self->package);
+ const char* evr = pakfire_package_get_string(self->package, PAKFIRE_PKG_EVR);
if (!evr)
Py_RETURN_NONE;
}
static PyObject* Package_get_arch(PackageObject* self) {
- const char* arch = pakfire_package_get_arch(self->package);
+ const char* arch = pakfire_package_get_string(self->package, PAKFIRE_PKG_ARCH);
if (!arch)
Py_RETURN_NONE;
return PyUnicode_FromString(arch);
}
-static void Package_set_arch(PackageObject* self, PyObject* value) {
- const char* arch = PyUnicode_FromValue(value);
-
- pakfire_package_set_arch(self->package, arch);
-}
-
static PyObject* Package_get_uuid(PackageObject* self) {
- const char* uuid = pakfire_package_get_uuid(self->package);
+ const char* uuid = pakfire_package_get_string(self->package, PAKFIRE_PKG_UUID);
if (!uuid)
Py_RETURN_NONE;
static void Package_set_uuid(PackageObject* self, PyObject* value) {
const char* uuid = PyUnicode_FromValue(value);
- pakfire_package_set_uuid(self->package, uuid);
+ pakfire_package_set_string(self->package, PAKFIRE_PKG_UUID, uuid);
}
static PyObject* Package_get_digest(PackageObject* self) {
}
static PyObject* Package_get_summary(PackageObject* self) {
- const char* summary = pakfire_package_get_summary(self->package);
+ const char* summary = pakfire_package_get_string(self->package, PAKFIRE_PKG_SUMMARY);
if (!summary)
Py_RETURN_NONE;
static void Package_set_summary(PackageObject* self, PyObject* value) {
const char* summary = PyUnicode_FromValue(value);
- pakfire_package_set_summary(self->package, summary);
+ pakfire_package_set_string(self->package, PAKFIRE_PKG_SUMMARY, summary);
}
static PyObject* Package_get_description(PackageObject* self) {
- const char* description = pakfire_package_get_description(self->package);
+ const char* description = pakfire_package_get_string(self->package, PAKFIRE_PKG_DESCRIPTION);
if (!description)
Py_RETURN_NONE;
static void Package_set_description(PackageObject* self, PyObject* value) {
const char* description = PyUnicode_FromValue(value);
- pakfire_package_set_description(self->package, description);
+ pakfire_package_set_string(self->package, PAKFIRE_PKG_DESCRIPTION, description);
}
static PyObject* Package_get_license(PackageObject* self) {
- const char* license = pakfire_package_get_license(self->package);
+ const char* license = pakfire_package_get_string(self->package, PAKFIRE_PKG_LICENSE);
if (!license)
Py_RETURN_NONE;
static void Package_set_license(PackageObject* self, PyObject* value) {
const char* license = PyUnicode_FromValue(value);
- pakfire_package_set_summary(self->package, license);
+ pakfire_package_set_string(self->package, PAKFIRE_PKG_LICENSE, license);
}
static PyObject* Package_get_url(PackageObject* self) {
- const char* url = pakfire_package_get_url(self->package);
+ const char* url = pakfire_package_get_string(self->package, PAKFIRE_PKG_URL);
if (!url)
Py_RETURN_NONE;
static void Package_set_url(PackageObject* self, PyObject* value) {
const char* url = PyUnicode_FromValue(value);
- pakfire_package_set_url(self->package, url);
+ pakfire_package_set_string(self->package, PAKFIRE_PKG_URL, url);
}
static PyObject* Package_get_groups(PackageObject* self) {
- const char* s = pakfire_package_get_groups(self->package);
+ const char* s = pakfire_package_get_string(self->package, PAKFIRE_PKG_GROUPS);
return PyUnicode_FromString(s);
}
const char* groups = PyUnicode_AsUTF8(value);
if (groups)
- pakfire_package_set_groups(self->package, groups);
+ pakfire_package_set_string(self->package, PAKFIRE_PKG_GROUPS, groups);
return 0;
}
static PyObject* Package_get_vendor(PackageObject* self) {
- const char* vendor = pakfire_package_get_vendor(self->package);
+ const char* vendor = pakfire_package_get_string(self->package, PAKFIRE_PKG_VENDOR);
if (!vendor)
Py_RETURN_NONE;
static void Package_set_vendor(PackageObject* self, PyObject* value) {
const char* vendor = PyUnicode_FromValue(value);
- pakfire_package_set_vendor(self->package, vendor);
+ pakfire_package_set_string(self->package, PAKFIRE_PKG_VENDOR, vendor);
}
static PyObject* Package_get_distribution(PackageObject* self) {
- const char* distribution = pakfire_package_get_distribution(self->package);
+ const char* distribution = pakfire_package_get_string(self->package, PAKFIRE_PKG_DISTRO);
if (!distribution)
Py_RETURN_NONE;
static void Package_set_distribution(PackageObject* self, PyObject* value) {
const char* distribution = PyUnicode_AsUTF8(value);
- pakfire_package_set_distribution(self->package, distribution);
+ pakfire_package_set_string(self->package, PAKFIRE_PKG_DISTRO, distribution);
}
static PyObject* Package_get_maintainer(PackageObject* self) {
- const char* maintainer = pakfire_package_get_maintainer(self->package);
+ const char* maintainer = pakfire_package_get_string(self->package, PAKFIRE_PKG_MAINTAINER);
if (!maintainer)
Py_RETURN_NONE;
static void Package_set_maintainer(PackageObject* self, PyObject* value) {
const char* maintainer = PyUnicode_FromValue(value);
- pakfire_package_set_maintainer(self->package, maintainer);
+ pakfire_package_set_string(self->package, PAKFIRE_PKG_MAINTAINER, maintainer);
}
static PyObject* Package_get_filename(PackageObject* self) {
{
"name",
(getter)Package_get_name,
- (setter)Package_set_name,
+ NULL,
NULL,
NULL
},
{
"arch",
(getter)Package_get_arch,
- (setter)Package_set_arch,
+ NULL,
NULL,
NULL
},
goto ERROR;
// Fetch NEVRA
- const char* nevra = pakfire_package_get_nevra(pkg);
+ const char* nevra = pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA);
DEBUG(archive->pakfire, "Extracting %s\n", archive->path);
return 1;
#ifdef ENABLE_DEBUG
- const char* nevra = pakfire_package_get_nevra(pkg);
+ const char* nevra = pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA);
+
DEBUG(archive->pakfire, "Created package %s (%p) from archive %p\n",
nevra, pkg, archive);
#endif
// Vendor
const char* vendor = pakfire_archive_metadata_get(archive, "vendor", NULL);
- if (vendor)
- pakfire_package_set_vendor(pkg, vendor);
+ if (vendor) {
+ r = pakfire_package_set_string(pkg, PAKFIRE_PKG_VENDOR, vendor);
+ if (r)
+ goto ERROR;
+ }
// UUID
const char* uuid = pakfire_archive_metadata_get(archive, "uuid", NULL);
- if (uuid)
- pakfire_package_set_uuid(pkg, uuid);
+ if (uuid) {
+ r = pakfire_package_set_string(pkg, PAKFIRE_PKG_UUID, uuid);
+ if (r)
+ goto ERROR;
+ }
// Groups
const char* groups = pakfire_archive_metadata_get(archive, "groups", NULL);
- if (groups)
- pakfire_package_set_groups(pkg, groups);
+ if (groups) {
+ r = pakfire_package_set_string(pkg, PAKFIRE_PKG_GROUPS, groups);
+ if (r)
+ goto ERROR;
+ }
// Distribution
const char* distro = pakfire_archive_metadata_get(archive, "distribution", NULL);
- if (distro)
- pakfire_package_set_distribution(pkg, distro);
+ if (distro) {
+ r = pakfire_package_set_string(pkg, PAKFIRE_PKG_DISTRO, distro);
+ if (r)
+ goto ERROR;
+ }
// Maintainer
const char* maintainer = pakfire_archive_metadata_get(archive, "maintainer", NULL);
- if (maintainer)
- pakfire_package_set_maintainer(pkg, maintainer);
+ if (maintainer) {
+ r = pakfire_package_set_string(pkg, PAKFIRE_PKG_MAINTAINER, maintainer);
+ if (r)
+ goto ERROR;
+ }
// URL
const char* url = pakfire_archive_metadata_get(archive, "url", NULL);
- if (url)
- pakfire_package_set_url(pkg, url);
+ if (url) {
+ r = pakfire_package_set_string(pkg, PAKFIRE_PKG_URL, url);
+ if (r)
+ goto ERROR;
+ }
// License
const char* license = pakfire_archive_metadata_get(archive, "license", NULL);
- if (license)
- pakfire_package_set_license(pkg, license);
+ if (license) {
+ r = pakfire_package_set_string(pkg, PAKFIRE_PKG_LICENSE, license);
+ if (r)
+ goto ERROR;
+ }
// Summary
const char* summary = pakfire_archive_metadata_get(archive, "summary", NULL);
- if (summary)
- pakfire_package_set_summary(pkg, summary);
+ if (summary) {
+ r = pakfire_package_set_string(pkg, PAKFIRE_PKG_SUMMARY, summary);
+ if (r)
+ goto ERROR;
+ }
// Description
const char* description = pakfire_archive_metadata_get(archive, "description", NULL);
- if (description)
- pakfire_package_set_description(pkg, description);
+ if (description) {
+ r = pakfire_package_set_string(pkg, PAKFIRE_PKG_DESCRIPTION, description);
+ if (r)
+ goto ERROR;
+ }
// Installed package size
size_t installsize = pakfire_archive_metadata_get_int64(archive, "size", NULL);
return r;
}
+static int pakfire_archive_package_set_string(struct pakfire_archive* archive,
+ struct pakfire_package* pkg, const enum pakfire_package_key key,
+ const char* key1, const char* key2) {
+ char* value = NULL;
+ int r;
+
+ // Fetch the value
+ value = pakfire_archive_get(archive, key1, key2);
+
+ // Set the value
+ r = pakfire_package_set_string(pkg, key, value);
+
+ if (value)
+ free(value);
+
+ return r;
+}
+
static int pakfire_archive_make_legacy_package(struct pakfire_archive* archive,
struct pakfire_repo* repo, struct pakfire_package** package) {
int r;
*package = pkg;
#ifdef ENABLE_DEBUG
- const char* nevra = pakfire_package_get_nevra(pkg);
+ const char* nevra = pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA);
+
DEBUG(archive->pakfire, "Created package %s (%p) from archive %p\n",
nevra, pkg, archive);
#endif
pakfire_package_set_path(pkg, archive->path);
// Set UUID
- char* uuid = pakfire_archive_get(archive, "package", "uuid");
- if (uuid) {
- pakfire_package_set_uuid(pkg, uuid);
- free(uuid);
- }
+ r = pakfire_archive_package_set_string(archive, pkg,
+ PAKFIRE_PKG_UUID, "package", "uuid");
+ if (r)
+ goto ERROR;
// Set groups
- char* groups = pakfire_archive_get(archive, "package", "groups");
- if (groups) {
- pakfire_package_set_groups(pkg, groups);
- free(groups);
- }
+ r = pakfire_archive_package_set_string(archive, pkg,
+ PAKFIRE_PKG_GROUPS, "package", "groups");
+ if (r)
+ goto ERROR;
// Set maintainer
- char* maintainer = pakfire_archive_get(archive, "package", "maintainer");
- if (maintainer) {
- pakfire_package_set_maintainer(pkg, maintainer);
- free(maintainer);
- }
+ r = pakfire_archive_package_set_string(archive, pkg,
+ PAKFIRE_PKG_MAINTAINER, "package", "maintainer");
+ if (r)
+ goto ERROR;
// Set URL
- char* url = pakfire_archive_get(archive, "package", "url");
- if (url) {
- pakfire_package_set_url(pkg, url);
- free(url);
- }
+ r = pakfire_archive_package_set_string(archive, pkg,
+ PAKFIRE_PKG_URL, "package", "url");
+ if (r)
+ goto ERROR;
// Set license
- char* license = pakfire_archive_get(archive, "package", "license");
- if (license) {
- pakfire_package_set_license(pkg, license);
- free(license);
- }
+ r = pakfire_archive_package_set_string(archive, pkg,
+ PAKFIRE_PKG_LICENSE, "package", "license");
+ if (r)
+ goto ERROR;
// Set summary
- char* summary = pakfire_archive_get(archive, "package", "summary");
- if (summary) {
- pakfire_package_set_summary(pkg, summary);
- free(summary);
- }
+ r = pakfire_archive_package_set_string(archive, pkg,
+ PAKFIRE_PKG_SUMMARY, "package", "summary");
+ if (r)
+ goto ERROR;
// Set description
- char* description = pakfire_archive_get(archive, "package", "description");
- if (description) {
- pakfire_package_set_description(pkg, description);
- free(description);
- }
+ r = pakfire_archive_package_set_string(archive, pkg,
+ PAKFIRE_PKG_DESCRIPTION, "package", "description");
+ if (r)
+ goto ERROR;
// Get package size
pakfire_package_set_downloadsize(pkg, pakfire_archive_get_size(archive));
}
// Set vendor
- char* vendor = pakfire_archive_get(archive, "distribution", "vendor");
- if (vendor) {
- pakfire_package_set_vendor(pkg, vendor);
- free(vendor);
- }
+ r = pakfire_archive_package_set_string(archive, pkg,
+ PAKFIRE_PKG_VENDOR, "distribution", "vendor");
+ if (r)
+ goto ERROR;
// Set build host
char* build_host = pakfire_archive_get(archive, "build", "host");
break;
}
- return 0;
+ERROR:
+ return r;
}
/*
// Set distribution
const char* distribution = pakfire_parser_get(makefile, NULL, "DISTRO_NAME");
- if (distribution)
- pakfire_package_set_distribution(pkg, distribution);
+ if (distribution) {
+ r = pakfire_package_set_string(pkg, PAKFIRE_PKG_DISTRO, distribution);
+ if (r)
+ goto ERROR;
+ }
// Set build ID
pakfire_package_set_build_id_from_uuid(pkg, &build->id);
struct pakfire_parser_error* error = NULL;
- const char* nevra = pakfire_package_get_nevra(package);
- const char* name = pakfire_package_get_name(package);
+ const char* nevra = pakfire_package_get_string(package, PAKFIRE_PKG_NEVRA);
+ const char* name = pakfire_package_get_string(package, PAKFIRE_PKG_NAME);
// Compose path to makefile
r = pakfire_path(build->pakfire, path, "/usr/src/packages/%s/%s.nm", nevra, name);
goto ERROR;
}
- const char* nevra = pakfire_package_get_nevra(package);
+ const char* nevra = pakfire_package_get_string(package, PAKFIRE_PKG_NEVRA);
INFO(build->pakfire, "Building %s...\n", nevra);
}
// Bind name
- const char* name = pakfire_package_get_name(pkg);
+ const char* name = pakfire_package_get_string(pkg, PAKFIRE_PKG_NAME);
r = sqlite3_bind_text(stmt, 1, name, -1, NULL);
if (r) {
}
// Bind evr
- const char* evr = pakfire_package_get_evr(pkg);
+ const char* evr = pakfire_package_get_string(pkg, PAKFIRE_PKG_EVR);
r = sqlite3_bind_text(stmt, 2, evr, -1, NULL);
if (r) {
}
// Bind arch
- const char* arch = pakfire_package_get_arch(pkg);
+ const char* arch = pakfire_package_get_string(pkg, PAKFIRE_PKG_ARCH);
r = sqlite3_bind_text(stmt, 3, arch, -1, NULL);
if (r) {
}
// Bind groups
- char* groups = pakfire_package_get_groups(pkg);
+ const char* groups = pakfire_package_get_string(pkg, PAKFIRE_PKG_GROUPS);
+
if (groups) {
r = sqlite3_bind_text(stmt, 4, groups, -1, NULL);
if (r) {
ERROR(db->pakfire, "Could not bind groups: %s\n", sqlite3_errmsg(db->handle));
- free(groups);
goto ERROR;
}
- free(groups);
-
// No groups
} else {
r = sqlite3_bind_null(stmt, 4);
}
// Bind license
- const char* license = pakfire_package_get_license(pkg);
+ const char* license = pakfire_package_get_string(pkg, PAKFIRE_PKG_LICENSE);
r = sqlite3_bind_text(stmt, 10, license, -1, NULL);
if (r) {
}
// Bind summary
- const char* summary = pakfire_package_get_summary(pkg);
+ const char* summary = pakfire_package_get_string(pkg, PAKFIRE_PKG_SUMMARY);
r = sqlite3_bind_text(stmt, 11, summary, -1, NULL);
if (r) {
}
// Bind description
- const char* description = pakfire_package_get_description(pkg);
+ const char* description = pakfire_package_get_string(pkg, PAKFIRE_PKG_DESCRIPTION);
r = sqlite3_bind_text(stmt, 12, description, -1, NULL);
if (r) {
}
// Bind uuid
- const char* uuid = pakfire_package_get_uuid(pkg);
+ const char* uuid = pakfire_package_get_string(pkg, PAKFIRE_PKG_UUID);
r = sqlite3_bind_text(stmt, 13, uuid, -1, NULL);
if (r) {
}
// Bind vendor
- const char* vendor = pakfire_package_get_vendor(pkg);
+ const char* vendor = pakfire_package_get_string(pkg, PAKFIRE_PKG_VENDOR);
r = sqlite3_bind_text(stmt, 14, vendor, -1, NULL);
if (r) {
}
// Distribution
- const char* distribution = pakfire_package_get_distribution(pkg);
+ const char* distribution = pakfire_package_get_string(pkg, PAKFIRE_PKG_DISTRO);
if (distribution) {
r = sqlite3_bind_text(stmt, 22, distribution, -1, NULL);
if (r)
goto ERROR;
// Fetch the package's UUID
- const char* uuid = pakfire_package_get_uuid(pkg);
+ const char* uuid = pakfire_package_get_string(pkg, PAKFIRE_PKG_UUID);
if (!uuid) {
ERROR(db->pakfire, "Package has no UUID\n");
r = 1;
int r = 1;
// Fetch the package's UUID
- const char* uuid = pakfire_package_get_uuid(pkg);
+ const char* uuid = pakfire_package_get_string(pkg, PAKFIRE_PKG_UUID);
if (!uuid) {
ERROR(db->pakfire, "Package has no UUID\n");
goto ERROR;
// Groups
const char* groups = (const char*)sqlite3_column_text(stmt, 4);
if (groups) {
- pakfire_package_set_groups(pkg, groups);
+ r = pakfire_package_set_string(pkg, PAKFIRE_PKG_GROUPS, groups);
+ if (r)
+ goto ERROR;
}
// Filename
// License
const char* license = (const char*)sqlite3_column_text(stmt, 10);
if (license) {
- pakfire_package_set_license(pkg, license);
+ r = pakfire_package_set_string(pkg, PAKFIRE_PKG_LICENSE, license);
+ if (r)
+ goto ERROR;
}
// Summary
const char* summary = (const char*)sqlite3_column_text(stmt, 11);
if (summary) {
- pakfire_package_set_summary(pkg, summary);
+ r = pakfire_package_set_string(pkg, PAKFIRE_PKG_SUMMARY, summary);
+ if (r)
+ goto ERROR;
}
// Description
const char* description = (const char*)sqlite3_column_text(stmt, 12);
if (description) {
- pakfire_package_set_description(pkg, description);
+ r = pakfire_package_set_string(pkg, PAKFIRE_PKG_DESCRIPTION, description);
+ if (r)
+ goto ERROR;
}
// UUID
const char* uuid = (const char*)sqlite3_column_text(stmt, 13);
if (uuid) {
- pakfire_package_set_uuid(pkg, uuid);
+ r = pakfire_package_set_string(pkg, PAKFIRE_PKG_UUID, uuid);
+ if (r)
+ goto ERROR;
}
// Vendor
const char* vendor = (const char*)sqlite3_column_text(stmt, 14);
if (vendor) {
- pakfire_package_set_vendor(pkg, vendor);
+ r = pakfire_package_set_string(pkg, PAKFIRE_PKG_VENDOR, vendor);
+ if (r)
+ goto ERROR;
}
// Build Host
// Distribution
const char* distribution = (const char*)sqlite3_column_text(stmt, 32);
- if (distribution)
- pakfire_package_set_distribution(pkg, distribution);
+ if (distribution) {
+ r = pakfire_package_set_string(pkg, PAKFIRE_PKG_DESCRIPTION, description);
+ if (r)
+ goto ERROR;
+ }
// Success
r = 0;
char archive_path[PATH_MAX];
char cache_path[PATH_MAX];
- const char* name = pakfire_package_get_name(pkg);
+ const char* name = pakfire_package_get_string(pkg, PAKFIRE_PKG_NAME);
// Compose path
r = pakfire_cache_path(pakfire, cache_path, "sources/%s/%s", name, filename);
int pakfire_package_cmp(struct pakfire_package* pkg1, struct pakfire_package* pkg2);
int pakfire_package_evr_cmp(struct pakfire_package* pkg1, struct pakfire_package* pkg2);
-const char* pakfire_package_get_nevra(struct pakfire_package* pkg);
-const char* pakfire_package_get_name(struct pakfire_package* pkg);
-void pakfire_package_set_name(struct pakfire_package* pkg, const char* name);
-const char* pakfire_package_get_evr(struct pakfire_package* pkg);
-void pakfire_package_set_evr(struct pakfire_package* pkg, const char* evr);
-const char* pakfire_package_get_arch(struct pakfire_package* pkg);
-void pakfire_package_set_arch(struct pakfire_package* pkg, const char* arch);
-
const char* pakfire_package_get_string(struct pakfire_package* pkg,
const enum pakfire_package_key key);
int pakfire_package_set_string(struct pakfire_package* pkg,
const enum pakfire_package_key key, const char* value);
-const char* pakfire_package_get_uuid(struct pakfire_package* pkg);
-void pakfire_package_set_uuid(struct pakfire_package* pkg, const char* uuid);
const unsigned char* pakfire_package_get_digest(struct pakfire_package* pkg,
enum pakfire_digest_types* type, size_t* length);
int pakfire_package_set_digest(struct pakfire_package* pkg,
enum pakfire_digest_types type, const unsigned char* digest, const size_t length);
-const char* pakfire_package_get_summary(struct pakfire_package* pkg);
-void pakfire_package_set_summary(struct pakfire_package* pkg, const char* summary);
-const char* pakfire_package_get_description(struct pakfire_package* pkg);
-void pakfire_package_set_description(struct pakfire_package* pkg, const char* description);
-const char* pakfire_package_get_license(struct pakfire_package* pkg);
-void pakfire_package_set_license(struct pakfire_package* pkg, const char* license);
-const char* pakfire_package_get_url(struct pakfire_package* pkg);
-void pakfire_package_set_url(struct pakfire_package* pkg, const char* url);
-char* pakfire_package_get_groups(struct pakfire_package* pkg);
-void pakfire_package_set_groups(struct pakfire_package* pkg, const char* groups);
-const char* pakfire_package_get_vendor(struct pakfire_package* pkg);
-void pakfire_package_set_vendor(struct pakfire_package* pkg, const char* vendor);
-const char* pakfire_package_get_distribution(struct pakfire_package* pkg);
-void pakfire_package_set_distribution(struct pakfire_package* pkg, const char* distribution);
-const char* pakfire_package_get_maintainer(struct pakfire_package* pkg);
-void pakfire_package_set_maintainer(struct pakfire_package* pkg, const char* maintainer);
const char* pakfire_package_get_filename(struct pakfire_package* pkg);
const char* pakfire_package_get_path(struct pakfire_package* pkg);
void pakfire_package_set_path(struct pakfire_package* pkg, const char* path);
pakfire_package_create;
pakfire_package_dump;
pakfire_package_eq;
- pakfire_package_get_arch;
pakfire_package_get_build_host;
pakfire_package_get_build_id;
pakfire_package_get_build_time;
pakfire_package_get_cache_path;
pakfire_package_get_conflicts;
- pakfire_package_get_description;
pakfire_package_get_digest;
- pakfire_package_get_distribution;
pakfire_package_get_downloadsize;
pakfire_package_get_enhances;
- pakfire_package_get_evr;
pakfire_package_get_filelist;
pakfire_package_get_filename;
- pakfire_package_get_groups;
- pakfire_package_get_license;
pakfire_package_get_location;
pakfire_package_get_installsize;
pakfire_package_get_install_time;
- pakfire_package_get_maintainer;
- pakfire_package_get_name;
- pakfire_package_get_nevra;
pakfire_package_get_obsoletes;
pakfire_package_get_pakfire;
pakfire_package_get_path;
pakfire_package_get_source_package;
pakfire_package_get_string;
pakfire_package_get_suggests;
- pakfire_package_get_summary;
pakfire_package_get_supplements;
- pakfire_package_get_url;
- pakfire_package_get_uuid;
- pakfire_package_get_vendor;
pakfire_package_is_installed;
pakfire_package_ref;
- pakfire_package_set_arch;
pakfire_package_set_build_host;
pakfire_package_set_build_id;
pakfire_package_set_build_time;
pakfire_package_set_checksum;
- pakfire_package_set_description;
- pakfire_package_set_distribution;
pakfire_package_set_downloadsize;
- pakfire_package_set_evr;
pakfire_package_set_filelist;
pakfire_package_set_filename;
- pakfire_package_set_groups;
pakfire_package_set_installsize;
pakfire_package_set_install_time;
- pakfire_package_set_license;
- pakfire_package_set_maintainer;
- pakfire_package_set_name;
pakfire_package_set_path;
pakfire_package_set_source_arch;
pakfire_package_set_source_evr;
pakfire_package_set_source_name;
pakfire_package_set_string;
- pakfire_package_set_summary;
- pakfire_package_set_url;
- pakfire_package_set_uuid;
- pakfire_package_set_vendor;
pakfire_package_unref;
# packagelist
pkg->repo = pakfire_repo_ref(repo);
// Set the given attributes
- pakfire_package_set_name(pkg, name);
- pakfire_package_set_evr(pkg, evr);
- pakfire_package_set_arch(pkg, arch);
+ pakfire_package_set_string(pkg, PAKFIRE_PKG_NAME, name);
+ pakfire_package_set_string(pkg, PAKFIRE_PKG_EVR, evr);
+ pakfire_package_set_string(pkg, PAKFIRE_PKG_ARCH, arch);
ERROR:
if (dummy)
return pkg->id;
}
-PAKFIRE_EXPORT const char* pakfire_package_get_nevra(struct pakfire_package* pkg) {
- if (!*pkg->nevra) {
- Pool* pool = pakfire_get_solv_pool(pkg->pakfire);
- Solvable* s = get_solvable(pkg);
-
- pakfire_string_set(pkg->nevra, pool_solvable2str(pool, s));
- }
-
- return pkg->nevra;
-}
-
-PAKFIRE_EXPORT const char* pakfire_package_get_name(struct pakfire_package* pkg) {
- Pool* pool = pakfire_get_solv_pool(pkg->pakfire);
- Solvable* s = get_solvable(pkg);
-
- return pool_id2str(pool, s->name);
-}
-
-PAKFIRE_EXPORT void pakfire_package_set_name(struct pakfire_package* pkg, const char* name) {
- Pool* pool = pakfire_get_solv_pool(pkg->pakfire);
- Solvable* s = get_solvable(pkg);
-
- s->name = pool_str2id(pool, name, 1);
-}
-
-PAKFIRE_EXPORT const char* pakfire_package_get_evr(struct pakfire_package* pkg) {
- Pool* pool = pakfire_get_solv_pool(pkg->pakfire);
- Solvable* s = get_solvable(pkg);
-
- return pool_id2str(pool, s->evr);
-}
-
-PAKFIRE_EXPORT void pakfire_package_set_evr(struct pakfire_package* pkg, const char* evr) {
- Pool* pool = pakfire_get_solv_pool(pkg->pakfire);
- Solvable* s = get_solvable(pkg);
-
- // Skip empty epoch
- if (pakfire_string_startswith(evr, "0:"))
- evr += 2;
-
- s->evr = pool_str2id(pool, evr, 1);
-}
-
char* pakfire_package_join_evr(const char* e, const char* v, const char* r) {
char* buffer = NULL;
return buffer;
}
-PAKFIRE_EXPORT const char* pakfire_package_get_arch(struct pakfire_package* pkg) {
- Pool* pool = pakfire_get_solv_pool(pkg->pakfire);
- Solvable* s = get_solvable(pkg);
-
- return pool_id2str(pool, s->arch);
-}
-
-PAKFIRE_EXPORT void pakfire_package_set_arch(struct pakfire_package* pkg, const char* arch) {
- Pool* pool = pakfire_get_solv_pool(pkg->pakfire);
- Solvable* s = get_solvable(pkg);
-
- s->arch = pool_str2id(pool, arch, 1);
-}
-
int pakfire_package_is_source(struct pakfire_package* pkg) {
- const char* arch = pakfire_package_get_arch(pkg);
+ const char* arch = pakfire_package_get_string(pkg, PAKFIRE_PKG_ARCH);
if (!arch)
return 1;
return ret;
}
-int pakfire_package_set_string(
+PAKFIRE_EXPORT int pakfire_package_set_string(
struct pakfire_package* pkg, const enum pakfire_package_key key, const char* value) {
Id id = ID_NULL;
+ Pool* pool = pakfire_get_solv_pool(pkg->pakfire);
+ Solvable* s = get_solvable(pkg);
+
switch (key) {
// Do not allow to change name, evr, or arch
case PAKFIRE_PKG_NAME:
+ // Reset nevra & filename
+ *pkg->nevra = *pkg->filename = '\0';
+
+ s->name = pool_str2id(pool, value, 1);
+ return 0;
+
case PAKFIRE_PKG_EVR:
+ // Reset nevra & filename
+ *pkg->nevra = *pkg->filename = '\0';
+
+ // Skip empty epoch
+ if (pakfire_string_startswith(value, "0:"))
+ value += 2;
+
+ s->evr = pool_str2id(pool, value, 1);
+ return 0;
+
case PAKFIRE_PKG_ARCH:
+ // Reset nevra & filename
+ *pkg->nevra = *pkg->filename = '\0';
+
+ s->arch = pool_str2id(pool, value, 1);
+ return 0;
+
case PAKFIRE_PKG_NEVRA:
errno = EINVAL;
return 1;
return 1;
}
- Solvable* s = get_solvable(pkg);
-
// Unset on empty string
if (!value || !*value)
solvable_unset(s, id);
solvable_set_num(s, type, value);
}
-static char** pakfire_package_get_string_array(struct pakfire_package* pkg, Id key) {
- char** strings = NULL;
-
- Queue ids;
- queue_init(&ids);
-
- Pool* pool = pakfire_get_solv_pool(pkg->pakfire);
- Solvable* s = get_solvable(pkg);
- solvable_lookup_idarray(s, key, &ids);
-
- if (ids.count > 0) {
- strings = calloc(ids.count + 1, sizeof(*strings));
- if (!strings) {
- queue_free(&ids);
- return NULL;
- }
-
- for (int i = 0; i < ids.count; i++) {
- const char* value = pool_id2str(pool, ids.elements[i]);
- strings[i] = strdup(value);
- }
-
- strings[ids.count] = NULL;
- }
-
- queue_free(&ids);
-
- return strings;
-}
-
-static void pakfire_package_add_string_array(struct pakfire_package* pkg, Id key, const char* value) {
- if (!value)
- return;
-
- Solvable* s = get_solvable(pkg);
- solvable_add_poolstr_array(s, key, value);
-}
-
uint64_t pakfire_package_get_dbid(struct pakfire_package* pkg) {
return pakfire_package_get_num(pkg, RPM_RPMDBID);
}
pakfire_package_set_num(pkg, RPM_RPMDBID, id);
}
-PAKFIRE_EXPORT const char* pakfire_package_get_uuid(struct pakfire_package* pkg) {
- return pakfire_package_get_string(pkg, SOLVABLE_PKGID);
-}
-
-PAKFIRE_EXPORT void pakfire_package_set_uuid(struct pakfire_package* pkg, const char* uuid) {
- pakfire_package_set_string(pkg, SOLVABLE_PKGID, uuid);
-}
-
static enum pakfire_digest_types pakfire_package_id2digest(Id id) {
switch (id) {
case REPOKEY_TYPE_SHA512:
return r;
}
-PAKFIRE_EXPORT const char* pakfire_package_get_summary(struct pakfire_package* pkg) {
- return pakfire_package_get_string(pkg, SOLVABLE_SUMMARY);
-}
-
-PAKFIRE_EXPORT void pakfire_package_set_summary(struct pakfire_package* pkg, const char* summary) {
- pakfire_package_set_string(pkg, SOLVABLE_SUMMARY, summary);
-}
-
-PAKFIRE_EXPORT const char* pakfire_package_get_description(struct pakfire_package* pkg) {
- return pakfire_package_get_string(pkg, SOLVABLE_DESCRIPTION);
-}
-
-PAKFIRE_EXPORT void pakfire_package_set_description(struct pakfire_package* pkg, const char* description) {
- pakfire_package_set_string(pkg, SOLVABLE_DESCRIPTION, description);
-}
-
-PAKFIRE_EXPORT const char* pakfire_package_get_license(struct pakfire_package* pkg) {
- return pakfire_package_get_string(pkg, SOLVABLE_LICENSE);
-}
-
-PAKFIRE_EXPORT void pakfire_package_set_license(struct pakfire_package* pkg, const char* license) {
- pakfire_package_set_string(pkg, SOLVABLE_LICENSE, license);
-}
-
-PAKFIRE_EXPORT const char* pakfire_package_get_url(struct pakfire_package* pkg) {
- return pakfire_package_get_string(pkg, SOLVABLE_URL);
-}
-
-PAKFIRE_EXPORT void pakfire_package_set_url(struct pakfire_package* pkg, const char* url) {
- pakfire_package_set_string(pkg, SOLVABLE_URL, url);
-}
-
-PAKFIRE_EXPORT char* pakfire_package_get_groups(struct pakfire_package* pkg) {
- char** groups = pakfire_package_get_string_array(pkg, SOLVABLE_GROUP);
- if (!groups)
- return NULL;
-
- char* string = pakfire_string_join(groups, " ");
-
- // Free array
- for (char** group = groups; *group; group++)
- free(*group);
- free(groups);
-
- return string;
-}
-
-PAKFIRE_EXPORT void pakfire_package_set_groups(struct pakfire_package* pkg, const char* groups) {
- char** list = pakfire_string_split(groups, ' ');
- if (!list)
- return;
-
- for (char** group = list; *group; group++) {
- pakfire_package_add_string_array(pkg, SOLVABLE_GROUP, *group);
- free(*group);
- }
-
- free(list);
-}
-
-PAKFIRE_EXPORT const char* pakfire_package_get_vendor(struct pakfire_package* pkg) {
- return pakfire_package_get_string(pkg, SOLVABLE_VENDOR);
-}
-
-PAKFIRE_EXPORT void pakfire_package_set_vendor(struct pakfire_package* pkg, const char* vendor) {
- pakfire_package_set_string(pkg, SOLVABLE_VENDOR, vendor);
-}
-
-PAKFIRE_EXPORT const char* pakfire_package_get_distribution(struct pakfire_package* pkg) {
- return pakfire_package_get_string(pkg, SOLVABLE_DISTRIBUTION);
-}
-
-PAKFIRE_EXPORT void pakfire_package_set_distribution(struct pakfire_package* pkg, const char* distribution) {
- pakfire_package_set_string(pkg, SOLVABLE_DISTRIBUTION, distribution);
-}
-
-PAKFIRE_EXPORT const char* pakfire_package_get_maintainer(struct pakfire_package* pkg) {
- return pakfire_package_get_string(pkg, SOLVABLE_PACKAGER);
-}
-
-PAKFIRE_EXPORT void pakfire_package_set_maintainer(struct pakfire_package* pkg, const char* maintainer) {
- pakfire_package_set_string(pkg, SOLVABLE_PACKAGER, maintainer);
-}
-
static int pakfire_package_make_cache_path(struct pakfire_package* pkg) {
const char* filename = pakfire_package_get_filename(pkg);
static const char* pakfire_package_make_filename(struct pakfire_package* pkg) {
if (!*pkg->filename) {
- const char* name = pakfire_package_get_name(pkg);
- const char* evr = pakfire_package_get_evr(pkg);
- const char* arch = pakfire_package_get_arch(pkg);
+ const char* name = pakfire_package_get_string(pkg, PAKFIRE_PKG_NAME);
+ const char* evr = pakfire_package_get_string(pkg, PAKFIRE_PKG_EVR);
+ const char* arch = pakfire_package_get_string(pkg, PAKFIRE_PKG_ARCH);
if (!name || !evr || !arch)
return NULL;
char* string = "";
// Name
- const char* name = pakfire_package_get_name(pkg);
- pakfire_package_dump_add_line(&string, _("Name"), name);
+ const char* name = pakfire_package_get_string(pkg, PAKFIRE_PKG_NAME);
+ if (name)
+ pakfire_package_dump_add_line(&string, _("Name"), name);
// EVR
- const char* evr = pakfire_package_get_evr(pkg);
- pakfire_package_dump_add_line(&string, _("Version"), evr);
+ const char* evr = pakfire_package_get_string(pkg, PAKFIRE_PKG_EVR);
+ if (evr)
+ pakfire_package_dump_add_line(&string, _("Version"), evr);
// Arch
- const char* arch = pakfire_package_get_arch(pkg);
- pakfire_package_dump_add_line(&string, _("Arch"), arch);
+ const char* arch = pakfire_package_get_string(pkg, PAKFIRE_PKG_ARCH);
+ if (arch)
+ pakfire_package_dump_add_line(&string, _("Arch"), arch);
// Size
size_t size = pakfire_package_get_size(pkg);
}
// Summary
- const char* summary = pakfire_package_get_summary(pkg);
- pakfire_package_dump_add_line(&string, _("Summary"), summary);
+ const char* summary = pakfire_package_get_string(pkg, PAKFIRE_PKG_SUMMARY);
+ if (summary)
+ pakfire_package_dump_add_line(&string, _("Summary"), summary);
// Description
- const char* description = pakfire_package_get_description(pkg);
+ const char* description = pakfire_package_get_string(pkg, PAKFIRE_PKG_DESCRIPTION);
if (description)
pakfire_package_dump_add_lines(&string, _("Description"), description);
// Groups
- const char* groups = pakfire_package_get_groups(pkg);
- if (groups) {
+ const char* groups = pakfire_package_get_string(pkg, PAKFIRE_PKG_GROUPS);
+ if (groups)
pakfire_package_dump_add_lines(&string, _("Groups"), groups);
- }
// URL
- const char* url = pakfire_package_get_url(pkg);
- pakfire_package_dump_add_line(&string, _("URL"), url);
+ const char* url = pakfire_package_get_string(pkg, PAKFIRE_PKG_URL);
+ if (url)
+ pakfire_package_dump_add_line(&string, _("URL"), url);
// License
- const char* license = pakfire_package_get_license(pkg);
- pakfire_package_dump_add_line(&string, _("License"), license);
+ const char* license = pakfire_package_get_string(pkg, PAKFIRE_PKG_LICENSE);
+ if (license)
+ pakfire_package_dump_add_line(&string, _("License"), license);
if (flags & PAKFIRE_PKG_DUMP_LONG) {
// Install Time
}
// Distribution
- const char* distro = pakfire_package_get_distribution(pkg);
+ const char* distro = pakfire_package_get_string(pkg, PAKFIRE_PKG_DISTRO);
if (distro)
pakfire_package_dump_add_line(&string, _("Distribution"), distro);
// Maintainer
- const char* maintainer = pakfire_package_get_maintainer(pkg);
- pakfire_package_dump_add_line(&string, _("Maintainer"), maintainer);
+ const char* maintainer = pakfire_package_get_string(pkg, PAKFIRE_PKG_MAINTAINER);
+ if (maintainer)
+ pakfire_package_dump_add_line(&string, _("Maintainer"), maintainer);
// Vendor
- const char* vendor = pakfire_package_get_vendor(pkg);
- pakfire_package_dump_add_line(&string, _("Vendor"), vendor);
+ const char* vendor = pakfire_package_get_string(pkg, PAKFIRE_PKG_VENDOR);
+ if (vendor)
+ pakfire_package_dump_add_line(&string, _("Vendor"), vendor);
// UUID
- const char* uuid = pakfire_package_get_uuid(pkg);
- pakfire_package_dump_add_line(&string, _("UUID"), uuid);
+ const char* uuid = pakfire_package_get_string(pkg, PAKFIRE_PKG_UUID);
+ if (uuid)
+ pakfire_package_dump_add_line(&string, _("UUID"), uuid);
// Build ID
const char* build_id = pakfire_package_get_build_id(pkg);
struct pakfire_repo* repo = pakfire_package_get_repo(pkg);
if (!repo) {
ERROR(pkg->pakfire, "Could not find repository for %s: %m\n",
- pakfire_package_get_nevra(pkg));
+ pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA));
return 1;
}
int r = 0;
// Name
- const char* name = pakfire_package_get_name(pkg);
+ const char* name = pakfire_package_get_string(pkg, PAKFIRE_PKG_NAME);
if (name) {
r = pakfire_json_add_string(pkg->pakfire, md, "name", name);
if (r)
}
// EVR
- const char* evr = pakfire_package_get_evr(pkg);
+ const char* evr = pakfire_package_get_string(pkg, PAKFIRE_PKG_EVR);
if (evr) {
r = pakfire_json_add_string(pkg->pakfire, md, "evr", evr);
if (r)
}
// Arch
- const char* arch = pakfire_package_get_arch(pkg);
+ const char* arch = pakfire_package_get_string(pkg, PAKFIRE_PKG_ARCH);
if (arch) {
r = pakfire_json_add_string(pkg->pakfire, md, "arch", arch);
if (r)
}
// Vendor
- const char* vendor = pakfire_package_get_vendor(pkg);
+ const char* vendor = pakfire_package_get_string(pkg, PAKFIRE_PKG_VENDOR);
if (vendor) {
r = pakfire_json_add_string(pkg->pakfire, md, "vendor", vendor);
if (r)
}
// Distribution
- const char* distribution = pakfire_package_get_distribution(pkg);
+ const char* distribution = pakfire_package_get_string(pkg, PAKFIRE_PKG_DISTRO);
if (distribution) {
r = pakfire_json_add_string(pkg->pakfire, md, "distribution", distribution);
if (r)
}
// UUID
- const char* uuid = pakfire_package_get_uuid(pkg);
+ const char* uuid = pakfire_package_get_string(pkg, PAKFIRE_PKG_UUID);
if (uuid) {
r = pakfire_json_add_string(pkg->pakfire, md, "uuid", uuid);
if (r)
}
// Groups
- char* groups = pakfire_package_get_groups(pkg);
+ const char* groups = pakfire_package_get_string(pkg, PAKFIRE_PKG_GROUPS);
if (groups) {
r = pakfire_json_add_string(pkg->pakfire, md, "groups", groups);
- free(groups);
- if (r)
- goto ERROR;
- }
-
- // Distribution
- const char* distro = pakfire_package_get_distribution(pkg);
- if (distro) {
- r = pakfire_json_add_string(pkg->pakfire, md, "distribution", distro);
if (r)
goto ERROR;
}
// Maintainer
- const char* maintainer = pakfire_package_get_maintainer(pkg);
+ const char* maintainer = pakfire_package_get_string(pkg, PAKFIRE_PKG_MAINTAINER);
if (maintainer) {
r = pakfire_json_add_string(pkg->pakfire, md, "maintainer", maintainer);
if (r)
}
// URL
- const char* url = pakfire_package_get_url(pkg);
+ const char* url = pakfire_package_get_string(pkg, PAKFIRE_PKG_URL);
if (url) {
r = pakfire_json_add_string(pkg->pakfire, md, "url", url);
if (r)
}
// License
- const char* license = pakfire_package_get_license(pkg);
+ const char* license = pakfire_package_get_string(pkg, PAKFIRE_PKG_LICENSE);
if (license) {
r = pakfire_json_add_string(pkg->pakfire, md, "license", license);
if (r)
}
// Summary
- const char* summary = pakfire_package_get_summary(pkg);
+ const char* summary = pakfire_package_get_string(pkg, PAKFIRE_PKG_SUMMARY);
if (summary) {
r = pakfire_json_add_string(pkg->pakfire, md, "summary", summary);
if (r)
}
// Description
- const char* description = pakfire_package_get_description(pkg);
+ const char* description = pakfire_package_get_string(pkg, PAKFIRE_PKG_DESCRIPTION);
if (description) {
r = pakfire_json_add_string(pkg->pakfire, md, "description", description);
if (r)
goto ERROR;
}
- pakfire_package_set_distribution(pkg, tag);
+ pakfire_package_set_string(pkg, PAKFIRE_PKG_DISTRO, tag);
// Set build host
pakfire_package_set_build_host(pkg, pakfire_hostname());
if (pakfire_package_is_source(packager->pkg))
pakfire_string_set(packager->filename, filename);
else {
- const char* arch = pakfire_package_get_arch(packager->pkg);
+ const char* arch = pakfire_package_get_string(packager->pkg, PAKFIRE_PKG_ARCH);
pakfire_string_format(packager->filename, "%s/%s", arch, filename);
}
struct archive* a = NULL;
int r = 1;
- const char* nevra = pakfire_package_get_nevra(packager->pkg);
+ const char* nevra = pakfire_package_get_string(packager->pkg, PAKFIRE_PKG_NEVRA);
// Add requires feature markers
if (pakfire_package_has_rich_deps(packager->pkg))
goto CLEANUP;
}
- pakfire_package_set_uuid(*pkg, uuid);
+ pakfire_package_set_string(*pkg, PAKFIRE_PKG_UUID, uuid);
free(uuid);
// Set build time
// Assign more attributes
const struct attribute {
const char* name;
- void(*func)(struct pakfire_package* pkg, const char* value);
+ const enum pakfire_package_key key;
} attributes[] = {
- { "summary", pakfire_package_set_summary, },
- { "description", pakfire_package_set_description, },
- { "license", pakfire_package_set_license, },
- { "url", pakfire_package_set_url, },
- { "groups", pakfire_package_set_groups, },
- { "vendor", pakfire_package_set_vendor, },
- { "maintainer", pakfire_package_set_maintainer, },
+ { "summary", PAKFIRE_PKG_SUMMARY },
+ { "description", PAKFIRE_PKG_DESCRIPTION, },
+ { "license", PAKFIRE_PKG_LICENSE, },
+ { "url", PAKFIRE_PKG_URL, },
+ { "groups", PAKFIRE_PKG_GROUPS, },
+ { "vendor", PAKFIRE_PKG_VENDOR, },
+ { "maintainer", PAKFIRE_PKG_MAINTAINER, },
{ NULL },
};
if (!value)
continue;
- a->func(*pkg, value);
+ r = pakfire_package_set_string(*pkg, a->key, value);
free(value);
+
+ if (r) {
+ ERROR(parser->pakfire, "Could not set %s: %m\n", a->name);
+ goto CLEANUP;
+ }
}
// Fetch build dependencies
if (!pkg)
return 1;
- const char* nevra = pakfire_package_get_nevra(pkg);
+ const char* nevra = pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA);
const char* path = pakfire_package_get_path(pkg);
// If prefix is set, skip anything that doesn't match
return;
pakfire_transaction_add_line(lines, width,
- pakfire_package_get_name(pkg),
- pakfire_package_get_arch(pkg),
- pakfire_package_get_evr(pkg),
+ pakfire_package_get_string(pkg, PAKFIRE_PKG_NAME),
+ pakfire_package_get_string(pkg, PAKFIRE_PKG_ARCH),
+ pakfire_package_get_string(pkg, PAKFIRE_PKG_EVR),
pakfire_repo_get_name(repo),
size
);
pakfire_transaction_add_package(lines, width, new_pkg);
pakfire_transaction_append_line(lines,
- " --> %s\n", pakfire_package_get_nevra(old_pkg));
+ " --> %s\n", pakfire_package_get_string(old_pkg, PAKFIRE_PKG_NEVRA));
}
static void pakfire_transaction_add_separator(char*** lines, size_t width) {
static int pakfire_transaction_verify(struct pakfire_transaction* transaction,
struct pakfire_package* pkg, struct pakfire_archive* archive) {
- const char* nevra = pakfire_package_get_nevra(pkg);
+ const char* nevra = pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA);
// Nothing to do if this step does not have an archive
if (!archive) {
static int pakfire_transaction_extract(struct pakfire_transaction* transaction,
struct pakfire_package* pkg, struct pakfire_archive* archive) {
- const char* nevra = pakfire_package_get_nevra(pkg);
+ const char* nevra = pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA);
// Update status
pakfire_transaction_status(transaction, _("Installing %s..."), nevra);
if (!transaction->userinstalled)
return 0;
- const char* name = pakfire_package_get_name(pkg);
+ const char* name = pakfire_package_get_string(pkg, PAKFIRE_PKG_NAME);
// Check if the package is on the list
for (char** elem = transaction->userinstalled; *elem; elem++) {
}
DEBUG(transaction->pakfire, "Running %s for %s\n",
- pakfire_action_type_string(action), pakfire_package_get_nevra(pkg));
+ pakfire_action_type_string(action), pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA));
enum pakfire_steps type = pakfire_transaction_get_step_type(transaction, pkg);
transaction->archives[i] = pakfire_package_get_archive(pkg);
if (!transaction->archives[i]) {
ERROR(transaction->pakfire, "Could not open archive for %s: %m\n",
- pakfire_package_get_nevra(pkg));
+ pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA));
return 1;
}
}
// Fetch mirrorlist
mirrorlist = pakfire_repo_get_mirrorlist(repo);
- const char* nevra = pakfire_package_get_nevra(pkg);
+ const char* nevra = pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA);
if (!nevra)
goto ERROR;
// Enqueue download
r = pakfire_transaction_download_package(transaction, downloader, pkg);
if (r) {
- const char* nevra = pakfire_package_get_nevra(pkg);
+ const char* nevra = pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA);
ERROR(transaction->pakfire, "Could not add download to queue: %s: %m\n", nevra);
goto ERROR;
ASSERT(pkg1);
// Set all metadata
- pakfire_package_set_summary(pkg1, "SUMMARY");
- pakfire_package_set_description(pkg1, "DESCRIPTION");
+ pakfire_package_set_string(pkg1, PAKFIRE_PKG_SUMMARY, "SUMMARY");
+ pakfire_package_set_string(pkg1, PAKFIRE_PKG_DESCRIPTION, "DESCRIPTION");
// Create packager
ASSERT_SUCCESS(pakfire_packager_create(&packager, t->pakfire, pkg1));
}
// Compare name
- s = pakfire_package_get_name(pkg2);
+ s = pakfire_package_get_string(pkg2, PAKFIRE_PKG_NAME);
ASSERT_STRING_EQUALS(s, "test");
// Compare evr
- s = pakfire_package_get_evr(pkg2);
+ s = pakfire_package_get_string(pkg2, PAKFIRE_PKG_EVR);
ASSERT_STRING_EQUALS(s, "1.0-1");
// Compare arch
- s = pakfire_package_get_arch(pkg2);
+ s = pakfire_package_get_string(pkg2, PAKFIRE_PKG_ARCH);
ASSERT_STRING_EQUALS(s, "x86_64");
// Compare summary
- s = pakfire_package_get_summary(pkg2);
+ s = pakfire_package_get_string(pkg2, PAKFIRE_PKG_SUMMARY);
ASSERT_STRING_EQUALS(s, "SUMMARY");
// Compare description
- s = pakfire_package_get_description(pkg2);
+ s = pakfire_package_get_string(pkg2, PAKFIRE_PKG_DESCRIPTION);
ASSERT_STRING_EQUALS(s, "DESCRIPTION");
// Everything passed