Remove deprecated aria2 support
authorMichael Andres <ma@suse.de>
Thu, 16 May 2013 10:19:02 +0000 (12:19 +0200)
committerMichael Andres <ma@suse.de>
Thu, 16 May 2013 10:28:36 +0000 (12:28 +0200)
doc/autoinclude/EnvironmentVariables.doc
zypp/CMakeLists.txt
zypp/media/MediaAccess.cc
zypp/media/MediaAria2c.cc [deleted file]
zypp/media/MediaAria2c.h [deleted file]
zypp/media/MediaException.cc
zypp/media/MediaException.h
zypp/media/MediaManager.h
zypp/media/TransferSettings.cc
zypp/media/TransferSettings.h

index 2f7d324..3608426 100644 (file)
@@ -29,7 +29,6 @@ Note that for Boolean variables we usually test whether the variable exists and
 \subsection zypp-envars-mediabackend Selecting the mediabackend to use.
 
 \li \c ZYPP_MULTICURL=0 Turn off multicurl (metalink and zsync) and fall back to plain libcurl.
-\li \c ZYPP_ARIA2C=1 Enable aria2c backend (deprecated).
 
 \subsection zypp-envars-plugin Variables related to plugins
 
index adfd277..5aebc2b 100644 (file)
@@ -278,7 +278,6 @@ SET( zypp_media_SRCS
   media/ProxyInfo.cc
   media/MediaCurl.cc
   media/MediaMultiCurl.cc
-  media/MediaAria2c.cc
   media/MediaISO.cc
   media/MediaPlugin.cc
   media/MediaSource.cc
@@ -301,7 +300,6 @@ SET( zypp_media_HEADERS
   media/MediaCIFS.h
   media/MediaCurl.h
   media/MediaMultiCurl.h
-  media/MediaAria2c.h
   media/MediaDIR.h
   media/MediaDISK.h
   media/MediaException.h
index 2bc7c9a..f119b00 100644 (file)
@@ -30,7 +30,6 @@
 #include "zypp/media/MediaDISK.h"
 #include "zypp/media/MediaCIFS.h"
 #include "zypp/media/MediaCurl.h"
-#include "zypp/media/MediaAria2c.h"
 #include "zypp/media/MediaMultiCurl.h"
 #include "zypp/media/MediaISO.h"
 #include "zypp/media/MediaPlugin.h"
@@ -135,23 +134,14 @@ MediaAccess::open (const Url& o_url, const Pathname & preferred_attach_point)
        _handler = new MediaCIFS (url,preferred_attach_point);
     else if (scheme == "ftp" || scheme == "tftp" || scheme == "http" || scheme == "https")
     {
-        // Another good idea would be activate MediaAria2c handler via external var
-        bool use_aria = false;
         bool use_multicurl = true;
         string urlmediahandler ( url.getQueryParam("mediahandler") );
         if ( urlmediahandler == "multicurl" )
         {
-          use_aria = false;
           use_multicurl = true;
         }
-        else if ( urlmediahandler == "aria2c" )
-        {
-          use_aria = true;
-          use_multicurl = false;
-        }
         else if ( urlmediahandler == "curl" )
         {
-          use_aria = false;
           use_multicurl = false;
         }
         else
@@ -160,7 +150,6 @@ MediaAccess::open (const Url& o_url, const Pathname & preferred_attach_point)
           {
             WAR << "unknown mediahandler set: " << urlmediahandler << endl;
           }
-          const char *ariaenv = getenv( "ZYPP_ARIA2C" );
           const char *multicurlenv = getenv( "ZYPP_MULTICURL" );
           // if user disabled it manually
           if ( use_multicurl && multicurlenv && ( strcmp(multicurlenv, "0" ) == 0 ) )
@@ -173,37 +162,11 @@ MediaAccess::open (const Url& o_url, const Pathname & preferred_attach_point)
               WAR << "multicurl manually enabled." << endl;
               use_multicurl = true;
           }
-          // if user disabled it manually
-          if ( use_aria && ariaenv && ( strcmp(ariaenv, "0" ) == 0 ) )
-          {
-              WAR << "aria2c manually disabled. Falling back to curl" << endl;
-              use_aria = false;
-          }
-          else if ( !use_aria && ariaenv && ( strcmp(ariaenv, "1" ) == 0 ) )
-          {
-              // no aria for ftp - no advantage in that over curl
-              if ( url.getScheme() == "ftp" || url.getScheme() == "tftp" )
-                  WAR << "no aria2c for FTP, despite ZYPP_ARIA2C=1" << endl;
-              else
-              {
-                  WAR << "aria2c manually enabled." << endl;
-                  use_aria = true;
-              }
-          }
-        }
-
-        // disable if it does not exist
-        if ( use_aria && ! MediaAria2c::existsAria2cmd() )
-        {
-            WAR << "aria2c not found. Falling back to curl" << endl;
-            use_aria = false;
         }
 
         MediaCurl *curl;
 
-        if ( use_aria )
-            curl = new MediaAria2c (url,preferred_attach_point);
-        else if ( use_multicurl )
+        if ( use_multicurl )
             curl = new MediaMultiCurl (url,preferred_attach_point);
        else
             curl = new MediaCurl (url,preferred_attach_point);
diff --git a/zypp/media/MediaAria2c.cc b/zypp/media/MediaAria2c.cc
deleted file mode 100644 (file)
index 824b6de..0000000
+++ /dev/null
@@ -1,592 +0,0 @@
-/*---------------------------------------------------------------------\
-|                          ____ _   __ __ ___                          |
-|                         |__  / \ / / . \ . \                         |
-|                           / / \ V /|  _/  _/                         |
-|                          / /__ | | | | | |                           |
-|                         /_____||_| |_| |_|                           |
-|                                                                      |
-\---------------------------------------------------------------------*/
-/** \file zypp/media/MediaAria2c.cc
- *
-*/
-
-#include <iostream>
-#include <list>
-#include <vector>
-#include <fstream>
-#include <boost/lexical_cast.hpp>
-
-#include "zypp/base/Logger.h"
-#include "zypp/base/Regex.h"
-#include "zypp/ExternalProgram.h"
-#include "zypp/ProgressData.h"
-#include "zypp/base/String.h"
-#include "zypp/base/Gettext.h"
-#include "zypp/base/Sysconfig.h"
-#include "zypp/base/Gettext.h"
-#include "zypp/ZYppCallbacks.h"
-
-#include "zypp/Edition.h"
-#include "zypp/Target.h"
-#include "zypp/ZYppFactory.h"
-#include "zypp/ZConfig.h"
-
-#include "zypp/TmpPath.h"
-
-#include "zypp/media/MediaAria2c.h"
-#include "zypp/media/proxyinfo/ProxyInfos.h"
-#include "zypp/media/ProxyInfo.h"
-#include "zypp/media/MediaUserAuth.h"
-#include "zypp/media/MediaCurl.h"
-#include "zypp/thread/Once.h"
-#include <cstdlib>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mount.h>
-#include <errno.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <boost/format.hpp>
-
-#define  DETECT_DIR_INDEX       0
-#define  CONNECT_TIMEOUT        60
-#define  TRANSFER_TIMEOUT       60 * 3
-#define  TRANSFER_TIMEOUT_MAX   60 * 60
-
-#define  ARIA_BINARY "aria2c"
-
-using namespace std;
-using namespace zypp::base;
-
-namespace zypp
-{
-namespace media
-{
-
-Pathname MediaAria2c::_cookieFile = "/var/lib/YaST2/cookies";
-std::string MediaAria2c::_aria2cVersion = "WE DON'T KNOW ARIA2C VERSION";
-
-//check if aria2c is present in the system
-bool
-MediaAria2c::existsAria2cmd()
-{
-  static const char* argv[] =
-  {
-    ARIA_BINARY,
-    "--version",
-    NULL
-  };
-  ExternalProgram aria( argv, ExternalProgram::Stderr_To_Stdout );
-  return( aria.close() == 0 );
-}
-
-/**
- * comannd line for aria.
- * The argument list gets passed as reference
- * and it is filled.
- */
-void fillAriaCmdLine( const string &ariaver,
-                      const TransferSettings &s,
-                      filesystem::TmpPath &credentials,
-                      const Url &url,
-                      const Pathname &destination,
-                      ExternalProgram::Arguments &args )
-{
-
-    // options that are not passed in the command line
-    // like credentials, every string is in the
-    // opt=val format
-    list<string> file_options;
-
-    args.push_back(ARIA_BINARY);
-    args.push_back(str::form("--user-agent=%s", s.userAgentString().c_str()));
-    args.push_back("--summary-interval=1");
-    args.push_back("--follow-metalink=mem");
-    args.push_back("--check-integrity=true");
-    args.push_back("--file-allocation=none");
-
-    // save the stats of the mirrors and use them as input later
-    Pathname statsFile = ZConfig::instance().repoCachePath() / "aria2.stats";
-    args.push_back(str::form("--server-stat-of=%s", statsFile.c_str()));
-    args.push_back(str::form("--server-stat-if=%s", statsFile.c_str()));
-    args.push_back("--uri-selector=adaptive");
-
-    // only present in recent aria lets find out the aria version
-    vector<string> fields;
-    // "aria2c version x.x"
-    str::split( ariaver, std::back_inserter(fields));
-    if ( fields.size() == 3 )
-    {
-        if ( Edition(fields[2]) >= Edition("1.1.2") )
-            args.push_back( "--use-head=false");
-    }
-
-    if ( s.maxDownloadSpeed() > 0 )
-        args.push_back(str::form("--max-download-limit=%ld", s.maxDownloadSpeed()));
-    if ( s.minDownloadSpeed() > 0 )
-        args.push_back(str::form("--lowest-speed-limit=%ld", s.minDownloadSpeed()));
-
-    args.push_back(str::form("--max-tries=%ld", s.maxSilentTries()));
-
-    if ( Edition(fields[2]) < Edition("1.2.0") )
-        WAR << "aria2c is older than 1.2.0, some features may be disabled" << endl;
-
-    // TODO make this one configurable
-    args.push_back(str::form("--max-concurrent-downloads=%ld", s.maxConcurrentConnections()));
-
-    // add the anonymous id.
-    for ( TransferSettings::Headers::const_iterator it = s.headersBegin();
-          it != s.headersEnd();
-          ++it )
-        args.push_back(str::form("--header=%s", it->c_str() ));
-
-    args.push_back( str::form("--connect-timeout=%ld", s.timeout()));
-
-    if ( s.username().empty() )
-    {
-        if ( url.getScheme() == "ftp" )
-        {
-            // set anonymous ftp
-            args.push_back(str::form("--ftp-user=%s", "suseuser" ));
-            args.push_back(str::form("--ftp-passwd=%s", VERSION ));
-
-            string id = "yast2";
-            id += VERSION;
-            DBG << "Anonymous FTP identification: '" << id << "'" << endl;
-        }
-    }
-    else
-    {
-        MIL << "Passing " << url.getScheme() << " credentials '" << s.username() << ':' << (s.password().empty() ? "" : "PASSWORD")<< "'" << endl;
-        if ( url.getScheme() == "ftp" )
-            file_options.push_back(str::form("ftp-user=%s", s.username().c_str() ));
-        else if ( url.getScheme() == "http" ||
-                  url.getScheme() == "https" )
-            file_options.push_back(str::form("http-user=%s", s.username().c_str() ));
-
-        if ( s.password().size() )
-        {
-            if ( url.getScheme() == "ftp" )
-                file_options.push_back(str::form("ftp-passwd=%s", s.password().c_str() ));
-            else if ( url.getScheme() == "http" ||
-                      url.getScheme() == "https" )
-                file_options.push_back(str::form("http-passwd=%s", s.password().c_str() ));
-        }
-    }
-
-    if ( s.proxyEnabled() )
-    {
-        args.push_back(str::form("--http-proxy=%s", s.proxy().c_str() ));
-        if ( ! s.proxyUsername().empty() )
-        {
-            MIL << "Passing " << /*url.getScheme()*/"http" << "-proxy credentials '" << s.proxyUsername() << ':' << (s.proxyPassword().empty() ? "" : "PASSWORD")<< "'" << endl;
-            file_options.push_back(str::form("http-proxy-user=%s", s.proxyUsername().c_str() ));
-            if ( ! s.proxyPassword().empty() )
-                file_options.push_back(str::form("http-proxy-passwd=%s", s.proxyPassword().c_str() ));
-        }
-    }
-
-    if ( ! destination.empty() )
-        args.push_back(str::form("--dir=%s", destination.c_str()));
-
-    // now append the file if there are hidden options
-    if ( ! file_options.empty() )
-    {
-        filesystem::TmpFile tmp;
-        ofstream outs( tmp.path().c_str() );
-        for_( it, file_options.begin(), file_options.end() )
-            outs << *it << endl;
-        outs.close();
-
-        credentials = tmp;
-        args.push_back(str::form("--conf-path=%s", credentials.path().c_str()));
-    }
-
-    // Credentials are passed via --{ftp,http}-{user,passwd}.
-    // Aria does not like them being repeated in the url. (bnc #544634)
-    args.push_back(url.asString( url.getViewOptions()
-                               - url::ViewOptions::WITH_USERNAME
-                               - url::ViewOptions::WITH_PASSWORD ).c_str());
-}
-
-const char *const MediaAria2c::agentString()
-{
-  // we need to add the release and identifier to the
-  // agent string.
-  // The target could be not initialized, and then this information
-  // is not available.
-  Target_Ptr target = zypp::getZYpp()->getTarget();
-
-  static const std::string _value(
-    str::form(
-       "ZYpp %s (%s) %s"
-       , VERSION
-       , MediaAria2c::_aria2cVersion.c_str()
-       , Target::targetDistribution( Pathname()/*guess root*/ ).c_str()
-    )
-  );
-  return _value.c_str();
-}
-
-
-
-MediaAria2c::MediaAria2c( const Url &      url_r,
-                      const Pathname & attach_point_hint_r )
-    : MediaCurl( url_r, attach_point_hint_r )
-{
-  MIL << "MediaAria2c::MediaAria2c(" << url_r << ", " << attach_point_hint_r << ")" << endl;
-  //Get aria2c version
-  _aria2cVersion = getAria2cVersion();
-}
-
-void MediaAria2c::attachTo (bool next)
-{
-  MediaCurl::attachTo(next);
-  _settings.setUserAgentString(agentString());
-}
-
-bool
-MediaAria2c::checkAttachPoint(const Pathname &apoint) const
-{
-    return MediaCurl::checkAttachPoint( apoint );
-}
-
-void MediaAria2c::disconnectFrom()
-{
-    MediaCurl::disconnectFrom();
-}
-
-void MediaAria2c::releaseFrom( const std::string & ejectDev )
-{
-  MediaCurl::releaseFrom(ejectDev);
-}
-
-void MediaAria2c::getFile( const Pathname & filename ) const
-{
-    // Use absolute file name to prevent access of files outside of the
-    // hierarchy below the attach point.
-    getFileCopy(filename, localPath(filename).absolutename());
-}
-
-void MediaAria2c::getFileCopy( const Pathname & filename , const Pathname & target) const
-{
-  callback::SendReport<DownloadProgressReport> report;
-
-  Url fileurl(getFileUrl(filename));
-
-  bool retry = false;
-
-  ExternalProgram::Arguments args;
-
-  filesystem::TmpPath credentials;
-  fillAriaCmdLine(_aria2cVersion, _settings, credentials, fileurl, target.dirname(), args);
-
-  do
-  {
-    try
-    {
-      report->start(fileurl, target.asString() );
-
-      ExternalProgram aria(args, ExternalProgram::Stderr_To_Stdout);
-
-      // extended regex for parsing of progress lines
-      // progress line like: [#1 SIZE:8.3MiB/10.1MiB(82%) CN:5 SPD:6899.88KiB/s]
-      // but since 1.4.0:    [#1 SIZE:8.3MiB/10.1MiB(82%) CN:5 SPD:899.8KiBs]
-      //       (bnc #513944) [#1 SIZE:8.3MiB/10.1MiB(82%) CN:5 SPD:3.8MiBs]
-      //                     [#1 SIZE:8.3MiB/10.1MiB(82%) CN:5 SPD:38Bs]
-      // later got also ETA: [#1 SIZE:8.3MiB/10.1MiB(82%) CN:5 SPD:38Bs ETA:02s]
-      static str::regex rxProgress(
-          "^\\[#[0-9]+ SIZE:[0-9\\.]+(|Ki|Mi|Ti)B/[0-9\\.]+(|Ki|Mi|Ti)B\\(?([0-9]+)?%?\\)? CN:[0-9]+ SPD:([0-9\\.]+)(|Ki|Mi|Ti)Bs.*\\]$");
-
-      // whether we received correct progress line before corresponding FILE line
-      bool gotProgress = false;
-      // download progress in %
-      int progress = 0;
-      // current download speed in bytes
-      double current_speed = 0;
-      // download speed in bytes
-      double average_speed = 0;
-      // number of speed measurements
-      long average_speed_count = 0;
-
-      // here we capture aria output exceptions
-      vector<string> ariaExceptions;
-
-      // whether it makes sense to retry with --continue
-      bool partialDownload = false;
-      // whether user request abort of the download
-      bool userAbort = false;
-
-      //Process response
-      for(std::string ariaResponse( aria.receiveLine());
-          ariaResponse.length();
-          ariaResponse = aria.receiveLine())
-      {
-        string line = str::trim(ariaResponse);
-        // INT << line << endl;
-
-        // look for the progress line and save parsed values until we find
-        // a string with FILE: later.
-        if ( str::hasPrefix(line, "[#") )
-        {
-          str::smatch progressValues;
-          if (( gotProgress = str::regex_match(line, progressValues, rxProgress) ))
-          {
-            // INT << "got: progress: '" << progressValues[3]
-            //     << "' speed: '" << progressValues[4] << " "
-            //     << progressValues[5] << "Bs'" << endl;
-
-            // get the percentage (progress) data
-            progress = std::atoi(progressValues[3].c_str());
-
-            // get the speed
-
-            int factor = 1; // B/KiB/MiB multiplication factor
-            if (progressValues[5] == "Ki")
-              factor = 1024;
-            else if (progressValues[5] == "Mi")
-              factor = 0x100000;
-            else if (progressValues[5] == "Ti")
-              factor = 0x40000000;
-
-            try {
-              current_speed = boost::lexical_cast<double>(progressValues[4]);
-              // convert to and work with bytes everywhere (bnc #537870)
-              current_speed *= factor;
-            }
-            catch (const std::exception&) {
-              ERR << "Can't parse speed from '" << progressValues[4] << "'" << endl;
-              current_speed = 0;
-            }
-          }
-          else
-            ERR << "Can't parse progress line '" << line << "'" << endl;
-        }
-        // save error messages for later
-        else if ( str::hasPrefix(line, "Exception: ") )
-        {
-          // for auth exception, we throw
-          if (!line.substr(0,31).compare("Exception: Authorization failed") )
-          {
-            ZYPP_THROW(MediaUnauthorizedException(
-                       _url, "Login failed.", "Login failed", "auth hint"
-            ));
-          }
-          // otherwise, remember the error
-          string excpMsg = line.substr(10, line.size());
-          DBG << "aria2c reported: '" << excpMsg << "'" << endl;
-          ariaExceptions.push_back(excpMsg);
-        }
-        // The file line tells which file corresponds to the previous progress,
-        // eg.: FILE: ./packages.FL.gz
-        else if ( str::hasPrefix(line, "FILE: ") )
-        {
-          // get the FILE name
-          string theFile(line.substr(6, line.size()));
-          // is the report about the filename we are downloading?
-          // aria may report progress about metalinks, torrent and
-          // other stuff which is not the main transfer
-          // the reported file is the url before the server emits a response
-          // and then is reported as the target file
-          if ( Pathname(theFile) == target || theFile == fileurl.asCompleteString() )
-          {
-            // once we find the FILE: line, progress has to be
-            // non empty
-            if ( gotProgress )
-            {
-              // we have a new average speed
-              average_speed_count++;
-
-              // this is basically A: average
-              // ((n-1)A(n-1) + Xn)/n = A(n)
-              average_speed =
-                (((average_speed_count - 1)*average_speed) + current_speed)
-                / average_speed_count;
-
-              if (!partialDownload && progress > 0)
-                partialDownload = true;
-
-              if ( ! report->progress ( progress, fileurl, average_speed, current_speed ) )
-                userAbort = true;
-
-              // clear the flag to detect mismatches between [# and FILE: lines
-              gotProgress = false;
-            }
-            else
-            {
-              WAR << "aria2c reported a file, but no progress data available" << endl;
-            }
-          }
-          else
-          {
-            DBG << "Progress is not about '" << target << "' but '" << theFile << "'" << endl;
-          }
-        }
-        else
-        {
-            // other line type, just ignore it.
-        }
-      }
-
-      int code;
-      if (userAbort)
-      {
-        aria.kill();
-        code = 7;
-      }
-      else
-        code = aria.close();
-
-      switch ( code )
-      {
-        case 0: // success?
-          if ( ! PathInfo( target ).isExist() )
-          {
-            // bnc #564816: aria2 might return 0 if an error occurred
-            // _before_ the download actually started.
-
-            // TranslatorExplanation: Failed to download <FILENAME> from <SERVERURL>.
-            std::string msg( str::form(_("Failed to download %s from %s"),
-                             filename.c_str(), _url.asString().c_str() ) );
-
-            MediaException e( msg );
-            for_( it, ariaExceptions.begin(), ariaExceptions.end() )
-              e.addHistory( *it );
-
-            ZYPP_THROW( e );
-          }
-          break;
-
-        case 2: // timeout
-        {
-          MediaTimeoutException e(_url);
-          for_(it, ariaExceptions.begin(), ariaExceptions.end())
-              e.addHistory(*it);
-          ZYPP_THROW(e);
-        }
-        break;
-
-        case 3: // not found
-        case 4: // max notfound reached
-        {
-          MediaFileNotFoundException e(_url, filename);
-          for_(it, ariaExceptions.begin(), ariaExceptions.end())
-              e.addHistory(*it);
-          ZYPP_THROW(e);
-        }
-        break;
-
-        case 5: // too slow
-        case 6: // network problem
-        case 7: // unfinished downloads (ctr-c)
-        case 1: // unknown
-        default:
-        {
-          if ( partialDownload )
-          {
-            // Ask for retry on partial downloads, when it makes sense to retry with --continue!
-            // Other errors are handled by the layers above.
-            MediaException e(str::form(_("Download interrupted at %d%%"), progress ));
-            for_(it, ariaExceptions.begin(), ariaExceptions.end())
-              e.addHistory(*it);
-
-            DownloadProgressReport::Action action = report->problem( _url, DownloadProgressReport::ERROR, e.asUserHistory() );
-            if ( action == DownloadProgressReport::RETRY )
-            {
-              retry = true;
-              continue;
-            }
-          }
-
-          string msg;
-          if (userAbort)
-            msg = _("Download interrupted by user");
-          else
-            // TranslatorExplanation: Failed to download <FILENAME> from <SERVERURL>.
-            msg = str::form(_("Failed to download %s from %s"),
-                filename.c_str(), _url.asString().c_str());
-
-          MediaException e(msg);
-          for_(it, ariaExceptions.begin(), ariaExceptions.end())
-              e.addHistory(*it);
-
-          ZYPP_THROW(e);
-        }
-        break;
-      }
-
-      retry = false;
-    }
-    // retry with proper authentication data
-    catch (MediaUnauthorizedException & ex_r)
-    {
-      if(authenticate(ex_r.hint(), !retry))
-        retry = true;
-      else
-      {
-        report->finish(fileurl, zypp::media::DownloadProgressReport::ACCESS_DENIED, ex_r.asUserHistory());
-        ZYPP_RETHROW(ex_r);
-      }
-
-    }
-    // unexpected exception
-    catch (MediaException & excpt_r)
-    {
-      // FIXME: error number fix
-      report->finish(fileurl, zypp::media::DownloadProgressReport::ERROR, excpt_r.asUserHistory());
-      ZYPP_RETHROW(excpt_r);
-    }
-  }
-  while (retry);
-
-  report->finish(fileurl, zypp::media::DownloadProgressReport::NO_ERROR, "");
-}
-
-bool MediaAria2c::getDoesFileExist( const Pathname & filename ) const
-{
-    return MediaCurl::getDoesFileExist(filename);
-}
-
-bool MediaAria2c::doGetDoesFileExist( const Pathname & filename ) const
-{
-    return MediaCurl::doGetDoesFileExist(filename);
-}
-
-void MediaAria2c::getDir( const Pathname & dirname, bool recurse_r ) const
-{
-    MediaCurl::getDir(dirname, recurse_r);
-}
-
-bool MediaAria2c::authenticate(const std::string & availAuthTypes, bool firstTry) const
-{
-    return false;
-}
-
-void MediaAria2c::getDirInfo( std::list<std::string> & retlist,
-                               const Pathname & dirname, bool dots ) const
-{
-  getDirectoryYast( retlist, dirname, dots );
-}
-
-void MediaAria2c::getDirInfo( filesystem::DirContent & retlist,
-                            const Pathname & dirname, bool dots ) const
-{
-  getDirectoryYast( retlist, dirname, dots );
-}
-
-std::string MediaAria2c::getAria2cVersion()
-{
-    static const char* argv[] =
-    {
-      ARIA_BINARY,
-      "--version",
-      NULL
-    };
-    ExternalProgram aria(argv, ExternalProgram::Stderr_To_Stdout);
-    std::string vResponse( str::trim( aria.receiveLine() ) );
-    aria.close();
-    return vResponse;
-}
-} // namespace media
-} // namespace zypp
-//
diff --git a/zypp/media/MediaAria2c.h b/zypp/media/MediaAria2c.h
deleted file mode 100644 (file)
index 1169edf..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*---------------------------------------------------------------------\
-|                          ____ _   __ __ ___                          |
-|                         |__  / \ / / . \ . \                         |
-|                           / / \ V /|  _/  _/                         |
-|                          / /__ | | | | | |                           |
-|                         /_____||_| |_| |_|                           |
-|                                                                      |
-\---------------------------------------------------------------------*/
-/** \file zypp/media/MediaAria2c.h
- *
-*/
-#ifndef ZYPP_MEDIA_MEDIAARIA2C_H
-#define ZYPP_MEDIA_MEDIAARIA2C_H
-
-#include "zypp/media/MediaHandler.h"
-#include "zypp/media/MediaCurl.h"
-#include "zypp/media/TransferSettings.h"
-#include "zypp/ZYppCallbacks.h"
-
-namespace zypp {
-  namespace media {
-
-/**
- * @short Implementation class for FTP, HTTP and HTTPS MediaHandler using an external program (aria2c) to retrive files
- *
- * @author gfarrasb (gfarrasb@gmail.com)
- * @author Duncan Mac-Vicar <dmacvicar@suse.de>
- *
- * @see MediaHandler
- **/
-class MediaAria2c : public MediaCurl {
-
-  public:
-   /**
-    * check if aria2c command line is present in the system
-    **/
-    static bool existsAria2cmd();
-
-  protected:
-    virtual void attachTo (bool next = false);
-    virtual void releaseFrom( const std::string & ejectDev );
-    virtual void getFile( const Pathname & filename ) const;
-    virtual void getDir( const Pathname & dirname, bool recurse_r ) const;
-    virtual void getDirInfo( std::list<std::string> & retlist,
-                             const Pathname & dirname, bool dots = true ) const;
-    virtual void getDirInfo( filesystem::DirContent & retlist,
-                             const Pathname & dirname, bool dots = true ) const;
-    /**
-     * Repeatedly calls doGetDoesFileExist() until it successfully returns,
-     * fails unexpectedly, or user cancels the operation. This is used to
-     * handle authentication or similar retry scenarios on media level.
-     */
-    virtual bool getDoesFileExist( const Pathname & filename ) const;
-
-    /**
-     * \see MediaHandler::getDoesFileExist
-     */
-    virtual bool doGetDoesFileExist( const Pathname & filename ) const;
-
-    /**
-     *
-     * \throws MediaException
-     *
-     */
-    virtual void disconnectFrom();
-    /**
-     *
-     * \throws MediaException
-     *
-     */
-    virtual void getFileCopy( const Pathname & srcFilename, const Pathname & targetFilename) const;
-
-    virtual bool checkAttachPoint(const Pathname &apoint) const;
-
-  public:
-
-    MediaAria2c( const Url &      url_r,
-              const Pathname & attach_point_hint_r );
-
-    virtual ~MediaAria2c() { try { release(); } catch(...) {} }
-
-    //static void setCookieFile( const Pathname & );
-
-    class Callbacks
-    {
-      public:
-       virtual ~Callbacks() {}
-        virtual bool progress( int percent ) = 0;
-    };
-
-  protected:
-
-    static const char *const agentString();
-
-  private:
-
-    bool authenticate(const std::string & availAuthTypes, bool firstTry) const;
-
-    std::string _currentCookieFile;
-    std::string _ca_path;
-    static Pathname _cookieFile;
-
-    /** External process to get aria2c version */
-    std::string getAria2cVersion();
-    static std::string _aria2cVersion;
-};
-
-///////////////////////////////////////////////////////////////////
-
-  } // namespace media
-} // namespace zypp
-
-#endif // ZYPP_MEDIA_MEDIAARIA2C_H
index 9cf3839..346802d 100644 (file)
@@ -85,22 +85,6 @@ namespace zypp
         << endl;
     }
 
-   std::ostream & MediaMetalinkInitException::dumpOn( std::ostream & str) const
-    {
-      return str << form(
-        // TranslatorExplanation: curl is the name of a library, don't translate
-        _("Download (Metalink curl) initialization failed for '%s'"), _url.c_str())
-        << endl;
-    }
-
-   std::ostream & MediaAria2cInitException::dumpOn( std::ostream & str) const
-    {
-      return str << form(
-        // TranslatorExplanation: curl is the name of a library, don't translate
-        _("Download (Metalink curl) initialization failed for '%s'"), _url.c_str())
-        << endl;
-    }
-
     std::ostream & MediaSystemException::dumpOn( std::ostream & str) const
     {
       return str << form(
@@ -179,42 +163,6 @@ namespace zypp
        << endl << _msg << endl;
     }
 
-   std::ostream & MediaMetalinkException::dumpOn( std::ostream & str) const
-    {
-      // TranslatorExplanation: curl is the name of a library, don't translate
-      return str << form(_(
-        "Download (metalink curl) error for '%s':\n"
-        "Error code: %s\n"
-        "Error message: %s\n"), _url.c_str(), _err.c_str(), _msg.c_str());
-    }
-
-    std::ostream & MediaMetalinkSetOptException::dumpOn( std::ostream & str) const
-    {
-      return str << form(
-        // TranslatorExplanation: curl is the name of a library, don't translate
-        _("Error occurred while setting download (metalink curl) options for '%s':"),
-        _url.c_str())
-       << endl << _msg << endl;
-    }
-
-   std::ostream & MediaAria2cException::dumpOn( std::ostream & str) const
-    {
-      // TranslatorExplanation: curl is the name of a library, don't translate
-      return str << form(_(
-        "Download (metalink curl) error for '%s':\n"
-        "Error code: %s\n"
-        "Error message: %s\n"), _url.c_str(), _err.c_str(), _msg.c_str());
-    }
-
-    std::ostream & MediaAria2cSetOptException::dumpOn( std::ostream & str) const
-    {
-      return str << form(
-        // TranslatorExplanation: curl is the name of a library, don't translate
-        _("Error occurred while setting download (metalink curl) options for '%s':"),
-        _url.c_str())
-       << endl << _msg << endl;
-    }
-
     std::ostream & MediaNotDesiredException::dumpOn( std::ostream & str ) const
     {
       return str << form(
index 40b4c73..1e885d8 100644 (file)
@@ -214,34 +214,6 @@ namespace zypp
       std::string _url;
     };
 
-class MediaMetalinkInitException : public MediaException
-    {
-    public:
-      MediaMetalinkInitException(const Url & url_r)
-      : MediaException()
-      , _url(url_r.asString())
-      {}
-      virtual ~MediaMetalinkInitException() throw() {};
-    protected:
-      virtual std::ostream & dumpOn( std::ostream & str ) const;
-    private:
-      std::string _url;
-    };
-
-class MediaAria2cInitException : public MediaException
-    {
-    public:
-      MediaAria2cInitException(const Url & url_r)
-      : MediaException()
-      , _url(url_r.asString())
-      {}
-      virtual ~MediaAria2cInitException() throw() {};
-    protected:
-      virtual std::ostream & dumpOn( std::ostream & str ) const;
-    private:
-      std::string _url;
-    };
-
     class MediaSystemException : public MediaException
     {
     public:
@@ -401,74 +373,6 @@ class MediaAria2cInitException : public MediaException
       std::string _msg;
     };
 
-    class MediaMetalinkException : public MediaException
-    {
-    public:
-      MediaMetalinkException(const Url & url_r,
-                        const std::string & err_r,
-                        const std::string & msg_r)
-      : MediaException()
-      , _url(url_r.asString())
-      , _err(err_r)
-      , _msg(msg_r)
-      {}
-      virtual ~MediaMetalinkException() throw() {};
-    protected:
-      virtual std::ostream & dumpOn( std::ostream & str ) const;
-      std::string _url;
-      std::string _err;
-      std::string _msg;
-    };
-
-    class MediaMetalinkSetOptException : public MediaException
-    {
-    public:
-      MediaMetalinkSetOptException(const Url & url_r, const std::string & msg_r)
-      : MediaException()
-      , _url(url_r.asString())
-      , _msg(msg_r)
-      {}
-      virtual ~MediaMetalinkSetOptException() throw() {};
-    protected:
-      virtual std::ostream & dumpOn( std::ostream & str ) const;
-      std::string _url;
-      std::string _msg;
-    };
-
-    class MediaAria2cException : public MediaException
-    {
-    public:
-      MediaAria2cException(const Url & url_r,
-                        const std::string & err_r,
-                        const std::string & msg_r)
-      : MediaException()
-      , _url(url_r.asString())
-      , _err(err_r)
-      , _msg(msg_r)
-      {}
-      virtual ~MediaAria2cException() throw() {};
-    protected:
-      virtual std::ostream & dumpOn( std::ostream & str ) const;
-      std::string _url;
-      std::string _err;
-      std::string _msg;
-    };
-
-    class MediaAria2cSetOptException : public MediaException
-    {
-    public:
-      MediaAria2cSetOptException(const Url & url_r, const std::string & msg_r)
-      : MediaException()
-      , _url(url_r.asString())
-      , _msg(msg_r)
-      {}
-      virtual ~MediaAria2cSetOptException() throw() {};
-    protected:
-      virtual std::ostream & dumpOn( std::ostream & str ) const;
-      std::string _url;
-      std::string _msg;
-    };
-
     class MediaNotDesiredException : public MediaException
     {
     public:
index 69f4421..b23a1b3 100644 (file)
@@ -417,7 +417,7 @@ namespace zypp
      *       Note, that this list depends on the list of methods supported
      *       by the curl library.
      *     - <tt>mediahandler</tt>: Set the mediahandler for this url
-     *     Valid values are: 'curl', 'multicurl', 'aria2c'
+     *     Valid values are: 'curl', 'multicurl'
      *   - Authority:
      *     The authority component has to provide a hostname. Optionally
      *     also a username and password. In case of the 'ftp' scheme,
index 5efdbc2..f64510f 100644 (file)
 
 using namespace std;
 
-#define ARIA2C_BINARY "/usr/bin/aria2c"
 #define CURL_BINARY "/usr/bin/curl"
 
 namespace zypp
 {
 namespace media
 {
-    
+
 class TransferSettings::Impl
 {
 public:
@@ -38,7 +37,7 @@ public:
     {}
 
     virtual ~Impl()
-    {}    
+    {}
 
     /** Offer default Impl. */
     static shared_ptr<Impl> nullimpl()
@@ -76,11 +75,11 @@ public:
     bool _verify_host;
     bool _verify_peer;
     Pathname _ca_path;
+
     // workarounds
     bool _head_requests_allowed;
 };
-    
+
 TransferSettings::TransferSettings()
     : _impl(new TransferSettings::Impl())
 {
@@ -305,13 +304,13 @@ std::string TransferSettings::authType() const
 
 void TransferSettings::setHeadRequestsAllowed(bool allowed)
 {
-    _impl->_head_requests_allowed = allowed;    
-}    
+    _impl->_head_requests_allowed = allowed;
+}
 
 bool TransferSettings::headRequestsAllowed() const
 {
-    return _impl->_head_requests_allowed;    
-} 
+    return _impl->_head_requests_allowed;
+}
 
 } // ns media
 } // ns zypp
index 4806056..bf970b3 100644 (file)
@@ -45,12 +45,12 @@ public:
   void addHeader( const std::string &header );
 
   /**
-   * begin iterators to additional headers 
+   * begin iterators to additional headers
    */
   Headers::const_iterator headersBegin() const;
 
   /**
-   * end iterators to additional headers 
+   * end iterators to additional headers
    */
   Headers::const_iterator headersEnd() const;
 
@@ -85,7 +85,7 @@ public:
   std::string password() const;
 
   /**
-   * returns the user and password as 
+   * returns the user and password as
    * a user:pass string
    */
   std::string userPassword() const;
@@ -136,7 +136,7 @@ public:
   std::string proxyPassword() const;
 
   /**
-   * returns the proxy user and password as 
+   * returns the proxy user and password as
    * a user:pass string
    */
   std::string proxyUserPassword() const;
@@ -176,7 +176,7 @@ public:
    * until the connection is dropped
    */
   long minDownloadSpeed() const;
-  
+
   /**
    * Set minimum download speed (bytes per second)
    * until the connection is dropped