فهرست منبع

Clean up svn environment to fix OSX issues, fixes #2708, refs #2146

Jordi Boggiano 11 سال پیش
والد
کامیت
432ace33d4

+ 4 - 2
src/Composer/Downloader/SvnDownloader.php

@@ -26,8 +26,9 @@ class SvnDownloader extends VcsDownloader
      */
     public function doDownload(PackageInterface $package, $path)
     {
-        $url =  $package->getSourceUrl();
-        $ref =  $package->getSourceReference();
+        SvnUtil::cleanEnv();
+        $url = $package->getSourceUrl();
+        $ref = $package->getSourceReference();
 
         $this->io->write("    Checking out ".$package->getSourceReference());
         $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
@@ -38,6 +39,7 @@ class SvnDownloader extends VcsDownloader
      */
     public function doUpdate(PackageInterface $initial, PackageInterface $target, $path)
     {
+        SvnUtil::cleanEnv();
         $url = $target->getSourceUrl();
         $ref = $target->getSourceReference();
 

+ 3 - 0
src/Composer/Package/Loader/RootPackageLoader.php

@@ -22,6 +22,7 @@ use Composer\Repository\Vcs\HgDriver;
 use Composer\IO\NullIO;
 use Composer\Util\ProcessExecutor;
 use Composer\Util\Git as GitUtil;
+use Composer\Util\Svn as SvnUtil;
 
 /**
  * ArrayLoader built for the sole purpose of loading the root package
@@ -303,6 +304,8 @@ class RootPackageLoader extends ArrayLoader
 
     private function guessSvnVersion(array $config)
     {
+        SvnUtil::cleanEnv();
+
         // try to fetch current version from svn
         if (0 === $this->process->execute('svn info --xml', $output)) {
             $trunkPath = isset($config['trunk-path']) ? preg_quote($config['trunk-path'], '#') : 'trunk';

+ 2 - 0
src/Composer/Repository/Vcs/SvnDriver.php

@@ -51,6 +51,8 @@ class SvnDriver extends VcsDriver
     {
         $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
 
+        SvnUtil::cleanEnv();
+
         if (isset($this->repoConfig['trunk-path'])) {
             $this->trunkPath = $this->repoConfig['trunk-path'];
         }

+ 6 - 0
src/Composer/Util/Svn.php

@@ -69,6 +69,12 @@ class Svn
         $this->process = $process ?: new ProcessExecutor;
     }
 
+    public static function cleanEnv()
+    {
+        // clean up env for OSX, see https://github.com/composer/composer/issues/2146#issuecomment-35478940
+        putenv("DYLD_LIBRARY_PATH");
+    }
+
     /**
      * Execute an SVN command and try to fix up the process with credentials
      * if necessary.