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

Fix magento root package identification for metapackage installation #22116

Conversation

oleksii-lisovyi
Copy link

Description (*)

Fix issue with failing Magento installing process (php bin/magento setup:install) for installation via metapackage, because of issue in root package defining.

Fixed Issues (if relevant)

  1. Magento installation via metapackage: checkExtensions fails #21136: Magento installation via metapackage: checkExtensions fails, because isMagentoRoot works incorrectly for installation

Manual testing scenarios (*)

Steps to reproduce could be takes from issue.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@m2-assistant
Copy link

m2-assistant bot commented Apr 2, 2019

Hi @oleksii-lisovyi. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@magento-engcom-team
Copy link
Contributor

Hi @ihor-sviziev, thank you for the review.
ENGCOM-4644 has been created to process this Pull Request

@@ -148,7 +148,6 @@ public function getRequiredExtensions()
/** @var CompletePackageInterface $package */
foreach ($this->getLocker()->getLockedRepository()->getPackages() as $package) {
$requires = array_keys($package->getRequires());
$requires = array_merge($requires, array_keys($package->getDevRequires()));
$allPlatformReqs = array_merge($allPlatformReqs, $requires);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do change this instead of because isMagentoRoot works incorrectly for installation?

Copy link
Contributor

Choose a reason for hiding this comment

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

It collects all packages from composer.lock file and collects all require and require-dev dependencies. But during composer install - require-dev dependencies are getting from composer.json file only. So fix is correct.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ihor-sviziev your statement does not answer my question.

The root issue: method $this->isMagentoRoot() returns FALSE for current Magento installation, because its regular expression /magento/magento2...?/ doesn't match magento/project-community-edition, that comes from metapackage.

Quote from the issue. Collected package information must be different depending whether it is a dev Magento installation or Composer-based.

@@ -92,7 +92,7 @@ public function testGetRequiredPhpVersion($composerDir)
public function testGetRequiredExtensions($composerDir)
{
$this->setupDirectory($composerDir);
$expectedExtensions = ['ctype', 'gd', 'spl', 'dom', 'simplexml', 'mcrypt', 'hash', 'curl', 'iconv', 'intl'];
$expectedExtensions = ['ctype', 'gd', 'spl', 'dom', 'simplexml', 'mcrypt', 'hash', 'curl', 'iconv'];
Copy link
Contributor

Choose a reason for hiding this comment

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

Does not match https://github.com/magento/magento2/blob/2.3-develop/composer.json#L30. Why do we need this test at all? How it works for outdated PHP versions?

Copy link
Contributor

Choose a reason for hiding this comment

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

@nmalevanec was fixing this integration test in #21137, then this forward port was created from that PR.
I think he fixed it incorrectly. I'll talk with him

@sivaschenko sivaschenko changed the title [Forwardport] Fix magento root package identification for metapackage installation Fix magento root package identification for metapackage installation Apr 3, 2019
Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

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

Hi,
As we discussed with @nmalevanec - he'll fix tests in correct way internally. And he already pushed some changes for fixing integration tests. I'm approving this PR.

@magento-engcom-team
Copy link
Contributor

Hi @ihor-sviziev, thank you for the review.
ENGCOM-4644 has been created to process this Pull Request

@nmalevanec nmalevanec force-pushed the fix-magento-root-package-identification-for-metapackage-installation-2.3 branch 2 times, most recently from 684abc8 to b0a899b Compare April 12, 2019 08:37
@@ -148,7 +148,6 @@ public function getRequiredExtensions()
/** @var CompletePackageInterface $package */
foreach ($this->getLocker()->getLockedRepository()->getPackages() as $package) {
$requires = array_keys($package->getRequires());
$requires = array_merge($requires, array_keys($package->getDevRequires()));
$allPlatformReqs = array_merge($allPlatformReqs, $requires);
Copy link
Contributor

Choose a reason for hiding this comment

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

@ihor-sviziev your statement does not answer my question.

The root issue: method $this->isMagentoRoot() returns FALSE for current Magento installation, because its regular expression /magento/magento2...?/ doesn't match magento/project-community-edition, that comes from metapackage.

Quote from the issue. Collected package information must be different depending whether it is a dev Magento installation or Composer-based.

@orlangur
Copy link
Contributor

@ihor-sviziev thanks for sorting this out in Slack.

@oleksii-lisovyi please squash changes into a single commit so that we have perfectly clean history 😉

@nmalevanec nmalevanec force-pushed the fix-magento-root-package-identification-for-metapackage-installation-2.3 branch from b0a899b to a2ad630 Compare April 15, 2019 12:28
@orlangur
Copy link
Contributor

All good here, waiting for @oleksii-lisovyi returning back from vacation 🉑

@ihor-sviziev
Copy link
Contributor

Hi @oleksii-lisovyi,
Will you be able to squash changes into single commit?

@oleksii-lisovyi
Copy link
Author

Hi. I can, but what is the advantage of having single commit comparing to couple?

@IvanPletnyov IvanPletnyov self-assigned this May 20, 2019
@ghost ghost added the Progress: accept label May 24, 2019
Copy link
Contributor

@orlangur orlangur left a comment

Choose a reason for hiding this comment

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

@oleksii-lisovyi we always must strive to as few logically separated commits as possible.

Fix integration test commit does not make sense as separate commit.

Please squash all three commits into one and force push.

@ysapiga ysapiga force-pushed the fix-magento-root-package-identification-for-metapackage-installation-2.3 branch from 1df503d to 2c91e5a Compare June 18, 2019 10:53
@engcom-Golf
Copy link
Contributor

@orlangur please review

@magento-engcom-team
Copy link
Contributor

Hi @ihor-sviziev, thank you for the review.
ENGCOM-4644 has been created to process this Pull Request
✳️ @ihor-sviziev, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@engcom-Alfa engcom-Alfa assigned engcom-Alfa and unassigned soleksii Jun 18, 2019
@ihor-sviziev ihor-sviziev added the Auto-Tests: Covered All changes in Pull Request is covered by auto-tests label Jun 18, 2019
@engcom-Alfa
Copy link
Contributor

✔️ QA Passed

@magento-engcom-team
Copy link
Contributor

Hi @orlangur, thank you for the review.
ENGCOM-4644 has been created to process this Pull Request

@m2-assistant
Copy link

m2-assistant bot commented Jun 27, 2019

Hi @oleksii-lisovyi, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@magento-engcom-team magento-engcom-team added this to the Release: 2.3.3 milestone Jun 27, 2019
magento-engcom-team pushed a commit that referenced this pull request Jun 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants