Skip to content

Conversation

malteschlueter
Copy link
Contributor

@malteschlueter malteschlueter commented Oct 15, 2020

Fix #777

Sometimes it's necessary to reinstall a recipe but actually it's not possible if there is not update for a recipe. Also with the --force option Flex won't reinstall/execute the recipe. Only if there is a update for a recipe.

I figured out that the $recipes in Flex.php#L466 are empty. It can't find/collects the recipe because the existing ref and the "reinstall" ref are same, see in Flex.php#L817.

So i tried to fix it but to be honest i'm not sure it's a good solution.


What do you think?


To reproduce:

  1. Create a new directory
  2. Execute composer require symfony/flex
  3. Execute composer require symfony/apache-pack
  4. Delete or truncate file public/.htaccess
  5. Execute composer recipes:install symfony/apache-pack --force

Previous PR #684 was closed automatically after changing the default branch from master to main.

@nicolas-grekas
Copy link
Member

I'm 👎 sorry.

As explained in #684 (comment), this will make updating recipes harder, because it will force ppl to review changes that don't need to be.

As you spotted in #684 (comment), the description of the --force option is wrong and is fixed by #714

You should manually remove the symfony.lock file if you want this exact behavior.

Note that this is not the last word on recipe updates, there are open discussions on the topic and things will improve I hope too.

@malteschlueter
Copy link
Contributor Author

Okay, no problem.

Maybe it would be useful to split installation and updates in 2 commands.

tgalopin pushed a commit to tgalopin/flex that referenced this pull request Dec 3, 2020
@dunglas
Copy link
Member

dunglas commented Jun 18, 2021

I've a use case with Symfony Docker that could require this patch (we discussed this with @nicolas-grekas privately): I want people to be able to add the Docker configuration to existing projects. To do so, they have to copy the Docker-related files and to set symfony.extra.docker to true in their composer.json. As some recipes modify the Dockerfile and docker-compose.*.yml, the user also have to re-execute the recipes. Currently, it's not possible, this PR could fix this.

Maybe could we have two separate flags such as --force to force re-executing all recipes and --force-updated to force re-executing only the recipes of updated packages?

@dunglas dunglas reopened this Jun 18, 2021
@nicolas-grekas
Copy link
Member

I've changed my mind on this topic. I think that the new name of the command (recipes:install) changes the expectation and that'd I'm fine changing this behavior. No need to have two flags.

@malteschlueter would you be able to rebase this PR and fix the CS issue?

@dunglas
Copy link
Member

dunglas commented Jun 18, 2021

Actually, having the ability to not reinstall the recipes that haven't change is very useful for another projet I maintain: API Platform. In the API Platform distribution, we made some customizations to the generated config files, but we have to sync recipes with Symfony before each release. This option is useful in this case, it reduces the maintenance burden.

@nicolas-grekas
Copy link
Member

having the ability to not reinstall the recipes that haven't change is very useful for another projet I maintain

without --force does it?

@dunglas
Copy link
Member

dunglas commented Jun 18, 2021

I mean reinstalling only the recipes that have changed, and not touching to the one that haven't changed. But maybe is it the default behavior?

@nicolas-grekas
Copy link
Member

Replaced by #795, thanks for the proposal and the discussion.

nicolas-grekas added a commit that referenced this pull request Sep 21, 2021
…ed recipes back to their initial state (nicolas-grekas)

This PR was merged into the 1.13-dev branch.

Discussion
----------

Add --reset flag to recipes:install to reset all installed recipes back to their initial state

Fix #777

Replaces #702, see discussion there.

Commits
-------

fc1998f Add --reset flag to recipes:install to reset all installed recipes back to their initial state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reinstalling recipes works only for updated ones
4 participants