symfony / flex

Composer plugin for Symfony
MIT License
4.17k stars 183 forks source link

Unable to update recipe #1014

Open mvhirsch opened 9 months ago

mvhirsch commented 9 months ago

Hi :-)

I really love symfony/flex. I use it a lot on other projects. Currently I'm maintaining a legacy project (started with Symfony 2.3 :partying_face: - now Symfony 4.4, currently updating to 5.4). So I needed to switch to symfony/flex, following the official guideline. It helped a lot! :heart:

Now I'm trying to use recipes:update but it somehow fails and I don't understand why:

symfony composer recipes:update symfony/phpunit-bridge -vvv
Reading ./composer.json (/path/to/project/composer.json)
Loading config file /home/meh/.config/composer/config.json
Loading config file /home/meh/.config/composer/auth.json
Loading config file ./composer.json (/path/to/project/composer.json)
Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
Executing command (/path/to/project): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v'
Executing async command (/path/to/project): git rev-list develop..feature/symfony5
Executing async command (/path/to/project): git rev-list remotes/upstream/develop..feature/symfony5
Executing async command (/path/to/project): git rev-list remotes/origin/master..feature/symfony5
Executing async command (/path/to/project): git rev-list remotes/origin/develop..feature/symfony5
Reading /home/meh/.config/composer/composer.json
Loading config file /home/meh/.config/composer/config.json
Loading config file /home/meh/.config/composer/auth.json
Loading config file /home/meh/.config/composer/composer.json (/home/meh/.config/composer/composer.json)
Loading config file /home/meh/.config/composer/auth.json
Reading /home/meh/.config/composer/auth.json
Reading /path/to/project/vendor/composer/installed.json
Skipped loading "php-http/discovery" as it is not in config.allow-plugins
Reading /home/meh/.config/composer/vendor/composer/installed.json
Loading plugin PHPStan\ExtensionInstaller\Plugin (from phpstan/extension-installer)
Loading plugin Symfony\Flex\Flex (from symfony/flex)
Loading plugin Infection\ExtensionInstaller\Plugin (from infection/extension-installer, installed globally)
Running 2.4.4 (2022-10-27 14:39:29) with PHP 8.1.27 on Linux / 6.7.4-200.fc39.x86_64
Executing command (.): git status --porcelain --untracked-files=no
Reading /home/meh/.cache/composer/repo/flex/symfony-recipes-flex-main-index.json from cache
Reading /home/meh/.cache/composer/repo/flex/symfony-recipes-contrib-flex-main-index.json from cache
Downloading https://raw.githubusercontent.com/symfony/recipes/flex/main/index.json using proxy (http://127.0.0.1:7080)
Downloading https://raw.githubusercontent.com/symfony/recipes-contrib/flex/main/index.json using proxy (http://127.0.0.1:7080)
[304] https://raw.githubusercontent.com/symfony/recipes/flex/main/index.json
[304] https://raw.githubusercontent.com/symfony/recipes-contrib/flex/main/index.json
Reading ./composer.lock (/path/to/project/composer.lock)
Reading /home/meh/.cache/composer/repo/flex/symfony-recipes-flex-main-archived-symfony.phpunit-bridge-170ab6f9abd4e1dab87462847116659ae138c34e.json from cache
Downloading https://raw.githubusercontent.com/symfony/recipes/flex/main/archived/symfony.phpunit-bridge/170ab6f9abd4e1dab87462847116659ae138c34e.json using proxy (http://127.0.0.1:7080)
[304] https://raw.githubusercontent.com/symfony/recipes/flex/main/archived/symfony.phpunit-bridge/170ab6f9abd4e1dab87462847116659ae138c34e.json
Reading /home/meh/.cache/composer/repo/flex/symfony-recipes-flex-main-symfony.phpunit-bridge.5.3.json from cache
Downloading https://raw.githubusercontent.com/symfony/recipes/flex/main/symfony.phpunit-bridge.5.3.json using proxy (http://127.0.0.1:7080)
[304] https://raw.githubusercontent.com/symfony/recipes/flex/main/symfony.phpunit-bridge.5.3.json
  Updating recipe for symfony/phpunit-bridge...

Executing command (.): git check-ignore '.env.test' 'bin/phpunit' 'phpunit.xml.dist' 'tests/bootstrap.php' '.gitignore'
Executing command (.): git rev-parse --show-prefix
Executing command (/tmp/_flex_recipe_update102080083565d32716235345.89631429): git init
Executing command (/tmp/_flex_recipe_update102080083565d32716235345.89631429): git config commit.gpgsign false
Executing command (/tmp/_flex_recipe_update102080083565d32716235345.89631429): git config user.name "Flex Updater"
Executing command (/tmp/_flex_recipe_update102080083565d32716235345.89631429): git config user.email ""
Executing command (/tmp/_flex_recipe_update102080083565d32716235345.89631429): git add -A
Executing command (/tmp/_flex_recipe_update102080083565d32716235345.89631429): git commit -m "original files"
Executing command (/tmp/_flex_recipe_update102080083565d32716235345.89631429): git hash-object '.env.test'
Executing command (/tmp/_flex_recipe_update102080083565d32716235345.89631429): git rev-parse --absolute-git-dir
There was an error applying the recipe update patch
file_get_contents(/tmp/_flex_recipe_update102080083565d32716235345.89631429/.git/objects/9e/7162f0b01d8778e236e79f4121e0926f68c194): Failed to open stream: No such file or directory

Update the recipe by re-installing the latest version with:
  composer recipes:install symfony/phpunit-bridge --force -v
unable to run /home/meh/bin/composer recipes:update symfony/phpunit-bridge -vvv

That directory was never created:

stat /tmp/_flex_recipe_update102080083565d32716235345.89631429/.git/objects/9e/7162f0b01d8778e236e79f4121e0926f68c194
stat: cannot statx '/tmp/_flex_recipe_update102080083565d32716235345.89631429/.git/objects/9e/7162f0b01d8778e236e79f4121e0926f68c194': No such file or directory

Any clue what I'm missing here? symfony/flex works fine, the project is stable, too. But I can't update any recipe. Force-Reinstall does work, but that would probably break my setup, too.

mvhirsch commented 9 months ago

I just noticed I'm running an outdated composer version. After a quick selfupdate, still same error.

symfony composer --version
Composer version 2.7.1 2024-02-09 15:26:28
symfony composer recipes:update symfony/phpunit-bridge
  Updating recipe for symfony/phpunit-bridge...

There was an error applying the recipe update patch
file_get_contents(/tmp/_flex_recipe_update209836198665d3285f1abfb4.66793082/.git/objects/9e/7162f0b01d8778e236e79f4121e0926f68c194): Failed to open stream: No such file or directory

Update the recipe by re-installing the latest version with:
  composer recipes:install symfony/phpunit-bridge --force -v
unable to run /home/meh/bin/composer recipes:update symfony/phpunit-bridge
mvhirsch commented 9 months ago

Cloning the project into a new directory fixed that problem.

mvhirsch commented 9 months ago

Now my freshly cloned repository is failing with the same error. :sob:

symfony composer recipe:update symfony/framework-bundle -vvv
Reading ./composer.json (/path/to/project/composer.json)
Loading config file /home/meh/.config/composer/config.json
Loading config file /home/meh/.config/composer/auth.json
Loading config file ./composer.json (/path/to/project/composer.json)
Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
Executing command (/path/to/project): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v'
Reading /home/meh/.config/composer/composer.json
Loading config file /home/meh/.config/composer/config.json
Loading config file /home/meh/.config/composer/auth.json
Loading config file /home/meh/.config/composer/composer.json (/home/meh/.config/composer/composer.json)
Loading config file /home/meh/.config/composer/auth.json
Reading /home/meh/.config/composer/auth.json
Reading /path/to/project/vendor/composer/installed.json
Skipped loading "php-http/discovery" as it is not in config.allow-plugins
Reading /home/meh/.config/composer/vendor/composer/installed.json
Loading plugin PHPStan\ExtensionInstaller\Plugin (from phpstan/extension-installer)
Loading plugin Symfony\Flex\Flex (from symfony/flex)
Loading plugin Infection\ExtensionInstaller\Plugin (from infection/extension-installer, installed globally)
Running 2.7.1 (2024-02-09 15:26:28) with PHP 8.1.27 on Linux / 6.7.4-200.fc39.x86_64
Executing command (.): git status --porcelain --untracked-files=no
Reading /home/meh/.cache/composer/repo/flex/symfony-recipes-flex-main-index.json from cache
Reading /home/meh/.cache/composer/repo/flex/symfony-recipes-contrib-flex-main-index.json from cache
Downloading https://raw.githubusercontent.com/symfony/recipes/flex/main/index.json using proxy (http://127.0.0.1:7080)
Downloading https://raw.githubusercontent.com/symfony/recipes-contrib/flex/main/index.json using proxy (http://127.0.0.1:7080)
[304] https://raw.githubusercontent.com/symfony/recipes/flex/main/index.json
[304] https://raw.githubusercontent.com/symfony/recipes-contrib/flex/main/index.json
Reading ./composer.lock (/path/to/project/composer.lock)
Reading /home/meh/.cache/composer/repo/flex/symfony-recipes-flex-main-archived-symfony.framework-bundle-24eb45d1355810154890460e6a05c0ca27318fe7.json from cache
Downloading https://raw.githubusercontent.com/symfony/recipes/flex/main/archived/symfony.framework-bundle/24eb45d1355810154890460e6a05c0ca27318fe7.json using proxy (http://127.0.0.1:7080)
[304] https://raw.githubusercontent.com/symfony/recipes/flex/main/archived/symfony.framework-bundle/24eb45d1355810154890460e6a05c0ca27318fe7.json
Reading /home/meh/.cache/composer/repo/flex/symfony-recipes-flex-main-symfony.framework-bundle.5.4.json from cache
Downloading https://raw.githubusercontent.com/symfony/recipes/flex/main/symfony.framework-bundle.5.4.json using proxy (http://127.0.0.1:7080)
[304] https://raw.githubusercontent.com/symfony/recipes/flex/main/symfony.framework-bundle.5.4.json
  Updating recipe for symfony/framework-bundle...

Executing command (.): git check-ignore 'config/bundles.php' 'config/bootstrap.php' 'config/packages/cache.yaml' 'config/packages/framework.yaml' 'config/packages/test/framework.yaml' 'config/preload.php' 'config/routes/dev/framework.yaml' 'config/services.yaml' 'public/index.php' 'src/Controller/.gitignore' 'src/Kernel.php' '.env' 'phpunit.xml.dist' 'composerjson' '.gitignore'
Executing command (.): git rev-parse --show-prefix
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git init
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git config commit.gpgsign false
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git config user.name "Flex Updater"
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git config user.email ""
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git add -A
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git commit -m "original files"
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git hash-object 'config/bundles.php'
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git rev-parse --absolute-git-dir
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git hash-object 'config/packages/cache.yaml'
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git rev-parse --absolute-git-dir
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git hash-object 'config/packages/framework.yaml'
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git rev-parse --absolute-git-dir
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git hash-object 'config/preload.php'
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git rev-parse --absolute-git-dir
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git hash-object 'config/services.yaml'
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git rev-parse --absolute-git-dir
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git hash-object 'public/index.php'
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git rev-parse --absolute-git-dir
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git hash-object 'src/Controller/.gitignore'
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git rev-parse --absolute-git-dir
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git hash-object 'src/Kernel.php'
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git rev-parse --absolute-git-dir
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git hash-object '.env'
Executing command (/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271): git rev-parse --absolute-git-dir
There was an error applying the recipe update patch
file_get_contents(/tmp/_flex_recipe_update98652119665d47158a92aa3.84155271/.git/objects/07/3ac447764f738945058d10777c8858bb3bf3fe): Failed to open stream: No such file or directory
Fly06-Fr commented 2 months ago

Hello @mvhirsch , I am running into the exact same problem. Would you mind to share your fix or workaround if you found one? Thanks.

mvhirsch commented 2 months ago

I'm sorry, I never figured out the root cause. I updated Symfony to 6.4 on this particular project (by manually applying configuration) and somehow it got fixed. Not sure if either by updating any package or symfony-cli itself.

Fly06-Fr commented 2 months ago

Hi @mvhirsch, I managed to update the recipe by re-installing the latest version as suggested by composer. Thanks for the reply.