1
0
Fork 0
Commit Graph

127 Commits (a155c076dbe826c7ca9947eb874295a9b283d756)

Author SHA1 Message Date
megubyte a155c076db
phpstan: update tests/Composer/Test/DependencyResolver/* to level 6 standard (#10242) 2021-10-30 10:30:36 +02:00
Jordi Boggiano 44b69ba77f
Upgrade php-cs-fixer to 3.x and fix CS 2021-10-27 16:21:45 +02:00
Jordi Boggiano c3c6969cf5
Type annotations 2021-10-16 10:25:12 +02:00
David Zülke 28b2b5c0c9
tests for solver handling multiple packages with same name and version (#10110)
Not a case with regular Packagist packages, but some custom installers with custom repos do this, and the current behavior should not randomly change at some point, as that would cause downstream breakage.
2021-10-02 19:02:22 +02:00
Jordi Boggiano d00edab884
Merge pull request #9477 from naderman/fix-alias-conflicts
Explicit conflicts should conflict with aliases of packages too
2020-11-26 13:59:57 +01:00
Nils Adermann 7197278fe9 Always install aliases together with their original package
Restores some Composer 1.x behavior like unbound constraints conflicting
with default branches unless they are branch aliased.

Simplifies conflicts with aliases because packages cannot be installed
without their aliases, so we do not need to know which aliases are
uninstalled in lock file or installed.json.
2020-11-26 12:10:07 +01:00
Jordi Boggiano b7d770659b
CS fixes 2020-11-22 14:52:39 +01:00
Jordi Boggiano 7b183956d8
Make sure the root aliases always get installed when a package is updated, fixes #9448 2020-11-13 13:52:21 +01:00
Michael Telgmann a4509d28e7
Introduce constants for Composer\Package\Link types 2020-09-21 14:22:06 +02:00
Jordi Boggiano 67a88880ec
Get rid of EmptyConstraint 2020-06-05 16:52:24 +02:00
Yanick Witschi bde9502473
Made the constraint argument in Link mandatory 2020-06-05 16:52:24 +02:00
Yanick Witschi 63906171f0
Cleanup EmptyConstraint output 2020-06-05 16:52:24 +02:00
Yanick Witschi 8e2dd62d10
Fixed tests related to constraint changes 2020-06-05 16:52:24 +02:00
Jordi Boggiano b72ac2d01a
Oops 2020-05-26 19:55:40 +02:00
Jordi Boggiano 863e7076ba
Bump to use composer/semver 3.x 2020-05-26 19:18:34 +02:00
Jordi Boggiano 34801239f1
Tweak problem wording slightly 2020-04-23 13:17:34 +02:00
Jordi Boggiano afa18f2092
Fix semver usage 2020-04-21 15:13:01 +02:00
Jordi Boggiano 80a7c40c76
Shorten long lists of similar versions in problem output, fixes #8743 2020-04-15 16:47:44 +02:00
Nils Adermann c270d3cfa6 PoolBuilder: make io non-nullable, NullIO can be used instead 2020-04-01 15:27:51 +02:00
Jordi Boggiano 2f4ea3a463
Fix show command, refactor RepositorySet constructor 2020-01-30 20:21:17 +01:00
Jordi Boggiano 189d5adab0
Fix reporting of replace conflicts to not mention provides 2020-01-30 17:13:12 +01:00
Jordi Boggiano ec90c17e3b
Fix conflict order to be more accurate 2020-01-30 15:55:37 +01:00
Jordi Boggiano c41df325d8
Remove RepositorySet from Solver and remove getPool from RepositorySet 2020-01-30 15:23:22 +01:00
Jordi Boggiano 1d4cdb60d0
Improve error reporting for conflicts/replaces of various kinds, fixes #7254 2020-01-30 14:43:56 +01:00
Jordi Boggiano 3fc7e10c5c
Improve error reporting of solver issues, refs #7779
Fixes #8525
Fixes #6513
2020-01-30 14:43:54 +01:00
Nils Adermann 0b4e8952f6 PHP5 disallows require as a function name, use requireName analog to fixPackage 2020-01-19 23:28:00 +01:00
Nils Adermann 5bdc0fc9c5 Request jobs replaced by root require / fixed package
The only type of request job remaining was "install" which is really a
root requirement. The only other kind of input for the solver is now a
set of fixed packages.

Rules have been updated to account for only two kinds of former job
reason: FIXED or ROOT_REQUIRE. The job property has always been
redundant and has been removed, since reasonData suffices.

Problem reasons are always rules, so the unnecessary wrapping in an
array has been removed.

We now only ever generate a single rule per root require or fixed
package, so there is no need for the solver to special handle disabling
"jobs" anymore, the rule can just be disabled as usual.

For consistency special handling of rules for jobs in problems has been
integrated into the rule class like all other rule reasons. As part of
this change the error message for root requirements has been improved a
bit to make it clearer where the package installation request came from.

The word job has also been removed from operations, which are called
operations, not jobs.
2020-01-19 23:21:07 +01:00
Jordi Boggiano b5e34ca767
Fix remove tests 2020-01-17 14:57:33 +01:00
Jordi Boggiano 7a4d3e6f25
Fix SolverTest 2020-01-15 15:03:11 +01:00
Nils Adermann 25de5218c3 Reunify lock and local repo transaction code and apply the same sorting 2019-11-08 15:56:46 +01:00
Nils Adermann 26da52227e Clean up the Solver tests, no more installed repo input and new sorting
The solver now only calculates a lock file transaction which does not
need to be sorted in order of dependencies. This is only necessary for
the local repo transaction generated without the solver during install
2019-11-07 21:51:53 +01:00
Nils Adermann f1e4ccbe1d Fix handling of reference updates and root references 2019-09-07 01:58:12 +02:00
Nils Adermann 9053d74282 Merge branch '2.0' into solve-without-installed
* 2.0: (101 commits)
  SVN: hide passwords for debug output
  Free $solver asap
  fixes #8179
  [minor] Fixed a typo in the CHANGELOG.md.
  Update deps
  Update changelog
  Revert "Allow overriding self-update target file with envvar COMPOSER_SELF_UPDATE_TARGET" Revert "Add docs for COMPOSER_SELF_UPDATE_TARGET, refs #8151"
  Add docs for COMPOSER_SELF_UPDATE_TARGET, refs #8151
  Fix display of HHVM warning appearing when HHVM is not in use, fixes #8138
  Read classmap-authoritative and apcu-autoloader from project config when installing via create-project, fixes #8155
  Use possessive quantifiers
  Update xdebug-handler to 1.3.3
  fixes #8159
  Allow overriding self-update target file with envvar COMPOSER_SELF_UPDATE_TARGET
  flag should come before script name
  use full command name, not abbreviated/alias
  modify text
  Document the alternatives to disable the default script timeout
  Anchor pattern
  Fix URL resolution for Composer repositories
  ...
2019-06-27 14:35:36 +02:00
Jordi Boggiano 799717f102
Tweak and fix some more phpstan reports 2019-02-18 13:05:14 +01:00
Jordi Boggiano fb3d0981c0
Fix test suite 2019-02-18 12:35:24 +01:00
Nils Adermann 10ada7bf82 Refactor Installer class into separate install and update processes
- Introduce separate Lock and LocalRepo transactions, one for changes
  to the lock file, one for changes to locally installed packages based
  on lock file
- Remove various hacks to keep dev dependencies updated and
  incorporated the functionality into the transaction classes
- Remove installed repo, there are now local repo, locked repo and
  platform repo
- Remove access to local repo from solver, only supply locked packages
- Update can now be run to modify the lock file but not install packages
  to local repo
2019-02-11 01:00:02 +01:00
Nils Adermann 287419f6a0 Merge branch 'master' into 2.0
* master:
  Follow up to #7946 test: add solver flag to assert path execution
  Fix tests
  Make sure config command output is also output on --quiet so that warnings can be hidden, fixes #7963
  Recognize composer-plugin-api as a platform package, fixes #7951
  Quote wildcards to avoid issues in some shells, fixes #7960
  Avoid dumping null values for dist reference/shasum and source reference, fixes #7955
  Soften hard exit after revert of composer file
  Make unixy proxy code POSIX compatible
  Update aliases.md
  Same but for Problem.php
  Better error message for present but incompatible versions
  Fix inconsistent casing
  Don't do (new Foo())->bar() - not 5.3-compatible
  Support identifying the HHVM version when not running with HHVM
2019-02-10 20:28:24 +01:00
Nils Adermann 29ff6a40ae Follow up to #7946 test: add solver flag to assert path execution 2019-02-10 20:26:47 +01:00
Nils Adermann 728e57b9e0 Merge branch 'master' into 2.0
* master:
  Fix solver problem exceptions with unexpected contradictory "Conclusions"
  Also load config into IO if not freshly created
  Only load configuration into IO if IO is available
  Fix defaultRepos fallback does not use auth config
  Add warning/info msg when tweaking disable-tls setting to avoid confusion, fixes #7935
2019-02-05 15:35:51 +01:00
Nils Adermann 6b2edeae56 Fix solver problem exceptions with unexpected contradictory "Conclusions"
This 5 character fix comes with a solver test as well as a functional
installer test essentially verifying the same thing. The solver test is
more useful when working on the solver. But the functional test is less
likely to be accidentally modified incorrectly during refactoring, as
every single package, version and link in the rather complex test
scenario is essential, and a modified version of the test may very well
still result in a successful installation but no longer verify the bug
described below.

Background:

In commit 451bab1c2c from May 19, 2012 I
refactored literals from complex objects into pure integers to reduce
memory consumption. The absolute value of an integer literal is the id
of the package it refers to in the package pool. The sign indicates
whether the package should be installed (positive) or removed (negative),

So a major part of the refactoring was swapping this call:

$literal->getPackageId()

For this:

abs($literal)

Unintentionally in line 554/523 I incorrectly applied this change to the
line:

$this->literalFromId(-$literal->getPackageId());

It was converted to:

-abs($literal);

The function literalFromId used to create a new literal object. By using
the abs() function this change essentially forces the resulting literal
to be negative, while the minus sign previously inverted the literal, so
positive into negative and vice versa.

This particular line is in a function meant to analyze a conflicting
decision during dependency resolution and to draw a conclusion from it,
then revert the state of the solver to an earlier position, and attempt
to solve the rest of the rules again with this new "learned" conclusion.

Because of this bug these conclusions could only ever occur in the
negative, e.g. "don't install package X". This is by far the most likely
scenario when the solver reaches this particular line, but there are
exceptions.

If you experienced a solver problem description that contained a
statement like "Conclusion: don't install vendor/package 1.2.3" which
directly contradicted other statements listed as part of the problem,
this could likely have been the cause.
2019-02-03 16:33:55 +01:00
Jordi Boggiano 2e0f31106a Merge remote-tracking branch 'origin/master' into 2.0 2018-11-12 16:01:07 +01:00
Gabriel Caruso 2a13bb2649 Fixes from PHPStan (#7687)
* fix docblocks

* remove redundant conditional

* fix wrong variable name

* fix wrong namespaces

* add missing private members

* remove unused/redundant arguments

* move testcase class

* exclude TestCase.php

* Tweak RuleWatchGraph type hints

* Tweak doc comment
2018-11-12 15:23:32 +01:00
Nils Adermann c0f19f6c57 Move construction of pool from repo set into a pool builder
Pool construction depends on the install request now, so only required
packages get loaded, add some structure for future asynchronously
loading composer repositories
2018-09-12 11:49:09 +02:00
Nils Adermann b6e2d60c9e Create the pool in the installer before giving it to the solver 2018-09-11 15:49:08 +02:00
Nils Adermann 1228bcdffc Internalize pool creation in repository set, store root aliases in set
The pool is still exposed too early in a few places which will require
further refactoring
2018-09-11 13:34:18 +02:00
Nils Adermann 6ef65e5319 Add a new RepositorySet class and restrict pool usage to the solver
Breaking change for the plugin interface so bumping the version of
composer-plugin-api to 2.0.0

First step for a refactoring of the package metadata loading mechanism
2018-09-10 15:27:54 +02:00
Gabriel Caruso a4b220273e Refactoring Tests (#6849) 2017-11-30 15:58:10 +01:00
Nils Adermann 7dffe79a0f Update tests of solver problem message to match new message 2017-11-16 12:41:41 +01:00
Jordi Boggiano 122e422682 CS fixes 2017-03-08 15:16:44 +01:00
Niels Keurentjes 8e78ce9a43 Add extra logging before and after SAT solving 2016-03-24 23:19:40 +01:00