General Public License for more details.
*/
+#include "config.h"
-#include "includes.h"
+#include <stdio.h>
#include <dirent.h>
#include <glob.h>
#include <fnmatch.h>
+#include <signal.h>
+#include <unistd.h>
#include "opkg_conf.h"
#include "opkg_cmd.h"
#include "opkg_upgrade.h"
#include "opkg_remove.h"
#include "opkg_configure.h"
-#include "libopkg.h"
#include "xsystem.h"
static void
/* If the package has already been visited (by this function), skip it */
for(j = 0; j < visited->len; j++)
if ( ! strcmp(visited->pkgs[j]->name, pkg->name)) {
- opkg_msg(INFO, "pkg %s already visited, skipping.\n", pkg->name);
+ opkg_msg(DEBUG, "pkg %s already visited, skipping.\n", pkg->name);
return 0;
}
count = pkg->pre_depends_count + pkg->depends_count + \
pkg->recommends_count + pkg->suggests_count;
- opkg_msg(INFO, "pkg %s.\n", pkg->name);
+ opkg_msg(DEBUG, "pkg %s.\n", pkg->name);
/* Iterate over all the dependencies of pkg. For each one, find a package
that is either installed or unpacked and satisfies this dependency.
l = 0;
if (dependents != NULL)
while (l < abpkg->provided_by->len && dependents[l] != NULL) {
- opkg_msg(INFO, "Descending on pkg %s.\n",
+ opkg_msg(DEBUG, "Descending on pkg %s.\n",
dependents [l]->name);
/* find whether dependent l is installed or unpacked,
pkg->state_status = SS_INSTALLED;
pkg->parent->state_status = SS_INSTALLED;
pkg->state_flag &= ~SF_PREFER;
+ opkg_state_changed++;
} else {
if (!err)
err = r;
static int
opkg_install_cmd(int argc, char **argv)
{
- int i;
+ int i, r;
char *arg;
int err=0;
}
}
- opkg_configure_packages(NULL);
+ r = opkg_configure_packages(NULL);
+ if (!err)
+ err = r;
write_status_files_if_changed();
static int
opkg_upgrade_cmd(int argc, char **argv)
{
- int i;
+ int i, r;
pkg_t *pkg;
int err;
pkg_vec_free(installed);
}
- opkg_configure_packages(NULL);
+ r = opkg_configure_packages(NULL);
+ if (!err)
+ err = r;
write_status_files_if_changed();
static int
opkg_download_cmd(int argc, char **argv)
{
- int i, err;
+ int i, err = 0;
char *arg;
pkg_t *pkg;
}
}
- return 0;
+ return err;
}
static int
opkg_remove_cmd(int argc, char **argv)
{
- int i, a, done;
+ int i, a, done, r, err = 0;
pkg_t *pkg;
pkg_t *pkg_to_remove;
pkg_vec_t *available;
opkg_msg(ERROR, "Package %s not installed.\n", pkg->name);
continue;
}
- opkg_remove_pkg(pkg_to_remove, 0);
+ r = opkg_remove_pkg(pkg_to_remove, 0);
+ if (!err)
+ err = r;
+
done = 1;
}
}
opkg_msg(NOTICE, "No packages removed.\n");
write_status_files_if_changed();
- return 0;
+ return err;
}
static int
int
opkg_cmd_exec(opkg_cmd_t *cmd, int argc, const char **argv)
{
- int result;
-
- result = (cmd->fun)(argc, argv);
-
- print_error_list();
- free_error_list();
-
- return result;
+ return (cmd->fun)(argc, argv);
}