glpi-project / glpi

GLPI is a Free Asset and IT Management Software package, Data center management, ITIL Service Desk, licenses tracking and software auditing.
https://glpi-project.org
GNU General Public License v3.0
4.15k stars 1.28k forks source link

Missing composer.hash file #3391

Closed mohierf closed 6 years ago

mohierf commented 6 years ago

I am using Glpi with PHP Storm IDE and composer is still installed on my system.

GLPI always asks Run "composer install --no-dev" in the glpi tree. because of the missing composer.hash file ... whereas I ran composer and dependencies are up-to-date.

trasher commented 6 years ago

Check composer install output. You have the following line in the output: > @php -r "file_put_contents('.composer.hash', sha1_file('composer.lock'));"; you may have an error.

mohierf commented 6 years ago

Indeed the composer was installed by my IDE PHP Storm and this is probably the main reason why the hash file is not found by Glpi...

My composer output:

composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
  - Installing atoum/atoum (3.2.0)
    Downloading: 100%         

  - Installing atoum/telemetry-extension (1.0.0)
    Downloading: 100%         

  - Installing symfony/process (v3.3.6)
    Downloading: 100%         

  - Installing symfony/finder (v3.3.6)
    Downloading: 100%         

  - Installing symfony/filesystem (v3.3.6)
    Downloading: 100%         

  - Installing symfony/event-dispatcher (v3.3.6)
    Downloading: 100%         

  - Installing psr/log (1.0.2)
    Loading from cache

  - Installing symfony/debug (v3.3.6)
    Downloading: 100%         

  - Installing symfony/console (v3.3.6)
    Downloading: 100%         

  - Installing league/container (2.4.1)
    Loading from cache

  - Installing consolidation/output-formatters (3.1.10)
    Downloading: 100%         

  - Installing consolidation/log (1.0.3)
    Downloading: 100%         

  - Installing symfony/yaml (v3.3.6)
    Downloading: 100%         

  - Installing dflydev/dot-access-data (v1.1.0)
    Loading from cache

  - Installing grasmash/yaml-expander (1.1.1)
    Downloading: 100%         

  - Installing consolidation/config (1.0.1)
    Downloading: 100%         

  - Installing webmozart/assert (1.2.0)
    Downloading: 100%         

  - Installing phpdocumentor/reflection-common (1.0)
    Downloading: 100%         

  - Installing phpdocumentor/type-resolver (0.3.0)
    Downloading: 100%         

  - Installing phpdocumentor/reflection-docblock (3.2.2)
    Downloading: 100%         

  - Installing consolidation/annotated-command (2.4.11)
    Downloading: 100%         

  - Installing consolidation/robo (1.1.2)
    Downloading: 100%         

  - Installing squizlabs/php_codesniffer (2.9.1)
    Loading from cache

  - Installing glpi-project/coding-standard (0.6)
    Loading from cache

  - Installing psr/http-message (1.0.1)
    Downloading: 100%         

  - Installing guzzlehttp/psr7 (1.4.2)
    Downloading: 100%         

  - Installing guzzlehttp/promises (v1.3.1)
    Downloading: 100%         

  - Installing guzzlehttp/guzzle (6.3.0)
    Downloading: 100%         

  - Installing natxet/cssmin (v3.0.4)
    Downloading: 100%         

  - Installing patchwork/jsqueeze (v2.0.5)
    Downloading: 100%         

atoum/atoum suggests installing atoum/stubs (Provides IDE support (like autocompletion) for atoum)
atoum/atoum suggests installing ext-xdebug (Provides code coverage report (>= 2.3))
symfony/event-dispatcher suggests installing symfony/dependency-injection ()
symfony/event-dispatcher suggests installing symfony/http-kernel ()
consolidation/robo suggests installing henrikbjorn/lurker (For monitoring filesystem changes in taskWatch)
consolidation/robo suggests installing natxet/CssMin (For minifying CSS files in taskMinify)
consolidation/robo suggests installing pear/archive_tar (Allows tar archives to be created and extracted in taskPack and taskExtract, respectively.)
trasher commented 6 years ago

The standard composer install command do launch referenced post-install-command scripts. If your IDE does not; it is not the default composer behavior, or it does not use the latests version, or...

Here is the standard output:

 % composer install > composer.log
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 47 installs, 0 updates, 0 removals
  - Installing iamcal/lib_autolink (v1.7): Downloading (100%)         
  - Installing jasig/phpcas (1.3.5): Loading from cache
  - Installing michelf/php-markdown (1.7.0): Downloading (100%)         
  - Installing paragonie/random_compat (v2.0.11): Loading from cache
  - Installing phpmailer/phpmailer (v6.0.1): Loading from cache
  - Installing sabre/uri (1.2.1): Loading from cache
  - Installing sabre/xml (1.5.0): Loading from cache
  - Installing sabre/vobject (4.1.3): Loading from cache
  - Installing simplepie/simplepie (1.5.1): Loading from cache
  - Installing tecnickcom/tcpdf (6.2.13): Loading from cache
  - Installing symfony/polyfill-mbstring (v1.6.0): Loading from cache
  - Installing true/punycode (v2.1.1): Downloading (100%)         
  - Installing zendframework/zend-stdlib (3.1.0): Loading from cache
  - Installing psr/container (1.0.0): Loading from cache
  - Installing container-interop/container-interop (1.2.0): Loading from cache
  - Installing zendframework/zend-servicemanager (3.3.0): Loading from cache
  - Installing zendframework/zend-eventmanager (3.2.0): Loading from cache
  - Installing zendframework/zend-cache (2.7.2): Loading from cache
  - Installing zendframework/zend-i18n (2.7.4): Loading from cache
  - Installing zendframework/zend-json (3.0.0): Loading from cache
  - Installing zendframework/zend-serializer (2.8.0): Loading from cache
  - Installing atoum/atoum (3.2.0): Loading from cache
  - Installing atoum/telemetry-extension (1.0.0): Loading from cache
  - Installing symfony/process (v3.3.10): Loading from cache
  - Installing symfony/finder (v3.3.10): Loading from cache
  - Installing symfony/filesystem (v3.3.10): Loading from cache
  - Installing symfony/event-dispatcher (v3.3.10): Loading from cache
  - Installing psr/log (1.0.2): Loading from cache
  - Installing symfony/debug (v3.3.10): Loading from cache
  - Installing symfony/console (v3.3.10): Loading from cache
  - Installing league/container (2.4.1): Loading from cache
  - Installing consolidation/output-formatters (3.1.12): Loading from cache
  - Installing consolidation/log (1.0.3): Loading from cache
  - Installing symfony/yaml (v3.3.10): Loading from cache
  - Installing dflydev/dot-access-data (v1.1.0): Loading from cache
  - Installing grasmash/yaml-expander (1.2.0): Loading from cache
  - Installing consolidation/config (1.0.6): Loading from cache
  - Installing consolidation/annotated-command (2.8.1): Loading from cache
  - Installing consolidation/robo (1.1.4): Loading from cache
  - Installing squizlabs/php_codesniffer (2.9.1): Loading from cache
  - Installing glpi-project/coding-standard (0.6): Loading from cache
  - Installing psr/http-message (1.0.1): Loading from cache
  - Installing guzzlehttp/psr7 (1.4.2): Loading from cache
  - Installing guzzlehttp/promises (v1.3.1): Loading from cache
  - Installing guzzlehttp/guzzle (6.3.0): Loading from cache
  - Installing natxet/cssmin (v3.0.5): Loading from cache
  - Installing patchwork/jsqueeze (v2.0.5): Loading from cache
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
phpmailer/phpmailer suggests installing hayageek/oauth2-yahoo (Needed for Yahoo XOAUTH2 authentication)
phpmailer/phpmailer suggests installing league/oauth2-google (Needed for Google XOAUTH2 authentication)
phpmailer/phpmailer suggests installing stevenmaguire/oauth2-microsoft (Needed for Microsoft XOAUTH2 authentication)
sabre/vobject suggests installing hoa/bench (If you would like to run the benchmark scripts)
simplepie/simplepie suggests installing mf2/mf2 (Microformat module that allows for parsing HTML for microformats)
zendframework/zend-servicemanager suggests installing ocramius/proxy-manager (ProxyManager 1.* to handle lazy initialization of services)
zendframework/zend-cache suggests installing ext-dba (DBA, to use the DBA storage adapter)
zendframework/zend-cache suggests installing ext-memcache (Memcache >= 2.0.0 to use the Memcache storage adapter)
zendframework/zend-cache suggests installing ext-memcached (Memcached >= 1.0.0 to use the Memcached storage adapter)
zendframework/zend-cache suggests installing ext-mongo (Mongo, to use MongoDb storage adapter)
zendframework/zend-cache suggests installing ext-redis (Redis, to use Redis storage adapter)
zendframework/zend-cache suggests installing ext-wincache (WinCache, to use the WinCache storage adapter)
zendframework/zend-cache suggests installing ext-xcache (XCache, to use the XCache storage adapter)
zendframework/zend-cache suggests installing mongofill/mongofill (Alternative to ext-mongo - a pure PHP implementation designed as a drop in replacement)
zendframework/zend-cache suggests installing zendframework/zend-session (Zend\Session component)
zendframework/zend-i18n suggests installing zendframework/zend-config (Zend\Config component)
zendframework/zend-i18n suggests installing zendframework/zend-filter (You should install this package to use the provided filters)
zendframework/zend-i18n suggests installing zendframework/zend-i18n-resources (Translation resources)
zendframework/zend-i18n suggests installing zendframework/zend-validator (You should install this package to use the provided validators)
zendframework/zend-i18n suggests installing zendframework/zend-view (You should install this package to use the provided view helpers)
zendframework/zend-json suggests installing zendframework/zend-json-server (For implementing JSON-RPC servers)
zendframework/zend-json suggests installing zendframework/zend-xml2json (For converting XML documents to JSON)
zendframework/zend-serializer suggests installing zendframework/zend-math ((^2.6 || ^3.0) To support Python Pickle serialization)
atoum/atoum suggests installing atoum/stubs (Provides IDE support (like autocompletion) for atoum)
symfony/event-dispatcher suggests installing symfony/dependency-injection ()
symfony/event-dispatcher suggests installing symfony/http-kernel ()
consolidation/robo suggests installing henrikbjorn/lurker (For monitoring filesystem changes in taskWatch)
consolidation/robo suggests installing natxet/CssMin (For minifying CSS files in taskMinify)
consolidation/robo suggests installing pear/archive_tar (Allows tar archives to be created and extracted in taskPack and taskExtract, respectively.)
Generating optimized autoload files
> @php -r "file_put_contents('.composer.hash', sha1_file('composer.lock'));"
> patch -d vendor/tecnickcom/tcpdf/ -p1 < tools/tcpdf-php7.2.patch
> patch -d vendor/zendframework/zend-cache/ -p1 < tools/zend-cache-php7.2.patch
trasher commented 6 years ago

See https://getcomposer.org/doc/articles/scripts.md#event-names

mohierf commented 6 years ago

My IDE simply installs the composer if it detects taht it is not yet installed on the system.

After more investigation, the composer verbose mode raises:

composer -vvv -d=/home/glpi/glpi install
Changed CWD to /home/glpi/glpi
Reading ./composer.json
Loading config file ./composer.json
Checking CA file /etc/ssl/certs/ca-certificates.crt
Executing command (/home/glpi/glpi): git branch --no-color --no-abbrev -v
Failed to initialize global composer: Composer could not find the config file: /home/glpi/.config/composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading /home/glpi/glpi/vendor/composer/installed.json
Reading ./composer.lock
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Reading ./composer.lock
Resolving dependencies through SAT
Dependency resolution completed in 0.002 seconds
Analyzed 154 packages to resolve dependencies
Analyzed 370 rules to resolve dependencies
Nothing to install or update
Generating optimized autoload files
> post-install-cmd: @php -r "file_put_contents('.composer.hash', sha1_file('composer.lock'));"

Note that the post-install-cmd is supposed to be executed but I do not have any composer.hash file created 😞

Also note the log: Failed to initialize global composer... perharps something to deal with ...

mohierf commented 6 years ago

My bad! I was searching for a composer.hash file ... not for a .composer.hash (see the dot) !

Thanks @trasher and sorry for the mistake :(

trasher commented 6 years ago

NP ;)