Merge request circular dependency test problem

Created on 26 November 2021, over 3 years ago
Updated 7 January 2025, 2 months ago

Problem/Motivation

If a project needs a require-dev in composer.json and the required project requires the dev version of the first project, then composer cannot solve the requirements in the merge request automated testing script. Automated testing with a patch files works without problem.

Steps to reproduce

Example issue: https://www.drupal.org/project/search_api/issues/3247781 β†’
Example search-api composer.json :

"require-dev": {
    "drupal/language_fallback_fix": "@dev",
    "drupal/search_api_autocomplete": "@dev"
  },

search_api_autocomplete composer.json:

 "require": {
    "drupal/search_api": "1.x"
  },
16:59:51 Composer Command: sudo -u www-data /usr/local/bin/composer require drupal/search_api merge-request-20-dev --prefer-stable --no-progress --no-suggest --no-interaction --working-dir /var/www/html
16:59:51 sudo -u www-data /usr/local/bin/composer require drupal/search_api merge-request-20-dev --prefer-stable --no-progress --no-suggest --no-interaction --working-dir /var/www/html
16:59:51 You are using the deprecated option "--no-suggest". It has no effect and will break in Composer 3.
16:59:51                                                                                                   ./composer.json has been updated
16:59:52 Running composer update drupal/search_api
16:59:52 > Drupal\Composer\Composer::ensureComposerVersion
16:59:52 Loading composer repositories with package information
16:59:52                                                       Updating dependencies
16:59:52 Lock file operations: 1 install, 0 updates, 0 removals
16:59:52   - Locking drupal/search_api (dev-merge-request-20 2f74c5a)
16:59:52 Writing lock file
16:59:52 Installing dependencies from lock file (including require-dev)
16:59:52 Package operations: 1 install, 0 updates, 0 removals
16:59:52   - Syncing drupal/search_api (dev-merge-request-20 2f74c5a) into cache
16:59:52   - Installing drupal/search_api (dev-merge-request-20 2f74c5a): Cloning 2f74c5a385 from cache
16:59:52 3 package suggestions were added by new dependencies, use `composer suggest` to see details.
16:59:52 Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
16:59:52 Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
16:59:52 Generating autoload files
16:59:52 > Drupal\Core\Composer\Composer::preAutoloadDump
16:59:52 Hardening vendor directory with .htaccess and web.config files.
16:59:52 70 packages you are using are looking for funding.
16:59:52 Use the `composer fund` command to find out more!
16:59:52 Cleaning installed packages.
16:59:52 > Drupal\Composer\Composer::generateMetapackages
16:59:52 Updated metapackage file composer/Metapackage/CoreRecommended/composer.json.
16:59:52 If you make a patch, ensure that the files above are included.
16:59:52 Adding testing (require-dev) dependencies.
16:59:52 Composer Command: sudo -u www-data /usr/local/bin/composer require 'drupal/language_fallback_fix:@dev' 'drupal/search_api_autocomplete:@dev' --prefer-stable --no-progress --no-suggest --working-dir /var/www/html
16:59:52 sudo -u www-data /usr/local/bin/composer require 'drupal/language_fallback_fix:@dev' 'drupal/search_api_autocomplete:@dev' --prefer-stable --no-progress --no-suggest --working-dir /var/www/html
16:59:53 You are using the deprecated option "--no-suggest". It has no effect and will break in Composer 3.
16:59:53                                                                                                   ./composer.json has been updated
16:59:53 Running composer update drupal/language_fallback_fix drupal/search_api_autocomplete
16:59:53 > Drupal\Composer\Composer::ensureComposerVersion
16:59:53 Loading composer repositories with package information
16:59:53                                                       Updating dependencies
16:59:54 Your requirements could not be resolved to an installable set of packages.
16:59:54 
16:59:54   Problem 1
16:59:54     - drupal/search_api_autocomplete[1.0.0-alpha1, ..., 1.0.0-beta1] require drupal/core ~8.0 -> satisfiable by drupal/core[8.0.0-beta6, ..., 8.9.x-dev] from composer repo (https://repo.packagist.org) but drupal/core[9.2.x-dev] from path repo (core) has higher repository priority. The packages with higher priority do not match your constraint and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance.
16:59:54     - drupal/search_api_autocomplete[dev-1.x, 1.0.0-beta2, ..., 1.5.0] require drupal/search_api 1.x -> satisfiable by drupal/search_api[dev-1.x, 1.0.0-alpha1, ..., 1.x-dev (alias of dev-1.x)] from composer repo (https://packages.drupal.org/8) but drupal/search_api[dev-merge-request-20] from vcs repo (git /var/lib/drupalci/vcsRepoDir) has higher repository priority. The packages with higher priority do not match your constraint and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance.
16:59:54     - drupal/search_api_autocomplete 1.3.0 requires drupal/core ^8.6 -> satisfiable by drupal/core[8.6.0-alpha1, ..., 8.9.x-dev] from composer repo (https://repo.packagist.org) but drupal/core[9.2.x-dev] from path repo (core) has higher repository priority. The packages with higher priority do not match your constraint and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance.
16:59:54     - drupal/search_api_autocomplete 1.x-dev is an alias of drupal/search_api_autocomplete dev-1.x and thus requires it to be installed too.
16:59:54     - Root composer.json requires drupal/search_api_autocomplete @dev -> satisfiable by drupal/search_api_autocomplete[dev-1.x, 1.0.0-alpha1, ..., 1.x-dev (alias of dev-1.x)].
16:59:54 
16:59:54 Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
16:59:54 
16:59:54 Installation failed, reverting ./composer.json and ./composer.lock to their original content.
16:59:54 Composer require-dev failure

Proposed resolution

Aliasing the merge request branch name to the dev branch might fix this issue for all projects

For example:
sudo -u www-data /usr/local/bin/composer require drupal/search_api merge-request-20-dev --prefer-stable --no-progress --no-suggest --no-interaction --working-dir /var/www/html

sudo -u www-data /usr/local/bin/composer require "drupal/search_api: merge-request-20-dev as 1.x-dev" --prefer-stable --no-progress --no-suggest --no-interaction --working-dir /var/www/html

πŸ› Bug report
Status

Active

Component

gitlab-ci

Created by

πŸ‡©πŸ‡ͺGermany sleitner

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024