1 #define INCLUDE_TESTSETUP_WITHOUT_BOOST
2 #include "../tests/lib/TestSetup.h"
3 #undef INCLUDE_TESTSETUP_WITHOUT_BOOST
5 static std::string appname( "ToolScanRepos" );
7 void message( const std::string & msg_r )
9 cerr << "*** " << msg_r << endl;
12 int usage( const std::string & msg_r = std::string(), int exit_r = 100 )
14 if ( ! msg_r.empty() )
20 cerr << "Usage: " << appname << "[OPTIONS] URL..." << endl;
21 cerr << " Load repos from URL to test system below /tmp/" << appname << "." << endl;
22 cerr << " -r ROOT Use /tmp/ROOT as location of test system (default: " << appname << ")." << endl;
23 cerr << " -a ARCH Use ARCH as test system architecture (default: x86_64)." << endl;
24 cerr << " -c Clear an existing test system (default)." << endl;
25 cerr << " -n Do not clear an existing test system but reuse it." << endl;
29 /******************************************************************
31 ** FUNCTION NAME : main
32 ** FUNCTION TYPE : int
34 int main( int argc, char * argv[] )
36 INT << "===[START]==========================================" << endl;
37 appname = Pathname::basename( argv[0] );
46 ///////////////////////////////////////////////////////////////////
47 Pathname mtmp( "/tmp" );
48 Pathname mroot( mtmp/appname );
49 Arch march( Arch_x86_64 );
50 bool oClearRoot = true;
52 std::vector<std::string> urls;
56 if ( argv[0] == std::string("-c") )
60 else if ( argv[0] == std::string("-n") )
64 else if ( argv[0] == std::string("-r") || argv[0] == std::string("--root"))
69 return usage( "Missing arg to -r ROOT", 101 );
71 if ( *(argv[0]) ) // empty
76 else if ( argv[0] == std::string("-a") )
81 return usage( "Missing arg to -a ARCH", 101 );
83 if ( *(argv[0]) ) // empty
84 march = Arch( argv[0] );
90 urls.push_back( argv[0] );
98 return usage( "Missing URLs", 102 );
101 ///////////////////////////////////////////////////////////////////
105 message( "Clear test system at " + mroot.asString() );
106 filesystem::recursive_rmdir( mroot );
110 message( "Use test system at " + mroot.asString() );
112 filesystem::assert_dir( mroot );
114 message( "Use archiecture " + march.asString() );
115 TestSetup test( mroot, march );
118 for_( it, urls.begin(), urls.end() )
120 message( "Setup " + *it );
123 test.loadRepo( *it );
125 catch ( const Exception & exp )
127 message( exp.asString() + "\n" + exp.historyAsString() );
132 INT << "===[END]============================================" << endl << endl;