[zypp-commit] r11212 - in /trunk/libzypp: package/libzypp.changes zypp/CMakeLists.txt zypp/media/MediaAccess.cc zypp/media/MediaAccess.h zypp/media/MediaException.cc zypp/media/MediaException.h
Author: dmacvicar Date: Tue Sep 30 00:04:58 2008 New Revision: 11212 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11212&view=rev Log: - Merge aria2c Media handler code from Google SOC 2008 (Gerard Farras) - Only activated by making env var ZYPP_ARIA=1 - various changes on merge: - moved exist function to the Aria specific class - close programs - use arrays of commands instead of building strings - some reformatting - cleanup will come later TODO: Move the exceptions also in the aria class. NOTE: the default handler is still the curl one. We merge the code so people can enable it and test it. But it can't be enabled without setting the env variable. Modified: trunk/libzypp/package/libzypp.changes trunk/libzypp/zypp/CMakeLists.txt trunk/libzypp/zypp/media/MediaAccess.cc trunk/libzypp/zypp/media/MediaAccess.h trunk/libzypp/zypp/media/MediaException.cc trunk/libzypp/zypp/media/MediaException.h Modified: trunk/libzypp/package/libzypp.changes URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=11212&r1=11211&r2=11212&view=diff ============================================================================== --- trunk/libzypp/package/libzypp.changes (original) +++ trunk/libzypp/package/libzypp.changes Tue Sep 30 00:04:58 2008 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Mon Sep 29 23:59:10 CEST 2008 - dmacvicar@suse.de + +- Merge aria2c Media handler code from Google SOC 2008 + (Gerard Farras) +- Only activated by making env var ZYPP_ARIA=1 + +------------------------------------------------------------------- Mon Sep 29 15:56:17 CEST 2008 - jkupec@suse.cz - history: tell which package failed before logging rpm output or Modified: trunk/libzypp/zypp/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/CMakeLists.txt?rev=11212&r1=11211&r2=11212&view=diff ============================================================================== --- trunk/libzypp/zypp/CMakeLists.txt (original) +++ trunk/libzypp/zypp/CMakeLists.txt Tue Sep 30 00:04:58 2008 @@ -258,6 +258,7 @@ media/MediaCIFS.cc media/ProxyInfo.cc media/MediaCurl.cc + media/MediaAria2c.cc media/MediaISO.cc media/MediaManager.cc media/MediaUserAuth.cc @@ -271,6 +272,7 @@ media/MediaCD.h media/MediaCIFS.h media/MediaCurl.h + media/MediaAria2c.h media/MediaDIR.h media/MediaDISK.h media/MediaException.h Modified: trunk/libzypp/zypp/media/MediaAccess.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/media/MediaAccess.cc?rev=11212&r1=11211&r2=11212&view=diff ============================================================================== --- trunk/libzypp/zypp/media/MediaAccess.cc (original) +++ trunk/libzypp/zypp/media/MediaAccess.cc Tue Sep 30 00:04:58 2008 @@ -15,6 +15,7 @@ #include <iostream> #include "zypp/base/Logger.h" +#include "zypp/ExternalProgram.h" #include "zypp/media/MediaException.h" #include "zypp/media/MediaAccess.h" @@ -27,6 +28,7 @@ #include "zypp/media/MediaSMB.h" #include "zypp/media/MediaCIFS.h" #include "zypp/media/MediaCurl.h" +#include "zypp/media/MediaAria2c.h" #include "zypp/media/MediaISO.h" using namespace std; @@ -126,7 +128,14 @@ else if (scheme == "cifs") _handler = new MediaCIFS (url,preferred_attach_point); else if (scheme == "ftp" || scheme == "http" || scheme == "https") - _handler = new MediaCurl (url,preferred_attach_point); + { + // Another good idea would be activate MediaAria2c handler via external var + if ( getenv( "ZYPP_ARIA2C" ) && + MediaAria2c::existsAria2cmd() ) + _handler = new MediaAria2c (url,preferred_attach_point); + else + _handler = new MediaCurl (url,preferred_attach_point); + } else { ZYPP_THROW(MediaUnsupportedUrlSchemeException(url)); Modified: trunk/libzypp/zypp/media/MediaAccess.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/media/MediaAccess.h?rev=11212&r1=11211&r2=11212&view=diff ============================================================================== --- trunk/libzypp/zypp/media/MediaAccess.h (original) +++ trunk/libzypp/zypp/media/MediaAccess.h Tue Sep 30 00:04:58 2008 @@ -72,9 +72,9 @@ void resetParentId(); bool dependsOnParent() const; + bool dependsOnParent(MediaAccessId parentId, bool exactIdMatch) const; - public: /** Modified: trunk/libzypp/zypp/media/MediaException.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/media/MediaException.cc?rev=11212&r1=11211&r2=11212&view=diff ============================================================================== --- trunk/libzypp/zypp/media/MediaException.cc (original) +++ trunk/libzypp/zypp/media/MediaException.cc Tue Sep 30 00:04:58 2008 @@ -85,6 +85,22 @@ << 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( @@ -163,6 +179,42 @@ << 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( Modified: trunk/libzypp/zypp/media/MediaException.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/media/MediaException.h?rev=11212&r1=11211&r2=11212&view=diff ============================================================================== --- trunk/libzypp/zypp/media/MediaException.h (original) +++ trunk/libzypp/zypp/media/MediaException.h Tue Sep 30 00:04:58 2008 @@ -214,6 +214,34 @@ 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: @@ -372,6 +400,74 @@ 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: -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
dmacvicar@svn.opensuse.org