magento-hackathon / magento-composer-installer

Composer installer for Magento modules
210 stars 154 forks source link

Option extra.magento-force doesn't work #165

Closed andrey-bublik closed 9 years ago

andrey-bublik commented 9 years ago

I got the following exception doing composer install:

Writing lock file
Generating autoload files
start magento core deploy via deployManager
start magento deploy for magento/core

[ErrorException]
Target app/design/adminhtml/default/default/template/rating/options.phtml already exists (set extra.magento-force to override)
Exception trace:
 () at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/Copy.php:78
 MagentoHackathon\Composer\Magento\Deploystrategy\Copy->createDelegate() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php:339                                                                                                                                        
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->create() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/Copy.php:67                                                                                                                                                 
 MagentoHackathon\Composer\Magento\Deploystrategy\Copy->createDelegate() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php:339                                                                                                                                        
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->create() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/Copy.php:62                                                                                                                                                 
 MagentoHackathon\Composer\Magento\Deploystrategy\Copy->createDelegate() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php:339                                                                                                                                        
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->create() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/Copy.php:67                                                                                                                                                 
 MagentoHackathon\Composer\Magento\Deploystrategy\Copy->createDelegate() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php:339                                                                                                                                        
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->create() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/Copy.php:62                                                                                                                                                 
 MagentoHackathon\Composer\Magento\Deploystrategy\Copy->createDelegate() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php:339                                                                                                                                        
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->create() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/Copy.php:67                                                                                                                                                 
 MagentoHackathon\Composer\Magento\Deploystrategy\Copy->createDelegate() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php:339                                                                                                                                        
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->create() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/Copy.php:62                                                                                                                                                 
 MagentoHackathon\Composer\Magento\Deploystrategy\Copy->createDelegate() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php:339                                                                                                                                        
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->create() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/Copy.php:67                                                                                                                                                 
 MagentoHackathon\Composer\Magento\Deploystrategy\Copy->createDelegate() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php:339                                                                                                                                        
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->create() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/Copy.php:62                                                                                                                                                 
 MagentoHackathon\Composer\Magento\Deploystrategy\Copy->createDelegate() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php:339                                                                                                                                        
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->create() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/Copy.php:67                                                                                                                                                 
 MagentoHackathon\Composer\Magento\Deploystrategy\Copy->createDelegate() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php:339
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->create() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/Copy.php:62
 MagentoHackathon\Composer\Magento\Deploystrategy\Copy->createDelegate() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php:339
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->create() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/Copy.php:67
 MagentoHackathon\Composer\Magento\Deploystrategy\Copy->createDelegate() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php:339
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->create() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/Copy.php:62
 MagentoHackathon\Composer\Magento\Deploystrategy\Copy->createDelegate() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php:339
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->create() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/Copy.php:67
 MagentoHackathon\Composer\Magento\Deploystrategy\Copy->createDelegate() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php:339
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->create() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/Copy.php:62
 MagentoHackathon\Composer\Magento\Deploystrategy\Copy->createDelegate() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php:339
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->create() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php:79
 MagentoHackathon\Composer\Magento\Deploystrategy\DeploystrategyAbstract->deploy() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/DeployManager.php:96
 MagentoHackathon\Composer\Magento\DeployManager->doDeploy() at /home/andrey/projects/magento-new/vendor/magento-hackathon/magento-composer-installer/src/MagentoHackathon/Composer/Magento/Plugin.php:184
 MagentoHackathon\Composer\Magento\Plugin->onNewCodeEvent() at n/a:n/a
 call_user_func() at phar:///home/andrey/projects/magento-new/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:159
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///home/andrey/projects/magento-new/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:120
 Composer\EventDispatcher\EventDispatcher->dispatchCommandEvent() at phar:///home/andrey/projects/magento-new/composer.phar/src/Composer/Installer.php:333
 Composer\Installer->run() at phar:///home/andrey/projects/magento-new/composer.phar/src/Composer/Command/InstallCommand.php:125
 Composer\Command\InstallCommand->execute() at phar:///home/andrey/projects/magento-new/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:252
 Symfony\Component\Console\Command\Command->run() at phar:///home/andrey/projects/magento-new/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:874
 Symfony\Component\Console\Application->doRunCommand() at phar:///home/andrey/projects/magento-new/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:195
 Symfony\Component\Console\Application->doRun() at phar:///home/andrey/projects/magento-new/composer.phar/src/Composer/Console/Application.php:146
 Composer\Console\Application->doRun() at phar:///home/andrey/projects/magento-new/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at phar:///home/andrey/projects/magento-new/composer.phar/src/Composer/Console/Application.php:83
 Composer\Console\Application->run() at phar:///home/andrey/projects/magento-new/composer.phar/bin/composer:43
 require() at /home/andrey/projects/magento-new/composer.phar:25

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [packages1] ... [packagesN]

Here is a part of my composer.json

    "require": {
        "magento-hackathon/magento-composer-installer": "*",
        "magento/core": "1.9.1.0",
        "connect20/aschroder_smtppro": "*",
        "connect20/fooman_googleanalyticsplus": "*",
        "aoepeople/aoe_scheduler": "*",
        "netzarbeiter/attribute-duplicator": "dev-master#8b5e3f629a03e98ad78ee4f397439a922dc5f537",
        "phoenix/varnish": "dev-master#c4d3537c014a7c020338ebadae660d5d8e40c8cd"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "http://packages.firegento.com"
        },
        {
            "type": "vcs",
            "url": "git@github.com:Vinai/attribute-duplicator.git"
        },
        {
            "type": "vcs",
            "url": "git@github.com:PHOENIX-MEDIA/Magento-PageCache-powered-by-Varnish.git"
        }
    ],
    "extra": {
        "magento-root-dir": "magento/",
        "magento-deploystrategy": "copy",
        "magento-force": true
    }

I have magento-force in composer.json, but seems it doesn't work. Packages version:

eloquent/composer-config-reader              2.0.0              A light-weight component for reading Composer configuration files.
eloquent/enumeration                         5.1.0              An enumeration implementation for PHP.
eloquent/liberator                           1.1.1              A proxy for circumventing PHP access modifier restrictions.
eloquent/pops                                3.1.1              PHP object proxy system.
icecave/isolator                             2.3.0              Dependency injection for global functions.
justinrainbow/json-schema                    1.3.7              A library to validate a json schema.
magento-hackathon/magento-composer-installer 2.1.1              Composer installer for Magento modules
magento/core                                 1.9.1.0            Magento Core

Composer version 1.0-dev (4569f528f66739ec0a3be1075e2c01d6062b0b41) 2014-12-22 11:50:02

PHP 5.5.19 (cli) (built: Nov 21 2014 12:01:33) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

Any suggestions? Thanks in advance.

ihor-sviziev commented 9 years ago

:+1: Time to time have same issue!

davidverholen commented 9 years ago

can you try it with

"extra": {
        "magento-root-dir": "magento/",
        "magento-deploystrategy": "copy",
        "magento-force": "override"
}

i did not look into the code yet, but that's basically what the exception says

andrey-bublik commented 9 years ago

@davidverholen according to FAQ and documentation - magento-force is the boolean option. Anyway, it doesn't work neither with "magento-force": "override", nor with "magento-force": true.

davidverholen commented 9 years ago

can't reproduce this on linux with php 5.6.4 (same composer build)

seems like isForced() for some reason returns false here:

https://github.com/magento-hackathon/magento-composer-installer/blob/32a1048626880b181906fddb70f0bac1bab97a65/src/MagentoHackathon/Composer/Magento/Deploystrategy/Copy.php#L78

davidverholen commented 9 years ago

ok it's a bug in the core Installer. The isForced property is not passed to the deployStrategy in the Core Installer.

The weird thing is, that there should not be any file that is overwritten by the core installer, since we don't change magento core files, or do we? ;P

andrey-bublik commented 9 years ago

I tried the following:

    "extra": {
        "magento-root-dir": "magento/",
        "magento-deploystrategy": "copy",
        "magento-force": true,
        "magento-deploystrategy-overwrite": {
            "magento/core": "none"
        },
        "magento-deploy-ignore": {
            "magento/core": ["*.*"]
        }
    }

It also doesn't work, exception is the same:

Generating autoload files
start magento core deploy via deployManager
start magento deploy for magento/core

  [ErrorException]                                                                                                                
  Target app/design/adminhtml/default/default/template/rating/options.phtml already exists (set extra.magento-force to override)

So, I'm really confused with this situation. Some explanation: I have git repository with my project, "vendor" dir added to .gitignore. Every time when I do git clone && composer install (to obtain vendor dir again with packages version from lockfile, and do composer update after install), I see the exception above, because in fact - there are files in magento root directory, and magento-installer tries to copy them again, totally ignoring magento-deploy-ignore, magento-deploystrategy-overwrite and magento-force.

davidverholen commented 9 years ago

you could also just remove magento/core from your composer.json.

The Installer does not consider that there are already magento core files in the root dir. Surely it would be a good idea to fix this so that the magento-force property also works with the magento core installer, but this problem also should not exist in an organized project.

You should either have the core in the git repository (which in my opinion is the worse solution) or install it with composer. It looks like your trying to do both, which causes the Problem, that there are already files where they should not be.

app/design/adminhtml/default/default/template/rating/options.phtml
Flyingmana commented 9 years ago

fix already got merged, so issue closed :)

ihor-sviziev commented 9 years ago

:+1: