add a patch helping available storage space detection, remove workaround from [13611...
[oweals/openwrt.git] / package / opkg / patches / 001-use-wget
1 --- opkg-4564/configure.ac-orig 2008-08-04 19:39:20.000000000 -0500
2 +++ opkg-4564/configure.ac      2008-08-04 19:37:17.000000000 -0500
3 @@ -22,9 +22,16 @@
4  
5  # Checks for libraries
6  
7 -# check for libcurl
8 -PKG_CHECK_MODULES(CURL, libcurl)
9 +AC_ARG_ENABLE(curl,
10 +    AC_HELP_STRING([--enable-curl], [Enable use of libcurl instead of wget
11 +      [[default=yes]] ]),
12 +    [want_curl="$enableval"], [want_curl="yes"])
13  
14 +if test "x$want_curl" = "xyes"; then
15 +  # check for libcurl
16 +  PKG_CHECK_MODULES(CURL, libcurl)
17 +  AC_DEFINE(HAVE_CURL, 1, [Define if you want to use libcurl instead of wget])
18 +fi
19  
20  
21  dnl **********
22 --- opkg-4564/libopkg/opkg.c-orig       2008-08-04 19:39:38.000000000 -0500
23 +++ opkg-4564/libopkg/opkg.c    2008-08-04 19:37:17.000000000 -0500
24 @@ -1020,8 +1020,9 @@
25  
26    return package;
27  }
28 -
29 +#ifdef HAVE_CURL
30  #include <curl/curl.h>
31 +#endif
32  /**
33   * @brief Check the accessibility of repositories. It will try to access the repository to check if the respository is accessible throught current network status. 
34   * @param opkg The opkg_t
35 @@ -1071,6 +1072,7 @@
36      repositories--;
37  
38      err = opkg_download(opkg->conf, iter1->data, "/dev/null", NULL, NULL);
39 +    #ifdef HAVE_CURL
40      if (!(err == CURLE_OK || 
41                 err == CURLE_HTTP_RETURNED_ERROR || 
42                 err == CURLE_FILE_COULDNT_READ_FILE ||
43 @@ -1079,6 +1081,7 @@
44                 )) {
45             ret++;
46      }
47 +    #endif
48      str_list_elt_deinit(iter1);
49      free(iter1);
50    }
51 --- opkg-4564/libopkg/opkg_download.c-orig      2008-08-04 19:39:56.000000000 -0500
52 +++ opkg-4564/libopkg/opkg_download.c   2008-08-04 19:37:17.000000000 -0500
53 @@ -17,7 +17,9 @@
54     General Public License for more details.
55  */
56  #include "config.h"
57 +#ifdef HAVE_CURL
58  #include <curl/curl.h>
59 +#endif
60  #ifdef HAVE_GPGME
61  #include <gpgme.h>
62  #endif
63 @@ -76,6 +78,7 @@
64         setenv("no_proxy", conf->no_proxy, 1);
65      }
66  
67 +#ifdef HAVE_CURL
68      CURL *curl;
69      CURLcode res;
70      FILE * file = fopen (tmp_file_location, "w");
71 @@ -121,6 +124,31 @@
72          free(src_basec);
73         return -1;
74      }
75 +#else /* if wget is selected */
76 +    char *cmd;
77 +    /* XXX: BUG rewrite to use execvp or else busybox's internal wget -Jamey 7/23/2002 */
78 +    sprintf_alloc(&cmd, "wget --passive-ftp %s %s%s %s%s -P %s %s",
79 +                 (conf->http_proxy || conf->ftp_proxy) ? "--proxy=on" : "",
80 +                 conf->proxy_user ? "--proxy-user=" : "",
81 +                 conf->proxy_user ? conf->proxy_user : "",
82 +                 conf->proxy_passwd ? "--proxy-passwd=" : "",
83 +                 conf->proxy_passwd ? conf->proxy_passwd : "",
84 +                 conf->tmp_dir,
85 +                 src);
86 +    err = xsystem(cmd);
87 +    if (err) {
88 +       if (err != -1) {
89 +           opkg_message(conf,OPKG_ERROR, "%s: ERROR: Command failed with return value %d: `%s'\n",
90 +                   __FUNCTION__, err, cmd);
91 +       } 
92 +       unlink(tmp_file_location);
93 +       free(tmp_file_location);
94 +       free(src_basec);
95 +       free(cmd);
96 +       return EINVAL;
97 +    }
98 +    free(cmd);
99 +#endif
100  
101      err = file_move(tmp_file_location, dest_file_name);
102