From f0f991d840b00e43f09bfa363ac1e7350098c180 Mon Sep 17 00:00:00 2001 From: ticktock35 Date: Sun, 14 Dec 2008 23:53:10 -0500 Subject: opkg: output state change messages only at info verbosity level git-svn-id: http://opkg.googlecode.com/svn/trunk@47 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- diff --git a/libopkg/opkg_configure.c b/libopkg/opkg_configure.c index 8309e40..ec7e5c8 100644 --- a/libopkg/opkg_configure.c +++ b/libopkg/opkg_configure.c @@ -32,7 +32,7 @@ int opkg_configure(opkg_conf_t *conf, pkg_t *pkg) 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"); @@ -42,7 +42,7 @@ int opkg_configure(opkg_conf_t *conf, pkg_t *pkg) } opkg_state_changed++; - opkg_set_current_state (OPKG_STATE_NONE, NULL); + opkg_set_current_state (conf, OPKG_STATE_NONE, NULL); return 0; } diff --git a/libopkg/opkg_download.c b/libopkg/opkg_download.c index bbd6efe..6cce64a 100644 --- a/libopkg/opkg_download.c +++ b/libopkg/opkg_download.c @@ -213,7 +213,7 @@ int opkg_download_pkg(opkg_conf_t *conf, pkg_t *pkg, const char *dir) } 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); @@ -227,7 +227,7 @@ int opkg_download_pkg(opkg_conf_t *conf, pkg_t *pkg, const char *dir) 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; } diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c index 599ae4d..7bdd3ba 100644 --- a/libopkg/opkg_install.c +++ b/libopkg/opkg_install.c @@ -854,7 +854,7 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade) 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 */ @@ -997,7 +997,7 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade) 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) diff --git a/libopkg/opkg_state.c b/libopkg/opkg_state.c index d83b96b..f094de7 100644 --- a/libopkg/opkg_state.c +++ b/libopkg/opkg_state.c @@ -39,7 +39,7 @@ static opkg_state_t opkg_state = 0; 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); @@ -60,7 +60,10 @@ opkg_set_current_state (opkg_state_t state, const char *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 diff --git a/libopkg/opkg_state.h b/libopkg/opkg_state.h index 2718569..d2e8e38 100644 --- a/libopkg/opkg_state.h +++ b/libopkg/opkg_state.h @@ -18,6 +18,8 @@ #ifndef OPKG_STATE_H #define OPKG_STATE_H +#include + typedef enum _opkg_state { OPKG_STATE_NONE, OPKG_STATE_DOWNLOADING_PKG, @@ -30,7 +32,7 @@ typedef enum _opkg_state { } 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 */ -- cgit v0.9.1