From 95763429e4df1295fd4e9472af6bb8763231f557 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Tue, 1 Nov 2016 11:06:25 +0900 Subject: [PATCH] Imported Upstream version 15.19.0 Change-Id: Ic46d7cd27330c3dd7bcbcc5c069c50fee3fce66a Signed-off-by: DongHun Kwak --- CMakeLists.txt | 2 +- VERSION.cmake | 6 +- devel/devel.ma/AOUT.cc | 36 - devel/devel.ma/CleandepsOnRemove.cc | 141 ---- devel/devel.ma/CommitCb.cc | 164 ----- devel/devel.ma/DumpSolv.cc | 289 -------- devel/devel.ma/Ex.cc | 166 ----- devel/devel.ma/ExPure.cc | 189 ------ devel/devel.ma/ExplicitMap.h | 44 +- devel/devel.ma/FakePool.cc | 84 --- devel/devel.ma/FakePool.h | 257 ------- devel/devel.ma/FilelistTransform.cc | 780 ---------------------- devel/devel.ma/MT.cc | 4 +- devel/devel.ma/MaTest.cc | 61 +- devel/devel.ma/Main.cc | 2 +- devel/devel.ma/NewPool.cc | 62 +- devel/devel.ma/Parse.cc | 483 -------------- devel/devel.ma/Printing.h | 10 +- devel/devel.ma/Sat.cc | 2 +- devel/devel.ma/Tools.h | 55 +- devel/devel.ma/TransList.cc | 242 ------- devel/devel.ma/Xml.cc | 2 +- devel/devel.ma/defstr.txt | 31 - devel/devel.ma/iorderbug.pool | 28 - devel/devel.ma/main.cc | 58 -- devel/devel.ma/main.h | 18 +- doc/autoinclude/ApplicationMetada.doc | 88 +++ package/libzypp.changes | 8 + tests/zypp/CpeId_test.cc | 8 +- tests/zypp/Dup_test.cc | 4 +- tests/zypp/KeyRingTestReceiver.h | 4 +- tests/zypp/PtrTypes_test.cc | 34 +- tests/zypp/ResStatus_test.cc | 12 +- tests/zypp/Selectable_test.cc | 12 +- zypp/Arch.cc | 8 +- zypp/AutoDispose.h | 34 +- zypp/Bit.h | 180 ++--- zypp/CMakeLists.txt | 1 - zypp/Callback.h | 42 +- zypp/Capability.cc | 6 +- zypp/CpeId.cc | 10 +- zypp/CpeId.h | 8 +- zypp/Date.h | 12 +- zypp/ExternalProgram.cc | 4 +- zypp/ExternalProgram.h | 8 +- zypp/Filter.h | 24 +- zypp/Glob.cc | 4 +- zypp/Glob.h | 36 +- zypp/MediaProducts.cc | 27 - zypp/MediaProducts.h | 8 +- zypp/Patch.h | 8 +- zypp/PathInfo.cc | 148 ++-- zypp/PluginScript.cc | 8 +- zypp/PoolItemBest.h | 8 +- zypp/PoolQuery.cc | 4 +- zypp/PoolQueryResult.h | 4 +- zypp/Product.h | 4 +- zypp/PublicKey.cc | 2 +- zypp/Range.h | 38 +- zypp/RelCompare.h | 111 ++- zypp/RepoInfo.h | 24 +- zypp/RepoManager.cc | 2 +- zypp/Repository.cc | 8 +- zypp/Repository.h | 6 +- zypp/ResFilters.h | 51 +- zypp/ResObject.h | 44 +- zypp/ResPool.h | 50 +- zypp/ResPoolProxy.h | 60 +- zypp/ResStatus.h | 16 +- zypp/ResTraits.h | 22 +- zypp/Resolvable.h | 16 +- zypp/VendorAttr.h | 4 +- zypp/ZConfig.cc | 14 +- zypp/ZYppCallbacks.h | 4 +- zypp/base/Algorithm.h | 18 +- zypp/base/Collector.h | 26 +- zypp/base/Counter.h | 12 +- zypp/base/Debug.h | 26 +- zypp/base/DefaultIntegral.h | 38 +- zypp/base/DtorReset.h | 24 +- zypp/base/EnumClass.h | 26 +- zypp/base/Exception.h | 37 +- zypp/base/Flags.h | 14 +- zypp/base/Functional.h | 222 +++--- zypp/base/Gettext.h | 4 +- zypp/base/GzStream.h | 10 +- zypp/base/Hash.h | 14 +- zypp/base/Iterable.h | 10 +- zypp/base/Iterator.h | 96 +-- zypp/base/LogControl.h | 4 +- zypp/base/LogTools.h | 136 ++-- zypp/base/Logger.h | 38 +- zypp/base/Measure.cc | 42 +- zypp/base/Measure.h | 12 + zypp/base/NamedValue.h | 32 +- zypp/base/ProvideNumericId.h | 10 +- zypp/base/PtrTypes.h | 290 ++++---- zypp/base/SetRelationMixin.cc | 4 +- zypp/base/SetRelationMixin.h | 16 +- zypp/base/SetTracker.h | 22 +- zypp/base/StrMatcher.cc | 5 +- zypp/base/StrMatcher.h | 4 +- zypp/base/String.h | 83 +-- zypp/base/TypeTraits.h | 28 +- zypp/base/ValueTransform.h | 12 +- zypp/base/Xml.h | 12 +- zypp/media/MediaHandler.cc | 8 +- zypp/media/MediaHandler.h | 2 +- zypp/media/ProxyInfo.cc | 2 +- zypp/media/proxyinfo/ProxyInfos.h | 2 +- zypp/parser/xml/Parse.h | 14 +- zypp/parser/xml/ParseDefConsume.h | 61 +- zypp/pool/PoolStats.h | 4 +- zypp/pool/PoolTraits.h | 12 +- zypp/sat/FileConflicts.h | 4 +- zypp/sat/LookupAttr.cc | 8 +- zypp/sat/LookupAttr.h | 35 +- zypp/sat/LookupAttrTools.h | 46 +- zypp/sat/Map.cc | 20 +- zypp/sat/Map.h | 13 +- zypp/sat/Pool.cc | 8 +- zypp/sat/Pool.h | 12 +- zypp/sat/Queue.cc | 16 +- zypp/sat/Queue.h | 12 +- zypp/sat/SolvIterMixin.h | 4 +- zypp/sat/Solvable.cc | 10 +- zypp/sat/Solvable.h | 16 +- zypp/sat/SolvableSet.h | 12 +- zypp/sat/SolvableType.h | 12 +- zypp/sat/Transaction.h | 4 - zypp/sat/WhatObsoletes.h | 4 +- zypp/sat/detail/PoolImpl.cc | 28 +- zypp/sat/detail/PoolImpl.h | 32 +- zypp/sat/detail/PoolMember.h | 28 +- zypp/solver/detail/SATResolver.cc | 353 ++++------ zypp/solver/detail/SATResolver.h | 19 +- zypp/solver/detail/SolverQueueItem.h | 6 +- zypp/solver/detail/SolverQueueItemDelete.cc | 2 +- zypp/solver/detail/SolverQueueItemDelete.h | 2 +- zypp/solver/detail/SolverQueueItemInstall.cc | 2 +- zypp/solver/detail/SolverQueueItemInstall.h | 2 +- zypp/solver/detail/SolverQueueItemInstallOneOf.cc | 2 +- zypp/solver/detail/SolverQueueItemInstallOneOf.h | 2 +- zypp/solver/detail/SolverQueueItemLock.cc | 2 +- zypp/solver/detail/SolverQueueItemLock.h | 2 +- zypp/solver/detail/SolverQueueItemUpdate.cc | 2 +- zypp/solver/detail/SolverQueueItemUpdate.h | 2 +- zypp/target/CommitPackageCache.h | 4 +- zypp/target/TargetImpl.commitFindFileConflicts.cc | 6 +- zypp/target/rpm/RpmDb.cc | 169 +++-- zypp/ui/Selectable.h | 12 +- zypp/ui/SelectableImpl.cc | 4 +- zypp/ui/SelectableImpl.h | 6 +- 153 files changed, 1889 insertions(+), 4920 deletions(-) delete mode 100644 devel/devel.ma/AOUT.cc delete mode 100644 devel/devel.ma/CleandepsOnRemove.cc delete mode 100644 devel/devel.ma/CommitCb.cc delete mode 100644 devel/devel.ma/DumpSolv.cc delete mode 100644 devel/devel.ma/Ex.cc delete mode 100644 devel/devel.ma/ExPure.cc delete mode 100644 devel/devel.ma/FakePool.cc delete mode 100644 devel/devel.ma/FakePool.h delete mode 100644 devel/devel.ma/FilelistTransform.cc delete mode 100644 devel/devel.ma/Parse.cc delete mode 100644 devel/devel.ma/TransList.cc delete mode 100644 devel/devel.ma/defstr.txt delete mode 100644 devel/devel.ma/iorderbug.pool delete mode 100644 devel/devel.ma/main.cc create mode 100644 doc/autoinclude/ApplicationMetada.doc delete mode 100644 zypp/MediaProducts.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index ff6dfdf..3377079 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -190,7 +190,7 @@ ELSE( DISABLE_LIBPROXY ) MESSAGE( STATUS "libproxy not found" ) ELSE ( NOT LIBPROXY_FOUND ) INCLUDE_DIRECTORIES( ${LIBPROXY_INCLUDE_DIR} ) - ADD_DEFINITIONS(-D_WITH_LIBPROXY_SUPPORT_) + ADD_DEFINITIONS(-DWITH_LIBPROXY_SUPPORT) ENDIF( NOT LIBPROXY_FOUND ) ENDIF( DISABLE_LIBPROXY ) diff --git a/VERSION.cmake b/VERSION.cmake index cdfd9b3..dd5aca6 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -59,10 +59,10 @@ # See './mkChangelog -h' for help. # SET(LIBZYPP_MAJOR "15") -SET(LIBZYPP_COMPATMINOR "14") -SET(LIBZYPP_MINOR "18") +SET(LIBZYPP_COMPATMINOR "19") +SET(LIBZYPP_MINOR "19") SET(LIBZYPP_PATCH "0") # -# LAST RELEASED: 15.18.0 (14) +# LAST RELEASED: 15.19.0 (19) # (The number in parenthesis is LIBZYPP_COMPATMINOR) #======= diff --git a/devel/devel.ma/AOUT.cc b/devel/devel.ma/AOUT.cc deleted file mode 100644 index b56ad18..0000000 --- a/devel/devel.ma/AOUT.cc +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include "zypp/base/Logger.h" -#include "zypp/base/LogTools.h" -#include "zypp/base/Function.h" -#include "zypp/base/IOStream.h" -#include "zypp/base/InputStream.h" -#include "zypp/ProgressData.h" - -#include "zypp/base/Random.h" - -#include - -using std::endl; -using namespace zypp; - - -void action( int i_r ) -{ - unsigned sec = base::random( 3 ); - sleep( sec ); - MIL << "Action " << i_r << " (" << sec << ")" << endl; -} - - -int main( int argc, char * argv[] ) -{ - INT << "===[START]==========================================" << endl; - - for ( unsigned i = 0; i < 5; ++i ) - { - new boost::thread( bind( action, i ) ); - } - - INT << "===[END]============================================" << endl << endl; - return ( 0 ); -} diff --git a/devel/devel.ma/CleandepsOnRemove.cc b/devel/devel.ma/CleandepsOnRemove.cc deleted file mode 100644 index 7a378e6..0000000 --- a/devel/devel.ma/CleandepsOnRemove.cc +++ /dev/null @@ -1,141 +0,0 @@ -#include "Tools.h" - -#include -#include -#include - -#include "zypp/sat/WhatObsoletes.h" -#include "zypp/ExternalProgram.h" - -/////////////////////////////////////////////////////////////////// - -//static const Pathname sysRoot( getenv("SYSROOT") ? getenv("SYSROOT") : "/Local/ROOT" ); -//static const Pathname sysRoot( "/tmp/ToolScanRepos" ); -static const Pathname sysRoot( "/" ); - -/////////////////////////////////////////////////////////////////// - -bool solve() -{ - bool rres = false; - { - //zypp::base::LogControl::TmpLineWriter shutUp; - //getZYpp()->resolver()->setOnlyRequires( true ); - rres = getZYpp()->resolver()->resolvePool(); - } - if ( ! rres ) - { - ERR << "resolve " << rres << endl; - getZYpp()->resolver()->problems(); - return false; - } - MIL << "resolve " << rres << endl; - return true; -} - -bool upgrade() -{ - bool rres = false; - { - //zypp::base::LogControl::TmpLineWriter shutUp; - Measure x( "Upgrade" ); - rres = getZYpp()->resolver()->doUpgrade(); - } - if ( ! rres ) - { - Measure x( "Upgrade Error" ); - ERR << "upgrade " << rres << endl; - getZYpp()->resolver()->problems(); - return false; - } - MIL << "upgrade " << rres << endl; - return true; -} - -namespace zypp -{ - namespace target - { - void writeUpgradeTestcase(); - } -} - -std::ostream & operator<<( std::ostream & str, const sat::Solvable::SplitIdent & obj ) -{ - str << "{" << obj.ident() << "}{" << obj.kind() << "}{" << obj.name () << "}" << endl; - return str; -} - -namespace zypp { -std::ostream & dumpOn( std::ostream & str, const Url & obj ) -{ - str << "{" << obj.getHost() << "}{" << obj.getPort() << "}"; - return str; -} -} - -int main( int argc, char * argv[] ) -try { - --argc,++argv; - zypp::base::LogControl::instance().logToStdErr(); - INT << "===[START]==========================================" << endl; - /////////////////////////////////////////////////////////////////// - if ( sysRoot == "/" ) - ::unsetenv( "ZYPP_CONF" ); - ResPool pool( ResPool::instance() ); - sat::Pool satpool( sat::Pool::instance() ); - /////////////////////////////////////////////////////////////////// - dumpRange( WAR << "satpool.multiversion " , satpool.multiversionBegin(), satpool.multiversionEnd() ) << endl; - TestSetup::LoadSystemAt( sysRoot, Arch_i586 ); - /////////////////////////////////////////////////////////////////// - - char * fix[] = { - "test" - }; - argv = fix; - argc = arraySize(fix); - for ( ; argc; --argc,++argv ) - { - ui::Selectable::Ptr p( getSel( *argv ) ); - if ( p ) - USR << p->setToDelete() << endl; - else - ERR << p << endl; - } - - std::set todel; - { - getZYpp()->resolver()->setCleandepsOnRemove( false ); - SEC << "=== Solve noclean:" << endl; - solve(); - std::copy( make_filter_begin(pool), - make_filter_end(pool), - std::inserter( todel, todel.begin() ) ); - WAR << todel << endl; - } - { - getZYpp()->resolver()->setCleandepsOnRemove( true ); - SEC << "=== Solve clean:" << endl; - solve(); - SEC << "========================================================" << endl; - for_( it, make_filter_begin(pool), make_filter_end(pool) ) - { - ( todel.find( *it ) == todel.end() ? INT : USR ) << *it << endl; - } - SEC << "========================================================" << endl; - } - - - - /////////////////////////////////////////////////////////////////// - INT << "===[END]============================================" << endl << endl; - zypp::base::LogControl::instance().logNothing(); - return 0; -} -catch ( const Exception & exp ) -{ - INT << exp << endl << exp.historyAsString(); -} -catch (...) -{} - diff --git a/devel/devel.ma/CommitCb.cc b/devel/devel.ma/CommitCb.cc deleted file mode 100644 index a0990ba..0000000 --- a/devel/devel.ma/CommitCb.cc +++ /dev/null @@ -1,164 +0,0 @@ -#include "Tools.h" -#include - -#include -#include -#include - -struct IRR : public zypp::callback::ReceiveReport -{ - IRR() - { connect(); } -#if 0 - enum Action { - ABORT, // abort and return error - RETRY, // retry - IGNORE // ignore the failure - }; - - enum Error { - NO_ERROR, - NOT_FOUND, // the requested Url was not found - IO, // IO error - INVALID // th resolvable is invalid - }; - - // the level of RPM pushing - /** \deprecated We fortunately no longer do 3 attempts. */ - enum RpmLevel { - RPM, - RPM_NODEPS, - RPM_NODEPS_FORCE - }; -#endif - - virtual void reportbegin() - { SEC << endl; } - virtual void reportend() - { SEC << endl; } - - virtual void start(Resolvable::constPtr /*resolvable*/) - { INT << endl; } - - virtual bool progress(int /*value*/, Resolvable::constPtr /*resolvable*/) - { - static int i = 4; - if ( --i <= 0 ) - { - INT << "return abort" << endl; - return false; - } - return true; - } - - virtual Action problem(Resolvable::constPtr /*resolvable*/, Error /*error*/, const std::string &/*description*/, RpmLevel /*level*/) - { - INT << "return abort" << endl; - return ABORT; - } - - virtual void finish(Resolvable::constPtr /*resolvable*/, Error /*error*/, const std::string &/*reason*/, RpmLevel /*level*/) - { INT << endl; } -}; - -struct RRR : public zypp::callback::ReceiveReport -{ - RRR() - { connect(); } -#if 0 - enum Action { - ABORT, // abort and return error - RETRY, // retry - IGNORE // ignore the failure - }; - - enum Error { - NO_ERROR, - NOT_FOUND, // the requested Url was not found - IO, // IO error - INVALID // th resolvable is invalid - }; -#endif - - virtual void reportbegin() - { SEC << endl; } - virtual void reportend() - { SEC << endl; } - - virtual void start( Resolvable::constPtr /*resolvable*/ ) - { INT << endl; } - - virtual bool progress(int /*value*/, Resolvable::constPtr /*resolvable*/) - { INT << endl; return true; } - - virtual Action problem( Resolvable::constPtr /*resolvable*/ , Error /*error*/ , const std::string &/*description*/ ) - { INT << endl; return ABORT; } - - virtual void finish( Resolvable::constPtr /*resolvable*/ , Error /*error*/ , const std::string &/*reason*/ ) - { INT << endl; } -}; - -bool solve() -{ - static unsigned run = 0; - USR << "Solve " << run++ << endl; - bool rres = false; - { - zypp::base::LogControl::TmpLineWriter shutUp; - rres = getZYpp()->resolver()->resolvePool(); - } - if ( ! rres ) - { - ERR << "resolve " << rres << endl; - getZYpp()->resolver()->problems(); - return false; - } - return true; -} - -bool install() -{ - ZYppCommitPolicy pol; -//pol.dryRun(true); - pol.rpmInstFlags( pol.rpmInstFlags().setFlag( target::rpm::RPMINST_JUSTDB ) ); - SEC << "START commit..." << endl; - SEC << getZYpp()->commit( pol ) << endl; - return true; -} - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - INT << "===[START]==========================================" << endl; - IRR _irr; - RRR _rrr; - Pathname mroot( "/tmp/ToolScanRepos" ); - TestSetup test( mroot, Arch_i586 ); - test.loadTarget(); - test.loadRepos(); - - ResPool pool( test.pool() ); - ui::Selectable::Ptr sel; - - getSel( "rpm" )->setToInstall(); - vdumpPoolStats( USR << "Selected:"<< endl, - make_filter_begin(pool), - make_filter_end(pool) ) << endl; - - if ( solve() ) - { - vdumpPoolStats( USR << "Solved:"<< endl, - make_filter_begin(pool), - make_filter_end(pool) ) << endl; - - install(); - } - - INT << "===[END]============================================" << endl << endl; - return 0; -} - diff --git a/devel/devel.ma/DumpSolv.cc b/devel/devel.ma/DumpSolv.cc deleted file mode 100644 index ad93024..0000000 --- a/devel/devel.ma/DumpSolv.cc +++ /dev/null @@ -1,289 +0,0 @@ -#include "Tools.h" - -#include -#include - - -static std::string appname( __FILE__ ); -static TestSetup test; - -/////////////////////////////////////////////////////////////////// - -#define OUT USR -#define HEADL SEC << "===> " - -inline std::ostream & errmessage( const std::string & msg_r = std::string() ) -{ - cerr << "*** "; - if ( ! msg_r.empty() ) - cerr << msg_r << endl; - return cerr; -} - -int usage( const std::string & msg_r = std::string(), int exit_r = 100 ) -{ - if ( ! msg_r.empty() ) - { - cerr << endl; - errmessage( msg_r ); - cerr << endl; - } - cerr << "Usage: " << appname << " TESTCASE" << endl; - cerr << " Load and process testcase." << endl; - return exit_r; -} - -/////////////////////////////////////////////////////////////////// - -bool upgrade() -{ - bool rres = false; - { - zypp::base::LogControl::TmpLineWriter shutUp; - rres = getZYpp()->resolver()->doUpgrade(); - } - if ( ! rres ) - { - ERR << "upgrade " << rres << endl; - getZYpp()->resolver()->problems(); - return false; - } - MIL << "upgrade " << rres << endl; - return true; -} - -bool solve() -{ - static unsigned run = 0; - USR << "Solve " << run++ << endl; - bool rres = false; - { - zypp::base::LogControl::TmpLineWriter shutUp; - rres = getZYpp()->resolver()->resolvePool(); - } - if ( ! rres ) - { - ERR << "resolve " << rres << endl; - getZYpp()->resolver()->problems(); - return false; - } - - return true; -} - -/////////////////////////////////////////////////////////////////// - -/** -*/ -struct ArgList -{ - typedef std::vector::const_iterator const_iterator; - - ArgList() - {} - - ArgList( const std::string & line_r ) - { str::splitEscaped( line_r, std::back_inserter(_argv) ); } - - const_iterator begin() const { const_iterator ret =_argv.begin(); for ( unsigned i = _carg; i; --i ) ++ret; return ret; } - const_iterator end() const { return _argv.end(); } - - void clear() { _argv.clear(); _carg = 0; } - bool empty() const { return _argv.size() == _carg; } - unsigned size() const { return _argv.size() - _carg; } - - std::string & operator[]( int idx ) { return _argv[_carg+idx]; } - const std::string & operator[]( int idx ) const { return _argv[_carg+idx]; } - - std::string at( int idx ) const { return _carg+idx < _argv.size() ? _argv[_carg+idx] : std::string(); } - - unsigned carg() const { return _carg; } - void poparg( int cnt = 1 ) { _carg = arange( _carg + cnt ); } - - public: - std::vector & get() { return _argv; } - const std::vector & get() const { return _argv; } - private: - unsigned arange( int idx ) const { return idx < 0 ? 0 : std::min( unsigned(idx), _argv.size() ); } - private: - DefaultIntegral _carg; - std::vector _argv; -}; - -std::ostream & operator<<( std::ostream & str, const ArgList & obj ) -{ - for_( it, 0U, obj.get().size() ) - { - str << ( it == obj.carg() ? " | " : " " ) << obj.get()[it]; - } - return str; -} - -/////////////////////////////////////////////////////////////////// -#define DELGATE(N,F) if ( argv.at(0) == #N ) { argv.poparg(); F( argv ); return; } -/////////////////////////////////////////////////////////////////// - -void exitCmd( ArgList & argv ) -{ - HEADL << argv << endl; - INT << "===[END]============================================" << endl << endl; - zypp::base::LogControl::TmpLineWriter shutUp; - ::exit( 0 ); -} - -/////////////////////////////////////////////////////////////////// - -void helpCmd( ArgList & argv ) -{ - HEADL << argv << endl; - OUT << "list repos - list repos in pool" << endl; - OUT << "list NAME... - list solvables named or providing NAME" << endl; - OUT << "help - this" << endl; - OUT << "exit - exit" << endl; -} - -/////////////////////////////////////////////////////////////////// - -void listReposCmd( ArgList & argv ) -{ - HEADL << "list repos" << endl; - - sat::Pool satpool( test.satpool() ); - for_( it, satpool.reposBegin(), satpool.reposEnd() ) - { - OUT << *it << endl; - } -} - -void listIdent( IdString ident_r ) -{ - HEADL << "list " << ident_r << endl; - - ui::Selectable::Ptr sel( ui::Selectable::get( ident_r ) ); - if ( sel ) - { - OUT << sel->ident() - << " I" << sel->installedSize() - << " A" << sel->availableSize() - << " " << sel->status() - << endl; - for_( it, sel->installedBegin(), sel->installedEnd() ) - { - OUT << "i " << *it << endl; - } - PoolItem cand( sel->candidateObj() ); - for_( it, sel->availableBegin(), sel->availableEnd() ) - { - OUT << (*it == cand ? "* " : " ") << *it << endl; - } - } - - { - sat::WhatProvides q( (Capability( ident_r.id() )) ); - bool head = true; - for_( it, q.begin(), q.end() ) - { - if ( it->ident() != ident_r ) - { - if ( head ) - { - OUT << "provided by:" << endl; - head = false; - } - OUT << " " << PoolItem( *it ) << endl; - } - } - } -} - - -void listCmd( ArgList & argv ) -{ - DELGATE( repos, listReposCmd ); - - for_( it, argv.begin(), argv.end() ) - { - listIdent( IdString(*it) ); - } -} - -/////////////////////////////////////////////////////////////////// - -void gocmd( ArgList & argv ) -{ - if ( argv.empty() ) - { - helpCmd( argv ); - return; - } - - switch ( argv[0][0] ) - { - case 'e': - DELGATE( exit, exitCmd ); - break; - - case 'h': - DELGATE( help, helpCmd ); - break; - - case 'l': - DELGATE( list, listCmd ); - break; - } - // no command fall back to list - listCmd( argv ); -} - -void goprompt() -{ - std::cin.tie( &std::cout ); - - do { - ArgList argv; - std::cout << "Hallo : "; - str::splitEscaped( iostr::getline( std::cin ), std::back_inserter(argv.get()) ); - gocmd( argv ); - } while ( true ); - -} - -/////////////////////////////////////////////////////////////////// - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - INT << "===[START]==========================================" << endl; - appname = Pathname::basename( argv[0] ); - --argc; - ++argv; - /////////////////////////////////////////////////////////////////// - - if ( !argc ) - return usage(); - - Pathname mtest( *argv ); - --argc; - ++argv; - - if ( ! PathInfo( mtest / "solver-test.xml" ).isFile() ) - { - return usage( "No testcase at " + mtest.asString() ); - } - - /////////////////////////////////////////////////////////////////// - - test.loadTestcaseRepos( mtest ); // <<< repos -#define GOCMD(c) { ArgList argv( #c ); gocmd( argv ); } - GOCMD( tgt ); - GOCMD( iscsitarget ); - goprompt(); - - INT << "===[END]============================================" << endl << endl; - zypp::base::LogControl::TmpLineWriter shutUp; - return 0; -} diff --git a/devel/devel.ma/Ex.cc b/devel/devel.ma/Ex.cc deleted file mode 100644 index 915644c..0000000 --- a/devel/devel.ma/Ex.cc +++ /dev/null @@ -1,166 +0,0 @@ -#include "Tools.h" - -#include -#include -#include -#include -#include - -#include "zypp/ZYppFactory.h" -#include "zypp/ResPoolProxy.h" - -#include "zypp/ZYppCallbacks.h" -#include "zypp/NVRAD.h" -#include "zypp/ResPool.h" -#include "zypp/ResFilters.h" -#include "zypp/Package.h" -#include "zypp/Pattern.h" -#include "zypp/Language.h" -#include "zypp/Digest.h" -#include "zypp/PackageKeyword.h" - - -#include "zypp/parser/TagParser.h" -#include "zypp/parser/susetags/PackagesFileReader.h" -#include "zypp/parser/susetags/PackagesLangFileReader.h" -#include "zypp/parser/susetags/PatternFileReader.h" -#include "zypp/parser/susetags/ContentFileReader.h" -#include "zypp/parser/susetags/RepoIndex.h" -#include "zypp/parser/susetags/RepoParser.h" -#include "zypp/cache/CacheStore.h" -#include "zypp/RepoManager.h" -#include "zypp/RepoInfo.h" - -#include "zypp/ui/PatchContents.h" -#include "zypp/ResPoolProxy.h" - -using namespace std; -using namespace zypp; -using namespace zypp::functor; -using namespace zypp::ui; -using zypp::parser::TagParser; - -/////////////////////////////////////////////////////////////////// - -static const Pathname sysRoot( "/Local/GTEST" ); - -/////////////////////////////////////////////////////////////////// - -struct Xprint -{ - bool operator()( const PoolItem & obj_r ) - { -// handle( asKind( obj_r ) ); -// handle( asKind( obj_r ) ); -// handle( asKind( obj_r ) ); -// handle( asKind( obj_r ) ); - return true; - } - - void handle( const Package_constPtr & p ) - { - if ( !p ) - return; - } - - void handle( const Patch_constPtr & p ) - { - if ( !p ) - return; - } - - void handle( const Pattern_constPtr & p ) - { - if ( !p ) - return; - } - - void handle( const Product_constPtr & p ) - { - if ( !p ) - return; - } -}; - -/////////////////////////////////////////////////////////////////// -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - //zypp::base::LogControl::instance().logfile( "log.restrict" ); - INT << "===[START]==========================================" << endl; - - setenv( "ZYPP_CONF", (sysRoot/"zypp.conf").c_str(), 1 ); - - RepoManager repoManager( makeRepoManager( sysRoot ) ); - RepoInfoList repos = repoManager.knownRepositories(); - SEC << "knownRepositories " << repos << endl; - - if ( repos.empty() ) - { - RepoInfo nrepo; - nrepo - .setAlias( "factorytest" ) - .setName( "Test Repo for factory." ) - .setEnabled( true ) - .setAutorefresh( false ) - .addBaseUrl( Url("http://dist.suse.de/install/stable-x86/") ); - - repoManager.addRepository( nrepo ); - repos = repoManager.knownRepositories(); - } - - for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it ) - { - RepoInfo & nrepo( *it ); - if ( ! nrepo.enabled() ) - continue; - - SEC << "refreshMetadata" << endl; - repoManager.refreshMetadata( nrepo ); - - if ( ! repoManager.isCached( nrepo ) || 0 ) - { - if ( repoManager.isCached( nrepo ) ) - { - SEC << "cleanCache" << endl; - repoManager.cleanCache( nrepo ); - } - SEC << "refreshMetadata" << endl; - repoManager.refreshMetadata( nrepo, RepoManager::RefreshForced ); - SEC << "buildCache" << endl; - repoManager.buildCache( nrepo ); - } - - SEC << nrepo << endl; - Repository nrep( repoManager.createFromCache( nrepo ) ); - const zypp::ResStore & store( nrep.resolvables() ); - dumpPoolStats( SEC << "Store: " << endl, - store.begin(), store.end() ) << endl; - getZYpp()->addResolvables( store ); - } - - ResPool pool( getZYpp()->pool() ); - vdumpPoolStats( USR << "Initial pool:" << endl, - pool.begin(), - pool.end() ) << endl; - - if ( 0 ) - { - { - //zypp::base::LogControl::TmpLineWriter shutUp; - getZYpp()->initTarget( sysRoot ); - } - MIL << "Added target: " << pool << endl; - } - - std::for_each( pool.begin(), pool.end(), Xprint() ); - - /////////////////////////////////////////////////////////////////// - INT << "===[END]============================================" << endl << endl; - zypp::base::LogControl::instance().logNothing(); - return 0; -} diff --git a/devel/devel.ma/ExPure.cc b/devel/devel.ma/ExPure.cc deleted file mode 100644 index 6b353a8..0000000 --- a/devel/devel.ma/ExPure.cc +++ /dev/null @@ -1,189 +0,0 @@ -#include - -#include - -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace zypp; -using namespace zypp::parser::yum; - -#include "zypp/parser/yum/YUMParser.h" - -/////////////////////////////////////////////////////////////////// - -template - void ti( const _Cl & c ) - { - SEC << __PRETTY_FUNCTION__ << endl; - } -/////////////////////////////////////////////////////////////////// - -template - bool consume( const typename _Parser::value_type & node_r ) - { - //DBG << node_r << endl; - return true; - } - -template - void parseXmlFile( const Pathname & file_r, - function consume_r - = consume<_Parser> ) - { - Measure x( " zparse "+file_r.asString() ); - ifgzstream istr( file_r.asString().c_str() ); - if ( ! istr ) - { - ZYPP_THROW( Exception( "Bad stream" ) ); - } - - for( _Parser parser( istr, "" ); ! parser.atEnd(); ++parser ) - { - if ( consume_r && ! consume_r( *parser ) ) - { - DBG << "abort parseXmlFile " << file_r << endl; - return; - } - } - } - -bool consumeRepomd( const YUMRepomdParser::value_type & node_r ) -{ - DBG << node_r << endl; - return true; -} - -void zparse( const Pathname & repodata_r ) -{ - Measure x( "ZPARSE" ); - parseXmlFile ( repodata_r / "repomd.xml", consumeRepomd ); - parseXmlFile ( repodata_r / "primary.xml" ); - parseXmlFile ( repodata_r / "other.xml" ); - parseXmlFile( repodata_r / "filelists.xml" ); - //parseXmlFile ( repodata_r / "patches.xml" ); -} - -/////////////////////////////////////////////////////////////////// - -/** - * processNode: - * @reader: the xmlReader - * - * Dump information about the current node - */ -template -static void -processNode(xmlTextReaderPtr reader, const _ParserValueType & stp ) { - const xmlChar *name, *value; - - name = xmlTextReaderConstName(reader); - if (name == NULL) - name = BAD_CAST "--"; - - value = xmlTextReaderConstValue(reader); - string t; - if ( value ) - { - t = (const char *)value; - } - return; - printf("%d %d %s %d %d", - xmlTextReaderDepth(reader), - xmlTextReaderNodeType(reader), - name, - xmlTextReaderIsEmptyElement(reader), - xmlTextReaderHasValue(reader)); - if (value == NULL) - printf("\n"); - else { - if (xmlStrlen(value) > 40) - printf(" %.40s...\n", value); - else - printf(" %s\n", value); - } -} - - -/** - * streamFile: - * @filename: the file name to parse - * - * Parse and print information about an XML file. - */ -template -static void -streamFile(const char *filename) { - Measure x( string(" lparse ")+filename ); - xmlTextReaderPtr reader; - int ret; - - typename _Parser::value_type stp; - - reader = xmlReaderForFile(filename, NULL, 0); - if (reader != NULL) { - ret = xmlTextReaderRead(reader); - while (ret == 1) { - stp = new typename _Parser::value_type::element_type; - processNode(reader, stp); - ret = xmlTextReaderRead(reader); - } - xmlFreeTextReader(reader); - if (ret != 0) { - ZYPP_THROW( Exception( string("Failed to parse ") + filename ) ); - } - } else { - ZYPP_THROW( Exception( string("Unable to open ") + filename ) ); - } -} - -void lparse( const Pathname & repodata_r ) -{ - Measure x( "LPARSE" ); - /* - * this initialize the library and check potential ABI mismatches - * between the version it was compiled for and the actual shared - * library used. - */ - LIBXML_TEST_VERSION - - streamFile ( (repodata_r / "repomd.xml").asString().c_str() ); - streamFile ( (repodata_r / "primary.xml").asString().c_str() ); - streamFile ( (repodata_r / "other.xml").asString().c_str() ); - streamFile( (repodata_r / "filelists.xml").asString().c_str() ); - //streamFile ( (repodata_r / "patches.xml").asString().c_str() ); - - /* - * Cleanup function for the XML library. - */ - xmlCleanupParser(); - - /* - * this is to debug memory for regression tests - */ - xmlMemoryDump(); -} - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - INT << "===[START]==========================================" << endl; - - Pathname repodata( "/Local/PATCHES/repodata" ); - repodata = "/Local/FACTORY/repodata"; - lparse( repodata ); - zparse( repodata ); - - INT << "===[END]============================================" << endl << endl; - return 0; -} - diff --git a/devel/devel.ma/ExplicitMap.h b/devel/devel.ma/ExplicitMap.h index 4265f36..7471492 100644 --- a/devel/devel.ma/ExplicitMap.h +++ b/devel/devel.ma/ExplicitMap.h @@ -23,7 +23,7 @@ namespace zypp /////////////////////////////////////////////////////////////////// // - // CLASS NAME : ExplicitMap<_Key, _Tp> + // CLASS NAME : ExplicitMap // /** A simple lookup map using default value for not existing entries. * @@ -33,17 +33,17 @@ namespace zypp * \ref TmpUnset and \ref TmpSetDefault are provided to temporarily * change and automaticlly restore values. */ - template + template class ExplicitMap { public: - typedef typename boost::call_traits<_Tp>::value_type value_type; - typedef typename boost::call_traits<_Tp>::reference reference; - typedef typename boost::call_traits<_Tp>::const_reference const_reference; - typedef typename boost::call_traits<_Tp>::param_type param_type; + typedef typename boost::call_traits::value_type value_type; + typedef typename boost::call_traits::reference reference; + typedef typename boost::call_traits::const_reference const_reference; + typedef typename boost::call_traits::param_type param_type; private: - typedef typename std::map<_Key,value_type> map_type; + typedef typename std::map map_type; typedef typename map_type::iterator iterator; public: @@ -60,13 +60,13 @@ namespace zypp : _mapDefault( mapDefault_r ) {} - template - ExplicitMap( _InputIterator first_r, _InputIterator last_r ) + template + ExplicitMap( TInputIterator first_r, TInputIterator last_r ) : _map( first_r, last_r ) {} - template - ExplicitMap( _InputIterator first_r, _InputIterator last_r, + template + ExplicitMap( TInputIterator first_r, TInputIterator last_r, param_type mapDefault_r ) : _map( first_r, last_r ) , _mapDefault( mapDefault_r ) @@ -110,8 +110,8 @@ namespace zypp void set( const key_type & key_r, param_type value_r ) { _map[key_r] = value_r; } - template - void set( _InputIterator first_r, _InputIterator last_r ) + template + void set( TInputIterator first_r, TInputIterator last_r ) { _map.insert( first_r, last_r ); } void unset( const key_type & key_r ) @@ -133,11 +133,11 @@ namespace zypp /////////////////////////////////////////////////////////////////// // - // CLASS NAME : ExplicitMap<_Key, _Tp>::TmpSet + // CLASS NAME : ExplicitMap::TmpSet // /** Temporarily set a value. */ - template - class ExplicitMap<_Key, _Tp>::TmpSet + template + class ExplicitMap::TmpSet { public: TmpSet( ExplicitMap & map_r, const key_type & key_r, param_type value_r ) @@ -179,11 +179,11 @@ namespace zypp /////////////////////////////////////////////////////////////////// // - // CLASS NAME : ExplicitMap<_Key, _Tp>::TmpUnset + // CLASS NAME : ExplicitMap::TmpUnset // /** Temporarily unset a value. */ - template - class ExplicitMap<_Key, _Tp>::TmpUnset + template + class ExplicitMap::TmpUnset { public: TmpUnset( ExplicitMap & map_r, const key_type & key_r ) @@ -221,11 +221,11 @@ namespace zypp /////////////////////////////////////////////////////////////////// // - // CLASS NAME : ExplicitMap<_Key, _Tp>::TmpSetDefault + // CLASS NAME : ExplicitMap::TmpSetDefault // /** Temporarily change the default value. */ - template - class ExplicitMap<_Key, _Tp>::TmpSetDefault + template + class ExplicitMap::TmpSetDefault { public: TmpSetDefault( ExplicitMap & map_r, param_type value_r ) diff --git a/devel/devel.ma/FakePool.cc b/devel/devel.ma/FakePool.cc deleted file mode 100644 index 3b0c10b..0000000 --- a/devel/devel.ma/FakePool.cc +++ /dev/null @@ -1,84 +0,0 @@ -#include "Tools.h" -#include "Tools.h" - -#include - -#include -#include -#include -#include -#include -#include -#include "zypp/ResPoolProxy.h" - -using namespace std; -using namespace zypp; -using namespace zypp::ui; - -bool chst( Selectable::Ptr & sel, Status status ) -{ - DBG << "+++ " << sel << endl; - Status ostatus( sel->status() ); - bool res = sel->set_status( status ); - (res?MIL:WAR) << ostatus << " -> " << status << " ==>(" << res << ") " << sel->status() << endl; - DBG << "--- " << sel << endl; - return res; -} - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - INT << "===[START]==========================================" << endl; - - const char *const lines[] = { - "@ package", - "@ installed", - "- foo 1 1 i686", - "@ available", - "- foo 2 1 i686", - "@ fin" - }; - - debug::addPool( lines, lines+(sizeof(lines)/sizeof(const char *const)) ); - - ResPool pool( getZYpp()->pool() ); - ResPoolProxy uipool( getZYpp()->poolProxy() ); - - USR << pool << endl; - USR << uipool << endl; - - //for_each( pool.begin(), pool.end(), Print() ); - - Selectable::Ptr sel( *uipool.byKindBegin() ); - -/* enum Status - { - S_Protected, // Keep this unmodified ( have installedObj && S_Protected ) - S_Taboo, // Keep this unmodified ( have no installedObj && S_Taboo) - // requested by user: - S_Del, // delete installedObj ( clears S_Protected if set ) - S_Update, // install candidateObj ( have installedObj, clears S_Protected if set ) - S_Install, // install candidateObj ( have no installedObj, clears S_Taboo if set ) - // not requested by user: - S_AutoDel, // delete installedObj - S_AutoUpdate, // install candidateObj ( have installedObj ) - S_AutoInstall, // install candidateObj ( have no installedObj ) - // no modification: - S_KeepInstalled, // no modification ( have installedObj && !S_Protected, clears S_Protected if set ) - S_NoInst, // no modification ( have no installedObj && !S_Taboo, clears S_Taboo if set ) - }; -*/ - MIL << sel << endl; - chst( sel, ui::S_Update ); - chst( sel, ui::S_Install ); - chst( sel, ui::S_Protected ); - chst( sel, ui::S_KeepInstalled ); - - INT << "===[END]============================================" << endl - << endl; - return 0; -} diff --git a/devel/devel.ma/FakePool.h b/devel/devel.ma/FakePool.h deleted file mode 100644 index 30c2c57..0000000 --- a/devel/devel.ma/FakePool.h +++ /dev/null @@ -1,257 +0,0 @@ -#if 0 -#define FakePool_h - -#include -#include -#include - -#include "zypp/base/LogTools.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Algorithm.h" -#include "zypp/base/Function.h" -#include "zypp/base/Functional.h" -#include "zypp/base/IOStream.h" -#include "zypp/base/String.h" - -#include "zypp/ZYppFactory.h" -#include "zypp/ResPool.h" -#include "zypp/ResPoolProxy.h" -#include "zypp/CapFactory.h" - -#include "zypp/Atom.h" -#include "zypp/Package.h" -#include "zypp/SrcPackage.h" -#include "zypp/Selection.h" -#include "zypp/Pattern.h" -#include "zypp/Product.h" -#include "zypp/Patch.h" -#include "zypp/Script.h" -#include "zypp/Message.h" -#include "zypp/Language.h" -#include "zypp/VendorAttr.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace debug - { ///////////////////////////////////////////////////////////////// - - /** - * \code - * const char * data[] = { - * "@ product" - * ,"@ installed" - * ,"- prodold 1 1 x86_64" - * ,"@ available" - * ,"- prodnew 1 1 x86_64" - * ,"@ obsoletes" - * ,"prodold" - * ,"@ fin" - * }; - * DataCollect dataCollect; - * for_each( data, data + ( sizeof(data) / sizeof(const char *) ), - * function( ref( dataCollect ) ) ); - * \endcode - */ - class DataCollect - { - public: - DataCollect( bool verbose_r = true ) - : _definst( false ) - , _defkind( ResKind::package ) - , _defdep( Dep::PROVIDES ) - , _defdepref( _defkind ) - , _verbose( verbose_r ) - { - VendorAttr::disableAutoProtect(); - } - - bool operator()( const std::string & line_r ) - { - parseLine( str::trim( line_r ) ); - return true; - } - - const ResStore & installed() const - { return _installed; } - - const ResStore & available() const - { return _available; } - - template - void collect( _Iterator begin_r, _Iterator end_r ) - { - for_each( begin_r, end_r, - function( ref(*this) ) ); - } - - private: - struct Data - { - Data( bool inst_r, Resolvable::Kind kind_r, const std::vector & words_r ) - : _inst( inst_r ) - , _kind( kind_r ) - , _data( words_r[1], Edition( words_r[2], words_r[3] ), Arch( words_r[4] ) ) - {} - - bool _inst; - Resolvable::Kind _kind; - NVRAD _data; - }; - - private: - void parseLine( const std::string & line_r ) - { - if ( line_r.empty() || line_r[0] == '#' ) - return; - - std::vector words; - str::split( line_r, std::back_inserter( words ) ); - if ( words.empty() ) - return; - - if ( words[0] == "@" ) - { - if ( words.size() < 2 ) - throw line_r; - if ( words[1] == "installed" ) - _definst = true; - else if ( words[1] == "available" ) - _definst = false; - else if ( words[1] == "fin" ) - finalize(); - else - { - try - { - _defdep = Dep( words[1] ); - if ( words.size() > 2 ) - _defdepref = Resolvable::Kind( words[2] ); - } - catch ( ... ) - { - _defkind = _defdepref = Resolvable::Kind( words[1] ); - } - return; - } - } - else if ( words[0] == "-" ) - { - if ( words.size() == 5 ) - { - finalize(); - _d.reset( new Data( _definst, _defkind, words ) ); - } - else - { - throw words; - } - } - else - { - _d->_data[_defdep].insert( CapFactory().parse( _defdepref, line_r ) ); - } - } - - void finalize() - { - if ( _d ) - { - ResObject::Ptr p; - if ( _d->_kind == ResKind::package ) - p = make(); - else if ( _d->_kind == ResKind::srcpackage ) - p = make(); - else if ( _d->_kind == ResTraits::kind ) - p = make(); - else if ( _d->_kind == ResKind::pattern ) - p = make(); - else if ( _d->_kind == ResKind::product ) - p = make(); - else if ( _d->_kind == ResKind::patch ) - p = make(); - else if ( _d->_kind == ResTraits