source: trunk/package/opkg/patches/001-use-wget @ 15901

Last change on this file since 15901 was 15901, checked in by florian, 8 years ago

[opkg] update to r4993

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