char *pkgid;
sprintf_alloc (&pkgid, "%s;%s;%s;", pkg->name, pkg->version, pkg->architecture);
- opkg_set_current_state (OPKG_STATE_CONFIGURING_PKG, pkgid);
+ opkg_set_current_state (conf, OPKG_STATE_CONFIGURING_PKG, pkgid);
free (pkgid);
err = pkg_run_script(conf, pkg, "postinst", "configure");
}
opkg_state_changed++;
- opkg_set_current_state (OPKG_STATE_NONE, NULL);
+ opkg_set_current_state (conf, OPKG_STATE_NONE, NULL);
return 0;
}
}
sprintf_alloc (&pkgid, "%s;%s;%s;", pkg->name, pkg->version, pkg->architecture);
- opkg_set_current_state (OPKG_STATE_DOWNLOADING_PKG, pkgid);
+ opkg_set_current_state (conf, OPKG_STATE_DOWNLOADING_PKG, pkgid);
free (pkgid);
sprintf_alloc(&url, "%s/%s", pkg->src->value, pkg->filename);
err = opkg_download(conf, url, pkg->local_filename);
free(url);
- opkg_set_current_state (OPKG_STATE_NONE, NULL);
+ opkg_set_current_state (conf, OPKG_STATE_NONE, NULL);
return err;
}
pkg_get_installed_replacees(conf, pkg, replacees);
sprintf_alloc (&pkgid, "%s;%s;%s;", pkg->name, pkg->version, pkg->architecture);
- opkg_set_current_state (OPKG_STATE_INSTALLING_PKG, pkgid);
+ opkg_set_current_state (conf, OPKG_STATE_INSTALLING_PKG, pkgid);
free (pkgid);
/* this next section we do with SIGINT blocked to prevent inconsistency between opkg database and filesystem */
return err;
}
- opkg_set_current_state (OPKG_STATE_NONE, NULL);
+ opkg_set_current_state (conf, OPKG_STATE_NONE, NULL);
}
static int prerm_upgrade_old_pkg(opkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg)
static char *opkg_state_data = NULL;
void
-opkg_set_current_state (opkg_state_t state, const char *data)
+opkg_set_current_state (opkg_conf_t *conf, opkg_state_t state, const char *data)
{
if (opkg_state_data)
free (opkg_state_data);
}
- printf ("opkg state set to %s: %s\n", state_strings[state], data);
+ if (data == NULL)
+ opkg_message (conf, OPKG_INFO, "opkg state set to %s\n", state_strings[state]);
+ else
+ opkg_message (conf, OPKG_INFO, "opkg state set to %s: %s\n", state_strings[state], data);
}
void
#ifndef OPKG_STATE_H
#define OPKG_STATE_H
+#include <opkg_message.h>
+
typedef enum _opkg_state {
OPKG_STATE_NONE,
OPKG_STATE_DOWNLOADING_PKG,
} opkg_state_t;
-void opkg_set_current_state (opkg_state_t state, const char *data);
+void opkg_set_current_state (opkg_conf_t *conf, opkg_state_t state, const char *data);
#endif /* OPKG_STATE_H */