opkg: remove some "#if 0" code
[oweals/opkg-lede.git] / libopkg / opkg_download.c
index 6cce64a82f18ebe5b316219fd8a4b06c985c6b8b..4dab8092f5001e5e94cc02e70edd235ec7849d7a 100644 (file)
 #include "file_util.h"
 #include "str_util.h"
 
-#ifdef OPKG_LIB
 #include "libopkg.h"
 opkg_download_progress_callback opkg_cb_download_progress = NULL;
-#endif
 
 int
 curl_progress_func (char* url,
@@ -47,7 +45,6 @@ curl_progress_func (char* url,
     int i;
     int p = (t) ? d*100/t : 0;
 
-#ifdef OPKG_LIB
     if (opkg_cb_download_progress)
     {
        static int prev = -1;
@@ -61,7 +58,6 @@ curl_progress_func (char* url,
        opkg_cb_download_progress (p, url);
        return 0;
     }
-#endif
 
     /* skip progress bar if we haven't done started yet
      * this prevents drawing the progress bar if we receive an error such as
@@ -125,31 +121,6 @@ int opkg_download(opkg_conf_t *conf, const char *src, const char *dest_file_name
        setenv("no_proxy", conf->no_proxy, 1);
     }
 
-    /* XXX: BUG rewrite to use execvp or else busybox's internal wget -Jamey 7/23/2002 */ 
-#if 0
-    sprintf_alloc(&cmd, "wget --passive-ftp %s %s%s %s%s %s -P %s %s",
-                 (conf->http_proxy || conf->ftp_proxy) ? "--proxy=on" : "",
-                 conf->proxy_user ? "--proxy-user=" : "",
-                 conf->proxy_user ? conf->proxy_user : "",
-                 conf->proxy_passwd ? "--proxy-passwd=" : "",
-                 conf->proxy_passwd ? conf->proxy_passwd : "",
-                 conf->verbose_wget ? "" : "-q",
-                 conf->tmp_dir,
-                 src);
-    err = xsystem(cmd);
-    if (err) {
-       if (err != -1) {
-           opkg_message(conf,OPKG_ERROR, "%s: ERROR: Command failed with return value %d: `%s'\n",
-                   __FUNCTION__, err, cmd);
-       } 
-       unlink(tmp_file_location);
-       free(tmp_file_location);
-       free(src_basec);
-       free(cmd);
-       return EINVAL;
-    }
-    free(cmd);
-#endif
     CURL *curl;
     CURLcode res;
     FILE * file = fopen (tmp_file_location, "w");
@@ -186,7 +157,9 @@ int opkg_download(opkg_conf_t *conf, const char *src, const char *dest_file_name
     else
        return -1;
 
-    printf ("\n");
+    /* if no custom progress handler was set, we need to clear the default progress bar */
+    if (!opkg_cb_download_progress)
+        printf ("\n");
 
     err = file_move(tmp_file_location, dest_file_name);
 
@@ -297,7 +270,7 @@ int opkg_prepare_url_for_install(opkg_conf_t *conf, const char *url, char **name
 }
 
 int
-opkg_verify_file (char *text_file, char *sig_file)
+opkg_verify_file (opkg_conf_t *conf, char *text_file, char *sig_file)
 {
 #ifdef HAVE_GPGME
     int status = -1;
@@ -340,7 +313,7 @@ opkg_verify_file (char *text_file, char *sig_file)
 
     return status;
 #else
-    printf ("Signature check skipped because GPG support was not enabled in this build\n");
+    opkg_message (conf, OPKG_NOTICE, "Signature check for %s was skipped because GPG support was not enabled in this build\n");
     return 0;
 #endif
 }