From 5c9b31dce3fb0af4abf4e3146eb23fab6ea89c32 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Tue, 20 Sep 2022 15:40:52 +0900 Subject: [PATCH] Imported Upstream version 17.29.4 --- CMakeLists.txt | 2 - VERSION.cmake | 4 +- devel/CMakeLists.txt | 5 - devel/devel.ma/Basic.cc | 283 --------------- devel/devel.ma/CMakeLists.txt | 31 -- devel/devel.ma/ExplicitMap.h | 252 -------------- devel/devel.ma/MT.cc | 96 ------ devel/devel.ma/MaTest.cc | 552 ----------------------------- devel/devel.ma/Main.cc | 112 ------ devel/devel.ma/NewPool.cc | 611 --------------------------------- devel/devel.ma/PluginTest.cc | 207 ----------- devel/devel.ma/PluginTest.py | 24 -- devel/devel.ma/Printing.h | 52 --- devel/devel.ma/Sat.cc | 121 ------- devel/devel.ma/SigTrackableFail.cc | 133 ------- devel/devel.ma/Signal.cc | 122 ------- devel/devel.ma/Test.cc | 82 ----- devel/devel.ma/ToolProvideSignedDir.cc | 127 ------- devel/devel.ma/Tools.h | 214 ------------ devel/devel.ma/Xml.cc | 216 ------------ devel/devel.ma/lines2array | 30 -- devel/devel.ma/ma_test | 48 --- devel/devel.ma/main.h | 170 --------- devel/genclass.in | 234 ------------- package/libzypp.changes | 9 + zypp-core/ExternalProgram.cc | 23 +- zypp-core/zyppng/io/forkspawnengine.cc | 1 + zypp/sat/detail/PoolImpl.cc | 2 + 28 files changed, 30 insertions(+), 3733 deletions(-) delete mode 100644 devel/CMakeLists.txt delete mode 100644 devel/devel.ma/Basic.cc delete mode 100644 devel/devel.ma/CMakeLists.txt delete mode 100644 devel/devel.ma/ExplicitMap.h delete mode 100644 devel/devel.ma/MT.cc delete mode 100644 devel/devel.ma/MaTest.cc delete mode 100644 devel/devel.ma/Main.cc delete mode 100644 devel/devel.ma/NewPool.cc delete mode 100644 devel/devel.ma/PluginTest.cc delete mode 100755 devel/devel.ma/PluginTest.py delete mode 100644 devel/devel.ma/Printing.h delete mode 100644 devel/devel.ma/Sat.cc delete mode 100644 devel/devel.ma/SigTrackableFail.cc delete mode 100644 devel/devel.ma/Signal.cc delete mode 100644 devel/devel.ma/Test.cc delete mode 100644 devel/devel.ma/ToolProvideSignedDir.cc delete mode 100644 devel/devel.ma/Tools.h delete mode 100644 devel/devel.ma/Xml.cc delete mode 100755 devel/devel.ma/lines2array delete mode 100755 devel/devel.ma/ma_test delete mode 100644 devel/devel.ma/main.h delete mode 100644 devel/genclass.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 44b8e78..8031f85 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -356,8 +356,6 @@ ADD_SUBDIRECTORY( zypp-core ) ADD_SUBDIRECTORY( zypp-media ) ADD_SUBDIRECTORY( zypp-curl ) ADD_SUBDIRECTORY( zypp ) -# do not build devel by default -ADD_SUBDIRECTORY( devel EXCLUDE_FROM_ALL ) ADD_SUBDIRECTORY( tools ) ADD_SUBDIRECTORY( doc ) diff --git a/VERSION.cmake b/VERSION.cmake index 9794c2f..7d396b2 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -61,8 +61,8 @@ SET(LIBZYPP_MAJOR "17") SET(LIBZYPP_COMPATMINOR "22") SET(LIBZYPP_MINOR "29") -SET(LIBZYPP_PATCH "3") +SET(LIBZYPP_PATCH "4") # -# LAST RELEASED: 17.29.3 (22) +# LAST RELEASED: 17.29.4 (22) # (The number in parenthesis is LIBZYPP_COMPATMINOR) #======= diff --git a/devel/CMakeLists.txt b/devel/CMakeLists.txt deleted file mode 100644 index e153575..0000000 --- a/devel/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${LIBZYPP_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) - -CONFIGURE_FILE(${LIBZYPP_SOURCE_DIR}/devel/genclass.in ${LIBZYPP_BINARY_DIR}/devel/genclass @ONLY) - -ADD_SUBDIRECTORY(devel.ma) diff --git a/devel/devel.ma/Basic.cc b/devel/devel.ma/Basic.cc deleted file mode 100644 index f1c8a7e..0000000 --- a/devel/devel.ma/Basic.cc +++ /dev/null @@ -1,283 +0,0 @@ -#include "Tools.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static const Pathname sysRoot( "/" ); - -using namespace zypp; -using namespace zypp::ui; - - -#include - - struct DownloadProgressReceive : public callback::ReceiveReport - { - DownloadProgressReceive() - { 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 - ACCESS_DENIED, // user authent. failed while accessing restricted file - ERROR // other error - }; -#endif - virtual void start( const Url & file, Pathname localfile ) - { - USR << "DP +++ " << file << endl; - lp = 0; - } - - virtual bool progress(int value, const Url &file, double dbps_avg = -1, double dbps_current = -1) - { - if ( abs(value-lp) >= 20 || value == 100 && lp != 100 ) - { - USR << "DP " << file << " " << value << "%" << endl; - lp = value; - } - return true; - - } - - virtual Action problem( const Url &file , Error error , const std::string &description ) - { - USR << "DP !!! " << file << " (" << error << ")" << endl; - return ABORT; - - } - - virtual void finish( const Url &file , Error error , const std::string &reason ) - { - USR << "DP --- " << file << " (" << error << ")" << endl; - } - - int lp; - }; - - //////////////////////////////////////////////////////////////////// - // - ////////////////////////////////////////////////////////////////// - - struct DownloadResolvableReceive : public callback::ReceiveReport - { - DownloadResolvableReceive() - { connect(); } -#if 0 - enum Action { - ABORT, // abort and return error - RETRY, // retry - IGNORE, // ignore this resolvable but continue - }; - - enum Error { - NO_ERROR, - NOT_FOUND, // the requested Url was not found - IO, // IO error - INVALID // the downloaded file is invalid - }; -#endif - virtual void start( Resolvable::constPtr resolvable_ptr, const Url &url ) - { - USR << "+++ " << resolvable_ptr << endl; - } - - - // Dowmload delta rpm: - // - path below url reported on start() - // - expected download size (0 if unknown) - // - download is interruptable - // - problems are just informal - virtual void startDeltaDownload( const Pathname & /*filename*/, const ByteCount & /*downloadsize*/ ) - { - USR << __PRETTY_FUNCTION__ << endl; - } - - virtual bool progressDeltaDownload( int /*value*/ ) - { - USR << __PRETTY_FUNCTION__ << endl; - return true; - } - - virtual void problemDeltaDownload( const std::string &/*description*/ ) - { - USR << __PRETTY_FUNCTION__ << endl; - } - - virtual void finishDeltaDownload() - { - USR << __PRETTY_FUNCTION__ << endl; - } - - // Apply delta rpm: - // - local path of downloaded delta - // - aplpy is not interruptable - // - problems are just informal - virtual void startDeltaApply( const Pathname & /*filename*/ ) - { - USR << __PRETTY_FUNCTION__ << endl; - } - - virtual void progressDeltaApply( int /*value*/ ) - { - USR << __PRETTY_FUNCTION__ << endl; - } - - virtual void problemDeltaApply( const std::string &/*description*/ ) - { - USR << __PRETTY_FUNCTION__ << endl; - } - - virtual void finishDeltaApply() - { - USR << __PRETTY_FUNCTION__ << endl; - } - - // return false if the download should be aborted right now - virtual bool progress(int value, Resolvable::constPtr resolvable_ptr) - { - if ( 1 || abs(value-lp) >= 20 || value == 100 && lp != 100 ) - { - USR << resolvable_ptr << " " << value << "%" << endl; - lp = value; - } - return true; - } - - virtual Action problem( Resolvable::constPtr resolvable_ptr , Error error , const std::string &/*description*/ ) - { - USR << "!!! " << resolvable_ptr << " (" << error << ")" << endl; - return ABORT; - } - - virtual void finish(Resolvable::constPtr resolvable_ptr , Error error , const std::string &/*reason*/ ) - { - USR << "--- " << resolvable_ptr << " (" << error << ")" << endl; - } - - int lp; - }; - - -bool queryInstalledEditionHelper( const std::string & name_r, - const Edition & ed_r, - const Arch & arch_r ) -{ - if ( ed_r == Edition::noedition ) - return true; - if ( name_r == "kernel-default" && ed_r == Edition("2.6.22.5-10") ) - return true; - if ( name_r == "update-test-affects-package-manager" && ed_r == Edition("1.1-6") ) - return true; - - return false; -} - -ManagedFile repoProvidePackage( const PoolItem & pi ) -{ - ResPool _pool( getZYpp()->pool() ); - repo::RepoMediaAccess _access; - - // Redirect PackageProvider queries for installed editions - // (in case of patch/delta rpm processing) to rpmDb. - repo::PackageProviderPolicy packageProviderPolicy; - packageProviderPolicy.queryInstalledCB( queryInstalledEditionHelper ); - - Package::constPtr p = asKind( pi.resolvable() ); - - // Build a repository list for repos - // contributing to the pool - repo::DeltaCandidates deltas;//( repo::makeDeltaCandidates( _pool.knownRepositoriesBegin(), _pool.knownRepositoriesEnd() ) ); - - repo::PackageProvider pkgProvider( _access, p, deltas, packageProviderPolicy ); - - return pkgProvider.providePackage(); -} - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - --argc; - ++argv; - zypp::base::LogControl::instance().logToStdErr(); - INT << "===[START]==========================================" << endl; - ::unsetenv( "ZYPP_CONF" ); - ZConfig::instance(); - - DownloadProgressReceive _dpr; - DownloadResolvableReceive _drr; - - TestSetup::LoadSystemAt( sysRoot ); - /////////////////////////////////////////////////////////////////// - ResPool pool( ResPool::instance() ); - sat::Pool satpool( sat::Pool::instance() ); - /////////////////////////////////////////////////////////////////// - dumpRange( USR, satpool.reposBegin(), satpool.reposEnd() ) << endl; - USR << "pool: " << pool << endl; - - if ( 0 ) { - PoolItem pi( getPi( "CDT", "amarok", Edition(), Arch_empty ) ); - SEC << pi << endl; - ManagedFile f( repoProvidePackage( pi ) ); - SEC << f << endl; - } - { - Url url("cd:///?devices=/dev/sr0"); - Pathname path(url.getPathName()); - url.setPathName ("/"); - MediaSetAccess access(url); - Pathname local = access.provideFile(path); - SEC << local << endl; - } - if ( 0 ) { - Url url("http://download.opensuse.org/debug/distribution/11.4/repo/oss/content.asc"); - url.setPathName ("/"); - MediaSetAccess access(url); - - zypp::Fetcher fch; - fch.reset(); - fch.setOptions(zypp::Fetcher::AutoAddIndexes); - - // path - add "/" to the beginning if it's missing there - std::string media_path("/debug/distribution/11.4/repo/oss/content.ascx"); - zypp::OnMediaLocation mloc(media_path, 1); - mloc.setOptional(true); - - zypp::filesystem::TmpDir tmpdir( zypp::filesystem::TmpDir::defaultLocation() ); - fch.addIndex(mloc); - fch.start(tmpdir.path(), access); - } - - - -// f.resetDispose(); -// ExternalProgram("find /tmp/var") >> DBG; -// DBG << endl; - - INT << "===[END]============================================" << endl; - zypp::base::LogControl::instance().logNothing(); - return 0; -} diff --git a/devel/devel.ma/CMakeLists.txt b/devel/devel.ma/CMakeLists.txt deleted file mode 100644 index de9776c..0000000 --- a/devel/devel.ma/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -## ############################################################ - -#ADD_SUBDIRECTORY( doc ) - -## ############################################################ - -SET(THREAD_LIBRARY boost_thread) - -## ############################################################ - -ADD_CUSTOM_TARGET( ma_test ALL - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ma_test - COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/ma_test ${CMAKE_CURRENT_BINARY_DIR}/ma_test -) - -## ############################################################ - -FILE( GLOB ALLCC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc" ) -STRING( REPLACE ".cc" ";" APLLPROG ${ALLCC} ) -FOREACH( loop_var ${APLLPROG} ) - ADD_EXECUTABLE( ${loop_var} - ${loop_var}.cc - ) - TARGET_LINK_LIBRARIES( ${loop_var} - boost_signals - zypp - ${THREAD_LIBRARY} - ) -ENDFOREACH( loop_var ) - -## ############################################################ diff --git a/devel/devel.ma/ExplicitMap.h b/devel/devel.ma/ExplicitMap.h deleted file mode 100644 index 7471492..0000000 --- a/devel/devel.ma/ExplicitMap.h +++ /dev/null @@ -1,252 +0,0 @@ -/*---------------------------------------------------------------------\ - | ____ _ __ __ ___ | - | |__ / \ / / . \ . \ | - | / / \ V /| _/ _/ | - | / /__ | | | | | | | - | /_____||_| |_| |_| | - | | - \---------------------------------------------------------------------*/ -/** \file zypp/ExplicitMap.h - * -*/ -#ifndef ZYPP_EXPLICITMAP_H -#define ZYPP_EXPLICITMAP_H - -#include -#include - -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ExplicitMap - // - /** A simple lookup map using default value for not existing entries. - * - * A std::map providing operator[] const only. Nor existing - * entries are mapped to a default value. Entries are maipulated vis - * methods \ref set and \ref unset. Helper classes \ref TmpSet, - * \ref TmpUnset and \ref TmpSetDefault are provided to temporarily - * change and automaticlly restore values. - */ - template - class ExplicitMap - { - public: - 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 map_type; - typedef typename map_type::iterator iterator; - - public: - typedef typename map_type::key_type key_type; - typedef typename map_type::size_type size_type; - typedef typename map_type::const_iterator const_iterator; - - public: - ExplicitMap() - {} - - explicit - ExplicitMap( param_type mapDefault_r ) - : _mapDefault( mapDefault_r ) - {} - - template - ExplicitMap( TInputIterator first_r, TInputIterator last_r ) - : _map( first_r, last_r ) - {} - - template - ExplicitMap( TInputIterator first_r, TInputIterator last_r, - param_type mapDefault_r ) - : _map( first_r, last_r ) - , _mapDefault( mapDefault_r ) - {} - - public: - size_type size() const - { return _map.size(); } - - bool empty() const - { return _map.empty(); } - - const_iterator begin() const - { return _map.begin(); } - - const_iterator end() const - { return _map.end(); } - - const_iterator find( const key_type & key_r ) const - { return _map.find( key_r ); } - - bool has( const key_type & key_r ) const - { return _map.find( key_r ) != end(); } - - const_reference get( const key_type & key_r ) const - { - const_iterator it = _map.find( key_r ); - return( it == _map.end() ? _mapDefault : it->second ); - } - - const_reference getDefault() const - { return _mapDefault; } - - const_reference operator[]( const key_type & key_r ) const - { return get( key_r ); } - - public: - void clear() - { _map.clear(); } - - void set( const key_type & key_r, param_type value_r ) - { _map[key_r] = value_r; } - - template - void set( TInputIterator first_r, TInputIterator last_r ) - { _map.insert( first_r, last_r ); } - - void unset( const key_type & key_r ) - { _map.erase( key_r ); } - - void setDefault( param_type value_r ) - { _mapDefault = value_r; } - - public: - class TmpSet; - class TmpUnset; - class TmpSetDefault; - - //private: - value_type _mapDefault; - map_type _map; - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ExplicitMap::TmpSet - // - /** Temporarily set a value. */ - template - class ExplicitMap::TmpSet - { - public: - TmpSet( ExplicitMap & map_r, const key_type & key_r, param_type value_r ) - : _map( map_r ) - , _key( key_r ) - { - const_iterator it = _map.find( _key ); - if ( it == _map.end() ) - { - _wasDefault = true; - } - else - { - _wasDefault = false; - _value = it->second; - } - _map.set( _key, value_r ); - } - - ~TmpSet() - { - if ( _wasDefault ) - { - _map.unset( _key ); - } - else - { - _map.set( _key, _value ); - } - } - - private: - ExplicitMap & _map; - key_type _key; - param_type _value; - bool _wasDefault; - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ExplicitMap::TmpUnset - // - /** Temporarily unset a value. */ - template - class ExplicitMap::TmpUnset - { - public: - TmpUnset( ExplicitMap & map_r, const key_type & key_r ) - : _map( map_r ) - , _key( key_r ) - { - const_iterator it = _map.find( _key ); - if ( it == _map.end() ) - { - _wasDefault = true; - } - else - { - _wasDefault = false; - _value = it->second; - _map.unset( _key ); - } - } - - ~TmpUnset() - { - if ( ! _wasDefault ) - { - _map.set( _key, _value ); - } - } - - private: - ExplicitMap & _map; - key_type _key; - param_type _value; - bool _wasDefault; - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ExplicitMap::TmpSetDefault - // - /** Temporarily change the default value. */ - template - class ExplicitMap::TmpSetDefault - { - public: - TmpSetDefault( ExplicitMap & map_r, param_type value_r ) - : _map( map_r ) - , _value( _map.getDefault() ) - { - _map.setDefault( value_r ); - } - - ~TmpSetDefault() - { - _map.setDefault( _value ); - } - - private: - ExplicitMap & _map; - param_type _value; - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_EXPLICITMAP_H diff --git a/devel/devel.ma/MT.cc b/devel/devel.ma/MT.cc deleted file mode 100644 index 3ad071c..0000000 --- a/devel/devel.ma/MT.cc +++ /dev/null @@ -1,96 +0,0 @@ -//#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include - -using std::endl; -using zypp::debug::Measure; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /** Run a number of tasks using \c threadCount threads. - * - * \code - * std::vector> tasks; - * for ( int i = 0; i < 100; ++i ) - * { - * tasks.push_back( [i]() - * { - * MIL << '[' << i << "]" << endl; - * }); - * } - * runTasks( tasks, 10 ); - * \endcode - */ - template - void runTasks( const std::vector& tasks, size_t threadCount = 1 ) - { - if ( threadCount ) - { - boost::thread_group group; - const size_t taskCount = (tasks.size() / threadCount) + 1; - for ( size_t start = 0; start < tasks.size(); start += taskCount ) - { - group.create_thread( [&tasks, start, taskCount]() - { - const size_t end = std::min( tasks.size(), start + taskCount ); - for ( size_t i = start; i < end; ++i ) - tasks[i](); - }); - } - group.join_all(); - } - else - { - for_( f, tasks.begin(), tasks.end() ) - (*f)(); - } - } -} -/////////////////////////////////////////////////////////////////// -using namespace zypp; -int main( int argc, char * argv[] ) -try { - --argc; - ++argv; - zypp::base::LogControl::instance().logToStdErr(); - INT << "===[START]==========================================" << endl; - /////////////////////////////////////////////////////////////////// - - std::vector> tasks; - for ( int i = 0; i < 100; ++i ) - { - tasks.push_back( [i]() - { - MIL << '[' << i << "]" << endl; - }); - } - { - Measure x( "THREAD" ); - runTasks( tasks, 100 ); - } - - - /////////////////////////////////////////////////////////////////// - INT << "===[END]============================================" << endl << endl; - zypp::base::LogControl::instance().logNothing(); - return 0; -} -catch ( const zypp::Exception & exp ) -{ - INT << exp << endl << exp.historyAsString(); -} -catch (...) -{} - diff --git a/devel/devel.ma/MaTest.cc b/devel/devel.ma/MaTest.cc deleted file mode 100644 index a27c917..0000000 --- a/devel/devel.ma/MaTest.cc +++ /dev/null @@ -1,552 +0,0 @@ -#include "Tools.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace zypp; -using namespace zypp::functor; -using namespace zypp::ui; - -/////////////////////////////////////////////////////////////////// - -static const Pathname sysRoot( getenv("SYSROOT") ? getenv("SYSROOT") : "/Local/ROOT" ); - -/////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - -bool queryInstalledEditionHelper( const std::string & name_r, - const Edition & ed_r, - const Arch & arch_r ) -{ - if ( ed_r == Edition::noedition ) - return true; - if ( name_r == "kernel-default" && ed_r == Edition("2.6.22.5-10") ) - return true; - if ( name_r == "update-test-affects-package-manager" && ed_r == Edition("1.1-6") ) - return true; - - return false; -} - - -ManagedFile repoProvidePackage( const PoolItem & pi ) -{ - ResPool _pool( getZYpp()->pool() ); - repo::RepoMediaAccess _access; - - // Redirect PackageProvider queries for installed editions - // (in case of patch/delta rpm processing) to rpmDb. - repo::PackageProviderPolicy packageProviderPolicy; - packageProviderPolicy.queryInstalledCB( queryInstalledEditionHelper ); - - Package::constPtr p = asKind(pi.resolvable()); - - // Build a repository list for repos - // contributing to the pool - repo::DeltaCandidates deltas( repo::makeDeltaCandidates( _pool.knownRepositoriesBegin(), - _pool.knownRepositoriesEnd() ) ); - repo::PackageProvider pkgProvider( _access, p, deltas, packageProviderPolicy ); - return pkgProvider.providePackage(); -} - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////// - -namespace zypp -{ - template - inline int invokeOnEach( TLIterator lbegin_r, TLIterator lend_r, - TRIterator rbegin_r, TRIterator rend_r, - TFunction fnc_r ) - { - int cnt = 0; - for ( TLIterator lit = lbegin_r; lit != lend_r; ++lit ) - { - for ( TRIterator rit = rbegin_r; rit != rend_r; ++rit ) - { - ++cnt; - if ( ! fnc_r( *lit, *rit ) ) - return -cnt; - } - } - return cnt; - } -} - -/////////////////////////////////////////////////////////////////// - -std::ostream & testDump( std::ostream & str, const PoolItem & pi ) -{ - str << pi << endl; - Package::constPtr p( asKind(pi) ); - if ( p ) - { -#define OUTS(V) str << str::form("%-25s: ",#V) << p->V() << endl - Locale l( "de" ); - str << str::form("%-25s: ",l.code().c_str()) << p->summary(l) << endl; - l = Locale( "fr" ); - str << str::form("%-25s: ",l.code().c_str()) << p->summary(l) << endl; - l = Locale( "dsdf" ); - str << str::form("%-25s: ",l.code().c_str()) << p->summary(l) << endl; - OUTS( summary ); - OUTS( installSize ); - OUTS( downloadSize ); - OUTS( sourcePkgName ); - OUTS( sourcePkgEdition ); - OUTS( checksum ); - OUTS( location ); -#undef OUTS - - - } - return str; -} - -struct Xprint -{ - bool operator()( const PoolItem & obj_r ) - { - //MIL << obj_r << endl; - //DBG << " -> " << obj_r->satSolvable() << endl; - - return true; - } - - bool operator()( const sat::Solvable & obj_r ) - { - //dumpOn( MIL, obj_r ) << endl; - return true; - } -}; - -/////////////////////////////////////////////////////////////////// -struct SetTransactValue -{ - SetTransactValue( ResStatus::TransactValue newVal_r, ResStatus::TransactByValue causer_r ) - : _newVal( newVal_r ) - , _causer( causer_r ) - {} - - ResStatus::TransactValue _newVal; - ResStatus::TransactByValue _causer; - - bool operator()( const PoolItem & pi ) const - { - bool ret = pi.status().setTransactValue( _newVal, _causer ); - if ( ! ret ) - ERR << _newVal << _causer << " " << pi << endl; - return ret; - } -}; - -struct StatusReset : public SetTransactValue -{ - StatusReset() - : SetTransactValue( ResStatus::KEEP_STATE, ResStatus::USER ) - {} -}; - -struct StatusInstall : public SetTransactValue -{ - StatusInstall() - : SetTransactValue( ResStatus::TRANSACT, ResStatus::USER ) - {} -}; - -/////////////////////////////////////////////////////////////////// - -bool solve() -{ - bool rres = false; - { - //zypp::base::LogControl::TmpLineWriter shutUp; - rres = getZYpp()->resolver()->resolvePool(); - } - if ( ! rres ) - { - ERR << "resolve " << rres << endl; - getZYpp()->resolver()->problems(); - return false; - } - MIL << "resolve " << rres << endl; - return true; -} - -bool install() -{ - ZYppCommitPolicy pol; - pol.dryRun(true); - pol.rpmInstFlags( pol.rpmInstFlags().setFlag( target::rpm::RPMINST_JUSTDB ) ); - SEC << getZYpp()->commit( pol ) << endl; - return true; -} - -void testcase() -{ - getZYpp()->resolver()->createSolverTestcase( "./solverTestcase" ); -} - -/////////////////////////////////////////////////////////////////// - -struct DigestReceive : public callback::ReceiveReport -{ - DigestReceive() - { - connect(); - } - - virtual bool askUserToAcceptNoDigest( const zypp::Pathname &file ) - { - USR << endl; - return false; - } - virtual bool askUserToAccepUnknownDigest( const Pathname &file, const std::string &name ) - { - USR << endl; - return false; - } - virtual bool askUserToAcceptWrongDigest( const Pathname &file, const std::string &requested, const std::string &found ) - { - USR << "fle " << PathInfo(file) << endl; - USR << "req " << requested << endl; - USR << "fnd " << found << endl; - return false; - } -}; - -struct KeyRingSignalsReceive : public callback::ReceiveReport -{ - KeyRingSignalsReceive() - { - connect(); - } - virtual void trustedKeyAdded( const PublicKey &/*key*/ ) - { - USR << endl; - } - virtual void trustedKeyRemoved( const PublicKey &/*key*/ ) - { - USR << endl; - } -}; - -/////////////////////////////////////////////////////////////////// - -struct MediaChangeReceive : public callback::ReceiveReport -{ - virtual Action requestMedia( Url & source - , unsigned mediumNr - , const std::string & label - , Error error - , const std::string & description - , const std::vector & devices - , unsigned int & dev_current ) - { - SEC << __FUNCTION__ << endl - << " " << source << endl - << " " << mediumNr << endl - << " " << label << endl - << " " << error << endl - << " " << description << endl - << " " << devices << endl - << " " << dev_current << endl; - return IGNORE; - } -}; - -/////////////////////////////////////////////////////////////////// - -namespace container -{ - template - bool isIn( const std::set & cont, const typename std::set::value_type & val ) - { return cont.find( val ) != cont.end(); } -} -/////////////////////////////////////////////////////////////////// - -void itCmp( const sat::Pool::SolvableIterator & l, const sat::Pool::SolvableIterator & r ) -{ - SEC << *l << " - " << *r << endl; - INT << "== " << (l==r) << endl; - INT << "!= " << (l!=r) << endl; -} - -bool isTrue() { return true; } -bool isFalse() { return false; } - -void dumpIdStr() -{ - for ( int i = -3; i < 30; ++i ) - { - DBG << i << '\t' << IdString( i ) << endl; - } -} - -void ttt( const char * lhs, const char * rhs ) -{ - DBG << lhs << " <=> " << rhs << " --> " << ::strcmp( lhs, rhs ) << endl; -} - -namespace zypp -{ -namespace filter -{ - template - class HasValue - { - public: - HasValue( TMemFun fun_r, TValue val_r ) - : _fun( fun_r ), _val( val_r ) - {} - template - bool operator()( const Tp & obj_r ) const - { return( _fun && (obj_r.*_fun)() == _val ); } - private: - TMemFun _fun; - TValue _val; - }; - - template - HasValue byValue( TMemFun fun_r, TValue val_r ) - { return HasValue( fun_r, val_r ); } -} - -} - -template -struct TestO { TestO( const L & lhs ) : _lhs( lhs ) {} const L & _lhs; }; - -template -std::ostream & operator<<( std::ostream & str, const TestO & obj ) -{ const L & lhs( obj._lhs); return str << (lhs?'_':'*') << (lhs.empty()?'e':'_') << "'" << lhs << "'"; } - -template -TestO testO( const L & lhs ) -{ return TestO( lhs ); } - -template -void testCMP( const L & lhs, const R & rhs ) -{ - MIL << "LHS " << testO(lhs) << endl; - MIL << "RHS " << rhs << endl; - -#define OUTS(S) DBG << #S << ": " << (S) << endl - OUTS( lhs.compare(rhs) ); - OUTS( lhs != rhs ); - OUTS( lhs < rhs ); - OUTS( lhs <= rhs ); - OUTS( lhs == rhs ); - OUTS( lhs >= rhs ); - OUTS( lhs > rhs ); -#undef OUTS -} - -inline bool useRepo( RepoInfo & repo ) -{ - //return repo.alias() == "matest"; - return repo.enabled(); -} - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -try { - --argc; - ++argv; - zypp::base::LogControl::instance().logToStdErr(); - INT << "===[START]==========================================" << endl; - ZConfig::instance(); - - ResPool pool( ResPool::instance() ); - sat::Pool satpool( sat::Pool::instance() ); - - if ( 0 ) - { - Measure x( "INIT TARGET" ); - { - { - zypp::base::LogControl::TmpLineWriter shutUp; - getZYpp()->initializeTarget( sysRoot ); - } - getZYpp()->target()->load(); - USR << getZYpp()->target()->targetDistribution() << endl; - USR << getZYpp()->target()->targetDistributionRelease() << endl; - } - } - - if ( 1 ) - { - RepoManager repoManager( makeRepoManager( sysRoot ) ); - RepoInfoList repos = repoManager.knownRepositories(); - - // launch repos - for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it ) - { - RepoInfo & nrepo( *it ); - SEC << nrepo << endl; - - if ( ! useRepo( nrepo ) ) - continue; - - if ( ! repoManager.isCached( nrepo ) || nrepo.type() == repo::RepoType::RPMPLAINDIR ) - { - if ( repoManager.isCached( nrepo ) ) - { - SEC << "cleanCache" << endl; - repoManager.cleanCache( nrepo ); - } - SEC << "refreshMetadata" << endl; - //repoManager.refreshMetadata( nrepo ); - SEC << "buildCache" << endl; - repoManager.buildCache( nrepo ); - } - } - - // create from cache: - { - Measure x( "CREATE FROM CACHE" ); - for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it ) - { - RepoInfo & nrepo( *it ); - if ( ! useRepo( nrepo ) ) - continue; - - Measure x( "CREATE FROM CACHE "+nrepo.alias() ); - try - { - repoManager.loadFromCache( nrepo ); - } - catch ( const Exception & exp ) - { - MIL << "Try to rebuild cache..." << endl; - SEC << "cleanCache" << endl; - repoManager.cleanCache( nrepo ); - SEC << "buildCache" << endl; - repoManager.buildCache( nrepo ); - SEC << "Create from cache" << endl; - repoManager.loadFromCache( nrepo ); - } - - USR << "pool: " << pool << endl; - } - } - } - - dumpRange( USR, satpool.reposBegin(), satpool.reposEnd() ); - USR << "pool: " << pool << endl; - - /////////////////////////////////////////////////////////////////// - - if ( 0 ) - { - Measure x( "Upgrade" ); - getZYpp()->resolver()->doUpgrade(); - } - - /////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// -// UNTh_(2)product:openSUSE-11.1.x86_64(openSUSE-dvd-11.1) -// U_Th_(583)yast2-ntp-client-2.17.1-1.26.noarch(openSUSE-dvd-11.1) -// U_Th_(1652)kernel-default-2.6.27-7.2.x86_64(openSUSE-dvd-11.1) -// U_Th_(2490)ntp-4.2.4p5-1.6.x86_64(openSUSE-dvd-11.1) -// UNTh_(2545)openSUSE-release-11.1-1.4.x86_64(openSUSE-dvd-11.1) -// USTh_(3462)pattern:base-11.1-46.1.x86_64(openSUSE-dvd-11.1) -// USTh_(3672)pattern:x11-11.1-46.1.x86_64(openSUSE-dvd-11.1) -// USTu_(3680)pattern:xfce-11.1-46.1.x86_64(openSUSE-dvd-11.1) - - - getZYpp()->resolver()->addRequire( Capability("product:openSUSE") ); - getZYpp()->resolver()->addRequire( Capability("yast2-ntp-client") ); - getZYpp()->resolver()->addRequire( Capability("kernel-default") ); - getZYpp()->resolver()->addRequire( Capability("ntp") ); - getZYpp()->resolver()->addRequire( Capability("openSUSE-release") ); - getZYpp()->resolver()->addRequire( Capability("pattern:base") ); - getZYpp()->resolver()->addRequire( Capability("pattern:x11") ); - getZYpp()->resolver()->addRequire( Capability("pattern:xfce") ); - - solve(); - - vdumpPoolStats( USR << "Transacting:"<< endl, - make_filter_begin(pool), - make_filter_end(pool) ) << endl; - - ByteCount sze; - ByteCount dusze; - DiskUsageCounter ducounter( DiskUsageCounter::justRootPartition() ); - for_( it, make_filter_begin(pool), make_filter_end(pool) ) - { - USR << *it << endl; - ByteCount csze( ducounter.disk_usage( *it ).begin()->commitDiff() ); - sze += (*it)->installSize(); - dusze += csze; - DBG <<(*it)->installSize() << " vs. " << csze << " | " << ByteCount( dusze-sze ) << endl; - - } - SEC << sze << endl; - SEC << dusze << endl; - - SEC << zypp::getZYpp()->diskUsage() << 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/Main.cc b/devel/devel.ma/Main.cc deleted file mode 100644 index 92017f7..0000000 --- a/devel/devel.ma/Main.cc +++ /dev/null @@ -1,112 +0,0 @@ -#include "Tools.h" - -#include -#include -#include - -#include -#include - -/////////////////////////////////////////////////////////////////// - -//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.multiversion().begin(), satpool.multiversion().end() ) << endl; - TestSetup::LoadSystemAt( sysRoot, Arch_i586 ); - /////////////////////////////////////////////////////////////////// - - ui::Selectable::Ptr p( getSel( "kruler" ) ); - if ( p ) - { - USR << p->setToDelete() << endl; - getZYpp()->resolver()->setCleandepsOnRemove( true ); - solve(); - } - - /////////////////////////////////////////////////////////////////// - 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/NewPool.cc b/devel/devel.ma/NewPool.cc deleted file mode 100644 index 65c3667..0000000 --- a/devel/devel.ma/NewPool.cc +++ /dev/null @@ -1,611 +0,0 @@ -#include "Tools.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -using namespace zypp; -using namespace zypp::functor; -using namespace zypp::ui; - -/////////////////////////////////////////////////////////////////// - -static const Pathname sysRoot( getenv("SYSROOT") ? getenv("SYSROOT") : "/Local/ROOT" ); - -/////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - -bool queryInstalledEditionHelper( const std::string & name_r, - const Edition & ed_r, - const Arch & arch_r ) -{ - if ( ed_r == Edition::noedition ) - return true; - if ( name_r == "kernel-default" && ed_r == Edition("2.6.22.5-10") ) - return true; - if ( name_r == "update-test-affects-package-manager" && ed_r == Edition("1.1-6") ) - return true; - - return false; -} - - -ManagedFile repoProvidePackage( const PoolItem & pi ) -{ - ResPool _pool( getZYpp()->pool() ); - repo::RepoMediaAccess _access; - - // Redirect PackageProvider queries for installed editions - // (in case of patch/delta rpm processing) to rpmDb. - repo::PackageProviderPolicy packageProviderPolicy; - packageProviderPolicy.queryInstalledCB( queryInstalledEditionHelper ); - - Package::constPtr p = asKind(pi.resolvable()); - - // Build a repository list for repos - // contributing to the pool - repo::DeltaCandidates deltas( repo::makeDeltaCandidates( _pool.knownRepositoriesBegin(), - _pool.knownRepositoriesEnd() ) ); - repo::PackageProvider pkgProvider( _access, p, deltas, packageProviderPolicy ); - return pkgProvider.providePackage(); -} - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////// - -namespace zypp -{ - template - inline int invokeOnEach( TLIterator lbegin_r, TLIterator lend_r, - TRIterator rbegin_r, TRIterator rend_r, - TFunction fnc_r ) - { - int cnt = 0; - for ( TLIterator lit = lbegin_r; lit != lend_r; ++lit ) - { - for ( TRIterator rit = rbegin_r; rit != rend_r; ++rit ) - { - ++cnt; - if ( ! fnc_r( *lit, *rit ) ) - return -cnt; - } - } - return cnt; - } -} - - -/////////////////////////////////////////////////////////////////// - -std::ostream & testDump( std::ostream & str, const PoolItem & pi ) -{ - str << pi << endl; - Package::constPtr p( asKind(pi) ); - if ( p ) - { -#define OUTS(V) str << str::form("%-25s: ",#V) << p->V() << endl - Locale l( "de" ); - str << str::form("%-25s: ",l.code().c_str()) << p->summary(l) << endl; - l = Locale( "fr" ); - str << str::form("%-25s: ",l.code().c_str()) << p->summary(l) << endl; - l = Locale( "dsdf" ); - str << str::form("%-25s: ",l.code().c_str()) << p->summary(l) << endl; - OUTS( summary ); - OUTS( installSize ); - OUTS( downloadSize ); - OUTS( sourcePkgName ); - OUTS( sourcePkgEdition ); - OUTS( checksum ); - OUTS( location ); -#undef OUTS - - - } - return str; -} - -struct Xprint -{ - bool operator()( const PoolItem & obj_r ) - { - //MIL << obj_r << endl; - //DBG << " -> " << obj_r->satSolvable() << endl; - - return true; - } - - bool operator()( const sat::Solvable & obj_r ) - { - //dumpOn( MIL, obj_r ) << endl; - return true; - } -}; - -/////////////////////////////////////////////////////////////////// -struct SetTransactValue -{ - SetTransactValue( ResStatus::TransactValue newVal_r, ResStatus::TransactByValue causer_r ) - : _newVal( newVal_r ) - , _causer( causer_r ) - {} - - ResStatus::TransactValue _newVal; - ResStatus::TransactByValue _causer; - - bool operator()( const PoolItem & pi ) const - { - bool ret = pi.status().setTransactValue( _newVal, _causer ); - if ( ! ret ) - ERR << _newVal << _causer << " " << pi << endl; - return ret; - } -}; - -struct StatusReset : public SetTransactValue -{ - StatusReset() - : SetTransactValue( ResStatus::KEEP_STATE, ResStatus::USER ) - {} -}; - -struct StatusInstall : public SetTransactValue -{ - StatusInstall() - : SetTransactValue( ResStatus::TRANSACT, ResStatus::USER ) - {} -}; - -/////////////////////////////////////////////////////////////////// - -bool solve() -{ - bool rres = false; - { - //zypp::base::LogControl::TmpLineWriter shutUp; - rres = getZYpp()->resolver()->resolvePool(); - } - if ( ! rres ) - { - ERR << "resolve " << rres << endl; - return false; - } - MIL << "resolve " << rres << endl; - return true; -} - -bool install() -{ - ZYppCommitPolicy pol; - pol.dryRun(true); - pol.rpmInstFlags( pol.rpmInstFlags().setFlag( target::rpm::RPMINST_JUSTDB ) ); - SEC << getZYpp()->commit( pol ) << endl; - return true; -} - -void testcase() -{ - getZYpp()->resolver()->createSolverTestcase( "./solverTestcase" ); -} - -/////////////////////////////////////////////////////////////////// - -struct DigestReceive : public callback::ReceiveReport -{ - DigestReceive() - { - connect(); - } - - virtual bool askUserToAcceptNoDigest( const zypp::Pathname &file ) - { - USR << endl; - return false; - } - virtual bool askUserToAccepUnknownDigest( const Pathname &file, const std::string &name ) - { - USR << endl; - return false; - } - virtual bool askUserToAcceptWrongDigest( const Pathname &file, const std::string &requested, const std::string &found ) - { - USR << "fle " << PathInfo(file) << endl; - USR << "req " << requested << endl; - USR << "fnd " << found << endl; - return false; - } -}; - -struct KeyRingSignalsReceive : public callback::ReceiveReport -{ - KeyRingSignalsReceive() - { - connect(); - } - virtual void trustedKeyAdded( const PublicKey &/*key*/ ) - { - USR << endl; - } - virtual void trustedKeyRemoved( const PublicKey &/*key*/ ) - { - USR << endl; - } -}; - -/////////////////////////////////////////////////////////////////// - -struct MediaChangeReceive : public callback::ReceiveReport -{ - virtual Action requestMedia( Url & source - , unsigned mediumNr - , const std::string & label - , Error error - , const std::string & description - , const std::vector & devices - , unsigned int & dev_current ) - { - SEC << __FUNCTION__ << endl - << " " << source << endl - << " " << mediumNr << endl - << " " << label << endl - << " " << error << endl - << " " << description << endl - << " " << devices << endl - << " " << dev_current << endl; - return IGNORE; - } -}; - -/////////////////////////////////////////////////////////////////// - -namespace container -{ - template - bool isIn( const std::set & cont, const typename std::set::value_type & val ) - { return cont.find( val ) != cont.end(); } -} -/////////////////////////////////////////////////////////////////// - -void itCmp( const sat::Pool::SolvableIterator & l, const sat::Pool::SolvableIterator & r ) -{ - SEC << *l << " - " << *r << endl; - INT << "== " << (l==r) << endl; - INT << "!= " << (l!=r) << endl; -} - -bool isTrue() { return true; } -bool isFalse() { return false; } - -void dumpIdStr() -{ - for ( int i = -3; i < 30; ++i ) - { - DBG << i << '\t' << IdString( i ) << endl; - } -} - -void ttt( const char * lhs, const char * rhs ) -{ - DBG << lhs << " <=> " << rhs << " --> " << ::strcmp( lhs, rhs ) << endl; -} - -namespace zypp -{ -namespace filter -{ - template - class HasValue - { - public: - HasValue( TMemFun fun_r, TValue val_r ) - : _fun( fun_r ), _val( val_r ) - {} - template - bool operator()( const Tp & obj_r ) const - { return( _fun && (obj_r.*_fun)() == _val ); } - private: - TMemFun _fun; - TValue _val; - }; - - template - HasValue byValue( TMemFun fun_r, TValue val_r ) - { return HasValue( fun_r, val_r ); } -} - -} - -template -struct TestO { TestO( const L & lhs ) : _lhs( lhs ) {} const L & _lhs; }; - -template -std::ostream & operator<<( std::ostream & str, const TestO & obj ) -{ const L & lhs( obj._lhs); return str << (lhs?'_':'*') << (lhs.empty()?'e':'_') << "'" << lhs << "'"; } - -template -TestO testO( const L & lhs ) -{ return TestO( lhs ); } - -template -void testCMP( const L & lhs, const R & rhs ) -{ - MIL << "LHS " << testO(lhs) << endl; - MIL << "RHS " << rhs << endl; - -#define OUTS(S) DBG << #S << ": " << (S) << endl - OUTS( lhs.compare(rhs) ); - OUTS( lhs != rhs ); - OUTS( lhs < rhs ); - OUTS( lhs <= rhs ); - OUTS( lhs == rhs ); - OUTS( lhs >= rhs ); - OUTS( lhs > rhs ); -#undef OUTS -} - -#include -#include -inline PoolQuery makeTrivialQuery( IdString ident_r ) -{ - sat::Solvable::SplitIdent ident( ident_r ); - - PoolQuery q; - q.addAttribute( sat::SolvAttr::name, ident.name().asString() ); - q.addKind( ident.kind() ); - q.setMatchExact(); - q.setCaseSensitive(true); - return q; -} -inline PoolQuery makeTrivialQuery( const char * ch ) -{ return makeTrivialQuery( IdString(ch) ); } -void lktest() -{ - static unsigned i = 0; - ResPool pool( ResPool::instance() ); - target::HardLocksFile::Data newdata; - pool.getHardLockQueries( newdata ); - SEC << '[' << i++ << ']' << newdata << endl; -} - - -Capability guessPackageSpec( const std::string & str_r ) -{ - return Capability::guessPackageSpec( str_r ); -} - - - - -void cut( const Capability & cap ) -{ - CapDetail detail( cap.detail() ); - if ( detail.isSimple() ) - { - MIL << detail.kind() << ": " << detail.name(); - if ( detail.hasArch() ) - MIL << " (" << detail.arch() << ")"; - if ( detail.isVersioned() ) - MIL << " " << detail.op() << " " << detail.ed(); - MIL << endl; - } - else - { - MIL << "--- ??? ---" << endl; - } -} - -namespace zypp { namespace target { - void XRunUpdateMessages( const Pathname & root_r, - const Pathname & messagesPath_r, - const std::vector & checkPackages_r, - ZYppCommitResult & result_r ); - -}} -using zypp::target::XRunUpdateMessages; - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -try { - --argc,++argv; - if (0) { - // download the repo index file - media::MediaManager mediamanager; - media::MediaAccessId mid = mediamanager.open( Url("http://download.opensuse.org") ); - mediamanager.attach( mid ); - } - zypp::base::LogControl::instance().logToStdErr(); - INT << "===[START]==========================================" << endl; - ZConfig::instance(); - - ResPool pool( ResPool::instance() ); - sat::Pool satpool( sat::Pool::instance() ); - - if ( 0 ) - { - Measure x( "INIT TARGET" ); - { - { - //zypp::base::LogControl::TmpLineWriter shutUp; - getZYpp()->initializeTarget( sysRoot ); - } - getZYpp()->target()->load(); - USR << "baseproduct: " << getZYpp()->target()->baseProduct() << endl; - USR << "targetDistribution: " << getZYpp()->target()->targetDistribution() << endl; - USR << "targetDistributionRelease: " << getZYpp()->target()->targetDistributionRelease() << endl; - dumpRange( USR << "Product ", pool.byKindBegin(), pool.byKindEnd() ) << endl; - } - } - - if ( 0 ) - { - RepoManager repoManager( makeRepoManager( sysRoot ) ); - ServiceInfoList services = repoManager.knownServices(); - - for ( ServiceInfoList::iterator it = services.begin(); it != services.end(); ++it ) - { - ServiceInfo & nservice( *it ); - SEC << nservice << endl; - - if ( ! nservice.enabled() ) - continue; - - repoManager.refreshService( nservice ); - } - } - - if ( 1 ) - { - RepoManager repoManager( makeRepoManager( sysRoot ) ); - RepoInfoList repos = repoManager.knownRepositories(); - - // launch repos - for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it ) - { - RepoInfo & nrepo( *it ); - SEC << nrepo << endl; - - if ( ! nrepo.enabled() ) - continue; - - if ( ! repoManager.isCached( nrepo ) || nrepo.type() == repo::RepoType::RPMPLAINDIR ) - { - if ( repoManager.isCached( nrepo ) ) - { - SEC << "cleanCache" << endl; - repoManager.cleanCache( nrepo ); - } - SEC << "refreshMetadata" << endl; - //repoManager.refreshMetadata( nrepo ); - SEC << "buildCache" << endl; - repoManager.buildCache( nrepo ); - } - } - - // create from cache: - { - Measure x( "CREATE FROM CACHE" ); - for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it ) - { - RepoInfo & nrepo( *it ); - if ( ! nrepo.enabled() ) - continue; - - Measure x( "CREATE FROM CACHE "+nrepo.alias() ); - try - { - repoManager.loadFromCache( nrepo ); - } - catch ( const Exception & exp ) - { - MIL << "Try to rebuild cache..." << endl; - SEC << "cleanCache" << endl; - repoManager.cleanCache( nrepo ); - SEC << "buildCache" << endl; - repoManager.buildCache( nrepo ); - SEC << "Create from cache" << endl; - repoManager.loadFromCache( nrepo ); - } - - //USR << "pool: " << pool << endl; - } - } - } - - dumpRange( USR, satpool.reposBegin(), satpool.reposEnd() ); - USR << "pool: " << pool << endl; - - /////////////////////////////////////////////////////////////////// - - if ( 0 ) - { - Measure x( "Upgrade" ); - getZYpp()->resolver()->doUpgrade(); - } - - /////////////////////////////////////////////////////////////////// - - - - - -#if 1 - getZYpp()->resolver()->addRequire( Capability("amarok") ); - pool.byKindBegin()->status().setTransact( true, ResStatus::USER ); - solve(); - vdumpPoolStats( USR << "Transacting:"<< endl, - make_filter_begin(pool), - make_filter_end(pool) ) << endl; -#endif - - ////////////////////////////////////////////////////////////////// - INT << "===[END]============================================" << endl << endl; - zypp::base::LogControl::instance().logNothing(); - return 0; -} -catch ( const Exception & exp ) -{ - INT << exp << endl << exp.historyAsString(); - throw; -} -catch (...) -{ - throw; -} - - diff --git a/devel/devel.ma/PluginTest.cc b/devel/devel.ma/PluginTest.cc deleted file mode 100644 index 8ca1a71..0000000 --- a/devel/devel.ma/PluginTest.cc +++ /dev/null @@ -1,207 +0,0 @@ -#include "Tools.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - - -using namespace zypp; -using namespace zypp::functor; -using namespace zypp::ui; - -/////////////////////////////////////////////////////////////////// - -static const Pathname sysRoot( getenv("SYSROOT") ? getenv("SYSROOT") : "/Local/ROOT" ); - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - -static PluginScript scr( "/bin/cat" ); - -void repeat( const PluginFrame & f ) -{ - if ( ! scr.isOpen() ) - scr.open(); - MIL << "--> " << f << endl; - scr.send( f ); - PluginFrame r( scr.receive() ); - MIL << "<-- " << r << endl; - if ( r != f ) - ERR << "send/receive does not match." << endl; -} - -void send( const PluginFrame & f ) -{ - if ( ! scr.isOpen() ) - scr.open(); - MIL << "--> " << f << endl; - scr.send( f ); -} - - -PluginFrame receive() -{ - if ( ! scr.isOpen() ) - scr.open(); - PluginFrame r( scr.receive() ); - MIL << "<-- " << r << endl; - return r; -} - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - -#define DOLOG(C) USR << #C << ": " << endl; C; - -namespace zypp { - namespace target { - void testCommitPlugins( const Pathname & path_r ); - } -} - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -try { - --argc,++argv; - zypp::base::LogControl::instance().logToStdErr(); - INT << "===[START]==========================================" << endl; - ////////////////////////////////////////////////////////////////// - - zypp::target::testCommitPlugins( "/tmp/pltest" ); - - if ( 0 ) - { - Pathname script( "PluginTest.py" ); - PluginScript plugin( script ); - USR << plugin << endl; - - DOLOG( plugin.open() ); - - DOLOG( plugin.send( PluginFrame( "PLUGINBEGIN" ) ) ); - - PluginFrame ret; - DOLOG( ret = plugin.receive() ); - MIL << ret << endl; - - DOLOG( plugin.send( PluginFrame( "PLUGINEND" ) ) ); - DOLOG( ret = plugin.receive() ); - MIL << ret << endl; - - DOLOG( plugin.close() ); - } - - if ( 0 ) { - Pathname script( ZConfig::instance().pluginsPath()/"system/spacewalkx" ); - if ( PathInfo( script ).isX() ) - try { - PluginScript spacewalk( script ); - spacewalk.open(); - - PluginFrame notify( "PACKAGESETCHANGED" ); - spacewalk.send( notify ); - - PluginFrame ret( spacewalk.receive() ); - MIL << ret << endl; - if ( ret.command() == "ERROR" ) - ret.writeTo( WAR ) << endl; - } - catch ( const Exception & excpt ) - { - WAR << excpt.asUserHistory() << endl; - } - } - - if ( 0 ) { - Measure x( "" ); - PluginFrame f( "a" ); - f.setBody( std::string( 1020, '0' ) ); - if ( ! scr.isOpen() ) - scr.open(); - for ( unsigned i = 1; true; ++i ) - { - try { - MIL << "Receiving " << i << endl; - PluginFrame ret( receive() ); - } - catch ( const PluginScriptTimeout & excpt ) - { - ERR << excpt << endl; - scr.send( f ); - } - catch ( const PluginScriptDiedUnexpectedly & excpt ) - { - ERR << excpt << endl; - ERR << scr << endl; - scr.close(); - break; - } - } - } - - if ( 0 ) { - Measure x( "" ); - PluginFrame f( "a" ); - f.setBody( std::string( 10200, '0' ) ); - for ( unsigned i = 1; true; ++i ) - { - try { - MIL << "Sending " << i << endl; - send( f ); - } - catch ( const PluginScriptTimeout & excpt ) - { - ERR << excpt << endl; - ::kill( scr.getPid(), SIGKILL); - } - catch ( const PluginScriptDiedUnexpectedly & excpt ) - { - ERR << excpt << endl; - ERR << scr << endl; - scr.close(); - break; - } - } - } - - ////////////////////////////////////////////////////////////////// - INT << "===[END]============================================" << endl << endl; - zypp::base::LogControl::instance().logNothing(); - return 0; -} -catch ( const Exception & exp ) -{ - INT << exp << endl << exp.historyAsString(); - throw; -} -catch (...) -{ - throw; -} - - diff --git a/devel/devel.ma/PluginTest.py b/devel/devel.ma/PluginTest.py deleted file mode 100755 index e3a5873..0000000 --- a/devel/devel.ma/PluginTest.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -# ZYpp plugin -# -import os -import sys -import traceback -import time - -from zypp_plugin import Plugin - -class MyPlugin(Plugin): - - def PLUGINBEGIN(self, headers, body): - # commit is going to start. - #self.error( {}, 'oops' ) - self.ack() - - def PLUGINEND(self, headers, body): - # commit ended - self.ack() - -plugin = MyPlugin() -plugin.main() diff --git a/devel/devel.ma/Printing.h b/devel/devel.ma/Printing.h deleted file mode 100644 index 09890c9..0000000 --- a/devel/devel.ma/Printing.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef MA_PRINTING_H -#define MA_PRINTING_H - -#include - -#include -#include -#include - -#include -#include -#include -#include - -using std::endl; - -/////////////////////////////////////////////////////////////////// - -struct Print -{ - template - bool operator()( const Tp & val_r ) const - { USR << val_r << endl; return true; } -}; - -/////////////////////////////////////////////////////////////////// - -template - struct PrintOn : public std::unary_function - { - bool operator()( const Tp & obj ) const - { - if ( _leadNL ) - _str << std::endl << _prfx << obj; - else - _str << _prfx << obj << std::endl; - return true; - } - - PrintOn( std::ostream & str, const std::string & prfx = std::string(), bool leadNL = false ) - : _str( str ) - , _prfx( prfx ) - , _leadNL( leadNL ) - {} - - std::ostream & _str; - std::string _prfx; - bool _leadNL; - }; - -/////////////////////////////////////////////////////////////////// -#endif // MA_PRINTING_H diff --git a/devel/devel.ma/Sat.cc b/devel/devel.ma/Sat.cc deleted file mode 100644 index b327ca8..0000000 --- a/devel/devel.ma/Sat.cc +++ /dev/null @@ -1,121 +0,0 @@ -#include - -#include -#include -namespace boost -{ - namespace detail - { - inline std::ostream & operator<<( std::ostream & str, const thread_data_base & obj ) - { return str << &obj; } - } -} - -#include -#include -#include -#include - -using std::endl; -using namespace zypp; - -#undef MIL -#define MIL MilSync( L_BASEFILE, __FUNCTION__, __LINE__ )._str - -#ifdef _REENTRANT -#warning _REENTRANT -#else -#warning NOT_REENTRANT -#endif - -template -struct ClassLevelLockable -{ - typedef boost::recursive_mutex Lockable; - - typedef boost::lock_guard Lock; - struct Lock - { - Lock( const Derived & obj ) - {} - ~Lock - }; - - Lockable _mutex; -}; - -template -struct ObjectLevelLockable -{ - typedef boost::recursive_mutex Lockable; - typedef boost::lock_guard Lock; - -}; - - -struct MilSync -{ - MilSync( const char * file_r, const char * func_r, const int line_r ) - : _guard( _mutex ) - , _str( zypp::base::logger::getStream( ZYPP_BASE_LOGGER_LOGGROUP, zypp::base::logger::E_MIL, file_r, func_r, line_r ) ) - {} - typedef boost::recursive_mutex Lockable; - static Lockable _mutex; - boost::lock_guard _guard; - std::ostream & _str; -}; -MilSync::Lockable MilSync::_mutex; - -struct ThreadExcl -{ - ThreadExcl() - { - MIL << "+TE" << boost::this_thread::get_id() << endl; - boost::this_thread::sleep( boost::posix_time::seconds(1) ); - } - - ~ThreadExcl() - { - MIL << "-TE" << boost::this_thread::get_id() << endl; - } -}; - -void t_exit() -{ - MIL << "---" << boost::this_thread::get_id() << endl; -} - -void t_main() -{ - MIL << "+++" << boost::this_thread::get_id() << " " << boost::this_thread::interruption_enabled() << endl; - boost::this_thread::at_thread_exit( t_exit ); - ThreadExcl a; - while( true ) - boost::this_thread::sleep( boost::posix_time::seconds(1) ); -} - -int main( int argc, char * argv[] ) -{ - //zypp::base::LogControl::instance().logfile( "log.restrict" ); - INT << "===[START]==========================================" << endl; - - MIL << "M+++" << boost::this_thread::get_id() << endl; - boost::thread_group mthreads; - - mthreads.create_thread( t_main ); - mthreads.create_thread( t_main ); - mthreads.create_thread( t_main ); - mthreads.create_thread( t_main ); - mthreads.create_thread( t_main ); - - MIL << "M???" << boost::this_thread::get_id() << endl; - //boost::this_thread::sleep( boost::posix_time::seconds(10) ); - mthreads.interrupt_all(); - mthreads.join_all(); - MIL << "M---" << boost::this_thread::get_id() << endl; - - /////////////////////////////////////////////////////////////////// - INT << "===[END]============================================" << endl << endl; - zypp::base::LogControl::instance().logNothing(); - return 0; -} diff --git a/devel/devel.ma/SigTrackableFail.cc b/devel/devel.ma/SigTrackableFail.cc deleted file mode 100644 index 1bb8b97..0000000 --- a/devel/devel.ma/SigTrackableFail.cc +++ /dev/null @@ -1,133 +0,0 @@ -#include -using std::endl; -using std::cout; - -#include -#include -using boost::signal; -using boost::signals::connection; -using boost::signals::scoped_connection; -using boost::signals::trackable; - -#define DBG std::cerr -#define MIL std::cerr -namespace boost -{ - template - std::ostream & operator<<( std::ostream & str, const signal & obj ) - { - return str << "Connected slots: " << obj.num_slots(); - } - - namespace signals - { - std::ostream & operator<<( std::ostream & str, const connection & obj ) - { - return str << "Connection: " - << ( obj.connected() ? '*' : '_' ) - << ( obj.blocked() ? 'B' : '_' ) - ; - } - } -} - -struct Sender -{ - void ping() const - { - static unsigned i = 0; - ++i; - MIL << "Sending " << i << " -> " << _sigA << endl; - _sigA( i ); - _sigB(); - } - - typedef signal SigA; - typedef signal SigB; - - SigA & siga() const { return _sigA; } - SigB & sigb() const { return _sigB; } - - mutable SigA _sigA; - mutable SigB _sigB; -}; - -struct Receiver : public trackable -{ - Receiver() {_s=++s;} - Receiver( const Receiver & rhs ) : trackable( rhs ) {_s=++s;} - Receiver& operator=( const Receiver & rhs ) { - trackable::operator=( rhs ); - return *this; - } - ~Receiver() {_s=-_s;} - static int s; - int _s; - - void fpong() - { - dumpOn( DBG << "Receiver " << _s << " <- " << 13 << " (" ) << ")" << endl; - } - - void operator()( unsigned i ) - { pong( i ); } - - void pong( unsigned i ) - { - dumpOn( DBG << "Receiver " << _s << " <- " << i << " (" ) << ")" << endl; - } - - std::ostream & dumpOn( std::ostream & str ) const - { - return str << "Receiver " << _s << " connected signals: " << _connected_signals().size(); - } -}; - -std::ostream & operator<<( std::ostream & str, const Receiver & obj ) -{ return obj.dumpOn( str ); } - -int Receiver::s; - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, const char * argv[] ) -{ - --argc; ++argv; // skip arg 0 - - Sender sender; - sender.ping(); - - Receiver rec; - sender.siga().connect( boost::bind( &Receiver::pong, &rec, _1 ) ); - sender.ping(); - - { - Receiver recw; - sender.siga().connect( boost::ref(recw) ); - sender.ping(); - - Receiver recx; - MIL << recx << endl; - sender.siga().connect( boost::bind( &Receiver::pong, &recx, _1 ) ); - sender.sigb().connect( boost::bind( &Receiver::fpong, &recx ) ); - MIL << recx << endl; - sender.ping(); - - Receiver recy; - connection cy( sender.siga().connect( boost::bind( &Receiver::pong, &recy, _1 ) ) ); - sender.ping(); - - Receiver recz; - scoped_connection cz( sender.siga().connect( boost::bind( &Receiver::pong, &recz, _1 ) ) ); - sender.ping(); - - cy.disconnect(); - } - - sender.ping(); - return 0; -} - diff --git a/devel/devel.ma/Signal.cc b/devel/devel.ma/Signal.cc deleted file mode 100644 index 065fa32..0000000 --- a/devel/devel.ma/Signal.cc +++ /dev/null @@ -1,122 +0,0 @@ -#include - -#include -#include - -#include -#include - -using std::endl; -using std::cout; -//////////////////////////////////////////////////////////////////////////////////////////////////// -namespace boost -{ - template - std::ostream & operator<<( std::ostream & str, const signal & obj ) - { - return str << "Connected slots: " << obj.num_slots(); - } - - namespace signals - { - std::ostream & operator<<( std::ostream & str, const connection & obj ) - { - return str << "Connection: " - << ( obj.connected() ? '*' : '_' ) - << ( obj.blocked() ? 'B' : '_' ) - ; - } - } -} -//////////////////////////////////////////////////////////////////////////////////////////////////// - -using namespace zypp; - -using boost::signal; -using boost::signals::connection; -using boost::signals::trackable; - -struct HelloWorld -{ - HelloWorld() {++i;} - HelloWorld(const HelloWorld &) {++i;} - ~HelloWorld() { --i;} - - void operator()(unsigned) const - { - USR << "Hello, World! " << i << std::endl; - } - - static int i; -}; - -int HelloWorld::i = 0; - -struct M -{ - void ping() const - { - static unsigned i = 0; - ++i; - MIL << i << " -> " << _sigA << endl; - _sigA( i ); - } - - typedef signal SigA; - - SigA & siga() const { return _sigA; } - - mutable SigA _sigA; -}; - -struct X : public trackable -{ - X() {_s=++s;} - X( const X & ) {_s=++s;} - X& operator=( const X & ) { return *this; } - ~X() {_s=-_s;} - static int s; - int _s; - - void pong( unsigned i ) const - { - DBG << _s << ' ' << i << endl; - } -}; - -int X::s; - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, const char * argv[] ) -{ - --argc; ++argv; // skip arg 0 - - M m; - m.ping(); - X xx; - m.siga().connect( boost::bind( &X::pong, &xx, _1 ) ); - m.ping(); - - { - X x; - m.siga().connect( boost::bind( &X::pong, &x, _1 ) ); - m.ping(); - - X y; - m.siga().connect( boost::bind( &X::pong, &y, _1 ) ); - m.ping(); - - } - - m.ping(); - - /////////////////////////////////////////// - - INT << "---STOP" << endl; - return 0; -} - diff --git a/devel/devel.ma/Test.cc b/devel/devel.ma/Test.cc deleted file mode 100644 index 42fbf41..0000000 --- a/devel/devel.ma/Test.cc +++ /dev/null @@ -1,82 +0,0 @@ -#include "Tools.h" -#include - -#include -#include - -static const Pathname sysRoot( "/tmp/ToolScanRepos" ); - -void addInstall( const std::string & pkgspec_r ) -{ - bool rewrote( false ); - Capability pkgspec( Capability::guessPackageSpec( pkgspec_r, rewrote ) ); - MIL << "Add '" << pkgspec << "' for '" << pkgspec_r << "'" << endl; - ResPool::instance().resolver().addRequire( pkgspec ); -} - -void addConflict( const std::string & pkgspec_r ) -{ - bool rewrote( false ); - Capability pkgspec( Capability::guessPackageSpec( pkgspec_r, rewrote ) ); - MIL << "Con '" << pkgspec << "' for '" << pkgspec_r << "'" << endl; - ResPool::instance().resolver().addConflict( pkgspec ); -} - -bool solve() -{ - bool rres = false; - { - //zypp::base::LogControl::TmpLineWriter shutUp; - //ResPool::instance().resolver().setOnlyRequires( true ); - rres = ResPool::instance().resolver().resolvePool(); - } - if ( ! rres ) - { - ERR << "resolve " << rres << endl; - ResPool::instance().resolver().problems(); - return false; - } - MIL << "resolve " << rres << endl; - vdumpPoolStats( USR << "Transacting:"<< endl, - make_filter_begin(ResPool::instance()), - make_filter_end(ResPool::instance()) ) << endl; - - return true; -} - -bool install() -{ - ZYppCommitPolicy pol; - pol.dryRun( true ); - pol.rpmInstFlags( pol.rpmInstFlags().setFlag( target::rpm::RPMINST_JUSTDB ) ); - SEC << getZYpp()->commit( pol ) << endl; - return true; -} - - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - INT << "===[START]==========================================" << endl; - /////////////////////////////////////////////////////////////////// - if ( sysRoot == "/" ) - ::unsetenv( "ZYPP_CONF" ); - TestSetup::LoadSystemAt( sysRoot, Arch_x86_64 ); - /////////////////////////////////////////////////////////////////// - ResPool pool( ResPool::instance() ); - sat::Pool satpool( sat::Pool::instance() ); - /////////////////////////////////////////////////////////////////// - -// addConflict( "kernel-default" ); -// addConflict( "kernel-default-base" ); - addInstall( "test"); - solve(); - - INT << "===[END]============================================" << endl << endl; - return 0; -} - diff --git a/devel/devel.ma/ToolProvideSignedDir.cc b/devel/devel.ma/ToolProvideSignedDir.cc deleted file mode 100644 index ecd2ffa..0000000 --- a/devel/devel.ma/ToolProvideSignedDir.cc +++ /dev/null @@ -1,127 +0,0 @@ -#include "Tools.h" - -#include - -static std::string appname( "ToolProvideSignedDir" ); - -void message( const std::string & msg_r ) -{ - cerr << "*** " << msg_r << endl; -} - -int usage( const std::string & msg_r = std::string(), int exit_r = 100 ) -{ - if ( ! msg_r.empty() ) - { - cerr << endl; - message( msg_r ); - cerr << endl; - } - cerr << "Usage: " << appname << "[OPTIONS] URL..." << endl; - cerr << " Load the digested directory at URL to test system below /tmp/" << appname << "." << endl; - cerr << " -r ROOT Use /tmp/ROOT as location of test system (default: " << appname << ")." << endl; - cerr << " -c Clear an existing test system (default)." << endl; - cerr << " -n Do not clear an existing test system but reuse it." << endl; - return exit_r; -} - -/****************************************************************** -** -** 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 mtmp( "/tmp" ); - Pathname mroot( mtmp/appname ); - bool oClearRoot = true; - - std::vector urls; - - while ( argc ) - { - if ( argv[0] == std::string("-c") ) - { - oClearRoot = true; - } - else if ( argv[0] == std::string("-n") ) - { - oClearRoot = false; - } - else if ( argv[0] == std::string("-r") ) - { - --argc; - ++argv; - if ( ! argc ) - return usage( "Missing arg to -r ROOT", 101 ); - - if ( *(argv[0]) ) // empty - mroot = mtmp/argv[0]; - else - mroot = mtmp/appname; - } - else - { - urls.push_back( argv[0] ); - } - --argc; - ++argv; - } - - if ( urls.empty() ) - { - return usage( "Missing URLs", 102 ); - } - - /////////////////////////////////////////////////////////////////// - - if ( oClearRoot ) - { - message( "Clear test system at " + mroot.asString() ); - filesystem::recursive_rmdir( mroot ); - } - else - { - message( "Use test system at " + mroot.asString() ); - } - filesystem::assert_dir( mroot ); - - KeyRing::setDefaultAccept( KeyRing::ACCEPT_UNKNOWNKEY|KeyRing::TRUST_KEY_TEMPORARILY ); - - int ret = 0; - for_( it, urls.begin(), urls.end() ) - { - message( "Setup " + *it ); - try - { - Url url( *it ); - Pathname tdir( mroot/url.getHost()/url.getPathName() ); - filesystem::assert_dir( tdir ); - - Fetcher f; - f.setOptions( Fetcher::AutoAddIndexes ); - f.enqueueDigestedDir( Pathname("."), /*recursive*/false ); - MediaSetAccess ma( url ); - f.start( tdir, ma ); - } - catch ( const Exception & exp ) - { - message( exp.asString() + "\n" + exp.historyAsString() ); - ++ret; - } - } - - INT << "===[END]============================================" << endl << endl; - return ret; -} diff --git a/devel/devel.ma/Tools.h b/devel/devel.ma/Tools.h deleted file mode 100644 index 49e2d07..0000000 --- a/devel/devel.ma/Tools.h +++ /dev/null @@ -1,214 +0,0 @@ -#ifndef Tools_h -#define Tools_h - -#include -#include -#include -#include -#include -#include - -#define INCLUDE_TESTSETUP_WITHOUT_BOOST -#include -#undef INCLUDE_TESTSETUP_WITHOUT_BOOST - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - - -using namespace zypp; -using zypp::debug::Measure; -using std::endl; - -/////////////////////////////////////////////////////////////////// - -#define for_providers_(IT,CAP) for ( sat::WhatProvides::const_iterator IT = sat::WhatProvides( Capability CAP ).begin(), _for_end = sat::WhatProvides().end(); IT != _for_end; ++IT ) - -/////////////////////////////////////////////////////////////////// - -template -void whichType( T ) -{ INT << __PRETTY_FUNCTION__ << endl; } -template -void whichType() -{ INT << __PRETTY_FUNCTION__ << endl; } - -void waitForInput() -{ - std::string i; - USR << "WAITING FOR INPUT!" << endl; - std::cin >> i; -} - -/////////////////////////////////////////////////////////////////// - -void mksrc( const std::string & url, const std::string & alias, RepoManager & repoManager ) -{ - RepoInfo nrepo; - nrepo.setAlias( alias ); - nrepo.setName( alias ); - nrepo.setEnabled( true ); - nrepo.setAutorefresh( false ); - nrepo.addBaseUrl( Url(url) ); - - if ( ! repoManager.isCached( nrepo ) ) - { - repoManager.buildCache( nrepo ); - } - - repoManager.loadFromCache( nrepo ); -} - -/////////////////////////////////////////////////////////////////// -// -template - struct SetTrue - { - SetTrue( TCondition cond_r ) - : _cond( cond_r ) - {} - - template - bool operator()( Tp t ) const - { - _cond( t ); - return true; - } - - TCondition _cond; - }; - -template - inline SetTrue setTrue_c( TCondition cond_r ) - { - return SetTrue( cond_r ); - } - -struct PrintPoolItem -{ - void operator()( const PoolItem & pi ) const - { USR << pi << endl; } -}; - -template - std::ostream & vdumpPoolStats( std::ostream & str, - TIterator begin_r, TIterator end_r ) - { - pool::PoolStats stats; - std::for_each( begin_r, end_r, - - functor::chain( setTrue_c(PrintPoolItem()), - setTrue_c(functor::functorRef(stats)) ) - - ); - return str << stats; - } - -/////////////////////////////////////////////////////////////////// -// rstats - -typedef zypp::pool::PoolStats Rstats; - -template - void rstats( TIterator begin, TIterator end ) - { - DBG << __PRETTY_FUNCTION__ << endl; - Rstats stats; - for_each( begin, end, functor::functorRef(stats) ); - MIL << stats << endl; - } - -template - void rstats( const TContainer & c ) - { - rstats( c.begin(), c.end() ); - } - -/////////////////////////////////////////////////////////////////// - -inline RepoManager makeRepoManager( const Pathname & mgrdir_r ) -{ - // set via zypp.conf - return RepoManager(); -} - -/////////////////////////////////////////////////////////////////// - -template -ui::Selectable::Ptr getSel( const std::string & name_r ) -{ - ResPoolProxy uipool( getZYpp()->poolProxy() ); - for_(it, uipool.byKindBegin(), uipool.byKindEnd() ) - { - if ( (*it)->name() == name_r ) - return (*it); - } - return 0; -} - - - -template -PoolItem getPi( const std::string & alias_r, const std::string & name_r, const Edition & ed_r, const Arch & arch_r ) -{ - PoolItem ret; - ResPool pool( getZYpp()->pool() ); - for_(it, pool.byIdentBegin(name_r), pool.byIdentEnd(name_r) ) - { - if ( ( ed_r.empty() || ed_r.match((*it)->edition()) == 0 ) - && ( arch_r.empty() || arch_r == (*it)->arch() ) - && ( alias_r.empty() || alias_r == (*it)->repository().alias() ) ) - { - if ( !ret || ret->repository().alias() == sat::Pool::systemRepoAlias() ) - { - ret = (*it); - MIL << " ->" << *it << endl; - } - else - { - DBG << " - " << *it << endl; - } - } - else - { - DBG << " ?" << *it << endl; - } - } - return ret; -} -template -PoolItem getPi( const std::string & name_r, const Edition & ed_r, const Arch & arch_r ) -{ - return getPi( "", name_r, ed_r, arch_r ); -} -template -PoolItem getPi( const std::string & name_r ) -{ - return getPi( name_r, Edition(), Arch_empty ); -} -template -PoolItem getPi( const std::string & name_r, const Edition & ed_r ) -{ - return getPi( name_r, ed_r, Arch_empty ); -} -template -PoolItem getPi( const std::string & name_r, const Arch & arch_r ) -{ - return getPi( name_r, Edition(), arch_r ); -} - -/////////////////////////////////////////////////////////////////// -#endif // Tools_h diff --git a/devel/devel.ma/Xml.cc b/devel/devel.ma/Xml.cc deleted file mode 100644 index 66e16f7..0000000 --- a/devel/devel.ma/Xml.cc +++ /dev/null @@ -1,216 +0,0 @@ -#include -#include -#include -#include - -#include -#include -#include - -#include -//#include -//#include - -using namespace zypp; - -#include -using zypp::debug::Measure; - -/////////////////////////////////////////////////////////////////// - -/** Helper to detect an objects type. */ -template void ti( const TCl & c ) -{ - SEC << __PRETTY_FUNCTION__ << endl; -} - -bool noop( xml::Reader & reader_r ) -{ - return true; -} -struct Noop -{ - bool operator()( xml::Reader & reader_r ) const - { return true; } -}; - -/////////////////////////////////////////////////////////////////// - -bool dumpNode( xml::Reader & reader_r ) -{ - switch ( reader_r->nodeType() ) - { - case XML_READER_TYPE_ELEMENT: - MIL << *reader_r << endl; - for ( int i = 0; i < reader_r->attributeCount(); ++i ) - { - MIL << " attr no " << i << " '" << reader_r->getAttributeNo( i ) << "'" << endl; - } - break; - - case XML_READER_TYPE_ATTRIBUTE: - WAR << *reader_r << endl; - break; - - case XML_READER_TYPE_TEXT: - case XML_READER_TYPE_CDATA: - DBG << *reader_r << endl; - break; - - default: - //ERR << *reader_r << endl; - break; - } - return true; -} - -/////////////////////////////////////////////////////////////////// - -bool consume( xml::Reader & reader_r ) -{ - switch ( reader_r->nodeType() ) - { - case XML_READER_TYPE_ELEMENT: - MIL << *reader_r << endl; - for ( int i = 0; i < reader_r->attributeCount(); ++i ) - { - MIL << " attr no " << i << " '" << reader_r->getAttributeNo( i ) << "'" << endl; - } - break; - - case XML_READER_TYPE_ATTRIBUTE: - WAR << *reader_r << endl; - break; - - case XML_READER_TYPE_TEXT: - case XML_READER_TYPE_CDATA: - DBG << *reader_r << endl; - break; - - default: - //ERR << *reader_r << endl; - break; - } - return true; -} - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - --argc, ++argv; - INT << "===[START]==========================================" << endl; - - bool verbose( true ); - Pathname input( "test.xml" ); - xml::Reader::ProcessNode consumer( consume ); - - if ( argc && !strcmp( *argv, "-q" ) ) - { - --argc, ++argv; - verbose = false; - } - - { - Measure m( "Parse all" ); - for ( ; argc; --argc, ++argv ) - { - input = *argv; - - try { - Measure m( input.basename() ); -// zypp::base::LogControl::TmpLineWriter shutUp; - xml::Reader reader( input ); - if ( verbose ) - reader.foreachNodeOrAttribute( consumer ); - else - reader.foreachNode( consumer ); - } - catch ( const Exception & exp ) - { - INT << exp << endl << exp.historyAsString(); - } - } - } - INT << "===[END]============================================" << endl << endl; - return 0; -} - -/* - - - -fam-devel -ppc - -59d6a65cdadd911fe8ceee87740a54305b2ab053 -Include Files and Libraries Mandatory for Development -Fam is a file alteration monitoring service. This means that you can - -foreachNode( dumpNode ) -======================= -START MEASURE(Parse) -0:ELEMENT [attr 3] - attr no 0 'http://linux.duke.edu/metadata/common' - attr no 1 'http://linux.duke.edu/metadata/rpm' - attr no 2 '23230' -1: ELEMENT [attr 1] - attr no 0 'rpm' -2: ELEMENT [noattr] -3: TEXT <#text> [noattr] {fam-devel} -2: ELEMENT [noattr] -3: TEXT <#text> [noattr] {ppc} -2: ELEMENT [attr 3|empty] - attr no 0 '0' - attr no 1 '2.6.10' - attr no 2 '141' -2: ELEMENT [attr 2] - attr no 0 'sha' - attr no 1 'YES' -3: TEXT <#text> [noattr] {59d6a65cdadd911fe8ceee87740a54305b2ab053} -2: ELEMENT [noattr] -3: TEXT <#text> [noattr] {Include Files and Libraries Mandatory for Development} -2: ELEMENT [noattr] -3: TEXT <#text> [noattr] {Fam is a file alteration monitoring service. This means that you can - -foreachNodeOrAttribute( dumpNode ) -================================== -START MEASURE(Parse) -0:ELEMENT [attr 3] - attr no 0 'http://linux.duke.edu/metadata/common' - attr no 1 'http://linux.duke.edu/metadata/rpm' - attr no 2 '23230' -1: ATTRIBUTE [noattr] {http://linux.duke.edu/metadata/common} -1: ATTRIBUTE [noattr] {http://linux.duke.edu/metadata/rpm} -1: ATTRIBUTE [noattr] {23230} -1: ELEMENT [attr 1] - attr no 0 'rpm' -2: ATTRIBUTE [noattr] {rpm} -2: ELEMENT [noattr] -3: TEXT <#text> [noattr] {fam-devel} -2: ELEMENT [noattr] -3: TEXT <#text> [noattr] {ppc} -2: ELEMENT [attr 3|empty] - attr no 0 '0' - attr no 1 '2.6.10' - attr no 2 '141' -3: ATTRIBUTE [noattr] {0} -3: ATTRIBUTE [noattr] {2.6.10} -3: ATTRIBUTE [noattr] {141} -2: ELEMENT [attr 2] - attr no 0 'sha' - attr no 1 'YES' -3: ATTRIBUTE [noattr] {sha} -3: ATTRIBUTE [noattr] {YES} -3: TEXT <#text> [noattr] {59d6a65cdadd911fe8ceee87740a54305b2ab053} -3: ATTRIBUTE [noattr] {sha} -3: ATTRIBUTE [noattr] {YES} -2: ELEMENT [noattr] -3: TEXT <#text> [noattr] {Include Files and Libraries Mandatory for Development} -2: ELEMENT [noattr] -3: TEXT <#text> [noattr] {Fam is a file alteration monitoring service. This means that you can - -*/ diff --git a/devel/devel.ma/lines2array b/devel/devel.ma/lines2array deleted file mode 100755 index 18107ae..0000000 --- a/devel/devel.ma/lines2array +++ /dev/null @@ -1,30 +0,0 @@ -#! /bin/bash - -OFILE=${1:-array} - -cat $1 | awk -vOFILE=$OFILE ' -BEGIN { - sep = " " - printf "#ifndef ARRAY_%s_h\n", OFILE - printf "#define ARRAY_%s_h\n", OFILE - printf "\n" - printf "#include \n" - printf "#include \n" - printf "\n" - printf "std::list %s()\n", OFILE - printf "{\n" - printf " const char *const val[] = {\n" -} -{ - printf " %s\"%s\"\n", sep, $0 - sep = "," -} -END { - printf " };\n" - printf " const char *const* e = val + sizeof( val ) / sizeof( const char *const );\n" - printf " return std::list( val, e );\n" - printf "}\n" - printf "\n" - printf "#endif // ARRAY_%s_h\n", OFILE -} -' > $OFILE.h diff --git a/devel/devel.ma/ma_test b/devel/devel.ma/ma_test deleted file mode 100755 index 4baea41..0000000 --- a/devel/devel.ma/ma_test +++ /dev/null @@ -1,48 +0,0 @@ -#! /bin/bash -# -#export LD_LIBRARY_PATH=/usr/local/lib64 - -PRG=Main -SUDO= -if [ "$1" = -su ]; then - SUDO="sudo -E" - shift -fi - -if [ -n "$1" ]; then - PRG=$1 - shift -fi - -if [ ! -x ~ma/bin/sy2l.tcl ]; then - exec ./$PRG "$@" -fi - -LPIPE=LOGFILE - -test -p "$LPIPE" || { - test -e "$LPIPE" && { echo "No pipe '$LPIPE' exists"; exit 1; } - mkfifo $LPIPE -} -if ! fuser $LPIPE >/dev/null; then - ~ma/bin/sy2l.tcl $LPIPE & -fi - -if ps axl | grep -q '[/]usr/sbin/iceccd'; then - MAKE="make -j 15" -else - MAKE="make -j 2" -fi - -$MAKE $PRG || exit 1 -echo "=====================================================" -export ZYPP_LOGFILE=- -export ZYPP_KEYRING_DEFAULT_ACCEPT_ALL=1 -export SYSROOT=/Local/ROOT -export ZYPP_CONF=$SYSROOT/zypp.conf - -#export ZYPP_TESTSUITE_FAKE_ARCH=x86_64 -#$SUDO ./$PRG "$@" 2>&1 | tee log > $LPIPE -exec 2> >(tee log > $LPIPE) -$SUDO ./$PRG "$@" - diff --git a/devel/devel.ma/main.h b/devel/devel.ma/main.h deleted file mode 100644 index cbde246..0000000 --- a/devel/devel.ma/main.h +++ /dev/null @@ -1,170 +0,0 @@ -#ifndef main_h -#define main_h - -#include -#include -#include -#include -#include - -using std::string; - -/////////////////////////////////////////////////////////////////// - -class Resolvable : public zypp::base::ReferenceCounted, private zypp::base::NonCopyable -{ - friend std::ostream & operator<<( std::ostream & str, const Resolvable & res ); - public: - string kind() const; - string name() const; - public: - typedef Resolvable Self; - typedef zypp::base::intrusive_ptr Ptr; - typedef zypp::base::intrusive_ptr constPtr; - protected: - Resolvable( const string kind_r /*NVRA*/ ); - virtual ~Resolvable(); - virtual std::ostream & dumpOn( std::ostream & str ) const; - private: - struct Impl; - zypp::base::ImplPtr _impl; -}; - -inline void intrusive_ptr_add_ref( const Resolvable * ptr_r ) -{ zypp::base::ReferenceCounted::add_ref( ptr_r ); } -inline void intrusive_ptr_release( const Resolvable * ptr_r ) -{ zypp::base::ReferenceCounted::release( ptr_r ); } - -inline std::ostream & operator<<( std::ostream & str, const Resolvable & res ) -{ return res.dumpOn( str ); } - -/////////////////////////////////////////////////////////////////// - -// connect resolvables interface and implementation. -template - struct ResImplConnect : public TRes - { - public: - typedef ResImplConnect Self; - typedef typename TRes::Impl Impl; - typedef zypp::base::shared_ptr ImplPtr; - typedef zypp::base::intrusive_ptr Ptr; - typedef zypp::base::intrusive_ptr constPtr; - public: - ResImplConnect( /*NVRA*/ ImplPtr impl_r ) - : _impl( impl_r ? impl_r : ImplPtr(new Impl /*NVRA*/) ) - { _impl->_backRef = this; } - virtual ~ResImplConnect() {} - private: - ImplPtr _impl; - virtual Impl & impl() { return *_impl; } - virtual const Impl & impl() const { return *_impl; } - }; - - -template - typename TImpl::ResType::Ptr - makeResolvable( /*NVRA*/ zypp::base::shared_ptr & impl_r ) - { - impl_r.reset( new TImpl ); - return new ResImplConnect( /*NVRA*/ impl_r ); - } - -/////////////////////////////////////////////////////////////////// -#include -using std::list; - -struct ObjectImpl -{ - const Resolvable * self() const { return _backRef; } - Resolvable * self() { return _backRef; } - - virtual string summary() const { return string(); } - virtual list description() const { return list(); } - //virtual FSize size() const { return 0; } - //virtual bool providesSources() const { return false; } - - ObjectImpl() - : _backRef( 0 ) - {} - virtual ~ObjectImpl() {}; - - private: - template - friend class ResImpl; - Resolvable * _backRef; -}; - -class Object : public Resolvable -{ - public: - string summary() const; - list description() const; - //FSize size() const; - //bool providesSources() const; - public: - typedef Object Self; - typedef ObjectImpl Impl; - typedef zypp::base::intrusive_ptr Ptr; - typedef zypp::base::intrusive_ptr constPtr; - protected: - Object( const string kind_r /*NVRA*/ ); - virtual ~Object(); - private: - virtual Impl & impl() = 0; - virtual const Impl & impl() const = 0; -}; - -/////////////////////////////////////////////////////////////////// -class Package; -struct PackageImpl : public ObjectImpl -{ - typedef Package ResType; - virtual string packagedata() const { return string(); } -}; - -class Package : public Object -{ - public: - string packagedata() const; - public: - typedef Package Self; - typedef PackageImpl Impl; - typedef zypp::base::intrusive_ptr Ptr; - typedef zypp::base::intrusive_ptr constPtr; - protected: - Package( /*NVRA*/ ); - virtual ~Package(); - private: - virtual Impl & impl() = 0; - virtual const Impl & impl() const = 0; -}; - -/////////////////////////////////////////////////////////////////// - -class Selection; -struct SelectionImpl : public ObjectImpl -{ - typedef Selection ResType; - virtual string selectiondata() const { return string(); } -}; - -class Selection : public Object -{ - public: - string selectiondata() const; - public: - typedef Selection Self; - typedef SelectionImpl Impl; - typedef zypp::base::intrusive_ptr Ptr; - typedef zypp::base::intrusive_ptr constPtr; - protected: - Selection( /*NVRA*/ ); - virtual ~Selection(); - private: - virtual Impl & impl() = 0; - virtual const Impl & impl() const = 0; -}; - -/////////////////////////////////////////////////////////////////// -#endif // main_h diff --git a/devel/genclass.in b/devel/genclass.in deleted file mode 100644 index 38c8fdf..0000000 --- a/devel/genclass.in +++ /dev/null @@ -1,234 +0,0 @@ -#! /bin/bash - -function usage() { - echo $@ >&2 - echo <&2 -Usage: genclass [path/]stem -EOF - exit 1 -} - -test -z "$1" && usage "Missing name!" - -TOPSRCDIR=${XTOPSRCDIR:-$(cd @CMAKE_SOURCE_DIR@ && pwd)} -test -z "$TOPSRCDIR" && { - echo "Dir does not exist '$TOPSRCDIR'" >&2 - exit 1 -} - -OUTDIR=$(dirname $1) -STEM=$(basename $1) -STEMDIR=$( cd $OUTDIR && pwd ) -test -z "$STEMDIR" && { - echo "Dir does not exist '$(dirname $1)'" >&2 - exit 1 -} -STEMDIR=${STEMDIR#$TOPSRCDIR/} - -CLASS=$STEM -CLASS_H=$STEMDIR/$STEM.h -CLASS_CC=$STEMDIR/$STEM.cc - -OUT_CLASS_H=$OUTDIR/$STEM.h -OUT_CLASS_CC=$OUTDIR/$STEM.cc -test -e $OUT_CLASS_H -o -e $OUT_CLASS_CC && { - test -e $OUT_CLASS_H && echo "File exists '$OUT_CLASS_H' using '$OUT_CLASS_H.new'" >&2 - test -e $OUT_CLASS_CC && echo "File exists '$OUT_CLASS_CC' using '$OUT_CLASS_CC.new'" >&2 - OUT_CLASS_H="$OUT_CLASS_H.new" - OUT_CLASS_CC="$OUT_CLASS_CC.new" -} - -INCLUDE_H=$CLASS_H -INCLUDE_DEF=$(echo $INCLUDE_H | sed 's/[./]/_/g' | awk '{print toupper($0)}') -NSLIST=$(echo $(dirname $INCLUDE_H) | awk '{l=tolower($0);gsub("/"," ",l);print l}') -SNLIST= -INDENT= -for N in $NSLIST; do - SNLIST="$N $SNLIST" - INDENT="$INDENT " -done - -###################################################################### -function intro() { -###################################################################### - local FILE=$1 -cat < - -#include "zypp/base/PtrTypes.h" - -$(nsopen) -${INDENT}/////////////////////////////////////////////////////////////////// -${INDENT}/// \class ${CLASS} -${INDENT}/// \brief -${INDENT}/////////////////////////////////////////////////////////////////// -${INDENT}class ${CLASS} -${INDENT}{ -${INDENT} friend std::ostream & operator<<( std::ostream & str, const ${CLASS} & obj ); -${INDENT} friend std::ostream & dumpOn( std::ostream & str, const ${CLASS} & obj ); -${INDENT} friend bool operator==( const ${CLASS} & lhs, const ${CLASS} & rhs ); - -${INDENT} public: -${INDENT} /** Default ctor */ -${INDENT} ${CLASS}(); - -${INDENT} /** Dtor */ -${INDENT} ~${CLASS}(); - -${INDENT} public: -${INDENT} /** Validate object in a boolean context. */ -${INDENT} explicit operator bool() const -${INDENT} { -${INDENT} /* !!! Perform Boolean logic here AND check implememtation of operator==!!! -${INDENT} * NOTE: SafeBool requires operator== otherwise equality is reduced to -${INDENT} * ( bool(${CLASS}) == bool(${CLASS}) ). -${INDENT} */ -${INDENT} } -${INDENT} public: -${INDENT} class Impl; ///< Implementation class. -${INDENT} private: -${INDENT} RWCOW_pointer _pimpl; ///< Pointer to implementation. -${INDENT}}; - -${INDENT}/** \relates ${CLASS} Stream output */ -${INDENT}std::ostream & operator<<( std::ostream & str, const ${CLASS} & obj ); - -${INDENT}/** \relates ${CLASS} Verbose stream output */ -${INDENT}std::ostream & dumOn( std::ostream & str, const ${CLASS} & obj ); - -${INDENT}/** \relates ${CLASS} */ -${INDENT}bool operator==( const ${CLASS} & lhs, const ${CLASS} & rhs ); - -${INDENT}/** \relates ${CLASS} */ -${INDENT}inline bool operator!=( const ${CLASS} & lhs, const ${CLASS} & rhs ) -${INDENT}{ return !( lhs == rhs ); } - -$(nsclose) -#endif // $INCLUDE_DEF -EOF -} - -###################################################################### -function genCC() { -###################################################################### -cat < -//#include "zypp/base/LogTools.h" -#include "zypp/base/NonCopyable.h" - -#include "${INCLUDE_H}" - -using std::endl; - -$(nsopen) - -${INDENT}/////////////////////////////////////////////////////////////////// -${INDENT}/// \class ${CLASS}::Impl -${INDENT}/// \brief ${CLASS} implementation. -${INDENT}/////////////////////////////////////////////////////////////////// -${INDENT}class ${CLASS}::Impl : private base::NonCopyable -${INDENT}{ -${INDENT} friend std::ostream & operator<<( std::ostream & str, const Impl & obj ); -${INDENT} friend std::ostream & dumpOn( std::ostream & str, const Impl & obj ); - -${INDENT} public: - -${INDENT} public: -${INDENT} /** Offer default Impl. */ -${INDENT} static shared_ptr nullimpl() -${INDENT} { -${INDENT} static shared_ptr _nullimpl( new Impl ); -${INDENT} return _nullimpl; -${INDENT} } -${INDENT} private: -${INDENT} friend Impl * rwcowClone( const Impl * rhs ); -${INDENT} /** clone for RWCOW_pointer */ -${INDENT} Impl * clone() const -${INDENT} { return new Impl( *this ); } -${INDENT}}; - -${INDENT}/** \relates ${CLASS}::Impl Stream output */ -${INDENT}inline std::ostream & operator<<( std::ostream & str, const ${CLASS}::Impl & obj ) -${INDENT}{ return str << "${CLASS}::Impl"; } - -${INDENT}/** \relates ${CLASS}::Impl Verbose stream output */ -${INDENT}inline std::ostream & dumpOn( std::ostream & str, const ${CLASS}::Impl & obj ) -${INDENT}{ return str << obj; } - -${INDENT}/////////////////////////////////////////////////////////////////// -${INDENT}// -${INDENT}// CLASS NAME : ${CLASS} -${INDENT}// -${INDENT}/////////////////////////////////////////////////////////////////// - -${INDENT}${CLASS}::${CLASS}() -${INDENT} : _pimpl( Impl::nullimpl() ) -${INDENT}{} - -${INDENT}${CLASS}::~${CLASS}() -${INDENT}{} - -${INDENT}std::ostream & operator<<( std::ostream & str, const ${CLASS} & obj ) -${INDENT}{ return str << *obj._pimpl; } - -${INDENT}std::ostream & dumpOn( std::ostream & str, const ${CLASS} & obj ) -${INDENT}{ return dumpOn( str, *obj._pimpl ); } - -${INDENT}bool operator==( const ${CLASS} & lhs, const ${CLASS} & rhs ) -${INDENT}{ return lhs._pimpl == rhs._pimpl || lhs._pimpl && rhs._pimpl && *lhs._pimpl == *rhs._pimpl; } - -$(nsclose) -EOF -} - -###################################################################### -###################################################################### -###################################################################### - -genH >$OUT_CLASS_H -genCC >$OUT_CLASS_CC diff --git a/package/libzypp.changes b/package/libzypp.changes index 897e3da..41a3958 100644 --- a/package/libzypp.changes +++ b/package/libzypp.changes @@ -1,4 +1,13 @@ ------------------------------------------------------------------- +Tue Feb 8 10:52:48 CET 2022 - ma@suse.de + +- Fix handling of redirected command in-/output (bsc#1195326) + This fixes delays at the end of zypper operations, where + zypper unintentionally waits for appdata plugin scripts to + complete. +- version 17.29.4 (22) + +------------------------------------------------------------------- Tue Feb 1 18:49:00 CET 2022 - ma@suse.de - Public header files on older distros must use c++11 diff --git a/zypp-core/ExternalProgram.cc b/zypp-core/ExternalProgram.cc index ec4882f..fd0d8b0 100644 --- a/zypp-core/ExternalProgram.cc +++ b/zypp-core/ExternalProgram.cc @@ -318,13 +318,22 @@ namespace zypp { _backend->setUseDefaultLocale( default_locale ); if ( _backend->start( argv, stdinFd, stdoutFd, stderrFd ) ) { - - inputfile = fdopen( childStdoutParentFd, "r" ); - childStdoutParentFd.resetDispose(); - outputfile = fdopen( childStdinParentFd, "w" ); - childStdinParentFd.resetDispose(); - - if (!inputfile || !outputfile) + bool connected = true; + if ( childStdoutParentFd != -1 ) { + inputfile = fdopen( childStdoutParentFd, "r" ); + if ( inputfile ) + childStdoutParentFd.resetDispose(); + else + connected = false; + } + if ( childStdinParentFd != -1 ) { + outputfile = fdopen( childStdinParentFd, "w" ); + if ( outputfile ) + childStdinParentFd.resetDispose(); + else + connected = false; + } + if ( not connected ) { ERR << "Cannot create streams to external program " << argv[0] << endl; ExternalProgram::close(); diff --git a/zypp-core/zyppng/io/forkspawnengine.cc b/zypp-core/zyppng/io/forkspawnengine.cc index d4aaf2b..e7d3565 100644 --- a/zypp-core/zyppng/io/forkspawnengine.cc +++ b/zypp-core/zyppng/io/forkspawnengine.cc @@ -348,6 +348,7 @@ bool zyppng::ForkSpawnEngine::start( const char * const *argv, int stdin_fd, int _execError = zypp::str::form( _("Can't exec '%s', unexpected error."), _args[0].c_str() ); break; } + ERR << "pid " << _pid << " launch failed: " << _execError << std::endl; // reap child and collect exit code isRunning( true ); diff --git a/zypp/sat/detail/PoolImpl.cc b/zypp/sat/detail/PoolImpl.cc index 1767a9d..d4b71d0 100644 --- a/zypp/sat/detail/PoolImpl.cc +++ b/zypp/sat/detail/PoolImpl.cc @@ -110,6 +110,8 @@ namespace zypp static void logSat( CPool *, void *data, int type, const char *logString ) { // "1234567890123456789012345678901234567890 + if ( 0 == strncmp( logString, "job: drop orphaned", 18 ) ) + return; if ( 0 == strncmp( logString, "job: user installed", 19 ) ) return; if ( 0 == strncmp( logString, "job: multiversion", 17 ) ) -- 2.7.4