opkg: output state change messages only at info verbosity level
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Dec 2008 04:53:10 +0000 (04:53 +0000)
committerticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Dec 2008 04:53:10 +0000 (04:53 +0000)
git-svn-id: http://opkg.googlecode.com/svn/trunk@47 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

libopkg/opkg_configure.c
libopkg/opkg_download.c
libopkg/opkg_install.c
libopkg/opkg_state.c
libopkg/opkg_state.h

index 8309e40d6dbe67fcd138d0f1a0d2c529de83dfe7..ec7e5c8eede4a20dcda747b47dc72d04d32352bf 100644 (file)
@@ -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);
 
     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");
     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_state_changed++;
-    opkg_set_current_state (OPKG_STATE_NONE, NULL);
+    opkg_set_current_state (conf, OPKG_STATE_NONE, NULL);
     return 0;
 }
 
     return 0;
 }
 
index bbd6efef868bf9deab58b6a58e703df96bd807d2..6cce64a82f18ebe5b316219fd8a4b06c985c6b8b 100644 (file)
@@ -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);
     }
 
     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);
     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);
 
     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;
 }
 
     return err;
 }
 
index 599ae4d33fdeec0a492a56098d0efc72fa1d84ff..7bdd3bac2c4d5ec0fef9192c56714c334387e363 100644 (file)
@@ -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);
      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 */
      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;
      }
 
          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 int prerm_upgrade_old_pkg(opkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg)
index d83b96b22e26bf8d6d38f0bed4b80b0703a72538..f094de7a5385a5d0127475988beb61127e6e9193 100644 (file)
@@ -39,7 +39,7 @@ static opkg_state_t opkg_state = 0;
 static char *opkg_state_data = NULL;
 
 void
 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);
 {
   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
 }
 
 void
index 27185693ca290f2c64f0dea038c8130e763854f7..d2e8e384d9eebfc28355538f74cafb0de5d698b8 100644 (file)
@@ -18,6 +18,8 @@
 #ifndef OPKG_STATE_H
 #define OPKG_STATE_H
 
 #ifndef OPKG_STATE_H
 #define OPKG_STATE_H
 
+#include <opkg_message.h>
+
 typedef enum _opkg_state {
   OPKG_STATE_NONE,
   OPKG_STATE_DOWNLOADING_PKG,
 typedef enum _opkg_state {
   OPKG_STATE_NONE,
   OPKG_STATE_DOWNLOADING_PKG,
@@ -30,7 +32,7 @@ typedef enum _opkg_state {
 } opkg_state_t;
 
 
 } 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 */
 
 
 #endif /* OPKG_STATE_H */