1
0

290-clarify-download-errors.patch 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. --- a/libopkg/opkg_cmd.c
  2. +++ b/libopkg/opkg_cmd.c
  3. @@ -85,6 +85,7 @@ opkg_update_cmd(int argc, char **argv)
  4. char *tmp;
  5. int err;
  6. int failures;
  7. + int pkglist_dl_error;
  8. char *lists_dir;
  9. pkg_src_list_elt_t *iter;
  10. pkg_src_t *src;
  11. @@ -130,15 +131,19 @@ opkg_update_cmd(int argc, char **argv)
  12. sprintf_alloc(&url, "%s/%s", src->value, src->gzip ? "Packages.gz" : "Packages");
  13. sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name);
  14. + pkglist_dl_error = 0;
  15. if (opkg_download(url, list_file_name, NULL, NULL, 0)) {
  16. failures++;
  17. + pkglist_dl_error = 1;
  18. + opkg_msg(NOTICE, "*** Failed to download the package list from %s\n\n",
  19. + url);
  20. } else {
  21. - opkg_msg(NOTICE, "Updated list of available packages in %s.\n",
  22. + opkg_msg(NOTICE, "Updated list of available packages in %s\n",
  23. list_file_name);
  24. }
  25. free(url);
  26. #if defined(HAVE_GPGME) || defined(HAVE_OPENSSL) || defined(HAVE_USIGN)
  27. - if (conf->check_signature) {
  28. + if (pkglist_dl_error == 0 && conf->check_signature) {
  29. /* download detached signitures to verify the package lists */
  30. /* get the url for the sig file */
  31. if (src->extra_data) /* debian style? */
  32. @@ -156,7 +161,7 @@ opkg_update_cmd(int argc, char **argv)
  33. err = opkg_download(url, tmp_file_name, NULL, NULL, 0);
  34. if (err) {
  35. failures++;
  36. - opkg_msg(NOTICE, "Signature check failed.\n");
  37. + opkg_msg(NOTICE, "Signature file download failed.\n");
  38. } else {
  39. err = opkg_verify_file (list_file_name, tmp_file_name);
  40. if (err == 0)
  41. --- a/libopkg/opkg_download.c
  42. +++ b/libopkg/opkg_download.c
  43. @@ -91,7 +91,7 @@ opkg_download(const char *src, const cha
  44. char *src_base = basename(src_basec);
  45. char *tmp_file_location;
  46. - opkg_msg(NOTICE,"Downloading %s.\n", src);
  47. + opkg_msg(NOTICE,"Downloading %s\n", src);
  48. if (str_starts_with(src, "file:")) {
  49. const char *file_src = src + 5;
  50. @@ -175,6 +175,8 @@ opkg_download(const char *src, const cha
  51. if (res) {
  52. opkg_msg(ERROR, "Failed to download %s, wget returned %d.\n", src, res);
  53. + if (res == 4)
  54. + opkg_msg(ERROR, "Check your network settings and connectivity.\n\n");
  55. free(tmp_file_location);
  56. return -1;
  57. }