dsgdg46465 2016-11-29 09:41
浏览 40
已采纳

如何使用反向依赖关系进行分叉?

I forked laravel/framework and want to use clone's testing-encoding branch:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/x-yuri/framework"
        }
    ],
    "require": {
        "laravel/framework": "dev-testing-encoding"
    }
}

But when I do composer require modelizer/selenium, it says:

Using version ^1.1 for modelizer/selenium
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)                
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/framework 5.4.x-dev requires symfony/console 3.2.* -> satisfiable by symfony/console[3.2.x-dev, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2] but these conflict with your requirements or minimum-stability.
    - laravel/framework 5.4.x-dev requires symfony/console 3.2.* -> satisfiable by symfony/console[3.2.x-dev, v3.2.0-BE
TA1, v3.2.0-RC1, v3.2.0-RC2] but these conflict with your requirements or minimum-stability.
    - Installation request for modelizer/selenium ^1.1 -> satisfiable by modelizer/selenium[v1.1.0].
    - Conclusion: remove laravel/framework dev-testing-encoding
    - Conclusion: don't install laravel/framework dev-testing-encoding
    - modelizer/selenium v1.1.0 requires laravel/framework ^5.1 -> satisfiable by laravel/framework[5.4.x-dev, 5.1.x-de
v, 5.2.x-dev, 5.3.x-dev].
    - Can only install one of: laravel/framework[5.1.x-dev, dev-testing-encoding].
    - Can only install one of: laravel/framework[5.2.x-dev, dev-testing-encoding].
    - Can only install one of: laravel/framework[5.3.x-dev, dev-testing-encoding].
    - Can only install one of: laravel/framework[dev-testing-encoding, 5.1.x-dev].
    - Can only install one of: laravel/framework[dev-testing-encoding, 5.2.x-dev].
    - Can only install one of: laravel/framework[dev-testing-encoding, 5.3.x-dev].
    - Installation request for laravel/framework dev-testing-encoding -> satisfiable by laravel/framework[dev-testing-e
ncoding].


Installation failed, reverting ./composer.json to its original content.

I tried to experiment with minimum-stability, and stability flags. To no avail. The best I could come up with is fork modelizer/selenium as well, and hardcode there laravel's branch I need:

diff --git a/composer.json b/composer.json
index 9036e47..65facf0 100644
--- a/composer.json
+++ b/composer.json
@@ -12,8 +12,14 @@
             "email": "john.hoopes@madisoncreativeweb.com"
         }
     ],
+    "repositories": [
+        {
+            "type": "vcs",
+            "url": "https://github.com/x-yuri/framework"
+        }
+    ],
     "require": {
-        "laravel/framework": "^5.1",
+        "laravel/framework": "dev-testing-encoding",
         "symfony/process": ">=2.7",
         "phpunit/phpunit-selenium": ">=1.2",
         "guzzlehttp/guzzle": "^6.2"

Add the repo to root composer.json:

{
    "type": "vcs",
    "url": "https://github.com/x-yuri/Selenium"
}

And then do: composer require modelizer/selenium=dev-laravel-testing-encoding. Which also means, I've got to fork laravel/socialite too, though it doesn't require laravel/framework directly. Can it be any simpler than this?

  • 写回答

1条回答 默认 最新

  • dongshipang8094 2016-12-01 18:04
    关注

    The guys on GitHub helped me with this one. As you can see, modelizer/selenium requires laravel/framework=^5.1. And we want laravel/framework=dev-testing-encoding. composer doesn't know how to compare these two versions, unless we tell it:

    "require": {
        "laravel/framework": "dev-testing-encoding as 5.1.0"
    }
    

    This way, we convey to composer that dev-testing-encoding can be treated as version 5.1.0. In other words, we alias dev-testing-encoding to 5.1.0. As such, it satisfies modelizer/selenium's dependency, and requiring the package succeeds.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?