Remove unused opkg_set_current_state bits.
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Wed, 4 Nov 2009 01:22:05 +0000 (01:22 +0000)
committergraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Wed, 4 Nov 2009 01:22:05 +0000 (01:22 +0000)
git-svn-id: http://opkg.googlecode.com/svn/trunk@252 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

libopkg/Makefile.am
libopkg/libopkg.h
libopkg/opkg_cmd.h
libopkg/opkg_configure.c
libopkg/opkg_download.c
libopkg/opkg_install.c
libopkg/opkg_remove.c
libopkg/opkg_state.c [deleted file]
libopkg/opkg_state.h [deleted file]
libopkg/pkg_dest.c

index 555b0e55d223124566fab11f0b5b2539ce573a93..5aee1714ca0a906a0dace3900f1b4ed7798f8f37 100644 (file)
@@ -6,7 +6,7 @@ libopkg_include_HEADERS= opkg.h
 
 
 opkg_libcore_sources = args.c args.h libopkg.c libopkg.h\
-                   user.c user.h opkg_state.c opkg_state.h \
+                   user.c user.h \
                    opkg.c opkg.h includes.h \
                    opkg_error.h opkg_defines.h
 opkg_cmd_sources = opkg_cmd.c opkg_cmd.h \
index 5e9564aaa3e67f722f96d11e738801a9c61c4c90..72d3640a55905e35558cc104d222d5e026312ce9 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "opkg_conf.h"
 #include "opkg_message.h"
-#include "opkg_state.h"
 #include "opkg_download.h"
 #include "opkg_utils.h"
 
index f512488bacfb0ca397349f35159809332e9c1cb9..9c9dad24426f20c9cb0ae17f383b0f9c3913f2a3 100644 (file)
@@ -31,4 +31,6 @@ typedef struct opkg_cmd opkg_cmd_t;
 opkg_cmd_t *opkg_cmd_find(const char *name);
 int opkg_cmd_exec(opkg_cmd_t *cmd, opkg_conf_t *conf, int argc, 
                   const char **argv, void *userdata);
+
+extern int opkg_state_changed;
 #endif
index bc8101542527cced24dfcc17603d2b07924f4c4d..2c22bfcd05791752fe29caa2b158a5f6c6eefa9a 100644 (file)
@@ -18,7 +18,8 @@
 #include "includes.h"
 #include "sprintf_alloc.h"
 #include "opkg_configure.h"
-#include "opkg_state.h"
+#include "opkg_message.h"
+#include "opkg_cmd.h"
 
 int opkg_configure(opkg_conf_t *conf, pkg_t *pkg)
 {
@@ -30,11 +31,6 @@ int opkg_configure(opkg_conf_t *conf, pkg_t *pkg)
     /* DPKG_INCOMPATIBILITY:
        dpkg actually includes a version number to this script call */
 
-    char *pkgid;
-    sprintf_alloc (&pkgid, "%s;%s;%s;", pkg->name, pkg->version, pkg->architecture);
-    opkg_set_current_state (conf, OPKG_STATE_CONFIGURING_PKG, pkgid);
-    free (pkgid);
-
     err = pkg_run_script(conf, pkg, "postinst", "configure");
     if (err) {
        opkg_message(conf, OPKG_ERROR, "ERROR: %s.postinst returned %d\n", pkg->name, err);
@@ -42,7 +38,6 @@ int opkg_configure(opkg_conf_t *conf, pkg_t *pkg)
     }
 
     opkg_state_changed++;
-    opkg_set_current_state (conf, OPKG_STATE_NONE, NULL);
     return 0;
 }
 
index 33019d8b39fd302243e331162e510db797d08476..2ee97bf2f9a2d58455acb684b7f2c5f206a2a146 100644 (file)
@@ -41,7 +41,6 @@
 #include "includes.h"
 #include "opkg_download.h"
 #include "opkg_message.h"
-#include "opkg_state.h"
 
 #include "sprintf_alloc.h"
 #include "xsystem.h"
@@ -216,7 +215,6 @@ int opkg_download_pkg(opkg_conf_t *conf, pkg_t *pkg, const char *dir)
 {
     int err;
     char *url;
-    char *pkgid;
     char *stripped_filename;
 
     if (pkg->src == NULL) {
@@ -229,10 +227,6 @@ int opkg_download_pkg(opkg_conf_t *conf, pkg_t *pkg, const char *dir)
        return -1;
     }
 
-    sprintf_alloc (&pkgid, "%s;%s;%s;", pkg->name, pkg->version, pkg->architecture);
-    opkg_set_current_state (conf, OPKG_STATE_DOWNLOADING_PKG, pkgid);
-    free (pkgid);
-
     sprintf_alloc(&url, "%s/%s", pkg->src->value, pkg->filename);
 
     /* XXX: BUG: The pkg->filename might be something like
@@ -249,7 +243,6 @@ int opkg_download_pkg(opkg_conf_t *conf, pkg_t *pkg, const char *dir)
     err = opkg_download_cache(conf, url, pkg->local_filename, NULL, NULL);
     free(url);
 
-    opkg_set_current_state (conf, OPKG_STATE_NONE, NULL);
     return err;
 }
 
index 601d8388756f2360c68645496d726c030b34a7f2..82749d56b93dc957ebcb383b5f29ad10b775a14c 100644 (file)
@@ -36,7 +36,7 @@ typedef void (*sighandler_t)(int);
 
 #include "opkg_utils.h"
 #include "opkg_message.h"
-#include "opkg_state.h"
+#include "opkg_cmd.h"
 #include "opkg_defines.h"
 
 #include "sprintf_alloc.h"
@@ -767,8 +767,7 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade)
 #ifdef HAVE_SHA256
      char* file_sha256;
 #endif
-     char *pkgid;
-    
+
      if ( from_upgrade ) 
         message = 1;            /* Coming from an upgrade, and should change the output message */
 
@@ -917,10 +916,6 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade)
      replacees = pkg_vec_alloc();
      pkg_get_installed_replacees(conf, pkg, replacees);
 
-     sprintf_alloc (&pkgid, "%s;%s;%s;", pkg->name, pkg->version, pkg->architecture);
-     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 */
      {
          sigset_t newset, oldset;
@@ -1064,7 +1059,6 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade)
           pkg_vec_free (replacees);
          return OPKG_ERR_UNKNOWN;
      }
-     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)
index 12de67839d9ecf5d170bc62f6112d482912b50ec..1eda4f6a17fae395968710e25f9b07e204f629b8 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "opkg_remove.h"
 #include "opkg_error.h"
-#include "opkg_state.h"
+#include "opkg_cmd.h"
 
 #include "file_util.h"
 #include "sprintf_alloc.h"
diff --git a/libopkg/opkg_state.c b/libopkg/opkg_state.c
deleted file mode 100644 (file)
index 36018c7..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/* opkg_state.c - the opkg package management system
-
-   Thomas Wood <thomas@openedhand.com>
-
-   Copyright (C) 2008 by OpenMoko Inc
-
-   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 2, 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.
-*/
-
-#include "opkg_state.h"
-
-
-static char *state_strings[] =
-{
-  "None",
-  "Downloading Package",
-  "Installing Package",
-  "Configuring Package",
-  "Upgrading Package",
-  "Removing Package",
-  "Downloading Repository",
-  "Verifying Repository Signature"
-};
-
-
-
-opkg_state_changed_callback opkg_cb_state_changed = NULL;
-
-static opkg_state_t opkg_state = 0;
-static char *opkg_state_data = NULL;
-
-void
-opkg_set_current_state (opkg_conf_t *conf, opkg_state_t state, const char *data)
-{
-  if (opkg_state_data)
-    free (opkg_state_data);
-  if (data)
-  {
-    opkg_state_data = strdup (data);
-  }
-  else
-  {
-    opkg_state_data = NULL;
-  }
-
-  opkg_state = state;
-
-  if (opkg_cb_state_changed)
-  {
-    opkg_cb_state_changed (opkg_state, opkg_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
-opkg_get_current_state (opkg_state_t *state, const char **data)
-{
-  *state = opkg_state;
-  *data = opkg_state_data;
-}
diff --git a/libopkg/opkg_state.h b/libopkg/opkg_state.h
deleted file mode 100644 (file)
index 44b8d0d..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/* opkg_state.c - the opkg package management system
-
-   Thomas Wood <thomas@openedhand.com>
-
-   Copyright (C) 2008 by OpenMoko Inc
-
-   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 2, 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.
-*/
-
-#ifndef OPKG_STATE_H
-#define OPKG_STATE_H
-
-#include "opkg_message.h"
-
-extern int opkg_state_changed;
-
-typedef enum _opkg_state {
-  OPKG_STATE_NONE,
-  OPKG_STATE_DOWNLOADING_PKG,
-  OPKG_STATE_INSTALLING_PKG,
-  OPKG_STATE_CONFIGURING_PKG,
-  OPKG_STATE_UPGRADING_PKG,
-  OPKG_STATE_REMOVING_PKG,
-  OPKG_STATE_DOWNLOADING_REPOSITORY,
-  OPKG_STATE_VERIFYING_REPOSITORY_SIGNATURE
-} opkg_state_t;
-
-
-void opkg_set_current_state (opkg_conf_t *conf, opkg_state_t state, const char *data);
-
-typedef void (*opkg_state_changed_callback)(opkg_state_t state, const char *data);
-
-
-
-#endif /* OPKG_STATE_H */
index 3f9e49388b03186b14c465ce630bba78273266dc..b5cfe23fa924586e1a974b590cb8a9bb2c23c51b 100644 (file)
@@ -21,7 +21,8 @@
 #include "file_util.h"
 #include "str_util.h"
 #include "sprintf_alloc.h"
-#include "opkg_state.h"
+#include "opkg_conf.h"
+#include "opkg_cmd.h"
 #include "opkg_defines.h"
 
 int pkg_dest_init(pkg_dest_t *dest, const char *name, const char *root_dir,const char * lists_dir)