}
int pakfire_client_builder_connect(pakfire_client* self, pakfire_builder* builder) {
+ const pakfire_distro* distro = NULL;
+ pakfire_cpuinfo cpuinfo = {};
+ pakfire_sysinfo sysinfo = {};
pakfire_xfer* xfer = NULL;
const char* arch = NULL;
int r;
+ // Fetch CPU info
+ r = pakfire_get_cpuinfo(&cpuinfo);
+ if (r < 0) {
+ ERROR(self->ctx, "Failed to fetch CPU info: %s\n", strerror(-r));
+ goto ERROR;
+ }
+
+ // Fetch system information
+ r = pakfire_get_sysinfo(&sysinfo);
+ if (r < 0) {
+ ERROR(self->ctx, "Failed to fetch system info: %s\n", strerror(-r));
+ goto ERROR;
+ }
+
// Create a new xfer
r = pakfire_client_xfer_create(&xfer, self, "/api/v1/builders/control");
if (r < 0)
goto ERROR;
}
+ // Fetch the distro that we are running on
+ distro = pakfire_ctx_get_distro(self->ctx);
+
+ // Send the distro information
+ if (distro) {
+ r = pakfire_xfer_add_query(xfer, "os_name", "%s", distro->pretty_name);
+ if (r < 0)
+ goto ERROR;
+ }
+
+ // System Vendor
+ if (*sysinfo.vendor) {
+ r = pakfire_xfer_add_query(xfer, "sys_vendor", "%s", sysinfo.vendor);
+ if (r < 0)
+ goto ERROR;
+ }
+
+ // System Model
+ if (*sysinfo.name) {
+ r = pakfire_xfer_add_query(xfer, "sys_name", "%s", sysinfo.name);
+ if (r < 0)
+ goto ERROR;
+ }
+
+ // CPU Model
+ if (*cpuinfo.model) {
+ r = pakfire_xfer_add_query(xfer, "cpu_model", "%s", cpuinfo.model);
+ if (r < 0)
+ goto ERROR;
+ }
+
+ // CPU Count
+ r = pakfire_xfer_add_query(xfer, "cpu_count", "%u", cpuinfo.count);
+ if (r < 0)
+ goto ERROR;
+
// Enable authentication
r = pakfire_client_xfer_auth(self, xfer);
if (r < 0)