Store vcs repositories in composer home to prevent permission issues

main
Jerome Tamarelle 12 years ago
parent 949728f812
commit da823f5f19

@ -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)) {

@ -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();

Loading…
Cancel
Save