summaryrefslogtreecommitdiffstats
path: root/libopkg
diff options
context:
space:
mode:
Diffstat (limited to 'libopkg')
-rw-r--r--libopkg/Makefile.am2
-rw-r--r--libopkg/libopkg.h1
-rw-r--r--libopkg/opkg_cmd.h2
-rw-r--r--libopkg/opkg_configure.c9
-rw-r--r--libopkg/opkg_download.c7
-rw-r--r--libopkg/opkg_install.c10
-rw-r--r--libopkg/opkg_remove.c2
-rw-r--r--libopkg/opkg_state.c73
-rw-r--r--libopkg/opkg_state.h43
-rw-r--r--libopkg/pkg_dest.c3
10 files changed, 10 insertions, 142 deletions
diff --git a/libopkg/Makefile.am b/libopkg/Makefile.am
index 555b0e5..5aee171 100644
--- a/libopkg/Makefile.am
+++ b/libopkg/Makefile.am
@@ -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 \
diff --git a/libopkg/libopkg.h b/libopkg/libopkg.h
index 5e9564a..72d3640 100644
--- a/libopkg/libopkg.h
+++ b/libopkg/libopkg.h
@@ -23,7 +23,6 @@
#include "opkg_conf.h"
#include "opkg_message.h"
-#include "opkg_state.h"
#include "opkg_download.h"
#include "opkg_utils.h"
diff --git a/libopkg/opkg_cmd.h b/libopkg/opkg_cmd.h
index f512488..9c9dad2 100644
--- a/libopkg/opkg_cmd.h
+++ b/libopkg/opkg_cmd.h
@@ -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
diff --git a/libopkg/opkg_configure.c b/libopkg/opkg_configure.c
index bc81015..2c22bfc 100644
--- a/libopkg/opkg_configure.c
+++ b/libopkg/opkg_configure.c
@@ -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;
}
diff --git a/libopkg/opkg_download.c b/libopkg/opkg_download.c
index 33019d8..2ee97bf 100644
--- a/libopkg/opkg_download.c
+++ b/libopkg/opkg_download.c
@@ -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;
}
diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c
index 601d838..82749d5 100644
--- a/libopkg/opkg_install.c
+++ b/libopkg/opkg_install.c
@@ -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)
diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c
index 12de678..1eda4f6 100644
--- a/libopkg/opkg_remove.c
+++ b/libopkg/opkg_remove.c
@@ -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
index 36018c7..0000000
--- a/libopkg/opkg_state.c
+++ /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
index 44b8d0d..0000000
--- a/libopkg/opkg_state.h
+++ /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 */
diff --git a/libopkg/pkg_dest.c b/libopkg/pkg_dest.c
index 3f9e493..b5cfe23 100644
--- a/libopkg/pkg_dest.c
+++ b/libopkg/pkg_dest.c
@@ -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)