Date: Thu, 8 Aug 2013 11:50:29 GMT From: mattbw@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r255676 - soc2013/mattbw/backend Message-ID: <201308081150.r78BoTM9020405@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mattbw Date: Thu Aug 8 11:50:29 2013 New Revision: 255676 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=255676 Log: Add a function for retrieving PackageIDs and their total simultaneously. This is now used by jobs (and will probably enter the query code shortly). It constitutes a very minor bit of abstraction over the PackageKit functions. Modified: soc2013/mattbw/backend/utils.c soc2013/mattbw/backend/utils.h Modified: soc2013/mattbw/backend/utils.c ============================================================================== --- soc2013/mattbw/backend/utils.c Thu Aug 8 09:04:02 2013 (r255675) +++ soc2013/mattbw/backend/utils.c Thu Aug 8 11:50:29 2013 (r255676) @@ -20,10 +20,11 @@ /* String/ID utilities. */ +#include <assert.h> /* assert */ #include <string.h> #include <glib.h> -#include "pk-backend.h" /* pk_package_id_split */ +#include "pk-backend.h" /* pk_backend_get_strv */ #include "utils.h" /* prototypes */ @@ -46,3 +47,22 @@ return result; } + +/* + * Retrieves PackageIDs from the backend, as well as the total number of them. + */ +gchar ** +get_package_ids(PkBackend *backend, guint *count_p) +{ + gchar **package_ids; + + assert(backend != NULL); + assert(count_p != NULL); + + package_ids = pk_backend_get_strv(backend, "package_ids"); + assert(package_ids != NULL); + + *count_p = g_strv_length(package_ids); + + return package_ids; +} Modified: soc2013/mattbw/backend/utils.h ============================================================================== --- soc2013/mattbw/backend/utils.h Thu Aug 8 09:04:02 2013 (r255675) +++ soc2013/mattbw/backend/utils.h Thu Aug 8 11:50:29 2013 (r255676) @@ -30,5 +30,6 @@ (void)pk_backend_error_code((backend), (type), (msg)) bool string_match(const char *left, const char *right); +gchar **get_package_ids(PkBackend *backend, guint *count_p); #endif /* !_PKGNG_BACKEND_DETAILS_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308081150.r78BoTM9020405>