Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors installing command into development environment #184

Open
2 tasks done
Roy-Orbison opened this issue Nov 16, 2023 · 3 comments
Open
2 tasks done

Errors installing command into development environment #184

Roy-Orbison opened this issue Nov 16, 2023 · 3 comments

Comments

@Roy-Orbison
Copy link

Bug Report

Describe the current, buggy behavior

I read the contributing guidlines for installing a command, but got an error that looked like a regression of the problem described in wp-cli/wp-cli#5602.

When trying to work around it with the :dev-main suffix, wp-cli baulked at the https: scheme and the ssh alias github: (which shortens the usual [email protected] and selects the right key).

Maybe I'm just doing it wrong but it seems like odd behaviour when supplying legitimate URLs that work with Git.

Describe how other contributors can replicate this bug

Install command using wp package install ... with an HTTP or ssh alias URL. It may do the same with the explicit git@... URL.

See shell output below.

Describe what you expect as the correct outcome

Command to install as per docs, or docs are updated to new expected command.

It worked when I used wp package install wp-cli/search-replace-command:dev-main.

Let us know what environment you are running this on

OS:     Linux 6.5.0-10-generic wp-cli/wp-cli#10-Ubuntu SMP PREEMPT_DYNAMIC Fri Oct 13 13:49:38 UTC 2023 x86_64
Shell:  /bin/bash
PHP binary:     /usr/bin/php
PHP version:    8.2.10-2ubuntu1
php.ini used:   /etc/php/8.2/cli/php.ini
MySQL binary:   /usr/bin/mysql
MySQL version:  mysql  Ver 15.1 Distrib 10.11.4-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper
SQL modes:
WP-CLI root dir:        /home/roy/GitHub/wp-cli
WP-CLI vendor dir:      /home/roy/GitHub/wp-cli/vendor
WP_CLI phar path:
WP-CLI packages dir:    /home/roy/.wp-cli/packages/
WP-CLI cache dir:       /home/roy/.wp-cli/cache
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.10.0-alpha

Provide additional context/screenshots

Shell output:

roy@RoyBook ~/GitHub/wp-cli
$ bin/wp package install https://github.com/wp-cli/search-replace-command.git
Installing package wp-cli/search-replace-command (dev-main)
Updating /home/roy/.wp-cli/packages/composer.json to require the package...
Registering https://github.com/wp-cli/search-replace-command.git as a VCS repository...
Using Composer to install the package...
---
Loading composer repositories with package information
Warning: Could not authenticate against github.com
---
Error: Package installation failed.
Reverted composer.json.


roy@RoyBook ~/GitHub/wp-cli
$ bin/wp package install github:wp-cli/search-replace-command.git
Warning: Couldn't fetch default branch for package 'github:wp-cli/search-replace-command.git' (HTTP code 403). Presuming default branch is 'master'.
Installing package wp-cli/search-replace-command (dev-master)
Updating /home/roy/.wp-cli/packages/composer.json to require the package...
Registering github:wp-cli/search-replace-command.git as a VCS repository...
Using Composer to install the package...
---
Loading composer repositories with package information
Updating dependencies
Generating rules
Resolving dependencies through SAT
Looking at all rules.

Dependency resolution completed in 0.000 seconds
Your requirements could not be resolved to an installable set of packages.
Problem 1
    - Root composer.json requires wp-cli/search-replace-command dev-master, found wp-cli/search-replace-command[dev-main, dev-bump-travis-server-to-xenial, v1.0.0, v1.0.1, v1.0.2, v1.0.3, v1.0.4, v1.1.0, v1.1.1, v1.1.2, v1.1.3, v1.1.4, v1.2.0, v1.3.0, v1.3.1, v2.0.0, v2.0.1, v2.0.2, v2.0.3, v2.0.4, v2.0.5, v2.0.6, v2.0.7, v2.0.8, v2.0.9, v2.0.10, v2.0.11, v2.0.12, v2.0.13, v2.0.14, v2.0.15, v2.0.16, v2.0.17, v2.0.18, v2.0.19, v2.0.20, v2.1.0, v2.1.1, v2.1.2, v2.1.3, 2.x-dev (alias of dev-main)] but it does not match the constraint. Perhaps dev-master was renamed to dev-main?
Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.
---
Error: Package installation failed (Composer return code 2).
Reverted composer.json.


roy@RoyBook ~/GitHub/wp-cli
$ bin/wp package install github:wp-cli/search-replace-command.git
Warning: Couldn't fetch default branch for package 'github:wp-cli/search-replace-command.git' (HTTP code 403). Presuming default branch is 'master'.
Installing package wp-cli/search-replace-command (dev-master)
Updating /home/roy/.wp-cli/packages/composer.json to require the package...
Registering github:wp-cli/search-replace-command.git as a VCS repository...
Using Composer to install the package...
---
Loading composer repositories with package information
Updating dependencies
Generating rules
Resolving dependencies through SAT
Looking at all rules.

Dependency resolution completed in 0.000 seconds
Your requirements could not be resolved to an installable set of packages.
Problem 1
    - Root composer.json requires wp-cli/search-replace-command dev-master, found wp-cli/search-replace-command[dev-main, dev-bump-travis-server-to-xenial, v1.0.0, v1.0.1, v1.0.2, v1.0.3, v1.0.4, v1.1.0, v1.1.1, v1.1.2, v1.1.3, v1.1.4, v1.2.0, v1.3.0, v1.3.1, v2.0.0, v2.0.1, v2.0.2, v2.0.3, v2.0.4, v2.0.5, v2.0.6, v2.0.7, v2.0.8, v2.0.9, v2.0.10, v2.0.11, v2.0.12, v2.0.13, v2.0.14, v2.0.15, v2.0.16, v2.0.17, v2.0.18, v2.0.19, v2.0.20, v2.1.0, v2.1.1, v2.1.2, v2.1.3, 2.x-dev (alias of dev-main)] but it does not match the constraint. Perhaps dev-master was renamed to dev-main?
Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.
---
Error: Package installation failed (Composer return code 2).
Reverted composer.json.


roy@RoyBook ~/GitHub/wp-cli
$ bin/wp package install github:wp-cli/search-replace-command.git:dev-main
Error: Invalid package: shortened identifier 'github' not found.


roy@RoyBook ~/GitHub/wp-cli
$ bin/wp package install https://github.com/wp-cli/search-replace-command.git:dev-main
Error: Invalid package: shortened identifier 'https' not found.


roy@RoyBook ~/GitHub/wp-cli
$ bin/wp package install wp-cli/search-replace-command:dev-main
Installing package wp-cli/search-replace-command (dev-main)
Updating /home/roy/.wp-cli/packages/composer.json to require the package...
Using Composer to install the package...
---
Loading composer repositories with package information
Updating dependencies
Generating rules
Resolving dependencies through SAT
Looking at all rules.

Dependency resolution completed in 0.000 seconds
Analyzed 86 packages to resolve dependencies
Analyzed 88 rules to resolve dependencies
Lock file operations: 1 install, 0 updates, 0 removals
Installs: wp-cli/search-replace-command:dev-main 0b662a3
- Locking wp-cli/search-replace-command (dev-main 0b662a3)
Writing lock file
Installing dependencies from lock file
Package operations: 1 install, 0 updates, 0 removals
Installs: wp-cli/search-replace-command:dev-main 0b662a3
 - Installing <info>wp-cli/search-replace-command</info> (<comment>dev-main 0b662a3</comment>)
Generating autoload files
---
Success: Package installed.
@danielbachhuber
Copy link
Member

Thanks for the report, @Roy-Orbison !

We can definitely try to fix up the URL syntaxes you think are broken. I'm having a little bit of a hard time grokking your report, though. Which syntaxes would you like to see supported?

@Roy-Orbison
Copy link
Author

Roy-Orbison commented Dec 11, 2023

In this docs section, it states that adding a module is done like so, the last parameter looking like a typical Git URL:

wp package install [email protected]:wp-cli/dist-archive-command.git

These all failed:

  • https://github.com/wp-cli/search-replace-command.git
  • github:wp-cli/search-replace-command.git (where github: is an SSH alias that sets the user and selects the SSH key)
  • github:wp-cli/search-replace-command.git:dev-main (trying to select correct branch)
  • https://github.com/wp-cli/search-replace-command.git:dev-main

What worked was wp-cli/search-replace-command:dev-main, which I gleaned from this issue comment where someone else had encountered the invalid default branch dev-master.

You don't necessarily have to support those URL types, more that the docs didn't match the experience, so maybe something needs to be updated.

@danielbachhuber
Copy link
Member

Thanks, @Roy-Orbison.

I think we should:

  • Support additional URL patterns where doing so wouldn't cause a backcompat break.
  • Document the URL patterns we don't support because they conflict with some existing pattern.

In honestly, what's most likely is that the additional URL patterns weren't considered when the feature was created.

Feel free to submit a pull request, if you'd like. Here is some guidance on our pull request best practices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants