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

Add SYMFONY_REQUIRE env var + disable recipes when flex is not in the root composer.json #409

Merged
merged 1 commit into from
Aug 18, 2018
Merged

Add SYMFONY_REQUIRE env var + disable recipes when flex is not in the root composer.json #409

merged 1 commit into from
Aug 18, 2018

Conversation

nicolas-grekas
Copy link
Member

The C.I. for symfony/symfony is starting to fail transiently because solving the dependency graph takes too much memory.
See e.g. https://ci.appveyor.com/project/fabpot/symfony/build/1.0.39377

But thanks to recent improvements in Flex, we know why and how to fix that: skipping old tags.
This PR allows using Flex while disabling the recipes subsystem and allows configuring the minimum version of components we give to the solver.

I plan to use the next version of Flex that embeds this PR (could be v1.1.0 btw) on symfony/symfony.

@nicolas-grekas
Copy link
Member Author

nicolas-grekas commented Aug 13, 2018

For symfony/symfony master:

before:
Memory usage: (peak: 1065.49MB), time: 9.91s

with SYMFONY_REQUIRE='~4.1':
Memory usage: (peak: 257.37MB), time: 2.57s

@nicolas-grekas nicolas-grekas changed the title Add SYMFONY_LOWEST_VERSION env var + handle SYMFONY_ENDPOINT=none Add SYMFONY_REQUIRE env var + handle SYMFONY_ENDPOINT=none Aug 14, 2018
@nicolas-grekas
Copy link
Member Author

nicolas-grekas commented Aug 14, 2018

PR now handles a new SYMFONY_REQUIRE env var that should contain a version constraint that will apply to all packages replaced by symfony/symfony.
This works without having to explicitly list these packages in the source, easing maintenance.

This will also allow deprecating symfony/lts and symfony/force-lowest, allowing to simplify the releasing process: libs that currently use them to test several versions of Symfony components could composer global require symfony/flex + e.g. SYMFONY_REQUIRE='4.1.*'

@BoShurik
Copy link

@nicolas-grekas is it possible to set extra.symfony.require instead of SYMFONY_REQUIRE env var?

@nicolas-grekas
Copy link
Member Author

@BoShurik I forgot to mention it, but Yes! I even plan to use it in our skeletons to replace symfony/lts.

@nicolas-grekas
Copy link
Member Author

PR ready, works as expected in symfony/symfony#28199

@nicolas-grekas
Copy link
Member Author

Now with a notice:
image

PR ready, it works well :)

$this->io = $io;
$config = $composer->getConfig();
$this->rfs = $rfs;
$this->cache = new ComposerCache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->endpoint));
$this->sess = bin2hex(random_bytes(16));

if (self::$DEFAULT_ENDPOINT !== $endpoint) {
$this->io->writeError('<warning>Warning: Using '.$endpoint.' as the Symfony endpoint</warning>');
Copy link
Member Author

@nicolas-grekas nicolas-grekas Aug 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning moved below, so that unrelated Composer commands don't display it.

@nicolas-grekas nicolas-grekas changed the title Add SYMFONY_REQUIRE env var + handle SYMFONY_ENDPOINT=none Add SYMFONY_REQUIRE env var + + disable recipes when flex is not in the root composer.json Aug 18, 2018
@nicolas-grekas
Copy link
Member Author

nicolas-grekas commented Aug 18, 2018

I removed the special handling of the "none" endpoint. Instead, flex disables recipes (displaying a warning) when it can't find itself in the "require" of the root composer.json

@nicolas-grekas nicolas-grekas changed the title Add SYMFONY_REQUIRE env var + + disable recipes when flex is not in the root composer.json Add SYMFONY_REQUIRE env var + disable recipes when flex is not in the root composer.json Aug 18, 2018
'manifests' => [],
'vulnerabilities' => [],
'locks' => [],
];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don"t think this is needed and should probably be removed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L135 populates $bodies with empty arrays, that's why.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pfff but the "if" L135 also prevents it...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this code works right now without adding this, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

@fabpot
Copy link
Member

fabpot commented Aug 18, 2018

Thank you @nicolas-grekas.

@fabpot fabpot merged commit 8649abc into symfony:master Aug 18, 2018
fabpot added a commit that referenced this pull request Aug 18, 2018
…is not in the root composer.json (nicolas-grekas)

This PR was squashed before being merged into the 1.0-dev branch (closes #409).

Discussion
----------

Add SYMFONY_REQUIRE env var + disable recipes when flex is not in the root composer.json

The C.I. for `symfony/symfony` is starting to fail transiently because solving the dependency graph takes too much memory.
See e.g. https://ci.appveyor.com/project/fabpot/symfony/build/1.0.39377

But thanks to recent improvements in Flex, we know why and how to fix that: skipping old tags.
This PR allows using Flex while disabling the recipes subsystem and allows configuring the minimum version of components we give to the solver.

I plan to use the next version of Flex that embeds this PR (could be v1.1.0 btw) on `symfony/symfony`.

Commits
-------

8649abc Add SYMFONY_REQUIRE env var + disable recipes when flex is not in the root composer.json
fabpot added a commit to symfony/symfony that referenced this pull request Aug 18, 2018
… (nicolas-grekas)

This PR was merged into the 2.8 branch.

Discussion
----------

[travis][appveyor] use symfony/flex to accelerate builds

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Playing with symfony/flex#409

The optimization is required because appveyor is transiently failing with OOM errors, see e.g.
https://ci.appveyor.com/project/fabpot/symfony/build/1.0.39377

Commits
-------

940ec8f [travis][appveyor] use symfony/flex to accelerate builds
nicolas-grekas pushed a commit to symfony/symfony that referenced this pull request Aug 18, 2018
… (nicolas-grekas)

This PR was merged into the 2.8 branch.

Discussion
----------

[travis][appveyor] use symfony/flex to accelerate builds

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Playing with symfony/flex#409

The optimization is required because appveyor is transiently failing with OOM errors, see e.g.
https://ci.appveyor.com/project/fabpot/symfony/build/1.0.39377

Commits
-------

940ec8f [travis][appveyor] use symfony/flex to accelerate builds
nicolas-grekas pushed a commit to symfony/symfony that referenced this pull request Aug 18, 2018
… (nicolas-grekas)

This PR was merged into the 2.8 branch.

Discussion
----------

[travis][appveyor] use symfony/flex to accelerate builds

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Playing with symfony/flex#409

The optimization is required because appveyor is transiently failing with OOM errors, see e.g.
https://ci.appveyor.com/project/fabpot/symfony/build/1.0.39377

Commits
-------

940ec8f [travis][appveyor] use symfony/flex to accelerate builds
@nicolas-grekas nicolas-grekas deleted the flex-env-config branch August 18, 2018 20:17
fabpot added a commit to symfony/skeleton that referenced this pull request Aug 21, 2018
… (nicolas-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

Use extra.symfony.require to restrict versions of symfony/*

Proposed way to leverage symfony/flex#409

Benefits:
- no `symfony/lts` / `symfony/force-lowest` anymore
- only one line to change to upgrade to next minor
- better control of exact minor used (right now, skeleton:4.0 pulls 4.1 components)
- (and a lot less merge conflicts for us when merging 3.4 up to master);

Commits
-------

32dec7e Use extra.symfony.require to restrict versions of symfony/*
fabpot added a commit to symfony/website-skeleton that referenced this pull request Aug 21, 2018
… (nicolas-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

Use extra.symfony.require to restrict versions of symfony/*

Same as symfony/skeleton#93 on website-skeleton.
See symfony/flex#409

Commits
-------

b899463 Use extra.symfony.require to restrict versions of symfony/*
Kocal added a commit to Yproximite/influxdb-preset-bundle that referenced this pull request Jun 22, 2020
Kocal added a commit to Yproximite/influxdb-bundle that referenced this pull request Oct 29, 2020
Kocal added a commit to Yproximite/influxdb-bundle that referenced this pull request Oct 29, 2020
Kocal added a commit to Yproximite/influxdb-bundle that referenced this pull request Oct 29, 2020
tgalopin pushed a commit to tgalopin/flex that referenced this pull request Dec 3, 2020
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.

3 participants