Skip to content

Conversation

@danielbachhuber
Copy link
Member

@danielbachhuber danielbachhuber commented Mar 22, 2017

@danielbachhuber danielbachhuber added this to the 1.0.1 milestone Mar 22, 2017
@danielbachhuber
Copy link
Member Author

@schlessera I don't think wp-cli/wp-cli#3921 fixed this issue. Composer still returns this error:

  Problem 1
    - Installation request for wp-cli/package-command dev-2a4ac19b859ac77c92e60efc972e539c6b834fb1 -> satisfiable by wp-cli/package-command[dev-2a4ac19b859ac77c92e60efc972e539c6b834fb1].
    - wp-cli/wp-cli dev-master requires wp-cli/package-command ^1.0 -> satisfiable by wp-cli/package-command[v1.0.0].
    - Can only install one of: wp-cli/package-command[v1.0.0, dev-2a4ac19b859ac77c92e60efc972e539c6b834fb1].
    - Installation request for wp-cli/wp-cli dev-master -> satisfiable by wp-cli/wp-cli[dev-master].

@schlessera
Copy link
Member

schlessera commented Mar 23, 2017

@danielbachhuber The issue is that Composer cannot rely on the fact that your dev branch automatically meets the ^1.0 requirement (it could include a breaking change, it could be something entirely different, ...).

That's why you need to explicitly tell it that your dev branch matches that requirement. You can do so by adding a branch alias to the wp-cli/package-command:

    "extra": {
        "branch-alias": {
            "dev-master": "1.0.x-dev"
        }
    }

@schlessera
Copy link
Member

You have "minimum-stability": "dev" in the composer.json file. You need to add "prefer-stable": true as well, otherwise it will pull down the dev version of every single dependency, instead of the stable ones.

@danielbachhuber
Copy link
Member Author

@schlessera Here's the fatal from removing the class_exists() check:

image

Also, we seem to be pulling in dev-master for composer/composer too. Is there a way to tie branch-alias to a specific project?

@danielbachhuber
Copy link
Member Author

From our phone call today, the fatal from removing the class_exists() check is probably because the autoloader is bundled in the Phar, and then loaded a second time by package-command.php at a different path.

@schlessera
Copy link
Member

The prefer-stable should fix the issue of having the dev-master of composer/composer be pulled in.

But just for future reference, you can also define package-specific aliases from within the requiring package by adding them to the version string as follows:

require: {
   "vendor/package": "dev-whatever-branch as 1.2.5"
}

@schlessera
Copy link
Member

schlessera commented Mar 29, 2017

Some more specifics about the fatal:
Normally, the require_once directive would avoid loading the Composer autoloader a second time. However, in this case, as the paths are different (file:///some/folder/vendor/autoload.php vs phar:///vendor/autoload.php), the require_once doesn't recognize them being the same file.

@danielbachhuber
Copy link
Member Author

Chatted in Slack, and decided to go with class_exists() for now https://wordpress.slack.com/archives/C02RP4T41/p1490886655640052

schlessera and others added 4 commits April 6, 2017 07:57
@schlessera
Copy link
Member

I think that the test failures after the latest changes are due to changed behaviour because of switching from included wp package to Composer-packaged wp package.

We will probably need to rethink these tests.

@danielbachhuber
Copy link
Member Author

@schlessera I've just pushed some changes. The build should pass now.

@schlessera
Copy link
Member

The build still fails. It seems to be able to pull in wp-cli/google-sitemap-generator-cli.git:

Warning: Failed to execute git clone --mirror 'git@github.com:wp-cli/google-sitemap-generator-cli.git' '/tmp/wp-cli-home/.composer/cache/vcs/git-github.com-wp-cli-google-sitemap-generator-cli.git/'

Maybe GitHub rate limit?

@danielbachhuber
Copy link
Member Author

Maybe GitHub rate limit?

Must be. It's flagged with the @github-api decorator. Test passes locally.

Updated to use ./bin/test.sh in 12f8777

@schlessera schlessera merged commit ee0313b into master Apr 11, 2017
@schlessera schlessera deleted the 1-phar-access branch April 11, 2017 16:16
schlessera pushed a commit to wp-cli/wp-cli-tests that referenced this pull request Jan 5, 2022
schlessera added a commit that referenced this pull request Jan 5, 2022
Install WP-CLI with Composer in tests to introduce `utils/make-phar.php`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:package Related to 'package' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants