Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add minimum required dependencies #5537

Closed
wants to merge 3 commits into from
Closed

Add minimum required dependencies #5537

wants to merge 3 commits into from

Conversation

drupol
Copy link
Contributor

@drupol drupol commented Apr 15, 2023

Dear maintainers,

I am currently working on updating the drush package for the Nix based distribution. The primary goal of the related PR is to replace all PHAR-based software with their respective source distributions. While most of the software packages have been successfully migrated, I am encountering an issue with Drush, which prompted this pull request.

The composer installation process includes the --no-dev flag to prevent installing development dependencies when using drush as a standalone tool, unattached to any Drupal installation. Unfortunately, with this flag in place, running the drush command results in a failure. I have included the log from running composer install --no-dev in the collapsed section below.

$ git checkout 11.x
$ git clean -fdx
$ composer install --no-dev
No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
Loading composer repositories with package information
Updating dependencies
Lock file operations: 118 installs, 0 updates, 0 removals
  - Locking asm89/stack-cors (1.3.0)
  - Locking chi-teck/drupal-code-generator (2.6.2)
  - Locking composer/installers (v1.12.0)
  - Locking composer/semver (3.3.2)
  - Locking consolidation/annotated-command (4.8.2)
  - Locking consolidation/config (2.1.2)
  - Locking consolidation/filter-via-dot-access-data (2.0.2)
  - Locking consolidation/log (2.1.1)
  - Locking consolidation/output-formatters (4.2.4)
  - Locking consolidation/robo (4.0.2)
  - Locking consolidation/self-update (2.1.0)
  - Locking consolidation/site-alias (4.0.0)
  - Locking consolidation/site-process (4.2.1)
  - Locking cweagans/composer-patches (1.7.3)
  - Locking david-garcia/phpwhois (4.3.0)
  - Locking dflydev/dot-access-data (v3.0.2)
  - Locking doctrine/annotations (1.13.3)
  - Locking doctrine/instantiator (1.5.0)
  - Locking doctrine/lexer (1.2.3)
  - Locking doctrine/reflection (1.2.3)
  - Locking drupal/core (9.5.7)
  - Locking drupal/core-recommended (9.5.7)
  - Locking drupal/semver_example (2.3.0)
  - Locking egulias/email-validator (3.2.5)
  - Locking enlightn/security-checker (v1.10.0)
  - Locking grasmash/expander (2.0.3)
  - Locking guzzlehttp/guzzle (6.5.8)
  - Locking guzzlehttp/promises (1.5.2)
  - Locking guzzlehttp/psr7 (1.9.0)
  - Locking jakeasmith/http_build_url (1.0.1)
  - Locking laminas/laminas-diactoros (2.14.0)
  - Locking laminas/laminas-escaper (2.9.0)
  - Locking laminas/laminas-feed (2.17.0)
  - Locking laminas/laminas-stdlib (3.11.0)
  - Locking league/container (4.2.0)
  - Locking masterminds/html5 (2.7.6)
  - Locking mso/idna-convert (v3.1.0)
  - Locking myclabs/deep-copy (1.11.1)
  - Locking nikic/php-parser (v4.15.4)
  - Locking pear/archive_tar (1.4.14)
  - Locking pear/console_getopt (v1.4.3)
  - Locking pear/pear-core-minimal (v1.10.11)
  - Locking pear/pear_exception (v1.0.2)
  - Locking phar-io/manifest (2.0.3)
  - Locking phar-io/version (3.2.1)
  - Locking phpstan/phpstan (1.10.13)
  - Locking phpunit/php-code-coverage (9.2.26)
  - Locking phpunit/php-file-iterator (3.0.6)
  - Locking phpunit/php-invoker (3.1.1)
  - Locking phpunit/php-text-template (2.0.4)
  - Locking phpunit/php-timer (5.0.3)
  - Locking phpunit/phpunit (9.6.7)
  - Locking psr/cache (1.0.1)
  - Locking psr/container (1.1.2)
  - Locking psr/http-factory (1.0.2)
  - Locking psr/http-message (1.0.1)
  - Locking psr/log (1.1.4)
  - Locking psy/psysh (v0.11.15)
  - Locking ralouphie/getallheaders (3.0.3)
  - Locking rector/rector (0.12.23)
  - Locking sebastian/cli-parser (1.0.1)
  - Locking sebastian/code-unit (1.0.8)
  - Locking sebastian/code-unit-reverse-lookup (2.0.3)
  - Locking sebastian/comparator (4.0.8)
  - Locking sebastian/complexity (2.0.2)
  - Locking sebastian/diff (4.0.4)
  - Locking sebastian/environment (5.1.5)
  - Locking sebastian/exporter (4.0.5)
  - Locking sebastian/global-state (5.0.5)
  - Locking sebastian/lines-of-code (1.0.3)
  - Locking sebastian/object-enumerator (4.0.4)
  - Locking sebastian/object-reflector (2.0.4)
  - Locking sebastian/recursion-context (4.0.5)
  - Locking sebastian/resource-operations (3.0.3)
  - Locking sebastian/type (3.2.1)
  - Locking sebastian/version (3.0.2)
  - Locking squizlabs/php_codesniffer (3.7.2)
  - Locking stack/builder (v1.0.6)
  - Locking symfony-cmf/routing (2.3.4)
  - Locking symfony/console (v4.4.49)
  - Locking symfony/debug (v4.4.44)
  - Locking symfony/dependency-injection (v4.4.49)
  - Locking symfony/deprecation-contracts (v2.5.2)
  - Locking symfony/error-handler (v4.4.44)
  - Locking symfony/event-dispatcher (v4.4.44)
  - Locking symfony/event-dispatcher-contracts (v1.1.13)
  - Locking symfony/filesystem (v5.4.21)
  - Locking symfony/finder (v5.4.21)
  - Locking symfony/http-client-contracts (v2.5.2)
  - Locking symfony/http-foundation (v4.4.49)
  - Locking symfony/http-kernel (v4.4.50)
  - Locking symfony/mime (v5.4.13)
  - Locking symfony/polyfill-ctype (v1.27.0)
  - Locking symfony/polyfill-iconv (v1.27.0)
  - Locking symfony/polyfill-intl-grapheme (v1.27.0)
  - Locking symfony/polyfill-intl-idn (v1.27.0)
  - Locking symfony/polyfill-intl-normalizer (v1.27.0)
  - Locking symfony/polyfill-mbstring (v1.27.0)
  - Locking symfony/polyfill-php72 (v1.27.0)
  - Locking symfony/polyfill-php73 (v1.27.0)
  - Locking symfony/polyfill-php80 (v1.27.0)
  - Locking symfony/process (v4.4.44)
  - Locking symfony/psr-http-message-bridge (v2.1.4)
  - Locking symfony/routing (v4.4.44)
  - Locking symfony/serializer (v4.4.47)
  - Locking symfony/service-contracts (v2.5.2)
  - Locking symfony/string (v5.4.22)
  - Locking symfony/translation (v4.4.47)
  - Locking symfony/translation-contracts (v2.5.2)
  - Locking symfony/validator (v4.4.48)
  - Locking symfony/var-dumper (v5.4.22)
  - Locking symfony/yaml (v4.4.45)
  - Locking theseer/tokenizer (1.2.1)
  - Locking twig/twig (v2.15.4)
  - Locking typo3/phar-stream-wrapper (v3.1.7)
  - Locking vlucas/phpdotenv (v2.6.9)
  - Locking webflo/drupal-finder (1.2.2)
  - Locking yoast/phpunit-polyfills (0.2.0)
Writing lock file
Installing dependencies from lock file
Package operations: 45 installs, 0 updates, 0 removals
  - Installing symfony/polyfill-php72 (v1.27.0): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.27.0): Extracting archive
  - Installing symfony/polyfill-ctype (v1.27.0): Extracting archive
  - Installing twig/twig (v2.15.4): Extracting archive
  - Installing symfony/polyfill-php80 (v1.27.0): Extracting archive
  - Installing symfony/polyfill-intl-normalizer (v1.27.0): Extracting archive
  - Installing symfony/polyfill-intl-grapheme (v1.27.0): Extracting archive
  - Installing symfony/string (v5.4.22): Extracting archive
  - Installing symfony/filesystem (v5.4.21): Extracting archive
  - Installing symfony/deprecation-contracts (v2.5.2): Extracting archive
  - Installing psr/container (1.1.2): Extracting archive
  - Installing symfony/service-contracts (v2.5.2): Extracting archive
  - Installing symfony/polyfill-php73 (v1.27.0): Extracting archive
  - Installing symfony/console (v4.4.49): Extracting archive
  - Installing psr/log (1.1.4): Extracting archive
  - Installing chi-teck/drupal-code-generator (2.6.2): Extracting archive
  - Installing dflydev/dot-access-data (v3.0.2): Extracting archive
  - Installing consolidation/filter-via-dot-access-data (2.0.2): Extracting archive
  - Installing symfony/yaml (v4.4.45): Extracting archive
  - Installing symfony/process (v4.4.44): Extracting archive
  - Installing symfony/finder (v5.4.21): Extracting archive
  - Installing symfony/event-dispatcher-contracts (v1.1.13): Extracting archive
  - Installing symfony/event-dispatcher (v4.4.44): Extracting archive
  - Installing league/container (4.2.0): Extracting archive
  - Installing composer/semver (3.3.2): Extracting archive
  - Installing consolidation/self-update (2.1.0): Extracting archive
  - Installing consolidation/output-formatters (4.2.4): Extracting archive
  - Installing consolidation/log (2.1.1): Extracting archive
  - Installing grasmash/expander (2.0.3): Extracting archive
  - Installing consolidation/config (2.1.2): Extracting archive
  - Installing consolidation/annotated-command (4.8.2): Extracting archive
  - Installing consolidation/robo (4.0.2): Extracting archive
  - Installing consolidation/site-alias (4.0.0): Extracting archive
  - Installing consolidation/site-process (4.2.1): Extracting archive
  - Installing symfony/polyfill-intl-idn (v1.27.0): Extracting archive
  - Installing ralouphie/getallheaders (3.0.3): Extracting archive
  - Installing psr/http-message (1.0.1): Extracting archive
  - Installing guzzlehttp/psr7 (1.9.0): Extracting archive
  - Installing guzzlehttp/promises (1.5.2): Extracting archive
  - Installing guzzlehttp/guzzle (6.5.8): Extracting archive
  - Installing enlightn/security-checker (v1.10.0): Extracting archive
  - Installing symfony/var-dumper (v5.4.22): Extracting archive
  - Installing nikic/php-parser (v4.15.4): Extracting archive
  - Installing psy/psysh (v0.11.15): Extracting archive
  - Installing webflo/drupal-finder (1.2.2): Extracting archive
53 package suggestions were added by new dependencies, use `composer suggest` to see details.
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
Package mso/idna-convert is abandoned, you should avoid using it. Use algo26-matthias/idna-convert instead.
Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
Generating optimized autoload files
25 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

$ ./drush

Fatal error: Uncaught Error: Class "Symfony\Component\HttpKernel\Kernel" not found in /home/pol/Code/tmp/drush/src/Preflight/Preflight.php:209
Stack trace:
#0 /home/pol/Code/tmp/drush/src/Runtime/Runtime.php(84): Drush\Preflight\Preflight->loadSymfonyCompatabilityAutoloader()
#1 /home/pol/Code/tmp/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 /home/pol/Code/tmp/drush/drush.php(79): Drush\Runtime\Runtime->run(Array)
#3 /home/pol/Code/tmp/drush/drush(4): require('/home/pol/Code/...')
#4 {main}
  thrown in /home/pol/Code/tmp/drush/src/Preflight/Preflight.php on line 209
$

To resolve this issue, I have opened this PR to propose the necessary minimal modifications to the composer.json file. These changes will ensure that drush can function properly without requiring the installation of development dependencies.

Thank you for your attention to this matter, and I look forward to your feedback.

@weitzman
Copy link
Member

We have not supported standalone Drush for years. I think you want drush launcher - . https://github.com/drush-ops/drush-launcher.

Folks interested in the error mentioned here can follow #5156

@weitzman weitzman closed this Apr 15, 2023
@drupol
Copy link
Contributor Author

drupol commented Apr 15, 2023

Fair enough, thank you for your response.

Based on the current situation, it seems appropriate to deprecate standalone usage of Drush within the Nix distribution, as it is not functioning as intended. However, users will still be able to use it within their Drupal installations as expected. This change will only affect standalone usage.

@drupol drupol deleted the add-minimum-required-dependencies branch April 15, 2023 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants