franzliedke / studio

A workbench for developing Composer packages.
MIT License
1.14k stars 73 forks source link

Fix "Package seems not been installed properly" #87

Open ryzr opened 6 years ago

ryzr commented 6 years ago

The installationSource and distType on original packages are reconfigured in the uninstall/install step. This prevents the "Package seems not been installed properly" error, and also "The package has modified files" warning after running composer update. I also made a change to the loading/detection of Studio packages in the pre/post autoload phases. This should ensure consistency and no clashes with other plugins.

I'm not sure what the purpose of the /compost/studio/installed.json file is (except for debugging), but things should run fine without it. I've left it there for now, as it may be valuable info to some.

I was able to composer install, composer update and composer dumpauto without any errors. I made changes to the autoload config in my symlinked packages, and it was reflected in the composer/autoload_x files.

It should be noted however, that I only tested with 'library' package types, downloaded from source (Bitbucket). I'm not sure what troubles might arise with dist packages or other composer package types.

julienfalque commented 5 years ago

I confirm this fixes the "Package seems not been installed properly" error.

I noticed something odd in the output though:

 $ composer update foo/foo-bundle
Loading composer repositories with package information
Updating dependencies (including require-dev)                                        
Package operations: 1 install, 0 updates, 0 removals
  - Installing foo/foo-bundle (dev-some-branch 455d8a2): Cloning 455d8a2cab from cache
Writing lock file
Generating autoload files
[Studio] Loading package foo/foo-bundle
ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class
  - Removing foo/foo-bundle (dev-some-branch 455d8a2)
  - Installing foo/foo-bundle (0.4.x-dev): Symlinking from ../foo-bundle

In my composer.json I require foo/foo-bundle: dev-some-branch and composer.lock is updated correctly using the latest commit from some-branch but when the installed package is replaced with a symlink to the local repository (on some-branch), the output shows version 0.4.x-dev is installed, which is the alias of the master branch. Is this expected?

julienfalque commented 5 years ago

These changes seem to have a drawback: requiring a dev branch in composer.json (e.g. dev-master) only works if the branch exists on the remote Git repository. IIRC this used to be possible even when the branch only exists on the local repository.