diff --git a/src/BuildTiles/Parallel/client.cxx b/src/BuildTiles/Parallel/client.cxx index a5dfbc01..a800394f 100644 --- a/src/BuildTiles/Parallel/client.cxx +++ b/src/BuildTiles/Parallel/client.cxx @@ -17,12 +17,14 @@ #include #include #include +#include +#include #include #include #include // atoi() -#include // bcopy() +#include // bcopy(), sterror() #include // bcopy() on Irix #include @@ -34,6 +36,7 @@ #include SG_USING_STD(cout); +SG_USING_STD(cerr); SG_USING_STD(endl); @@ -177,14 +180,12 @@ long int get_next_task( const string& host, int port, long int last_tile ) { return -1; } -static bool file_exists( const string& file ) { - struct stat buf; - - if ( stat( file.c_str(), &buf ) == 0 ) { - return true; - } else { - return false; - } +bool endswith(const char* s, const char* suffix) { + size_t slen=strlen(s); + size_t sufflen=strlen(suffix); + if (slend_name,prefix.c_str(),prefix_len)) + continue; + string file=path+"/"+de->d_name; + if ( stat(file.c_str(), &src_stat) != 0) { + /* huh!? */ + cerr << " Could not stat file " << file << ":" << strerror(errno) << "\n"; + continue; + } + if ( have_btg && src_stat.st_mtime>btg_stat.st_mtime ) { + cout << " File " << file << " is newer than btg-file => rebuild\n"; + return true; + } + if ( have_stg && src_stat.st_mtime>stg_stat.st_mtime ) { + cout << " File " << file << " is newer than stg-file => rebuild\n"; + return true; + } + /* Ignore elevation data, as it is not used if we have no + * landmass data. So in addition to elevation data we need at + * least one polygon file. + */ + if ( endswith( de->d_name, ".arr.gz" ) || endswith( de->d_name, ".fit.gz" ) ) + continue; + if ( !(have_stg && have_btg) ) { + cout << " There is source-data (" << file << ") for tile " << b.gen_index_str() << " but .btg or .stg is missing => build\n"; + return true; + } + } + + closedir(loaddir); + } + + return false; } @@ -301,6 +363,10 @@ int main(int argc, char *argv[]) { cout << "Running in rude mode" << endl; else cout << "Running in polite mode" << endl; + if (do_overwrite) + cout << "Will overwrite existing buckets" << endl; + else + cout << "Will not overwrite up-to-date existing buckets" << endl; for (int i = arg_pos; i < argc; i++) { string dir; dir = work_base + "/"; @@ -334,6 +400,7 @@ int main(int argc, char *argv[]) { if ( result ) { last_tile = tile; } else { + cout << "Build of tile " << tile << " failed\n"; last_tile = -tile; }