Fix VCS drivers to always use identifiers and not tag names since those can change or disappear

main
Jordi Boggiano 11 years ago
parent 30f94365f0
commit 444bdb2e25

@ -65,9 +65,7 @@ class GitBitbucketDriver extends VcsDriver implements VcsDriverInterface
*/
public function getSource($identifier)
{
$label = array_search($identifier, $this->getTags()) ?: $identifier;
return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $label);
return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
}
/**
@ -75,10 +73,9 @@ class GitBitbucketDriver extends VcsDriver implements VcsDriverInterface
*/
public function getDist($identifier)
{
$label = array_search($identifier, $this->getTags()) ?: $identifier;
$url = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$label.'.zip';
$url = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$identifier.'.zip';
return array('type' => 'zip', 'url' => $url, 'reference' => $label, 'shasum' => '');
return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
}
/**

@ -87,7 +87,6 @@ class GitHubDriver extends VcsDriver
if ($this->gitDriver) {
return $this->gitDriver->getSource($identifier);
}
$label = array_search($identifier, $this->getTags()) ?: $identifier;
if ($this->isPrivate) {
// Private GitHub repositories should be accessed using the
// SSH version of the URL.
@ -96,7 +95,7 @@ class GitHubDriver extends VcsDriver
$url = $this->getUrl();
}
return array('type' => 'git', 'url' => $url, 'reference' => $label);
return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
}
/**
@ -107,10 +106,9 @@ class GitHubDriver extends VcsDriver
if ($this->gitDriver) {
return $this->gitDriver->getDist($identifier);
}
$label = array_search($identifier, $this->getTags()) ?: $identifier;
$url = 'https://api.github.com/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$label;
$url = 'https://api.github.com/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
return array('type' => 'zip', 'url' => $url, 'reference' => $label, 'shasum' => '');
return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
}
/**

@ -68,9 +68,7 @@ class HgBitbucketDriver extends VcsDriver
*/
public function getSource($identifier)
{
$label = array_search($identifier, $this->getTags()) ?: $identifier;
return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $label);
return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
}
/**
@ -78,10 +76,9 @@ class HgBitbucketDriver extends VcsDriver
*/
public function getDist($identifier)
{
$label = array_search($identifier, $this->getTags()) ?: $identifier;
$url = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$label.'.zip';
$url = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$identifier.'.zip';
return array('type' => 'zip', 'url' => $url, 'reference' => $label, 'shasum' => '');
return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
}
/**

@ -98,9 +98,7 @@ class HgDriver extends VcsDriver
*/
public function getSource($identifier)
{
$label = array_search($identifier, (array) $this->tags) ? : $identifier;
return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $label);
return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
}
/**

Loading…
Cancel
Save