1
0
Fork 0

Store vcs repositories in composer home to prevent permission issues

pull/617/head
Jerome Tamarelle 2012-04-24 17:03:15 +02:00
parent 949728f812
commit da823f5f19
2 changed files with 3 additions and 3 deletions

View File

@ -36,7 +36,7 @@ class GitDriver extends VcsDriver
if (static::isLocalUrl($this->url)) {
$this->repoDir = str_replace('file://', '', $this->url);
} else {
$this->repoDir = getenv('HOME') . '/.composer/cache.git/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
$this->repoDir = $this->config->get('home') . '/cache.git/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
// update the repo if it is a valid git repository
if (is_dir($this->repoDir) && 0 === $this->process->execute('git remote', $output, $this->repoDir)) {

View File

@ -31,14 +31,14 @@ class HgDriver extends VcsDriver
*/
public function initialize()
{
$this->tmpDir = sys_get_temp_dir() . '/composer-' . preg_replace('{[^a-z0-9]}i', '-', $url) . '/';
$this->tmpDir = $this->config->get('home') . '/cache.hg/' . preg_replace('{[^a-z0-9]}i', '-', $url) . '/';
$url = escapeshellarg($this->url);
$tmpDir = escapeshellarg($this->tmpDir);
if (is_dir($this->tmpDir)) {
$this->process->execute(sprintf('cd %s && hg pull -u', $tmpDir), $output);
} else {
$this->process->execute(sprintf('cd %s && hg clone %s %s', escapeshellarg(sys_get_temp_dir()), $url, $tmpDir), $output);
$this->process->execute(sprintf('cd %s && hg clone %s %s', escapeshellarg(dirname($this->tmpDir)), $url, $tmpDir), $output);
}
$this->getTags();