}
static int Pakfire_init(PakfireObject* self, PyObject* args, PyObject* kwds) {
- char* kwlist[] = { "path", "arch", "logger", "offline", "conf", "build",
+ char* kwlist[] = { "path", "arch", "logger", "interactive", "offline", "conf", "build",
"enable_ccache", "enable_snapshot", "status_callback", "progress_callback", NULL };
const char* path = NULL;
const char* arch = NULL;
const char* conf = NULL;
+ int interactive = 0;
int offline = 0;
int build = 0;
int enable_ccache = 1;
int enable_snapshot = 1;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|zzOpzpppOO", kwlist,
- &path, &arch, &self->callbacks.log, &offline, &conf, &build,
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|zzOppzpppOO", kwlist,
+ &path, &arch, &self->callbacks.log, &interactive, &offline, &conf, &build,
&enable_ccache, &enable_snapshot, &self->callbacks.status,
&self->callbacks.progress))
return -1;
int flags = 0;
+ // Enable interactive mode
+ if (interactive)
+ flags |= PAKFIRE_FLAGS_INTERACTIVE;
+
// Enable offline mode
if (offline)
flags |= PAKFIRE_FLAGS_OFFLINE;
DEBUG(archive->pakfire, "Extracting %s to %s\n", archive->path, path);
// Create a progressbar
- if (!pakfire_has_flag(archive->pakfire, PAKFIRE_FLAGS_NON_INTERACTIVE)) {
+ if (pakfire_has_flag(archive->pakfire, PAKFIRE_FLAGS_INTERACTIVE)) {
r = pakfire_archive_extract_progressbar(archive, &progressbar);
if (r)
goto ERROR;
#include <pakfire/repolist.h>
enum pakfire_flags {
- PAKFIRE_FLAGS_OFFLINE = (1 << 0),
- PAKFIRE_FLAGS_NON_INTERACTIVE = (1 << 1),
+ PAKFIRE_FLAGS_INTERACTIVE = (1 << 0),
+ PAKFIRE_FLAGS_OFFLINE = (1 << 1),
PAKFIRE_FLAGS_BUILD = (1 << 2),
PAKFIRE_FLAGS_DISABLE_CCACHE = (1 << 3),
PAKFIRE_FLAGS_DISABLE_SNAPSHOT = (1 << 4),
DEBUG(p, " path = %s\n", pakfire_get_path(p));
// Automatically disable interactive mode
- if (!pakfire_has_flag(p, PAKFIRE_FLAGS_NON_INTERACTIVE)) {
+ if (pakfire_has_flag(p, PAKFIRE_FLAGS_INTERACTIVE)) {
if (pakfire_tty_is_noninteractive()) {
DEBUG(p, "Interactive mode disabled\n");
- flags |= PAKFIRE_FLAGS_NON_INTERACTIVE;
+ flags &= ~PAKFIRE_FLAGS_INTERACTIVE;
}
}
// Setup build stuff
if (pakfire_has_flag(p, PAKFIRE_FLAGS_BUILD)) {
// Builds are never interactive
- p->flags |= PAKFIRE_FLAGS_NON_INTERACTIVE;
+ p->flags &= ~PAKFIRE_FLAGS_INTERACTIVE;
}
*pakfire = p;
char* dump = pakfire_transaction_dump(transaction, 80);
// Check if we should continue
- if (!pakfire_has_flag(transaction->pakfire, PAKFIRE_FLAGS_NON_INTERACTIVE)) {
+ if (pakfire_has_flag(transaction->pakfire, PAKFIRE_FLAGS_INTERACTIVE)) {
r = pakfire_ui_confirm(transaction->pakfire, dump, _("Is this okay? [y/N]"));
if (r) {
ERROR(transaction->pakfire, "Transaction aborted upon user request\n");
printf("%s\n", message);
// Skip this, if running in non-interactive mode
- if (pakfire_has_flag(pakfire, PAKFIRE_FLAGS_NON_INTERACTIVE))
+ if (!pakfire_has_flag(pakfire, PAKFIRE_FLAGS_INTERACTIVE))
return 0;
char* line = NULL;
static int pakfire_ui_enter_number(struct pakfire* pakfire, const char* question,
unsigned int* choice, unsigned int min, unsigned int max) {
// Skip this, if running in non-interactive mode
- if (pakfire_has_flag(pakfire, PAKFIRE_FLAGS_NON_INTERACTIVE))
+ if (!pakfire_has_flag(pakfire, PAKFIRE_FLAGS_INTERACTIVE))
return 0;
char* line = NULL;
}
// Skip this, if running in non-interactive mode
- if (pakfire_has_flag(pakfire, PAKFIRE_FLAGS_NON_INTERACTIVE)) {
+ if (!pakfire_has_flag(pakfire, PAKFIRE_FLAGS_INTERACTIVE)) {
r = 1;
goto ERROR;
}
conf=args.config,
arch=args.arch,
path=args.root,
+ interactive=True,
offline=args.offline,
)