libopkg: drop support for Release files
[oweals/opkg-lede.git] / libopkg / opkg_cmd.c
index b98b86fb1ec116ed4ebd49dc245650e8ae832912..60ffee3e25de51c4d4502bfac4a52b7905e58cf3 100644 (file)
@@ -27,7 +27,6 @@
 #include "opkg_conf.h"
 #include "opkg_cmd.h"
 #include "opkg_message.h"
-#include "release.h"
 #include "pkg.h"
 #include "pkg_dest.h"
 #include "pkg_parse.h"
@@ -114,39 +113,6 @@ opkg_update_cmd(int argc, char **argv)
      }
 
 
-     for (iter = void_list_first(&conf->dist_src_list); iter; iter = void_list_next(&conf->dist_src_list, iter)) {
-         char *url, *list_file_name;
-
-         src = (pkg_src_t *)iter->data;
-
-         sprintf_alloc(&url, "%s/dists/%s/Release", src->value, src->name);
-
-         sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name);
-         err = opkg_download(url, list_file_name, NULL, NULL, 0);
-         if (!err) {
-              opkg_msg(NOTICE, "Downloaded release files for dist %s.\n",
-                           src->name);
-              release_t *release = release_new(); 
-              err = release_init_from_file(release, list_file_name);
-              if (!err) {
-                   if (!release_comps_supported(release, src->extra_data))
-                        err = -1;
-              }
-              if (!err) {
-                   err = release_download(release, src, lists_dir, tmp);
-              }
-              release_deinit(release); 
-              if (err)
-                   unlink(list_file_name);
-         }
-
-         if (err)
-              failures++;
-
-         free(list_file_name);
-         free(url);
-     }
-
      for (iter = void_list_first(&conf->pkg_src_list); iter; iter = void_list_next(&conf->pkg_src_list, iter)) {
          char *url, *list_file_name;
 
@@ -162,37 +128,14 @@ opkg_update_cmd(int argc, char **argv)
              sprintf_alloc(&url, "%s/%s", src->value, src->gzip ? "Packages.gz" : "Packages");
 
          sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name);
-         if (src->gzip) {
-             char *tmp_file_name;
-             FILE *in, *out;
-
-             sprintf_alloc (&tmp_file_name, "%s/%s.gz", tmp, src->name);
-             err = opkg_download(url, tmp_file_name, NULL, NULL, 0);
-             if (err == 0) {
-                  opkg_msg(NOTICE, "Inflating %s.\n", url);
-                  in = fopen (tmp_file_name, "r");
-                  out = fopen (list_file_name, "w");
-                  if (in && out)
-                       unzip (in, out);
-                  else
-                       err = 1;
-                  if (in)
-                       fclose (in);
-                  if (out)
-                       fclose (out);
-                  unlink (tmp_file_name);
-             }
-             free(tmp_file_name);
-         } else
-             err = opkg_download(url, list_file_name, NULL, NULL, 0);
-         if (err) {
+         if (opkg_download(url, list_file_name, NULL, NULL, 0)) {
               failures++;
          } else {
               opkg_msg(NOTICE, "Updated list of available packages in %s.\n",
                            list_file_name);
          }
          free(url);
-#if defined(HAVE_GPGME) || defined(HAVE_OPENSSL)
+#if defined(HAVE_GPGME) || defined(HAVE_OPENSSL) || defined(HAVE_USIGN)
           if (conf->check_signature) {
               /* download detached signitures to verify the package lists */
               /* get the url for the sig file */
@@ -219,7 +162,7 @@ opkg_update_cmd(int argc, char **argv)
                   else
                       opkg_msg(NOTICE, "Signature check failed.\n");
               }
-              if (err) {
+              if (err && !conf->force_signature) {
                   /* The signature was wrong so delete it */
                   opkg_msg(NOTICE, "Remove wrong Signature file.\n");
                   unlink (tmp_file_name);
@@ -594,7 +537,7 @@ opkg_download_cmd(int argc, char **argv)
 
 
 static int
-opkg_list_cmd(int argc, char **argv)
+opkg_list_find_cmd(int argc, char **argv, int use_desc)
 {
      int i;
      pkg_vec_t *available;
@@ -610,7 +553,8 @@ opkg_list_cmd(int argc, char **argv)
      for (i=0; i < available->len; i++) {
          pkg = available->pkgs[i];
          /* if we have package name or pattern and pkg does not match, then skip it */
-         if (pkg_name && fnmatch(pkg_name, pkg->name, conf->nocase))
+         if (pkg_name && fnmatch(pkg_name, pkg->name, conf->nocase) &&
+             (!use_desc || !pkg->description || fnmatch(pkg_name, pkg->description, conf->nocase)))
               continue;
           print_pkg(pkg);
      }
@@ -619,6 +563,18 @@ opkg_list_cmd(int argc, char **argv)
      return 0;
 }
 
+static int
+opkg_list_cmd(int argc, char **argv)
+{
+       return opkg_list_find_cmd(argc, argv, 0);
+}
+
+static int
+opkg_find_cmd(int argc, char **argv)
+{
+       return opkg_list_find_cmd(argc, argv, 1);
+}
+
 
 static int
 opkg_list_installed_cmd(int argc, char **argv)
@@ -1262,6 +1218,7 @@ static opkg_cmd_t cmds[] = {
      {"configure", 0, (opkg_cmd_fun_t)opkg_configure_cmd, PFM_DESCRIPTION|PFM_SOURCE},
      {"files", 1, (opkg_cmd_fun_t)opkg_files_cmd, PFM_DESCRIPTION|PFM_SOURCE},
      {"search", 1, (opkg_cmd_fun_t)opkg_search_cmd, PFM_DESCRIPTION|PFM_SOURCE},
+     {"find", 1, (opkg_cmd_fun_t)opkg_find_cmd, PFM_SOURCE},
      {"download", 1, (opkg_cmd_fun_t)opkg_download_cmd, PFM_DESCRIPTION|PFM_SOURCE},
      {"compare_versions", 1, (opkg_cmd_fun_t)opkg_compare_versions_cmd, PFM_DESCRIPTION|PFM_SOURCE},
      {"compare-versions", 1, (opkg_cmd_fun_t)opkg_compare_versions_cmd, PFM_DESCRIPTION|PFM_SOURCE},