src/libpakfire/solution.c \
src/libpakfire/solver.c \
src/libpakfire/step.c \
+ src/libpakfire/system.c \
src/libpakfire/transaction.c \
src/libpakfire/util.c
src/libpakfire/include/pakfire/solution.h \
src/libpakfire/include/pakfire/solver.h \
src/libpakfire/include/pakfire/step.h \
+ src/libpakfire/include/pakfire/system.h \
src/libpakfire/include/pakfire/transaction.h \
src/libpakfire/include/pakfire/types.h \
src/libpakfire/include/pakfire/util.h
const char* path = NULL;
const char* arch = NULL;
- if (!PyArg_ParseTuple(args, "ss", &path, &arch))
+ if (!PyArg_ParseTuple(args, "s|s", &path, &arch))
return -1;
self->pakfire = pakfire_create(path, arch);
--- /dev/null
+/*#############################################################################
+# #
+# Pakfire - The IPFire package management system #
+# Copyright (C) 2017 Pakfire development team #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+#############################################################################*/
+
+#ifndef PAKFIRE_SYSTEM_H
+#define PAKFIRE_SYSTEM_H
+
+const char* system_machine();
+
+#endif /* PAKFIRE_SYSTEM_H */
#include <pakfire/pakfire.h>
#include <pakfire/pool.h>
+#include <pakfire/system.h>
#include <pakfire/types.h>
#include <pakfire/util.h>
pakfire->nrefs = 1;
pakfire->path = pakfire_strdup(path);
+ if (!arch) {
+ arch = system_machine();
+ }
pakfire->arch = pakfire_strdup(arch);
// Initialize the pool
--- /dev/null
+/*#############################################################################
+# #
+# Pakfire - The IPFire package management system #
+# Copyright (C) 2017 Pakfire development team #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+#############################################################################*/
+
+#include <string.h>
+#include <sys/utsname.h>
+
+#include <pakfire/constants.h>
+#include <pakfire/system.h>
+#include <pakfire/util.h>
+
+const char* system_machine() {
+ static char __system_machine[STRING_SIZE] = "";
+
+ if (!*__system_machine) {
+ struct utsname buf;
+
+ int r = uname(&buf);
+ if (!r)
+ return NULL;
+
+ strncpy(__system_machine, buf.machine, sizeof(*__system_machine));
+ }
+
+ return __system_machine;
+}