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 \
#include "opkg_conf.h"
#include "opkg_message.h"
-#include "opkg_state.h"
#include "opkg_download.h"
#include "opkg_utils.h"
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
#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)
{
/* 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);
}
opkg_state_changed++;
- opkg_set_current_state (conf, OPKG_STATE_NONE, NULL);
return 0;
}
#include "includes.h"
#include "opkg_download.h"
#include "opkg_message.h"
-#include "opkg_state.h"
#include "sprintf_alloc.h"
#include "xsystem.h"
{
int err;
char *url;
- char *pkgid;
char *stripped_filename;
if (pkg->src == NULL) {
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
err = opkg_download_cache(conf, url, pkg->local_filename, NULL, NULL);
free(url);
- opkg_set_current_state (conf, OPKG_STATE_NONE, NULL);
return err;
}
#include "opkg_utils.h"
#include "opkg_message.h"
-#include "opkg_state.h"
+#include "opkg_cmd.h"
#include "opkg_defines.h"
#include "sprintf_alloc.h"
#ifdef HAVE_SHA256
char* file_sha256;
#endif
- char *pkgid;
-
+
if ( from_upgrade )
message = 1; /* Coming from an upgrade, and should change the output message */
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;
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)
#include "opkg_remove.h"
#include "opkg_error.h"
-#include "opkg_state.h"
+#include "opkg_cmd.h"
#include "file_util.h"
#include "sprintf_alloc.h"
+++ /dev/null
-/* 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;
-}
+++ /dev/null
-/* 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 */
#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)