#include "opkg_configure.h"
#include "opkg_message.h"
-#ifdef OPKG_LIB
#include "libopkg.h"
static void *p_userdata = NULL;
-#endif
static int opkg_update_cmd(opkg_conf_t *conf, int argc, char **argv);
static int opkg_upgrade_cmd(opkg_conf_t *conf, int argc, char **argv);
return NULL;
}
-#ifdef OPKG_LIB
int opkg_cmd_exec(opkg_cmd_t *cmd, opkg_conf_t *conf, int argc, const char **argv, void *userdata)
{
int result;
p_userdata = NULL;
return result;
}
-#else
-int opkg_cmd_exec(opkg_cmd_t *cmd, opkg_conf_t *conf, int argc, const char **argv)
-{
- return (cmd->fun)(conf, argc, argv);
-}
-#endif
static int opkg_update_cmd(opkg_conf_t *conf, int argc, char **argv)
{
free (tmp);
free(lists_dir);
-#ifdef CONFIG_CLEAR_SW_INSTALL_FLAG
-#warning here
- /* clear SW_INSTALL on any package where state is SS_NOT_INSTALLED.
- * this is a hack to work around poor bookkeeping in old opkg upgrade code
- * -Jamey 3/1/03
- */
- {
- int i;
- int changed = 0;
- pkg_vec_t *available = pkg_vec_alloc();
- pkg_hash_fetch_available(&conf->pkg_hash, available);
- opkg_message(conf, OPKG_DEBUG, "Clearing SW_INSTALL for SS_NOT_INSTALLED packages.\n");
- for (i = 0; i < available->len; i++) {
- pkg_t *pkg = available->pkgs[i];
- if (pkg->state_want == SW_INSTALL && pkg->state_status == SS_NOT_INSTALLED) {
- opkg_message(conf, OPKG_DEBUG, "Clearing SW_INSTALL on package %s.\n", pkg->name);
- pkg->state_want = SW_UNKNOWN;
- changed = 1;
- }
- }
- pkg_vec_free(available);
- if (changed) {
- write_status_files_if_changed(conf);
- }
- }
-#endif
-
return failures;
}
if (newline) {
*newline = '\0';
}
-#ifndef OPKG_LIB
- printf("%s - %s\n", pkg->name, desc_short);
-#else
if (opkg_cb_list) {
version_str = pkg_version_str_alloc(pkg);
opkg_cb_list(pkg->name,desc_short,
p_userdata);
free(version_str);
}
-#endif
}
pkg_vec_free(available);
if (newline) {
*newline = '\0';
}
-#ifndef OPKG_LIB
- printf("%s - %s\n", pkg->name, desc_short);
-#else
if (opkg_cb_list) {
version_str = pkg_version_str_alloc(pkg);
opkg_cb_list(pkg->name,desc_short,
p_userdata);
free(version_str);
}
-#endif
}
return 0;
if (pkg_name && fnmatch(pkg_name, pkg->name, 0)) {
continue;
}
-#ifndef OPKG_LIB
- if (n_fields) {
- for (j = 0; j < n_fields; j++)
- pkg_print_field(pkg, stdout, pkg_fields[j]);
- } else {
- pkg_print_info(pkg, stdout);
- }
-#else
buff = pkg_formatted_info(pkg);
if ( buff ) {
*/
free(buff);
}
-#endif
if (conf->verbosity > 1) {
conffile_list_elt_t *iter;
for (iter = pkg->conffiles.head; iter; iter = iter->next) {
}
}
}
-#ifndef OPKG_LIB
- if (buff)
- free(buff);
-#endif
pkg_vec_free(available);
return 0;
installed_files = pkg_get_installed_files(pkg);
pkg_version = pkg_version_str_alloc(pkg);
-#ifndef OPKG_LIB
- printf("Package %s (%s) is installed on %s and has the following files:\n",
- pkg->name, pkg_version, pkg->dest->name);
- for (iter = installed_files->head; iter; iter = iter->next) {
- puts(iter->data);
- }
-#else
if (buff) {
try_again:
used_len = snprintf(buff, buff_len, "Package %s (%s) is installed on %s and has the following files:\n",
p_userdata);
free(buff);
}
-#endif
free(pkg_version);
pkg_free_installed_files(pkg);
for (iter = installed_files->head; iter; iter = iter->next) {
installed_file = iter->data;
if (fnmatch(argv[0], installed_file, 0)==0) {
-#ifndef OPKG_LIB
- printf("%s: %s\n", pkg->name, installed_file);
-#else
if (opkg_cb_list) opkg_cb_list(pkg->name,
installed_file,
pkg_version_str_alloc(pkg),
pkg->state_status, p_userdata);
-#endif
}
}