composer-php - 如何要求 Drupal 项目的特定提交?

标签 composer-php drupal-8

我知道这已经被问过好几次了,但其他解决方案对我不起作用,所以问题可能出在其他地方。

在一个依赖项目中,我需要一个这样的包:

"require": {
    "drupal/security_review": "dev-8.x-1.x#35ebae44"
}

但是 composer update失败的原因:
package/name dev-master requires drupal/security_review dev-8.x-1.x#35ebae44 
  -> no matching package found.

出于研究目的,我获取了包信息:
[local]$ composer show --all drupal/security_review
name     : drupal/security_review                       
descrip. : Site security and configuration review module.
keywords : 
versions : 1.x-dev, dev-1.x
type     : drupal-module
source   : [git] https://git.drupal.org/project/security_review 9a3bdf82a645dabb9801f73d2d76acf8c3081d88

support
source : http://cgit.drupalcode.org/security_review

requires
drupal/core ~8.0

然后尝试使用版本代替分支,因为它作为前缀从版本中省略“dev-”部分:
"require": {
    "drupal/security_review": "dev-1.x#35ebae44"
}

情况有所不同:
[local]$ composer update
...
- Installing drupal/security_review (dev-1.x 9a3bdf8): Cloning 9a3bdf82a6

如您所见,它获取提交 #9a3bdf8 而不是请求的 - #35ebae44。

有任何想法吗?

最佳答案

也需要弄清楚这一点,它是 1.x-dev而不是 dev-1.x
例如:

composer require drupal/security_review:1.x-dev#35ebae44
    1/2:    http://packagist.org/p/provider-latest$00ceddb9dc4b7174d6c84c3e2ac454ccd6a6cb952ab70c1ab623371566d63754.json
    2/2:    http://packagist.org/p/provider-2018-04$1ce22045b6ddc998c850721c3db7f2902d0d37ae5989b30f0fb40ebfa5e91833.json
    Finished: success: 2, skipped: 0, failure: 0, total: 2
./composer.json has been updated
Gathering patches for root package.
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
Gathering patches for root package.
  - Installing drupal/security_review (dev-1.x 35ebae44): Gathering patches for dependencies. This might take a minute.
Cloning 35ebae44 from cache
Writing lock file
Generating autoload files
> DrupalProject\composer\ScriptHandler::createRequiredFiles

关于composer-php - 如何要求 Drupal 项目的特定提交?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48943258/

相关文章:

php - 最新的 symfony 安装程序与 Composer

drupal-8 - Drupal 8, hook_preprocess_ page by route

php - 为什么更新包时 "composer.json"没有更新?

php - Composer 是供服务器使用还是本地使用?

php - 如何在 Mac 上安装 Composer?

hook - Drupal 8 模块开发 : hook_node_access not called

php - "paragraph"实体类型不存在。在 Drupal\Core\Entity\EntityTypeManager->getDefinition()

php - 为什么 COMPOSER_HOME 是空的?

drupal-8 - Drupal 8 - 自定义 block 未在 Controller 中呈现

drupal - 无法从内容类型中删除字段