#include <iostream>
+
+#include <boost/signal.hpp>
+#include <boost/bind.hpp>
+
#include <zypp/base/LogTools.h>
#include <zypp/base/Easy.h>
-#include <zypp/sat/Pool.h>
using std::endl;
using std::cout;
+
+namespace boost
+{
+ template<class Tp>
+ std::ostream & operator<<( std::ostream & str, const signal<Tp> & 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;
+ _sigA( ++i );
+ }
+
+ typedef signal<void(unsigned)> SigA;
+
+ SigA & siga() const { return _sigA; }
+
+ mutable SigA _sigA;
+};
+
+struct X : public trackable
+{
+ X() {++s;}
+ X( const X & ) {++s;}
+ ~X() {--s;}
+ static int s;
+
+ void pong( unsigned i ) const
+ {
+ DBG << s << ' ' << i << endl;
+ }
+};
+
+int X::s;
+
/******************************************************************
**
** FUNCTION NAME : main
int main( int argc, const char * argv[] )
{
--argc; ++argv; // skip arg 0
- sat::Pool satpool( sat::Pool::instance() );
- for ( ; argc; --argc, ++argv )
+ M m;
+ X xx;
+ m.siga().connect( boost::bind( &X::pong, &xx, _1 ) );
+ m.ping();
+
{
- cout << "Read: " << argv[0] << endl;
- satpool.addRepoSolv( argv[0] );
+ X x;
+ m.siga().connect( boost::bind( &X::pong, &x, _1 ) );
+ m.ping();
}
- cout << "Done: " << satpool << endl;
+ m.ping();
- if ( getenv("VERBOSE") )
- {
- for_( it, satpool.solvablesBegin(), satpool.solvablesEnd() )
- {
- cout << dump(*it) << endl;
- }
- }
+ ///////////////////////////////////////////
+ INT << "---STOP" << endl;
return 0;
}
///////////////////////////////////////////////////////////////////
-RepoManager makeRepoManager( const Pathname & mgrdir_r )
-{
-
- RepoManagerOptions mgropt;
- mgropt.repoCachePath = mgrdir_r/"cache";
- mgropt.repoRawCachePath = mgrdir_r/"raw_cache";
- mgropt.knownReposPath = mgrdir_r/"repos";
-
- return RepoManager( mgropt );
-}
-
-struct Impl : public base::ReferenceCounted
-{
- Impl() : i(13) {}
- int i;
-};
-DEFINE_PTR_TYPE(Impl);
-IMPL_PTR_TYPE(Impl);
+static const Pathname sysRoot( getenv("SYSROOT") ? getenv("SYSROOT") : "/Local/ROOT" );
-inline std::ostream & operator<<( std::ostream & str, const Impl & obj )
-{ return str << &obj; }
-
-#define TCODE \
- SEC << endl; \
- MIL << "n " << _nimpl << endl; \
- MIL << "n " << (_nimpl?1:0) << endl; \
- MIL << "p " << _pimpl << endl; \
- MIL << "p " << (_pimpl?1:0) << endl; \
- MIL << "P " << _Pimpl << endl; \
- MIL << "P " << (_Pimpl?1:0) << endl; \
- MIL << "= " << (_nimpl == _pimpl) << endl; \
- MIL << "! " << (_nimpl != _pimpl) << endl; \
- MIL << "= " << (_Pimpl == _pimpl) << endl; \
- MIL << "! " << (_Pimpl != _pimpl) << endl; \
- MIL << "= " << (_pimpl == _pimpl) << endl; \
- MIL << "! " << (_pimpl != _pimpl) << endl;
+///////////////////////////////////////////////////////////////////
/******************************************************************
**
{
INT << "===[START]==========================================" << endl;
- {
- RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _nimpl;
- RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl(new Impl);
- RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _Pimpl(new Impl);
- TCODE;
- }
- {
- RW_pointer<Impl,rw_pointer::Shared<Impl> > _nimpl;
- RW_pointer<Impl,rw_pointer::Shared<Impl> > _pimpl(new Impl);
- RW_pointer<Impl,rw_pointer::Shared<Impl> > _Pimpl(new Impl);
- TCODE;
- }
- {
- RW_pointer<Impl,rw_pointer::Scoped<Impl> > _nimpl;
- RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl(new Impl);
- RW_pointer<Impl,rw_pointer::Scoped<Impl> > _Pimpl(new Impl);
- TCODE;
- }
-
- INT << "===[END]============================================" << endl << endl;
- return 0;
-
- RepoManager repoManager( makeRepoManager( "/ROOT" ) );
- RepoInfoList repos = repoManager.knownRepositories();
- SEC << repos << endl;
+ //TmpDir tmp_dir;
+ //KeyRing keyring( tmp_dir.path() );
- if ( repos.empty() )
{
- RepoInfo nrepo;
- nrepo
- .setAlias( "factorytest" )
- .setName( "Test Repo for factory." )
- .setEnabled( true )
- .setAutorefresh( false )
- .addBaseUrl( Url("ftp://dist.suse.de/install/stable-x86/") );
-
- repoManager.addRepository( nrepo );
- repos = repoManager.knownRepositories();
- SEC << repos << endl;
-
-// SEC << "refreshMetadat" << endl;
-// repoManager.refreshMetadata( nrepo );
-// SEC << "buildCache" << endl;
-// repoManager.buildCache( nrepo );
-// SEC << "------" << endl;
+ Measure x( "INIT TARGET" );
+ {
+ {
+ //zypp::base::LogControl::TmpLineWriter shutUp;
+ getZYpp()->initializeTarget( sysRoot );
+ }
+ //getZYpp()->target()->load();
+ }
}
+
INT << "===[END]============================================" << endl << endl;
return 0;
}