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

Added API for an install path in installable repository #2424

Closed
wants to merge 1 commit into from

Conversation

@hason
Copy link
Contributor

@hason hason commented Nov 14, 2013

Fixes #2174

@stof
stof reviewed Nov 14, 2013
View changes
src/Composer/Repository/InstalledFilesystemRepository.php Outdated
throw new \InvalidArgumentException('The package "'.$package.'" is not in the repository.');
}

$this->packageData[$package->getUniqueName()] = $extra;

This comment has been minimized.

@stof

stof Nov 14, 2013
Contributor

is it intended to overwrite the install path here ? As there is a separate interface to set it, people might not expect it to be stored as package data

@stof
stof reviewed Nov 14, 2013
View changes
src/Composer/Repository/DataRepositoryInterface.php Outdated
*
* @author Martin Hasoň <martin.hason@gmail.com>
*/
interface DataRepositoryInterface

This comment has been minimized.

@stof

stof Nov 14, 2013
Contributor

The methods in this interface are only used internally in your implementation of InstalledFilesystemRepository. What is the use case for a new interface ?

@Seldaek
Copy link
Member

@Seldaek Seldaek commented Mar 9, 2014

Just a note that #2773 might need to be updated after merging this.

@alebiavati
Copy link
Contributor

@alebiavati alebiavati commented Mar 31, 2014

I'll get that done.

@hason hason force-pushed the hason:installpath branch from 11a9ec0 to 30e82e6 Nov 10, 2014
@Seldaek Seldaek modified the milestones: Backwards Compatible, Urgent Feb 25, 2015
@gossi
Copy link

@gossi gossi commented May 2, 2015

At which place to find the install-path for each package (I'm sorry for asking I'm not into the composer api).

@Seldaek
Copy link
Member

@Seldaek Seldaek commented May 2, 2015

This is the key part of how to access the install path for a package instance, I am not sure at which level you are working, but I don't think they persist to the installed.json in this PR.

+                            $repository = $composer->getRepositoryManager()->getLocalRepository();
+                            if ($repository instanceof InstalledRepositoryInterface && $repository->hasPackage($package)) {
+                                $path = $repository->getInstallPath($package);
+                            }
@gossi
Copy link

@gossi gossi commented May 3, 2015

I'm consuming installed.json if it's in there it's the perfect place for composer and for me to read the desired information 😃

@hason hason force-pushed the hason:installpath branch from 30e82e6 to 9f5219f May 4, 2015
@hason
Copy link
Contributor Author

@hason hason commented May 4, 2015

This PR is updated.

@hason hason force-pushed the hason:installpath branch from 9f5219f to c2896b8 May 4, 2015
$path = $this->getInstallPath($package);
$data[] = array(
'package' => $dumper->dump($package),
'install-path' => null !== $path ? $this->fs->findShortestPath($fileDir, $path, true) : null,

This comment has been minimized.

@gossi

gossi May 7, 2015

This would break the functionality of tools that rely on the current structure of the dump. It would be better to put the install-path into the $package and dump it the way it currently is.

// some pseudo-code:
foreach ($this->getCanonicalPackages() as $package) {
    $path = $this->getInstallPath($package);
    $package['installPath'] = null !== $path ? $this->fs->findShortestPath($fileDir, $path, true) : null;
    $data[] = $dumper->dump($package);
}

And then let the dumper transform installPath into install-path.

@Seldaek Seldaek modified the milestones: 2.0, Nice To Have Apr 12, 2016
@Seldaek Seldaek modified the milestones: 2.0, 2.0-core Jan 30, 2019
Seldaek added a commit that referenced this pull request Aug 2, 2019
…closes #2424
@Seldaek
Copy link
Member

@Seldaek Seldaek commented Aug 2, 2019

Finally had a good look at this (about time? :P) anyway decided to take the key bits of it and do a minimalistic patch to avoid spreading this too much, thanks @hason though for the inspiration (and patience..) - see 63da7c6

@Seldaek Seldaek closed this Aug 2, 2019
naderman added a commit to naderman/composer that referenced this pull request Sep 7, 2019
…-installed

* github-composer/2.0: (48 commits)
  Fix missing use/undefined var
  Split up steps on VCS downloaders to allow doing network operations before touching the filesystem on GitDownloader, fixes composer#7903
  Fix use statement
  Deduplicate findHeaderValue code
  Add install-path to the installed.json for every package, fixes composer#2174, closes composer#2424
  Remove unnecessary config from phpstan
  Make sure the directory exists and will not block installation later when downloading
  Avoid wiping the whole target package if download of the new one fails, refs composer#7929
  Only empty dir before actually installing packages, fixes composer#7929
  Improve output when installing packages
  Show best possible version in diagnose command
  Remove extra arg
  Allow path repos to point to their own source dir as install target, resulting in noop, fixes composer#8254
  Fix use of decodeJson
  Fix update mirrors to also update transport-options, fixes composer#7672
  Fix updating or URLs to include dist type and shasum, fixes composer#8216
  Fix origin computation
  Improve handling of non-standard ports for GitLab and GitHub installs, fixes composer#8173
  Load packages from the lock file for check-platform-reqs if no dependencies have been installed yet, fixes composer#8058
  Fix error_handler return type declaration
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants