studio icon indicating copy to clipboard operation
studio copied to clipboard

Symlink not created

Open Arcesilas opened this issue 7 years ago • 9 comments

Hi,

Note: between each try, I've cleared composer cache.

Here's what I have done:

Ran studio load ../dot-array:

$ cat studio.json
{
    "version": 2,
    "paths": [
        "../dot-array/"
    ]
}

In my composer.json, I have:

    "require": {
        "arcesilas/dot-array": "^1.0"
    }

Which is ok with the package in ../dot-array (excerpt):

$ cat ../dot-array/composer.json
{
    "name": "arcesilas/dot-array",
    "description": "Dot notation for arrays",
    "type": "library",

Then, run installing dependencies:

$ composer update
[Studio] Loading path ../dot-array/
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing arcesilas/dot-array (v1.0.0): Downloading (100%)         
Writing lock file
Generating autoload files

The package is downloaded from packagist, since it's published on it.

Running composer with debug verbose (with relevant information):

[Studio] Loading path ../dot-array/
Loading composer repositories with package information
Executing command (/home/olivier/dev/arcesilas/dot-array/): git branch --no-color --no-abbrev -v
Executing command (/home/olivier/dev/arcesilas/dot-array/): git log -n1 --pretty=%H
Downloading https://packagist.org/packages.json

If I run the git commands in the ../dot-array directory:

✔ [dot-array] [master L|✔] 
13:04 $ git branch --no-color --no-abbrev -v
  develop 9883fcd487798648cb995ec503d0167fa0742f11 First release
* master  9883fcd487798648cb995ec503d0167fa0742f11 First release
✔ [dot-array] [master L|✔] 
13:04 $ git log -n1 --pretty=%H
9883fcd487798648cb995ec503d0167fa0742f11

I understand it's not really a Studio problem: Composer does not try to find the tag I require (1.0.0), which yet exists:

✔ [dot-array] [master L|✔] 
13:04 $ git tag
v1.0.0

If I change my composer.json configuration:

    "require": {
        "arcesilas/dot-array": "dev-master"
    },
    "minimum-stability": "dev",
    "prefer-stable": true

Then it works:

Installs: arcesilas/dot-array:dev-master
  - Installing arcesilas/dot-array (dev-master): Symlinking from ../dot-array
    REASON: Required by the root package: Install command rule (install arcesilas/dot-array dev-master|install arcesilas/dot-array dev-master)

Is there a bug in Studio that make it no hook where it should? Why is my package symlinked only if I specify a dev version? Btw, the dev version is also available through Composer/Packagist, therefore, I don't understand the difference Composer does between a stable and a dev version...

I've also tried to specify the directory as a path repository in composer.json:

    "repositories": [
        {
            "type": "path",
            "url": "/path/to/dot-array"
        }
    ]

Also tried with

options: {
    "symlink": true
}

Symlink is created only when specifying a dev version.

I understand the problem may not be related to Studio (I'm not sure). Is there a way Studio can make Composer actually use the local path and symlink even when we don't specify a dev version?

EDIT: I've opened an issue on Composer

Arcesilas avatar Jan 28 '18 12:01 Arcesilas

What version of Studio are you running? This sounds like what is described in issue #52 and being fixed in #73 PR.

rask avatar Jan 29 '18 14:01 rask

I've updated (composer global update) and version is 0.12.0... I have not digged into the dependencies to check why it did not update to 0.13...

Arcesilas avatar Jan 29 '18 14:01 Arcesilas

I've just figured out that the actual version is indeed 0.13: studio --version does not give the correct information (version had not been bumped in 0.12).

So it seems I'm actually up-to-date:

composer global info
Changed current directory to /home/olivier/.config/composer
behat/behat                         v3.4.3 Scenario-oriented BDD framework for PHP 5.3
behat/gherkin                       v4.5.1 Gherkin DSL parser for PHP 5.3
behat/transliterator                v1.2.0 String transliterator
container-interop/container-interop 1.2.0  Promoting the interoperability of container objects (DIC, SL, etc.)
doctrine/instantiator               1.1.0  A small, lightweight utility to instantiate objects in PHP without invoking their constructors
franzl/studio                       0.13.0 Develop your Composer libraries with style

Arcesilas avatar Jan 30 '18 16:01 Arcesilas

@Arcesilas

composer global require franzl/studio:0.14.x-dev

ElfSundae avatar Jan 31 '18 15:01 ElfSundae

I have custom packages loading from private packagist.com and when I try to switch it to symlinks it's not working. I've tried

// with   "franzl/studio": ">=0.14.0",
// with   "minimum-stability": "dev",
// with   "prefer-stable": true

composer clearcache && rm -rf vendor && rm -rf composer.lock && composer update

to no avail. It keeps on downloading them instead of symlinking them. The even more perplexing thing is this output at the end of composer install/update:

[Studio] Loading package mystuff/my-utils-9999999-dev
[Studio] Loading package mystuff/mylogger-9999999-dev
[Studio] Loading package mystuff/myresources-dev-develop
[InvalidArgumentException]
Package mystuff/my-utils-9999999-dev seems not been installed properly

After that, all three are there, but from packagist, not symlinked.

phpguru avatar Aug 10 '18 17:08 phpguru

@franzliedke I've upgraded Studio to the latest beta and get the same error as @phpguru : Package mystuff/my-utils-9999999-dev seems not been installed properly.

Any idea how to fix that ?

gnutix avatar May 27 '19 18:05 gnutix

Same error here with latest beta. Doesn't work with 0.13 nor 0.11-dev neither (symlinking on MacOS, packages versions are used).

mailopl avatar Jul 05 '19 09:07 mailopl

@gnutix @mailopl In addition to the commands above also do

rm -rf vendor

I got this tip from packagist.com (enterprise packagist) tech support. In short, composer can learn about packages if they’re already in the vendor folder, so whack it completely. Also, contrary to the docs I don’t think it works with a relative path; use a fully qualified system path in your studio.json.

phpguru avatar Jul 05 '19 14:07 phpguru

I switched to developing on Ubuntu, and found the same issues on 0.13.0, so I tried this:

"require-dev" : { 
     // stuff
    "franzl/studio": "0.14.0-beta1",
    // stuff
}

and ran rm -rf vendor && rm -rf composer.lock && composer install and it still isn't working for me; that is, no symlinks are created, even though I am getting plenty of

[Studio] Loading package mystuff/my-utils
[Studio] Loading package mystuff/my-commands

on the cli output from composer install command.

Does this have to do with using private (enterprise, paid plan) packagist?

I have this in composer.json to handle that:

"repositories": [
    {
        "type": "composer",
        "url": "https://repo.packagist.com/mystuff/"
    },
    {
        "packagist.org": false
    }

phpguru avatar Aug 04 '20 18:08 phpguru