Add a function for recursive directory removal and use that instead of xsystem.
[oweals/opkg-lede.git] / libopkg / opkg_cmd.c
index f67a2645152866689a8f8336995ae1c110b78979..c40694eff8bb1b78425ea5b0f7bf43b6f4c65760 100644 (file)
@@ -323,7 +323,6 @@ static opkg_intercept_t opkg_prep_intercepts(opkg_conf_t *conf)
 
 static int opkg_finalize_intercepts(opkg_intercept_t ctx)
 {
-    char *cmd;
     DIR *dir;
     int err = 0;
 
@@ -349,10 +348,7 @@ static int opkg_finalize_intercepts(opkg_intercept_t ctx)
     } else
        perror (ctx->statedir);
        
-    sprintf_alloc (&cmd, "rm -rf %s", ctx->statedir);
-    err = xsystem (cmd);
-    free (cmd);
-
+    rm_r(ctx->statedir);
     free (ctx->statedir);
     free (ctx);
 
@@ -758,7 +754,7 @@ static int opkg_info_status_cmd(opkg_conf_t *conf, int argc, char **argv, int in
 
          pkg_formatted_info(stdout, pkg);
 
-         if (conf->verbosity > 1) {
+         if (conf->verbosity >= OPKG_NOTICE) {
               conffile_list_elt_t *iter;
               for (iter = nv_pair_list_first(&pkg->conffiles); iter; iter = nv_pair_list_next(&pkg->conffiles, iter)) {
                    conffile_t *cf = (conffile_t *)iter->data;
@@ -1080,8 +1076,7 @@ static int opkg_depends_cmd(opkg_conf_t *conf, int argc, char **argv)
                              for (l = 0; l < cdepend->possibility_count; l++) {
                                   depend_t *possibility = cdepend->possibilities[l];
                                   opkg_message(conf, OPKG_ERROR, "    %s", possibility->pkg->name);
-                                  if (conf->verbosity > 0) {
-                                       // char *ver = abstract_pkg_version_str_alloc(possibility->pkg); 
+                                  if (conf->verbosity >= OPKG_NOTICE) {
                                        opkg_message(conf, OPKG_NOTICE, " %s", possibility->version);
                                        if (possibility->version) {
                                             char *typestr = NULL;
@@ -1095,7 +1090,6 @@ static int opkg_depends_cmd(opkg_conf_t *conf, int argc, char **argv)
                                             }
                                             opkg_message(conf, OPKG_NOTICE, " (%s %s)", typestr, possibility->version);
                                        }
-                                       // free(ver);
                                   }
                                   opkg_message(conf, OPKG_ERROR, "\n");
                              }
@@ -1183,9 +1177,9 @@ static int opkg_what_depends_conflicts_cmd(opkg_conf_t *conf, enum what_field_ty
                                   pkg_mark_provides(pkg);
                                   changed++;
 
-                                  opkg_message(conf, OPKG_NOTICE, "    %s", pkg->name);
-                                  if (conf->verbosity > 0) {
+                                  if (conf->verbosity >= OPKG_NOTICE) {
                                        char *ver = pkg_version_str_alloc(pkg); 
+                                       opkg_message(conf, OPKG_NOTICE, "    %s", pkg->name);
                                        opkg_message(conf, OPKG_NOTICE, " %s", ver);
                                        opkg_message(conf, OPKG_NOTICE, "\t%s %s", rel_str, possibility->pkg->name);
                                        if (possibility->version) {
@@ -1350,8 +1344,8 @@ static int opkg_compare_versions_cmd(opkg_conf_t *conf, int argc, char **argv)
      if (argc == 3) {
          /* this is a bit gross */
          struct pkg p1, p2;
-         parseVersion(&p1, argv[0]); 
-         parseVersion(&p2, argv[2]); 
+         parse_version(&p1, argv[0]); 
+         parse_version(&p2, argv[2]); 
          return pkg_version_satisfied(&p1, &p2, argv[1]);
      } else {
          opkg_message(conf, OPKG_ERROR,