【问题标题】:How to require a specific commit of a Drupal project?如何要求 Drupal 项目的特定提交?
【发布时间】:2018-02-23 07:38:47
【问题描述】:

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

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

"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。

有什么想法吗?

【问题讨论】:

    标签: composer-php drupal-8


    【解决方案1】:

    也需要弄清楚这一点,它是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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-12-11
      • 2021-02-21
      • 2020-09-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多