From: Michael Tremer Date: Thu, 11 Feb 2021 16:21:09 +0000 (+0000) Subject: package: Give build_host/build_time proper names and types X-Git-Tag: 0.9.28~1285^2~757 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ffc704d6236e79d23c8727ab0e6a8332e947631;p=pakfire.git package: Give build_host/build_time proper names and types Signed-off-by: Michael Tremer --- diff --git a/src/_pakfire/package.c b/src/_pakfire/package.c index a725034c4..c250c6d78 100644 --- a/src/_pakfire/package.c +++ b/src/_pakfire/package.c @@ -398,29 +398,29 @@ static PyObject* Package_get_size(PackageObject* self) { } static PyObject* Package_get_buildhost(PackageObject* self) { - const char* buildhost = pakfire_package_get_buildhost(self->package); - if (!buildhost) + const char* build_host = pakfire_package_get_build_host(self->package); + if (!build_host) Py_RETURN_NONE; - return PyUnicode_FromString(buildhost); + return PyUnicode_FromString(build_host); } static void Package_set_buildhost(PackageObject* self, PyObject* value) { - const char* buildhost = PyUnicode_FromValue(value); + const char* build_host = PyUnicode_FromValue(value); - pakfire_package_set_buildhost(self->package, buildhost); + pakfire_package_set_build_host(self->package, build_host); } static PyObject* Package_get_buildtime(PackageObject* self) { - unsigned long long buildtime = pakfire_package_get_buildtime(self->package); + time_t build_time = pakfire_package_get_build_time(self->package); - return PyLong_FromUnsignedLongLong(buildtime); + return PyLong_FromUnsignedLongLong(build_time); } static void Package_set_buildtime(PackageObject* self, PyObject* value) { - unsigned long long buildtime = PyLong_AsUnsignedLongLong(value); + time_t build_time = PyLong_AsUnsignedLongLong(value); - pakfire_package_set_buildtime(self->package, buildtime); + pakfire_package_set_build_time(self->package, build_time); } static PyObject* Package_get_cache_path(PackageObject* self) { diff --git a/src/libpakfire/archive.c b/src/libpakfire/archive.c index 8c580f5cc..cdb8ee96f 100644 --- a/src/libpakfire/archive.c +++ b/src/libpakfire/archive.c @@ -1357,19 +1357,19 @@ PAKFIRE_EXPORT PakfirePackage pakfire_archive_make_package(PakfireArchive archiv } // Set build host - char* buildhost = pakfire_archive_get(archive, "build.host"); - if (buildhost) { - pakfire_package_set_buildhost(pkg, buildhost); - free(buildhost); + char* build_host = pakfire_archive_get(archive, "build.host"); + if (build_host) { + pakfire_package_set_build_host(pkg, build_host); + free(build_host); } // Set build time - char* buildtime = pakfire_archive_get(archive, "build.time"); - if (buildtime) { - unsigned long long t = strtoull(buildtime, NULL, 10); - free(buildtime); + char* build_time = pakfire_archive_get(archive, "build.time"); + if (build_time) { + time_t t = strtoull(build_time, NULL, 10); + free(build_time); - pakfire_package_set_buildtime(pkg, t); + pakfire_package_set_build_time(pkg, t); } // Relations diff --git a/src/libpakfire/db.c b/src/libpakfire/db.c index 1ed27c6ff..d130a6166 100644 --- a/src/libpakfire/db.c +++ b/src/libpakfire/db.c @@ -1150,16 +1150,16 @@ PAKFIRE_EXPORT int pakfire_db_add_package(struct pakfire_db* db, } // Bind build_host - const char* buildhost = pakfire_package_get_buildhost(pkg); + const char* build_host = pakfire_package_get_build_host(pkg); - r = sqlite3_bind_text(stmt, 16, buildhost, -1, NULL); + r = sqlite3_bind_text(stmt, 16, build_host, -1, NULL); if (r) { ERROR(db->pakfire, "Could not bind build_host: %s\n", sqlite3_errmsg(db->handle)); goto ROLLBACK; } // Bind build_time - unsigned long long build_time = pakfire_package_get_buildtime(pkg); + time_t build_time = pakfire_package_get_build_time(pkg); r = sqlite3_bind_int64(stmt, 17, build_time); if (r) { @@ -1470,13 +1470,13 @@ static int pakfire_db_load_package(struct pakfire_db* db, PakfireRepo repo, sqli // Build Host const char* build_host = (const char*)sqlite3_column_text(stmt, 15); if (build_host) { - pakfire_package_set_buildhost(pkg, build_host); + pakfire_package_set_build_host(pkg, build_host); } // Build Time time_t build_time = sqlite3_column_int64(stmt, 16); if (build_time) { - pakfire_package_set_buildtime(pkg, build_time); + pakfire_package_set_build_time(pkg, build_time); } // Files diff --git a/src/libpakfire/include/pakfire/package.h b/src/libpakfire/include/pakfire/package.h index ebcc7de14..26cde93a1 100644 --- a/src/libpakfire/include/pakfire/package.h +++ b/src/libpakfire/include/pakfire/package.h @@ -21,6 +21,8 @@ #ifndef PAKFIRE_PACKAGE_H #define PAKFIRE_PACKAGE_H +#include + #include #include @@ -79,11 +81,11 @@ void pakfire_package_set_downloadsize(PakfirePackage pkg, unsigned long long dow unsigned long long pakfire_package_get_installsize(PakfirePackage pkg); void pakfire_package_set_installsize(PakfirePackage pkg, unsigned long long installsize); unsigned long long pakfire_package_get_size(PakfirePackage pkg); -const char* pakfire_package_get_buildhost(PakfirePackage pkg); -void pakfire_package_set_buildhost(PakfirePackage pkg, const char* buildhost); -unsigned long long pakfire_package_get_buildtime(PakfirePackage pkg); -void pakfire_package_set_buildtime(PakfirePackage pkg, unsigned long long buildtime); -unsigned long long pakfire_package_get_installtime(PakfirePackage pkg); +const char* pakfire_package_get_build_host(PakfirePackage pkg); +void pakfire_package_set_build_host(PakfirePackage pkg, const char* build_host); +time_t pakfire_package_get_build_time(PakfirePackage pkg); +void pakfire_package_set_build_time(PakfirePackage pkg, time_t build_time); +time_t pakfire_package_get_installtime(PakfirePackage pkg); PakfireRelationList pakfire_package_get_provides(PakfirePackage pkg); void pakfire_package_set_provides(PakfirePackage pkg, PakfireRelationList relationlist); diff --git a/src/libpakfire/libpakfire.sym b/src/libpakfire/libpakfire.sym index 50e0ac0a4..221a1b52a 100644 --- a/src/libpakfire/libpakfire.sym +++ b/src/libpakfire/libpakfire.sym @@ -161,8 +161,8 @@ global: pakfire_package_create_from_solvable; pakfire_package_dump; pakfire_package_get_arch; - pakfire_package_get_buildhost; - pakfire_package_get_buildtime; + pakfire_package_get_build_host; + pakfire_package_get_build_time; pakfire_package_get_cache_path; pakfire_package_get_checksum; pakfire_package_get_conflicts; @@ -202,8 +202,8 @@ global: pakfire_package_join_evr; pakfire_package_ref; pakfire_package_set_arch; - pakfire_package_set_buildhost; - pakfire_package_set_buildtime; + pakfire_package_set_build_host; + pakfire_package_set_build_time; pakfire_package_set_checksum; pakfire_package_set_conflicts; pakfire_package_set_description; diff --git a/src/libpakfire/package.c b/src/libpakfire/package.c index e69cf78c0..5ffd6c288 100644 --- a/src/libpakfire/package.c +++ b/src/libpakfire/package.c @@ -508,23 +508,23 @@ PAKFIRE_EXPORT unsigned long long pakfire_package_get_size(PakfirePackage pkg) { return pakfire_package_get_downloadsize(pkg); } -PAKFIRE_EXPORT const char* pakfire_package_get_buildhost(PakfirePackage pkg) { +PAKFIRE_EXPORT const char* pakfire_package_get_build_host(PakfirePackage pkg) { return pakfire_package_get_string(pkg, SOLVABLE_BUILDHOST); } -PAKFIRE_EXPORT void pakfire_package_set_buildhost(PakfirePackage pkg, const char* buildhost) { - pakfire_package_set_string(pkg, SOLVABLE_BUILDHOST, buildhost); +PAKFIRE_EXPORT void pakfire_package_set_build_host(PakfirePackage pkg, const char* build_host) { + pakfire_package_set_string(pkg, SOLVABLE_BUILDHOST, build_host); } -PAKFIRE_EXPORT unsigned long long pakfire_package_get_buildtime(PakfirePackage pkg) { +PAKFIRE_EXPORT time_t pakfire_package_get_build_time(PakfirePackage pkg) { return pakfire_package_get_num(pkg, SOLVABLE_BUILDTIME); } -PAKFIRE_EXPORT void pakfire_package_set_buildtime(PakfirePackage pkg, unsigned long long buildtime) { - pakfire_package_set_num(pkg, SOLVABLE_BUILDTIME, buildtime); +PAKFIRE_EXPORT void pakfire_package_set_build_time(PakfirePackage pkg, time_t build_time) { + pakfire_package_set_num(pkg, SOLVABLE_BUILDTIME, build_time); } -PAKFIRE_EXPORT unsigned long long pakfire_package_get_installtime(PakfirePackage pkg) { +PAKFIRE_EXPORT time_t pakfire_package_get_installtime(PakfirePackage pkg) { return pakfire_package_get_num(pkg, SOLVABLE_INSTALLTIME); } @@ -836,12 +836,12 @@ PAKFIRE_EXPORT char* pakfire_package_dump(PakfirePackage pkg, int flags) { pakfire_package_dump_add_line(&string, _("UUID"), uuid); // Build time - unsigned long long buildtime = pakfire_package_get_buildtime(pkg); - pakfire_package_dump_add_line_date(&string, _("Build Time"), buildtime); + time_t build_time = pakfire_package_get_build_time(pkg); + pakfire_package_dump_add_line_date(&string, _("Build Time"), build_time); // Build host - const char* buildhost = pakfire_package_get_buildhost(pkg); - pakfire_package_dump_add_line(&string, _("Build Host"), buildhost); + const char* build_host = pakfire_package_get_build_host(pkg); + pakfire_package_dump_add_line(&string, _("Build Host"), build_host); // Dependencies