User tests: Successful: Unsuccessful:
Fixes running composer install --no-dev
This currently breaks the build script - see: https://build.joomla.org:8443/job/cms_packaging/job/nightly_build_40/431/console
To test just run composer install
and composer install --no-dev
. Before patch the latter fails. After patch both work
Status | New | ⇒ | Pending |
Category | ⇒ | Unit Tests Repository Administration |
Category | Unit Tests Repository Administration | ⇒ | External Library Composer Change |
Title |
|
Title |
|
Labels |
Added:
?
?
|
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-07-27 23:33:32 |
Closed_By | ⇒ | wilsonge |
composer install --no-dev
returns:
[ $COMPOSER_DEV_MODE -eq 0 ] || phpcs --config-set installed_paths ../../joomla/cms-coding-standards/lib,../../joomla/coding-standards
sh: 1: [: -eq: unexpected operator
sh: 1: phpcs: not found
Script [ $COMPOSER_DEV_MODE -eq 0 ] || phpcs --config-set installed_paths ../../joomla/cms-coding-standards/lib,../../joomla/coding-standards handling the post-install-cmd event returned with error code 127
composer install --no-scripts
succeeds.
composer install --no-dev
succeeds with the latest release of composer.
@twister65 doesnt work for me
Generating optimized autoload files
> [ $COMPOSER_DEV_MODE -eq 0 ] || phpcs --config-set installed_paths ../../joomla/cms-coding-standards/lib,../../joomla/coding-standards
'[' is not recognized as an internal or external command,
operable program or batch file.
Using config file: C:\htdocs\joomla-cms\libraries\vendor\squizlabs\php_codesniffer\CodeSniffer.con
Generating optimized autoload files
> [ $COMPOSER_DEV_MODE -eq 0 ] || phpcs --config-set installed_paths ../../joomla/cms-coding-standards/lib,../../joomla/coding-standards
'[' is not recognized as an internal or external command,
operable program or batch file.
'phpcs' is not recognized as an internal or external command,
operable program or batch file.
Script [ $COMPOSER_DEV_MODE -eq 0 ] || phpcs --config-set installed_paths ../../joomla/cms-coding-standards/lib,../../joomla/coding-standards handling the post-install-cmd event returned with error code 1
'[' is not recognized as an internal or external command,
I think you have an old version of composer, I had the same problem. I solved it by updating the composer.
PS C:\htdocs\joomla-cms> composer -V
Composer version 1.8.6 2019-06-11 15:03:05
I suspect it might be because I am on windows?
Note: this does not work on windows, since it would need %COMPOSER_DEV_MODE%.
https://stackoverflow.com/questions/13087088/composer-run-scripts-only-in-dev-environment
:(
Running composer install
on the branch https://github.com/Hackwar/joomla-cms/tree/j4mailtemplates I get here (Macintosh)
Generating optimized autoload files
> [ $COMPOSER_DEV_MODE -eq 0 ] || phpcs --config-set installed_paths ../../joomla/cms-coding-standards/lib,../../joomla/coding-standards
Warning: Unsupported declare 'strict_types' in /Applications/MAMP/htdocs/joomla-cms-j4mailtemplates/libraries/vendor/zendframework/zend-diactoros/src/functions/create_uploaded_file.php on line 8
Parse error: parse error, expecting `'{'' in /Applications/MAMP/htdocs/joomla-cms-j4mailtemplates/libraries/vendor/zendframework/zend-diactoros/src/functions/create_uploaded_file.php on line 19
Script [ $COMPOSER_DEV_MODE -eq 0 ] || phpcs --config-set installed_paths ../../joomla/cms-coding-standards/lib,../../joomla/coding-standards handling the post-install-cmd event returned with error code 255
For now revert the change in this PR
Something unrelated is wrong with JMs code. @infograf768 is there any way your php version locally is less than PHP 7? Because that suggests your php version doesn't recognise strict_types
.
I also have tested this right now on my MacBook and it works just fine (@brianteeman is right this is broken on windows and needs to be fixed there (reverting is good enough)). However this patch is fine on linux + mac
Php: 7.3.1 on MAMP
I now ran composer update
on the same branch.
I get
imac-2:joomla-cms-j4mailtemplates mac$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 15 updates, 0 removals
- Updating symfony/console (v4.3.2 => v4.3.3): Downloading (100%)
- Updating symfony/debug (v4.3.2 => v4.3.3): Downloading (100%)
- Updating symfony/options-resolver (v4.3.2 => v4.3.3): Loading from cache
- Updating symfony/ldap (v4.3.2 => v4.3.3): Loading from cache
- Updating symfony/web-link (v4.3.2 => v4.3.3): Loading from cache
- Updating symfony/yaml (v4.3.2 => v4.3.3): Downloading (100%)
- Updating symfony/dom-crawler (v4.3.2 => v4.3.3): Loading from cache
- Updating symfony/browser-kit (v4.3.2 => v4.3.3): Loading from cache
- Updating symfony/css-selector (v4.3.2 => v4.3.3): Loading from cache
- Updating symfony/event-dispatcher (v4.3.2 => v4.3.3): Downloading (100%)
- Updating symfony/finder (v4.3.2 => v4.3.3): Downloading (100%)
- Updating symfony/process (v4.3.2 => v4.3.3): Loading from cache
- Updating symfony/filesystem (v4.3.2 => v4.3.3): Loading from cache
- Updating symfony/stopwatch (v4.3.2 => v4.3.3): Loading from cache
- Updating symfony/var-dumper (v4.3.2 => v4.3.3): Downloading (100%)
Writing lock file
Generating optimized autoload files
Then no error with composer install --no-dev
> [ $COMPOSER_DEV_MODE -eq 0 ] || phpcs --config-set installed_paths ../../joomla/cms-coding-standards/lib,../../joomla/coding-standards
Reason given here already #25720 (comment)
That's how composer works. I'm aware and I will fix it when I'm next sitting down to write code. I'm just making the point JM's issue is something totally different.
something like this works:
"php -r \"$ret=0; getenv('COMPOSER_DEV_MODE') !== '1' ?? system('phpcs --config-set installed_paths ../../joomla/cms-coding-standards/lib,../../joomla/coding-standards', $ret); exit($ret);\""
if you're using php you don't have to use getenv
you can just create a php class for it and use the function (what i'm intending). I just need to configure out something better than calling system as a function. via the config class somehow https://github.com/squizlabs/PHP_CodeSniffer/blob/9ae59b2b73550d86710a08befeeef5e74d9fbdc9/src/Config.php#L747 - but i need time to sit down and figure that out
Merging to fix nightly builds. Also got Hannes to code review from his phone as he introduced this code