56 Commits (6b48258432f1d166744cebc5bc23b18e69716de9)

Author SHA1 Message Date
Jordi Boggiano b7e1383083
Make sure the alias package gets added to conflict rules etc, and only add it if aliased package is actually added 4 years ago
Jordi Boggiano 7b183956d8
Make sure the root aliases always get installed when a package is updated, fixes #9448 4 years ago
Nils Adermann 74fb313c39 Separate locked packages from fixed packages in request
Locked packages are basically like removable fixed packages, so we still
only load one version, but we do not require their installation unless
something the user needs requires their use. So they automatically get
removed if they are no longer needed on any update.
4 years ago
Yanick Witschi bd6f62c535 Consistently reuse the new PlatformRepository::isPlatformPackage() method 4 years ago
Jordi Boggiano a66a939b76
Merge pull request #8937 from Seldaek/optim-rules
Optimize rule creation for alias packages
4 years ago
Jordi Boggiano 9bd255d8f1
Remove some dead code from RuleSetGenerator 4 years ago
Jordi Boggiano 5a4709c3d6
Optimize rule creation for alias packages
This mainly benefits projects running updates with minimum-stability: dev
4 years ago
Jordi Boggiano 0ea9eafcaf
Add rules for aliased packages when an alias is added, fixes #8902 4 years ago
Jordi Boggiano e85da00dff
Add a way to ignore only some packages in --ignore-platform-reqs, and make the platform check ignore those packages which were ignored as requirements, fixes #8861 4 years ago
Jordi Boggiano 81bf47ffa2
Use fully qualified calls in hot classes 4 years ago
Nils Adermann 80a5fdf398 Remove obsolete rules and their generation
The only automatic conflict we have results from packages using the same name
either by literally having the same name and being different versions or they
replace the same name, so

- removed all types of obsolete rules
- simplified rule generation significantly
- got rid of provide filtering in the pool
- fixed some language in error handling
4 years ago
Nils Adermann 4e3d989978 A package providing a name should not conflict with a package replacing it
Simplified whatProvides, mustMatchName is unused, removed unused
function from policy
4 years ago
Nils Adermann fdfdee03c1 Remove unused argument to pool->match 4 years ago
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.
4 years ago
Jordi Boggiano 1d31190472
Keep track of unacceptable fixed packages for later to use in error reporting and make sure the pool state is consistent 5 years ago
Jordi Boggiano c6a3f48eaf
Remove some more remove request handling 5 years ago
Jordi Boggiano 6dc576738a
Avoid partial updates from applying changes to packages which are not locked with an acceptable stability 5 years ago
Nils Adermann dc0f2e7e46 Ensure multi conflict rules are only used for 3+ literals
Implements the equals method correctly on multi conflict rules. If there
are fewer literals a regular Rule2Literals is enough to represent the
basic conflict rule.
5 years ago
Nils Adermann ed300b9f22 New Multi Conflict Rule for transitive conflicts, to reduce memory 5 years ago
Nils Adermann c50d236378 Correctly load branch aliases from lock file
Root aliases are also stored in the lock file, so on install do not read
them from composer.json.
5 years ago
Nils Adermann 4481cc4a88 Allow an install request for a package name which is already fixed
Ensures packages get loaded from locked repo correctly. We may not want
to support this particular use-case at all, but for now it fixes the
existing test, so we may want to revisit this later.
5 years ago
Nils Adermann 995b4f923e Fix more tests which were lacking lock files for partial updates, display fix jobs in problems 5 years ago
Nils Adermann f5e18250e6 Merge remote-tracking branch 'github-composer/2.0' into solve-without-installed
* github-composer/2.0: (48 commits)
  Fix missing use/undefined var
  Split up steps on VCS downloaders to allow doing network operations before touching the filesystem on GitDownloader, fixes #7903
  Fix use statement
  Deduplicate findHeaderValue code
  Add install-path to the installed.json for every package, fixes #2174, closes #2424
  Remove unnecessary config from phpstan
  Make sure the directory exists and will not block installation later when downloading
  Avoid wiping the whole target package if download of the new one fails, refs #7929
  Only empty dir before actually installing packages, fixes #7929
  Improve output when installing packages
  Show best possible version in diagnose command
  Remove extra arg
  Allow path repos to point to their own source dir as install target, resulting in noop, fixes #8254
  Fix use of decodeJson
  Fix update mirrors to also update transport-options, fixes #7672
  Fix updating or URLs to include dist type and shasum, fixes #8216
  Fix origin computation
  Improve handling of non-standard ports for GitLab and GitHub installs, fixes #8173
  Load packages from the lock file for check-platform-reqs if no dependencies have been installed yet, fixes #8058
  Fix error_handler return type declaration
  ...
5 years ago
Jordi Boggiano 6c4357a7ed
Merge branch 'master' into 2.0 5 years ago
Baptiste Lafontaine a4611d511f Ignore platform reqs now handle conflict rules 5 years ago
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
5 years ago
Jordi Boggiano 2e0f31106a Merge remote-tracking branch 'origin/master' into 2.0 6 years ago
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
6 years ago
Nils Adermann 7c2d3518e5 Remove whitelisting of required package names, done by pool builder now 6 years ago
Christophe Coevoet e5b948c683 Refactor the handling of conflict rules in the solver
Conflict rules are not added in the solver based on the packages loaded in the
solver by require rules, instead of loading remote metadata for them. This has
2 benefits:

- it reduces the number of conflict rules in the solver in case of conflict
  rules targetting packages which are not required
- it fixes the behavior of replaces, which is meant to conflict with all
  versions of the replaced package, without introducing a performance
  regression (this behavior was changed when optimizing composer in the past).
6 years ago
Markus Staab f7a1c34c92
Removed unused variables 6 years ago
Markus Staab 07383552b3
Temporary save the package-name into a variable
this reduces number of unnecessary function calls in the hot path of "composer update"
6 years ago
Gabriel Caruso 7d9f8e2247
Improvements
Small improvements, such as remove unused imports, unecessaries casts, parentheses, etc.
6 years ago
Jordi Boggiano c0eb32669a Remove comment 7 years ago
Vladimir Reznichenko c8615358cb SCA with PHP Inspections (EA Extended) 7 years ago
rubenrua 4e1887a721 Improve memory usage resolving dependencies
It is known that composer update takes a lot of memory: #5915, #5902,

I am playing with a profiler (@blackfireio) to make a demo in my local
PHP meetup (@phpvigo) and I found out a way to use less memory. These
are my first tests:

* Private project using PHP 5.6:
  * Memory: from 1.31GB to 1.07GB
  * Wall Time: from 2min 8s to 1min 33s

* symfony-demo using PHP 7.1 in my old mac book:
  * Memory: from 667MB to 523MB
  * Wall Time: from  5min 29s to 5min 28s

Not use an array inside conflict rules is this improvement main idea:

```php
<?php
//Memory 38MB
gc_collect_cycles();
gc_disable();

class Rule
{
    public $literals;

    public function __construct(array $literals)
    {
        $this->literals = $literals;
    }
}

$rules = array();

$i = 0;
while ($i<80000){ //
    $i++;

    $array = array(-$i, $i);
    $rule = new Rule($array);
    $rules[] = $rule;
}
```

```php
<?php
//Memory 11.1MB
gc_collect_cycles();
gc_disable();

class Rule2Literals
{
    public $literal1;
    public $literal2;

    public function __construct($literal1, $literal2)
    {
        $this->literal1 = $literal1;
        $this->literal2 = $literal2;
    }
}

$rules = array();

$i = 0;
while ($i<80000){ //
    $i++;

    $rule = new ConflictRule(-$i, $i);
    $rules[] = $rule;
}
```

More info https://github.com/composer/composer/pull/6168
7 years ago
Yanick Witschi 4a769a785c Reduce calls on Rule::getHash() 8 years ago
Steve Preston dfe18d2e7f Fixed dependency problem caused by pull request #3482 10 years ago
Nils Adermann 4a945da55b Avoid generating duplicate conflict rules
For each version of each package we create a conflict rule with each
other version. These are then added to the rule set and skipped if
duplicate so instead we can just generate them only once to begin with
and avoid unnecessary memory allocation and duplication lookups.
10 years ago
Nils Adermann 26598c4a9a Remove unnecessary pool reference from rules 10 years ago
Nils Adermann c6af09b1da Make project id public
Reduction of rougly 1.3 million function calls on packagist update
10 years ago
Nils Adermann ee56db8767 Remove the handling of updates in the generator
Updates are implicitly handled by whatProvides for install requests
10 years ago
Jordi Boggiano ec0463a400 Add tests for platform packages required by root and avoid creating rules altogether instead of disabling them, refs #3320 10 years ago
Jordi Boggiano ac497feaba CS fixes 10 years ago
Jordi Boggiano e23665be59 Fix replacers being picked if whatProvide was called before building the package whitelist, fixes #2991, fixes #2962 10 years ago
Nils Adermann 5b80144ad0 Resolve job packages after whitelist generation 10 years ago
Nils Adermann 3148ffd355 Whitelist packages with names matching those specified before generating rules
Addresses #2690 doesn't do any performance optimisations yet which we
could do now
10 years ago
Pascal Borreli 83fd3967f0 Fixed PHPDoc 12 years ago
Nils Adermann cc7632489d Make problem report messages more readable
Added pretty strings to constraints
12 years ago
Nils Adermann dc2a9bfe62 Ignore null rules in rule generator
Fixes #806
12 years ago