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) public function getSource($identifier)
{ {
$label = array_search($identifier, $this->getTags()) ?: $identifier; return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $label);
} }
/** /**
@ -75,10 +73,9 @@ class GitBitbucketDriver extends VcsDriver implements VcsDriverInterface
*/ */
public function getDist($identifier) public function getDist($identifier)
{ {
$label = array_search($identifier, $this->getTags()) ?: $identifier; $url = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$identifier.'.zip';
$url = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$label.'.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) { if ($this->gitDriver) {
return $this->gitDriver->getSource($identifier); return $this->gitDriver->getSource($identifier);
} }
$label = array_search($identifier, $this->getTags()) ?: $identifier;
if ($this->isPrivate) { if ($this->isPrivate) {
// Private GitHub repositories should be accessed using the // Private GitHub repositories should be accessed using the
// SSH version of the URL. // SSH version of the URL.
@ -96,7 +95,7 @@ class GitHubDriver extends VcsDriver
$url = $this->getUrl(); $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) { if ($this->gitDriver) {
return $this->gitDriver->getDist($identifier); return $this->gitDriver->getDist($identifier);
} }
$label = array_search($identifier, $this->getTags()) ?: $identifier; $url = 'https://api.github.com/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
$url = 'https://api.github.com/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$label;
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) public function getSource($identifier)
{ {
$label = array_search($identifier, $this->getTags()) ?: $identifier; return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $label);
} }
/** /**
@ -78,10 +76,9 @@ class HgBitbucketDriver extends VcsDriver
*/ */
public function getDist($identifier) public function getDist($identifier)
{ {
$label = array_search($identifier, $this->getTags()) ?: $identifier; $url = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$identifier.'.zip';
$url = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$label.'.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) public function getSource($identifier)
{ {
$label = array_search($identifier, (array) $this->tags) ? : $identifier; return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $label);
} }
/** /**

Loading…
Cancel
Save