umpirsky / country-list

:globe_with_meridians: List of all countries with names and ISO 3166-1 codes in all languages and data formats.
MIT License
5.14k stars 1.55k forks source link

Help getting build working #131

Open jackocnr opened 3 months ago

jackocnr commented 3 months ago

Thanks again for this fab project!

I'm trying to rebuild the data to submit a PR, but I'm struggling to get the build script working. I'm on MacOS v13.6.6 and so far I've managed the following:

Install the required version of PHP (7.3) - instructions here

Install Composer locally - instructions here

I've successfully installed the project dependencies with ./composer.phar install

But now I'm having trouble running the build script. The readme says to run docker-compose run php /var/www/html/bin/build -v but that doesn't seem right, as I don't have a docker-compose command, nor a /var/www/html/bin/build directory. I've tried just running php bin/build -v which seems to run a bit, but then produces the following errors:

PHP Warning:  The use statement with non-compound name 'Locale' has no effect in /Users/jack/workspace/country-list/bin/build on line 4

Warning: The use statement with non-compound name 'Locale' has no effect in /Users/jack/workspace/country-list/bin/build on line 4
[file+] /Users/jack/workspace/country-list/bin/../data/af/country.json
[file+] /Users/jack/workspace/country-list/bin/../data/af/country.xliff
[file+] /Users/jack/workspace/country-list/bin/../data/af/country.xml
[file+] /Users/jack/workspace/country-list/bin/../data/af/country.txt

In AbstractPostgreSQLDriver.php line 79:

  [Doctrine\DBAL\Exception\DriverException]                                                                                                            
  An exception occurred in driver: SQLSTATE[08006] [7] could not translate host name "pgsql" to address: nodename nor servname provided, or not known  

Exception trace:
  at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php:79
 Doctrine\DBAL\Driver\AbstractPostgreSQLDriver->convertException() at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:169
 Doctrine\DBAL\DBALException::wrapException() at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:155
 Doctrine\DBAL\DBALException::driverException() at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php:48
 Doctrine\DBAL\Driver\PDOPgSql\Driver->connect() at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:356
 Doctrine\DBAL\Connection->connect() at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:422
 Doctrine\DBAL\Connection->getDatabasePlatformVersion() at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:382
 Doctrine\DBAL\Connection->detectDatabasePlatform() at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:324
 Doctrine\DBAL\Connection->getDatabasePlatform() at /Users/jack/workspace/country-list/vendor/umpirsky/list-generator/src/Umpirsky/ListGenerator/Exporter/SqlExporter.php:85
 Umpirsky\ListGenerator\Exporter\SqlExporter->exportCreateTable() at /Users/jack/workspace/country-list/vendor/umpirsky/list-generator/src/Umpirsky/ListGenerator/Exporter/SqlExporter.php:23
 Umpirsky\ListGenerator\Exporter\SqlExporter->export() at /Users/jack/workspace/country-list/vendor/umpirsky/list-generator/src/Umpirsky/ListGenerator/Builder/Build.php:81
 Umpirsky\ListGenerator\Builder\Build->execute() at /Users/jack/workspace/country-list/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /Users/jack/workspace/country-list/vendor/symfony/console/Application.php:987
 Symfony\Component\Console\Application->doRunCommand() at /Users/jack/workspace/country-list/vendor/symfony/console/Application.php:255
 Symfony\Component\Console\Application->doRun() at /Users/jack/workspace/country-list/vendor/symfony/console/Application.php:148
 Symfony\Component\Console\Application->run() at /Users/jack/workspace/country-list/bin/build:25

In PDOConnection.php line 31:

  [Doctrine\DBAL\Driver\PDOException (7)]                                                                             
  SQLSTATE[08006] [7] could not translate host name "pgsql" to address: nodename nor servname provided, or not known  

Exception trace:
  at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31
 Doctrine\DBAL\Driver\PDOConnection->__construct() at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php:24
 Doctrine\DBAL\Driver\PDOPgSql\Driver->connect() at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:356
 Doctrine\DBAL\Connection->connect() at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:422
 Doctrine\DBAL\Connection->getDatabasePlatformVersion() at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:382
 Doctrine\DBAL\Connection->detectDatabasePlatform() at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:324
 Doctrine\DBAL\Connection->getDatabasePlatform() at /Users/jack/workspace/country-list/vendor/umpirsky/list-generator/src/Umpirsky/ListGenerator/Exporter/SqlExporter.php:85
 Umpirsky\ListGenerator\Exporter\SqlExporter->exportCreateTable() at /Users/jack/workspace/country-list/vendor/umpirsky/list-generator/src/Umpirsky/ListGenerator/Exporter/SqlExporter.php:23
 Umpirsky\ListGenerator\Exporter\SqlExporter->export() at /Users/jack/workspace/country-list/vendor/umpirsky/list-generator/src/Umpirsky/ListGenerator/Builder/Build.php:81
 Umpirsky\ListGenerator\Builder\Build->execute() at /Users/jack/workspace/country-list/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /Users/jack/workspace/country-list/vendor/symfony/console/Application.php:987
 Symfony\Component\Console\Application->doRunCommand() at /Users/jack/workspace/country-list/vendor/symfony/console/Application.php:255
 Symfony\Component\Console\Application->doRun() at /Users/jack/workspace/country-list/vendor/symfony/console/Application.php:148
 Symfony\Component\Console\Application->run() at /Users/jack/workspace/country-list/bin/build:25

In PDOConnection.php line 27:

  [PDOException (7)]                                                                                                  
  SQLSTATE[08006] [7] could not translate host name "pgsql" to address: nodename nor servname provided, or not known  

Exception trace:
  at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27
 PDO->__construct() at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27
 Doctrine\DBAL\Driver\PDOConnection->__construct() at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php:24
 Doctrine\DBAL\Driver\PDOPgSql\Driver->connect() at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:356
 Doctrine\DBAL\Connection->connect() at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:422
 Doctrine\DBAL\Connection->getDatabasePlatformVersion() at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:382
 Doctrine\DBAL\Connection->detectDatabasePlatform() at /Users/jack/workspace/country-list/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:324
 Doctrine\DBAL\Connection->getDatabasePlatform() at /Users/jack/workspace/country-list/vendor/umpirsky/list-generator/src/Umpirsky/ListGenerator/Exporter/SqlExporter.php:85
 Umpirsky\ListGenerator\Exporter\SqlExporter->exportCreateTable() at /Users/jack/workspace/country-list/vendor/umpirsky/list-generator/src/Umpirsky/ListGenerator/Exporter/SqlExporter.php:23
 Umpirsky\ListGenerator\Exporter\SqlExporter->export() at /Users/jack/workspace/country-list/vendor/umpirsky/list-generator/src/Umpirsky/ListGenerator/Builder/Build.php:81
 Umpirsky\ListGenerator\Builder\Build->execute() at /Users/jack/workspace/country-list/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /Users/jack/workspace/country-list/vendor/symfony/console/Application.php:987
 Symfony\Component\Console\Application->doRunCommand() at /Users/jack/workspace/country-list/vendor/symfony/console/Application.php:255
 Symfony\Component\Console\Application->doRun() at /Users/jack/workspace/country-list/vendor/symfony/console/Application.php:148
 Symfony\Component\Console\Application->run() at /Users/jack/workspace/country-list/bin/build:25

Is there something else I need to do to get this working? Thanks for your time.

umpirsky commented 3 months ago

I didn't run it for quite some time, I might try when I have time and update it a bit. Looks like for PostgreSQLDriver some additional setup is needed.

anthony0030 commented 3 months ago

I got it running,

I don't have a docker-compose command

Do you have Docker Desktop installed?

nor a /var/www/html/bin/build directory

This is a path from inside the docker container.

Try

  ./composer.phar self-update --2.2 

here are the Docker files that I was able to make. I can't upload the vendor files as they are too big. I can send them to you via wetransfer if you want.

@jackocnr I have some experience with Docker but very little with PHP.

After the rebuild, the output files were the same.

ac: "Ascension Island",
xk: "Kosovo",

These weren't added

From my little understanding of PHP it looks like the data is coming from here.

Ps I am running MacOS 14.4.1 (23E224)