composer / installers

A Multi-Framework Composer Library Installer
MIT License
1.43k stars 413 forks source link

When target location change, data must be moved (not duplicated) #500

Open mvorisek opened 2 years ago

mvorisek commented 2 years ago

Steps to reproduce:

Run composer update with the following config:

{
    "name": "xxx/xxx",
    "type": "library",
    "require": {
        "composer/installers": "^1.0.21",
        "prestashop/ps_specials": "^1.0",
    }
}

and notice module package is installed into /modules/ directory.

now edit the config to:

{
    "name": "xxx/xxx",
    "type": "library",
    "require": {
        "composer/installers": "^1.0.21",
        "prestashop/ps_specials": "^1.0",
    },
    "extra": {
        "installer-disable": [
            "prestashop"
        ]
    }
}

and run composer update again. The prestashop/ps_specials package is not moved (although vendor contains data about the original location), instead a new copy of it is installed to the standard vendor location.

Seldaek commented 2 years ago

Yeah if the installer is disabled there is no way for Composer to know where the package was previously. You'd need to remove the packages, disable the installer then install them again for this to work. I don't see how we can possibly fix that edge case tbh.

mvorisek commented 2 years ago

I think the target/install local directory is stored in composer metadata.

Seldaek commented 2 years ago

Yes that is true, but some custom installers also allow installing several things in the same path, so it's not like we can simply wipe that old path if the new one is different due to a custom installer being missing, we'd risk deleting user data.