[Compbench-devel] CompBenchmarks++ cloptions.cpp,1.16,1.17
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-02-06 17:50:05
|
Update of /cvsroot/compbench/CompBenchmarks++ In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15716 Modified Files: cloptions.cpp Log Message: Querying operations vastly improved. Index: cloptions.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/cloptions.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** cloptions.cpp 5 Feb 2007 20:08:42 -0000 1.16 --- cloptions.cpp 6 Feb 2007 17:49:56 -0000 1.17 *************** *** 37,41 **** typedef enum { ! ActionUndef, ActionInstall, ActionUninstall } OptAction; --- 37,44 ---- typedef enum { ! ActionUndef, ActionInstall, ActionUninstall, ! ActionLLDownload, ActionLLExtract, ActionLLPatch, ! ActionLLPreconfigure, ActionLLRelease, ! ActionLLTestsuite, ActionLLFetch } OptAction; *************** *** 182,185 **** --- 185,189 ---- std::string compiler; std::string options; + std::string tarball; OptDomain domain = DomainUndef; /* help/query/{install/uninstall : manage ?}/bench/version/low-level */ *************** *** 199,204 **** {"uninstall", required_argument, 0, 'U' }, - {"fetch", required_argument, 0, 'f'}, - {"all", 0, 0, 'a' }, --- 203,206 ---- *************** *** 209,216 **** /* {"package-benchmarks-info", 1, 0, 'I' }, */ - {"benchmarks-info", 0, 0, 'L'}, {"host-info", 0, 0, 'H' }, {"programs-info", 0, 0, 'P' }, ! {"compiler-info", 1, 0, 'C' }, {"bench", 1, 0, 'B'}, --- 211,217 ---- /* {"package-benchmarks-info", 1, 0, 'I' }, */ {"host-info", 0, 0, 'H' }, {"programs-info", 0, 0, 'P' }, ! {"compiler-info", 1, 0, 'c' }, {"bench", 1, 0, 'B'}, *************** *** 218,227 **** {"package-download", 1, 0, 'D' }, {"package-extract", 1, 0, 'E' }, ! {"package-patch", 1, 0, 1011 }, ! {"package-preconfigure", 1, 0, 'g' }, ! {"package-test", 1, 0, 't' }, ! {"package-release", 1, 0, 'r' }, ! {"disable-testsuite", 0, 0, 'T' }, ! {"force", 0, 0, 'F' }, { 0, 0, 0, 0} }; --- 219,229 ---- {"package-download", 1, 0, 'D' }, {"package-extract", 1, 0, 'E' }, ! {"package-patch", 1, 0, 'P' }, ! {"package-preconfigure", 1, 0, 'C' }, ! {"package-test", 1, 0, 'T' }, ! {"package-fetch", 1, 0, 'F' }, ! {"package-release", 1, 0, 'R' }, ! {"disable-testsuite", 0, 0, 'S' }, ! {"force", 0, 0, 'f' }, { 0, 0, 0, 0} }; *************** *** 233,237 **** break; ! c = getopt_long (argc, argv, "hviI:f:U:qp::b::aM", // uLHPCFIB", /* :011000112", */ long_options, &option_index); if (c==-1) { --- 235,239 ---- break; ! c = getopt_long (argc, argv, "hviI:F:U:qp::b::aMmD:E:P:C:T:R:S:f", // uLHPCFIB", /* :011000112", */ long_options, &option_index); if (c==-1) { *************** *** 244,255 **** break; case 'q': ! cbmSingleDomain(&domain, DomainQuery, "v"); ! // optQuery=1; break; case 'h': ! domain=DomainHelp; break; case 'm': ! domain=DomainManage; break; case 'a': --- 246,259 ---- break; case 'q': ! cbmSingleDomain(&domain, DomainQuery, "q"); break; case 'h': ! cbmSingleDomain(&domain, DomainHelp, "h"); break; case 'm': ! cbmSingleDomain(&domain, DomainManage, "m"); ! break; ! case 'M': ! cbmSingleDomain(&domain, DomainLowLevel, "M"); break; case 'a': *************** *** 261,284 **** case 'p': filter.package=1; - filter.benchmark=0; if (optarg) P=cbmOptionsExpectPackage(optarg); break; - /* - case 1011: - P=cbmOptionsExpectPackage(optarg); - if (P) - P->displayBenchmarks(); - parseExitValue=0; - break; - !!! - */ case 'b': - filter.package=0; filter.benchmark=1; if (optarg) B=cbmOptionsExpectBenchmark(optarg); break; ! case 'I': action=ActionInstall; --- 265,319 ---- case 'p': filter.package=1; if (optarg) P=cbmOptionsExpectPackage(optarg); break; case 'b': filter.benchmark=1; if (optarg) B=cbmOptionsExpectBenchmark(optarg); break; ! case 'D': ! action=ActionLLDownload; ! if (optarg) ! P=cbmOptionsExpectPackage(optarg); ! break; ! case 'E': ! action=ActionLLExtract; ! if (optarg) ! B=cbmOptionsExpectBenchmark(optarg); ! break; ! case 'P': ! action=ActionLLPatch; ! if (optarg) ! B=cbmOptionsExpectBenchmark(optarg); ! break; ! case 'C': ! action=ActionLLPreconfigure; ! if (optarg) ! B=cbmOptionsExpectBenchmark(optarg); ! break; ! case 'T': ! action=ActionLLTestsuite; ! if (optarg) ! B=cbmOptionsExpectBenchmark(optarg); ! break; ! case 'F': ! action=ActionLLFetch; ! P=cbmOptionsExpectPackage(optarg); ! if (!P) ! break; ! if (optind<=argc) { ! tarball=argv[optind-1]; ! } else { ! std::cerr << "tarball missing in argument line" << std::endl; ! parseExitValue=1; ! break; ! } ! break; ! case 'R': ! action=ActionLLRelease; ! if (optarg) ! B=cbmOptionsExpectBenchmark(optarg); ! break; case 'I': action=ActionInstall; *************** *** 289,300 **** P=cbmOptionsExpectPackage(optarg); break; ! case 'L': ! /* cbmSystem->displayAllBenchmarks(); */ /* !!! */ ! parseExitValue=0; ! break; ! case 'T': UO_enableTestSuite=0; break; ! case 'F': UO_force=1; break; --- 324,331 ---- P=cbmOptionsExpectPackage(optarg); break; ! case 'S': UO_enableTestSuite=0; break; ! case 'f': UO_force=1; break; *************** *** 303,311 **** parseExitValue=0; break; ! case 'P': ! /* cbmSystem->displayPrograms(); */ /* !!! */ ! parseExitValue=0; ! break; ! case 'C': C=SC.select((char*) optarg); if (C) { --- 334,338 ---- parseExitValue=0; break; ! case 'c': C=SC.select((char*) optarg); if (C) { *************** *** 322,352 **** } break; ! case 'f': ! P=cbmOptionsExpectPackage(optarg); ! if (!P) ! break; ! if (optind<=argc) { ! P->Fetch(argv[optind-1], UO_force); ! } else { ! std::cerr << "tarball missing in argument line" << std::endl; ! parseExitValue=1; ! break; ! } ! break; ! case 'D': ! P=cbmOptionsExpectPackage(optarg); ! if (P) { ! if (P->downloadURL()!="") { ! parseExitValue=!P->Download(); ! } else { ! CBM::cbmUI->Fatal("Package is not known to be hosted anymore on the Internet. Use --fetch option"); ! } ! } ! break; ! case 'E': ! P=cbmOptionsExpectPackage(optarg); ! if (P) ! parseExitValue=!P->Extract(UO_force); ! break; case 1011: P=cbmOptionsExpectPackage(optarg); --- 349,365 ---- } break; ! /* case 'f': !!! ! P=cbmOptionsExpectPackage(optarg); ! if (!P) ! break; ! if (optind<=argc) { ! P->Fetch(argv[optind-1], UO_force); ! } else { ! std::cerr << "tarball missing in argument line" << std::endl; ! parseExitValue=1; ! break; ! } ! break; ! */ case 1011: P=cbmOptionsExpectPackage(optarg); *************** *** 445,448 **** --- 458,487 ---- break; case DomainQuery: + if ((filter.all) || (filter.installed)) { + if ((filter.package) && (P)) { + std::cerr << "-p must have no argument when -a or -i is used." << std::endl; + parseExitValue=255; + break; + } + if ((filter.benchmark) && (B)) { + std::cerr << "-b must have no argument when -a or -i is used." << std::endl; + parseExitValue=255; + break; + } + } + + if ((filter.package) && (filter.benchmark)) { + if ((!filter.all) && (!filter.installed) && (P)) { + int i; + int n = P->benchmarkNumber(); + for(i=0; i<n; i++) { + B=P->Benchmark(i); + std::cout << B->Name() << std::endl; + } + parseExitValue=0; + } + break; + } + if (filter.package) { if ((filter.all) && (!filter.installed)) { *************** *** 469,472 **** --- 508,527 ---- parseExitValue=0; } + if ((!filter.all) && (!filter.installed) && (P)) { + std::cout << "Package (PID) : " << P->Name() << std::endl; + std::cout << "Version : " << P->Version() << std::endl; + std::cout << "Size : " << P->Size() << std::endl; + std::cout << "Total size : " << P->totalSize() << std::endl; + std::cout << "Benchmarks : " << P->benchmarkNumber() << std::endl; + std::cout << "Language : " << P->language() << std::endl; + std::cout << "License : " << P->license() << std::endl; + std::cout << "Author : " << P->author() << std::endl; + std::cout << "Testsuite : " << (P->hasTest() ? "Yes" : "No") << std::endl; + std::cout << "Status : " << P->getStatusStr() << std::endl; + std::cout << "Comments : " << std::endl; + std::cout << P->Comments() << std::endl; + parseExitValue=0; + } + } else if (filter.benchmark) { if ((filter.all) && (!filter.installed)) { *************** *** 505,508 **** --- 560,571 ---- parseExitValue=0; } + + if ((!filter.all) && (!filter.installed) && (B)) { + std::cout << "Benchmark (PID) : " << B->Name() << std::endl; + std::cout << "Package (PID) : " << B->Package()->Name() << std::endl; + std::cout << "Comments : " << std::endl; + std::cout << B->Comments() << std::endl; + parseExitValue=0; + } } break; *************** *** 524,527 **** --- 587,616 ---- std::cerr << "action not specified." << std::endl; } + case DomainLowLevel: + switch(action) { + case ActionLLDownload: + if (P->downloadURL()!="") { + parseExitValue=!P->Download(); + } else { + CBM::cbmUI->Fatal("Package is not known to be hosted anymore on the Internet. Use --fetch option"); + } + break; + case ActionLLExtract: + parseExitValue=!P->Extract(); + break; + case ActionLLPatch: + parseExitValue=!P->Patch(); + break; + case ActionLLPreconfigure: + parseExitValue=!P->PreConfigure(); + break; + case ActionLLRelease: + parseExitValue=!P->Release(); + break; + case ActionLLTestsuite: + parseExitValue=!P->Test(); + break; + } + break; } |