[Compbench-devel] CompBenchmarks++/Benchmark Benchmark.cpp, 1.7, 1.8 Benchmark.h, 1.4, 1.5
Brought to you by:
xfred
|
From: Frederic T. <xf...@us...> - 2006-09-24 16:30:10
|
Update of /cvsroot/compbench/CompBenchmarks++/Benchmark In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21538 Modified Files: Benchmark.cpp Benchmark.h Log Message: Fetch() added. Index: Benchmark.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/Benchmark/Benchmark.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Benchmark.h 19 Sep 2006 17:09:35 -0000 1.4 --- Benchmark.h 24 Sep 2006 16:30:00 -0000 1.5 *************** *** 337,340 **** --- 337,349 ---- virtual int Install(int _force = 0); + /** Copy a local archive. + * Copy package to directory defined by CBMSystem::Download. It'll be ready + * to be extracted using Install(). + * \param _source the archive file + * \return 1 if ok. May changes status. + * \sa status + * \sa extract */ + virtual int Fetch(char *_source); + /** Uninstall package. * Uses uninstall(). Overloading is unadvised. Index: Benchmark.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/Benchmark/Benchmark.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Benchmark.cpp 19 Sep 2006 15:39:16 -0000 1.7 --- Benchmark.cpp 24 Sep 2006 16:30:00 -0000 1.8 *************** *** 454,457 **** --- 454,485 ---- } + int CBMBenchmark::Fetch(char *_source) + { + std::string dest = localPackageAbsoluteName(); + std::string source = _source; + std::string expected_md5; + std::string md5; + + if (getStatus()>=Downloaded) { + return(1); + } + + if (dest!=source) { + cbmSystem->copy(source, dest); + } + + if (cbmSystem->fileExists(dest)) { + expected_md5=expectedMD5(); + md5=system->md5File(dest); + + if (expected_md5==md5) { + storeStatus(Downloaded); + return(1); + } + } + + return(0); + } + int CBMBenchmark::Uninstall(void) { |