backup
[platform/upstream/libzypp.git] / devel / devel.ma / ToolScanRepos.cc
1 #include "Tools.h"
2
3 /******************************************************************
4 **
5 **      FUNCTION NAME : main
6 **      FUNCTION TYPE : int
7 */
8 int main( int argc, char * argv[] )
9 try {
10   INT << "===[START]==========================================" << endl;
11   std::string appname( Pathname::basename( argv[0] ) );
12   --argc;
13   ++argv;
14
15   if ( ! argc )
16   {
17     cerr << "Usage: " << appname << "[OPTIONS] URL..." << endl;
18     cerr << "  Load repos from URL to test system below /tmp/" << appname << "." << endl;
19     cerr << "  --nc Do not clear an existing test system but reuse it." << endl;
20     return 0;
21   }
22
23   Pathname mroot( "/tmp/"+appname );
24   if ( argc && argv[0] == std::string("--nc") )
25   {
26     --argc;
27     ++argv;
28   }
29   else
30   {
31     filesystem::recursive_rmdir( mroot );
32   }
33   filesystem::assert_dir( mroot );
34   TestSetup test( mroot, Arch_x86_64 );
35
36   while ( argc )
37   {
38     test.loadRepo( Url( argv[0] ) );
39     --argc;
40     ++argv;
41   }
42
43   INT << "===[END]============================================" << endl << endl;
44   return 0;
45 }
46 catch ( const Exception & exp )
47 {
48   INT;
49   cerr << exp << endl << exp.historyAsString();
50   throw;
51 }
52 catch (...)
53 {}