SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden -fno-strict-aliasing -fPIC -g -rdynamic -Wall -Woverloaded-virtual -Wnon-virtual-dtor -Wl,-as-needed -std=c++11" )
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing -fPIC -g -rdynamic -Wall -Wl,-as-needed" )
-set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3" )
-set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3" )
+set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3 -DZYPP_NDEBUG" )
+set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3 -DZYPP_NDEBUG" )
IF(${CC_FORMAT_SECURITY})
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=format-security")
# See './mkChangelog -h' for help.
#
SET(LIBZYPP_MAJOR "15")
-SET(LIBZYPP_COMPATMINOR "0")
-SET(LIBZYPP_MINOR "0")
+SET(LIBZYPP_COMPATMINOR "1")
+SET(LIBZYPP_MINOR "1")
SET(LIBZYPP_PATCH "0")
#
-# LAST RELEASED: 15.0.0 (0)
+# LAST RELEASED: 15.1.0 (1)
# (The number in parenthesis is LIBZYPP_COMPATMINOR)
#=======
-------------------------------------------------------------------
+Wed Apr 22 10:50:00 CEST 2015 - ma@suse.de
+
+- ZYpp: Changed ZYpp::Ptr to be a shared_ptr;
+ a precondition for fixing bnc-899755
+- rpmmd: support 'metalink=' in .repo (for zypper#63)
+- RepoMirrorList: ignore comments and malformed urls in mirrorlist
+- PathInfo: remove minor/major conflicting with GNU libc macros
+ DiskUsageCounter: remove ctors taking 'magic' bool flags
+ ZyppCallbacks: remove unused PatchDownload callbacks
+- version 15.1.0 (1)
+
+-------------------------------------------------------------------
Thu Apr 2 19:06:56 CEST 2015 - ma@suse.de
- POODLE: libzypp should only talk TLS (bnc#903405)
{
tableOut( str::numstring( it->id() ), it->asString(),
str::form( "(%d)%s", it->repository().info().priority(), it->repository().name().c_str() ),
- it->vendor().asString(),
str::numstring( PoolItem(*it)->buildtime() ) );
+ tableOut( "", "",
+ it->vendor().asString() );
if ( ! it.matchesEmpty() )
{
for_( match, it.matchesBegin(), it.matchesEnd() )
{
- tableOut( "", "", "", match->inSolvAttr().asString().substr( 9, 3 )+": " +match->asString() );
+ tableOut( "", "", match->inSolvAttr().asString().substr( 9, 3 )+": " +match->asString() );
}
}
}
: MountPoint( std::string(d?d:""), HintFlags(hint) )
{}
-
- /** \deprecated Use HintFlags instead of a trailing 'bool ro' argument.
- * \code
- * - MountPoint( "/usr", ..., true ); // readonly
- * + MountPoint( "/usr", ..., MountPoint::Hint_readonly );
- * \endcode
- */
- ZYPP_DEPRECATED MountPoint( const std::string & d, long long bs, long long total, long long used, long long pkg, bool ro )
- : MountPoint( d, bs, total, used, pkg, HintFlags(ro?Hint_readonly:NoHint) )
- {}
- /** \deprecated Use HintFlags instead of a trailing 'bool ro' argument.
- * \code
- * - MountPoint( "/usr", ..., true ); // readonly
- * + MountPoint( "/usr", ..., MountPoint::Hint_readonly );
- * \endcode
- */
- ZYPP_DEPRECATED MountPoint( const char * d, long long bs, long long total, long long used, long long pkg, bool ro )
- : MountPoint( d, bs, total, used, pkg, HintFlags(ro?Hint_readonly:NoHint) )
- {}
-
-
/** Sort by directory name */
bool operator<( const MountPoint & rhs ) const
{ return dir < rhs.dir; }
*/
unsigned int PathInfo::devMajor() const
{
- return isBlk() || isChr() ? ::major(statbuf_C.st_rdev) : 0;
+ return isBlk() || isChr() ? major(statbuf_C.st_rdev) : 0;
}
/******************************************************************
*/
unsigned int PathInfo::devMinor() const
{
- return isBlk() || isChr() ? ::minor(statbuf_C.st_rdev) : 0;
+ return isBlk() || isChr() ? minor(statbuf_C.st_rdev) : 0;
}
- unsigned int PathInfo::major() const
- { INT << "Cleanup the code: This method is deprecated" << endl; return devMajor(); }
- unsigned int PathInfo::minor() const
- { INT << "Cleanup the code: This method is deprecated" << endl; return devMinor(); }
-
/******************************************************************
**
** FUNCTION NAME : operator<<
#include <set>
#include <map>
-#include "zypp/APIConfig.h"
#include "zypp/Pathname.h"
#include "zypp/CheckSum.h"
#include "zypp/ByteCount.h"
unsigned int devMajor() const;
unsigned int devMinor() const;
-
- /** \deprecated Name clashes with GNU libc macro, use \ref devMajor instead. */
- unsigned int major() const ZYPP_DEPRECATED;
- /** \deprecated Name clashes with GNU libc macro, use \ref devMinor instead. */
- unsigned int minor() const ZYPP_DEPRECATED;
//@}
/** \name Size info. */
Impl()
: gpgcheck(indeterminate)
, keeppackages(indeterminate)
+ , _mirrorListForceMetalink(false)
, type(repo::RepoType::NONE_e)
, emptybaseurls(false)
{}
{
emptybaseurls = true;
DBG << "MetadataPath: " << metadatapath << endl;
- repo::RepoMirrorList rmurls( mlurl, metadatapath );
+ repo::RepoMirrorList rmurls( mlurl, metadatapath, _mirrorListForceMetalink );
_baseUrls.raw().insert( _baseUrls.raw().end(), rmurls.getUrls().begin(), rmurls.getUrls().end() );
}
return _baseUrls;
TriBool keeppackages;
RepoVariablesReplacedUrl _gpgKeyUrl;
RepoVariablesReplacedUrl _mirrorListUrl;
+ bool _mirrorListForceMetalink;
repo::RepoType type;
Pathname path;
std::string service;
{ _pimpl->gpgcheck = check; }
void RepoInfo::setMirrorListUrl( const Url & url_r ) // Raw
- { _pimpl->_mirrorListUrl.raw() = url_r; }
+ { _pimpl->_mirrorListUrl.raw() = url_r; _pimpl->_mirrorListForceMetalink = false; }
+
+ void RepoInfo::setMetalinkUrl( const Url & url_r ) // Raw
+ { _pimpl->_mirrorListUrl.raw() = url_r; _pimpl->_mirrorListForceMetalink = true; }
void RepoInfo::setGpgKeyUrl( const Url & url_r )
{ _pimpl->_gpgKeyUrl.raw() = url_r; }
str << tag_r << value_r << std::endl;
});
- strif( "- mirrorlist : ", rawMirrorListUrl().asString() );
+ strif( (_pimpl->_mirrorListForceMetalink ? "- metalink : " : "- mirrorlist : "), rawMirrorListUrl().asString() );
strif( "- path : ", path().asString() );
str << "- type : " << type() << std::endl;
str << "- priority : " << priority() << std::endl;
str << "path="<< path() << endl;
if ( ! (rawMirrorListUrl().asString().empty()) )
- str << "mirrorlist=" << rawMirrorListUrl() << endl;
+ str << (_pimpl->_mirrorListForceMetalink ? "metalink=" : "mirrorlist=") << rawMirrorListUrl() << endl;
str << "type=" << type().asString() << endl;
if (!(tmpstr = gpgKeyUrl().asString()).empty())
str << " gpgkey=\"" << escape(tmpstr) << "\"";
if (!(tmpstr = mirrorListUrl().asString()).empty())
- str << " mirrorlist=\"" << escape(tmpstr) << "\"";
+ str << (_pimpl->_mirrorListForceMetalink ? " metalink=\"" : " mirrorlist=\"") << escape(tmpstr) << "\"";
str << ">" << endl;
if ( _pimpl->baseurl2dump() )
* \param url The base url for the list
*/
void setMirrorListUrl( const Url &url );
+ /**
+ * Like \ref setMirrorListUrl but expect metalink format.
+ */
+ void setMetalinkUrl( const Url &url );
/**
* Type of repository,
namespace zypp
{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : ZYpp::ZYpp
- // METHOD TYPE : Ctor
- //
ZYpp::ZYpp( const Impl_Ptr & impl_r )
: _pimpl( impl_r )
{}
- ///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : ZYpp::~ZYpp
- // METHOD TYPE : Dtor
- //
ZYpp::~ZYpp()
{}
- ///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : ZYpp::dumpOn
- // METHOD TYPE : std::ostream &
- //
- std::ostream & ZYpp::dumpOn( std::ostream & str ) const
- {
- return str << *_pimpl;
- }
+ std::ostream & operator<<( std::ostream & str, const ZYpp & obj )
+ { return str << *obj._pimpl; }
///////////////////////////////////////////////////////////////////
//
#include <iosfwd>
-#include "zypp/base/ReferenceCounted.h"
#include "zypp/base/NonCopyable.h"
#include "zypp/base/PtrTypes.h"
#include "zypp/APIConfig.h"
* \todo define Exceptions
* ZYpp API main interface
*/
- class ZYpp : public base::ReferenceCounted, private base::NonCopyable
+ class ZYpp : private base::NonCopyable
{
- public:
+ friend std::ostream & operator<<( std::ostream & str, const ZYpp & obj );
- typedef intrusive_ptr<ZYpp> Ptr;
- typedef intrusive_ptr<const ZYpp> constPtr;
+ public:
+ // can't get swig working if shared_ptr is without namespace here
+ typedef ::boost::shared_ptr<ZYpp> Ptr;
+ typedef ::boost::shared_ptr<const ZYpp> constPtr;
public:
/** set the home, if you need to change it */
void setHomePath( const Pathname & path );
- protected:
- /** Dtor */
- virtual ~ZYpp();
- /** Stream output */
- virtual std::ostream & dumpOn( std::ostream & str ) const;
private:
/** Factory */
friend class ZYppFactory;
-
- /** */
typedef zypp_detail::ZYppImpl Impl;
typedef shared_ptr<Impl> Impl_Ptr;
/** Factory ctor */
- explicit
- ZYpp( const Impl_Ptr & impl_r );
+ explicit ZYpp( const Impl_Ptr & impl_r );
+ private:
+ /** Deleted via shared_ptr */
+ friend void ::boost::checked_delete<ZYpp>(ZYpp*); // template<class T> inline void checked_delete(T * x)
+ /** Dtor */
+ ~ZYpp();
private:
/** Pointer to implementation */
RW_pointer<Impl> _pimpl;
virtual void finishDeltaApply()
{}
- /** \deprecated Unused since 2008 */
- virtual ZYPP_DEPRECATED void startPatchDownload( const Pathname & /*filename*/, const ByteCount & /*downloadsize*/ )
- {}
-
- /** \deprecated Unused since 2008 */
- virtual ZYPP_DEPRECATED bool progressPatchDownload( int /*value*/ )
- { return true; }
-
- /** \deprecated Unused since 2008 */
- virtual ZYPP_DEPRECATED void problemPatchDownload( const std::string &/*description*/ )
- {}
-
- /** \deprecated Unused since 2008 */
- virtual ZYPP_DEPRECATED void finishPatchDownload()
- {}
-
-
// return false if the download should be aborted right now
virtual bool progress(int /*value*/, Resolvable::constPtr /*resolvable_ptr*/)
{ return true; }
}
}
// Here we go...
- _instance = new ZYpp( ZYpp::Impl_Ptr(new ZYpp::Impl) );
+ _instance.reset( new ZYpp( ZYpp::Impl_Ptr(new ZYpp::Impl) ) );
if ( _instance )
_haveZYpp = true;
}
*
* Debuging tools which should not be used in released code.
*/
+#ifndef ZYPP_NDEBUG
#warning ZYPP_BASE_DEBUG_H included
#ifndef ZYPP_BASE_DEBUG_H
#define ZYPP_BASE_DEBUG_H
} // namespace zypp
///////////////////////////////////////////////////////////////////
#endif // ZYPP_BASE_DEBUG_H
+#endif // ZYPP_NDEBUG
namespace zypp
{ /////////////////////////////////////////////////////////////////
+#ifndef ZYPP_NDEBUG
+ namespace debug
+ {
+ void osdlog( const std::string & msg_r, unsigned level_r )
+ {
+ // Fg::Black: 30 Bg: 40 Attr::Normal: 22;27
+ // Fg::Red: 31 ... Attr::Bright: 1
+ // Fg::Green: 32 Attr::Reverse: 7
+ // Fg::Yellow: 33
+ // Fg::Blue: 34
+ // Fg::Magenta: 35
+ // Fg::Cyan: 36
+ // Fg::White: 37
+ // Fg::Default: 39
+ static const char * ansi[] = {
+ "\033[37;40m", // 0 w
+ "\033[36;40m", // 1 c
+ "\033[33;1;40m", // 2 y
+ "\033[32;40m", // 3 g
+ "\033[31;1;40m", // 4 r
+ "\033[35;40m", // 5 m
+ };
+ static const unsigned n = sizeof(ansi)/sizeof(const char *);
+ switch ( level_r )
+ {
+ case 'w': level_r = 0; break;
+ case 'c': level_r = 1; break;
+ case 'y': level_r = 2; break;
+ case 'g': level_r = 3; break;
+ case 'r': level_r = 4; break;
+ case 'm': level_r = 5; break;
+ }
+ std::cerr << ansi[level_r%n] << "OSD[" << msg_r << "]\033[0m" << std::endl;
+ }
+}
+#endif // ZYPP_NDEBUG
+
///////////////////////////////////////////////////////////////////
namespace log
{ /////////////////////////////////////////////////////////////////
*/
#ifndef ZYPP_BASE_LOGGER_H
#define ZYPP_BASE_LOGGER_H
-
-#include <iosfwd>
#include <cstring>
+#include <iosfwd>
+#include <string>
+
+///////////////////////////////////////////////////////////////////
+#ifdef ZYPP_NDEBUG
+#define OSDLOG( MSG )
+#define OSMLOG( L, MSG )
+#else
+namespace zypp
+{
+ namespace debug
+ {
+ void osdlog( const std::string & msg_r, unsigned level_r ); // LogControl.cc
+ }
+}
+#define OSDLOG( MSG ) ::zypp::debug::osdlog( MSG, 0 )
+#define OSMLOG( L, MSG ) ::zypp::debug::osdlog( MSG, L )
+#endif // ZYPP_NDEBUG
+///////////////////////////////////////////////////////////////////
/** \defgroup ZYPP_BASE_LOGGER_MACROS ZYPP_BASE_LOGGER_MACROS
* Convenience macros for logging.
info.setAutorefresh( str::strToTrue( it->second ) );
else if ( it->first == "mirrorlist" && !it->second.empty())
info.setMirrorListUrl(Url(it->second));
+ else if ( it->first == "metalink" && !it->second.empty())
+ info.setMetalinkUrl(Url(it->second));
else if ( it->first == "gpgkey" && !it->second.empty())
{
std::vector<std::string> keys;
string tmpurl;
while (getline(tmpfstream.stream(), tmpurl))
{
- my_urls.push_back(Url(tmpurl));
+ if ( tmpurl[0] == '#' )
+ continue;
+ try {
+ my_urls.push_back(Url(tmpurl));
+ }
+ catch (...)
+ {;} // ignore malformed urls
}
return my_urls;
}
/** Parse a local mirrorlist \a listfile_r and return usable URLs */
- inline std::vector<Url> RepoMirrorListParse( const Url & url_r, const Pathname & listfile_r )
+ inline std::vector<Url> RepoMirrorListParse( const Url & url_r, const Pathname & listfile_r, bool mirrorListForceMetalink_r )
{
USR << url_r << " " << listfile_r << endl;
std::vector<Url> mirrorurls;
- if ( url_r.asString().find( "/metalink" ) != string::npos )
+ if ( mirrorListForceMetalink_r || url_r.asString().find( "/metalink" ) != string::npos )
mirrorurls = RepoMirrorListParseXML( listfile_r );
else
mirrorurls = RepoMirrorListParseTXT( listfile_r );
} // namespace
///////////////////////////////////////////////////////////////////
-
- RepoMirrorList::RepoMirrorList( const Url & url_r, const Pathname & metadatapath_r )
+ RepoMirrorList::RepoMirrorList( const Url & url_r, const Pathname & metadatapath_r, bool mirrorListForceMetalink_r )
{
if ( url_r.getScheme() == "file" )
{
// never cache for local mirrorlist
- _urls = RepoMirrorListParse( url_r, url_r.getPathName() );
+ _urls = RepoMirrorListParse( url_r, url_r.getPathName(), mirrorListForceMetalink_r );
}
else if ( ! PathInfo( metadatapath_r).isDir() )
{
// no cachedir
RepoMirrorListTempProvider provider( url_r ); // RAII: lifetime of any downloaded files
- _urls = RepoMirrorListParse( url_r, provider.localfile() );
+ _urls = RepoMirrorListParse( url_r, provider.localfile(), mirrorListForceMetalink_r );
}
else
{
// have cachedir
Pathname cachefile( metadatapath_r );
- if ( url_r.asString().find( "/metalink" ) != string::npos )
+ if ( mirrorListForceMetalink_r || url_r.asString().find( "/metalink" ) != string::npos )
cachefile /= "mirrorlist.xml";
else
cachefile /= "mirrorlist.txt";
zypp::filesystem::hardlinkCopy( provider.localfile(), cachefile );
}
- _urls = RepoMirrorListParse( url_r, cachefile );
+ _urls = RepoMirrorListParse( url_r, cachefile, mirrorListForceMetalink_r );
if( _urls.empty() )
{
DBG << "Removing Cachefile as it contains no URLs" << endl;
class RepoMirrorList
{
public:
- RepoMirrorList( const Url & url_r, const Pathname & metadatapath_r = Pathname() );
+ RepoMirrorList( const Url & url_r, const Pathname & metadatapath_r, bool mirrorListForceMetalink_r );
+
+ RepoMirrorList( const Url & url_r )
+ : RepoMirrorList( url_r, Pathname(), false )
+ {}
const std::vector<Url> & getUrls() const
{ return _urls; }