From: Sarah Hoffmann Date: Tue, 9 Feb 2021 19:04:08 +0000 (+0100) Subject: use DataDir constant for data only X-Git-Tag: v3.7.0~38^2~10 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/3cb6f3e4601c01df3035c0c11ba227cb72cf4b08?ds=inline use DataDir constant for data only So far the data directory constant has pointed to the source directory to be usable with different subdirectories. Now only the data subdirectory itself is being used with the constant, so point to the directory directly. --- diff --git a/cmake/script.tmpl b/cmake/script.tmpl index 863d79ee..3fbe535e 100755 --- a/cmake/script.tmpl +++ b/cmake/script.tmpl @@ -4,7 +4,7 @@ require('@CMAKE_SOURCE_DIR@/lib-php/dotenv_loader.php'); @define('CONST_Default_ModulePath', '@CMAKE_BINARY_DIR@/module'); @define('CONST_Default_Osm2pgsql', '@CMAKE_BINARY_DIR@/osm2pgsql/osm2pgsql'); -@define('CONST_DataDir', '@CMAKE_SOURCE_DIR@'); +@define('CONST_DataDir', '@CMAKE_SOURCE_DIR@/data'); @define('CONST_SqlDir', '@CMAKE_SOURCE_DIR@/lib-sql'); @define('CONST_ConfigDir', '@CMAKE_SOURCE_DIR@/settings'); diff --git a/cmake/tool.tmpl b/cmake/tool.tmpl index 9823c75f..a6022402 100755 --- a/cmake/tool.tmpl +++ b/cmake/tool.tmpl @@ -12,6 +12,6 @@ exit(cli.nominatim(module_dir='@CMAKE_BINARY_DIR@/module', osm2pgsql_path='@CMAKE_BINARY_DIR@/osm2pgsql/osm2pgsql', phplib_dir='@CMAKE_SOURCE_DIR@/lib-php', sqllib_dir='@CMAKE_SOURCE_DIR@/lib-sql', - data_dir='@CMAKE_SOURCE_DIR@', + data_dir='@CMAKE_SOURCE_DIR@/data', config_dir='@CMAKE_SOURCE_DIR@/settings', phpcgi_path='@PHPCGI_BIN@')) diff --git a/lib-php/setup/SetupClass.php b/lib-php/setup/SetupClass.php index 80dcabb2..03b01631 100755 --- a/lib-php/setup/SetupClass.php +++ b/lib-php/setup/SetupClass.php @@ -166,13 +166,13 @@ class SetupFunctions // Try accessing the C module, so we know early if something is wrong $this->checkModulePresence(); // raises exception on failure - if (!file_exists(CONST_DataDir.'/data/country_osm_grid.sql.gz')) { + if (!file_exists(CONST_DataDir.'/country_osm_grid.sql.gz')) { echo 'Error: you need to download the country_osm_grid first:'; - echo "\n wget -O ".CONST_DataDir."/data/country_osm_grid.sql.gz https://www.nominatim.org/data/country_grid.sql.gz\n"; + echo "\n wget -O ".CONST_DataDir."/country_osm_grid.sql.gz https://www.nominatim.org/data/country_grid.sql.gz\n"; exit(1); } - $this->pgsqlRunScriptFile(CONST_DataDir.'/data/country_name.sql'); - $this->pgsqlRunScriptFile(CONST_DataDir.'/data/country_osm_grid.sql.gz'); + $this->pgsqlRunScriptFile(CONST_DataDir.'/country_name.sql'); + $this->pgsqlRunScriptFile(CONST_DataDir.'/country_osm_grid.sql.gz'); if ($this->bNoPartitions) { $this->pgsqlRunScript('update country_name set partition = 0'); @@ -350,7 +350,7 @@ class SetupFunctions // pre-create the word list if (!$bDisableTokenPrecalc) { info('Loading word list'); - $this->pgsqlRunScriptFile(CONST_DataDir.'/data/words.sql'); + $this->pgsqlRunScriptFile(CONST_DataDir.'/words.sql'); } info('Load Data'); @@ -737,8 +737,6 @@ class SetupFunctions fwrite($rFile, '@define(\'CONST_Debug\', $_GET[\'debug\'] ?? false);'."\n\n"); fwriteConstDef($rFile, 'LibDir', CONST_LibDir); - fwriteConstDef($rFile, 'DataDir', CONST_DataDir); - fwriteConstDef($rFile, 'InstallDir', CONST_InstallDir); fwriteConstDef($rFile, 'Database_DSN', getSetting('DATABASE_DSN')); fwriteConstDef($rFile, 'Default_Language', getSetting('DEFAULT_LANGUAGE')); fwriteConstDef($rFile, 'Log_DB', getSettingBool('LOG_DB')); diff --git a/test/bdd/steps/nominatim_environment.py b/test/bdd/steps/nominatim_environment.py index d337c099..dd76dee3 100644 --- a/test/bdd/steps/nominatim_environment.py +++ b/test/bdd/steps/nominatim_environment.py @@ -87,7 +87,7 @@ class NominatimEnvironment: self.test_env['NOMINATIM_FLATNODE_FILE'] = '' self.test_env['NOMINATIM_IMPORT_STYLE'] = 'full' self.test_env['NOMINATIM_USE_US_TIGER_DATA'] = 'yes' - self.test_env['NOMINATIM_DATADIR'] = self.src_dir + self.test_env['NOMINATIM_DATADIR'] = self.src_dir / 'data' self.test_env['NOMINATIM_SQLDIR'] = self.src_dir / 'lib-sql' self.test_env['NOMINATIM_CONFIGDIR'] = self.src_dir / 'settings' self.test_env['NOMINATIM_DATABASE_MODULE_SRC_PATH'] = self.build_dir / 'module'