Skip to content

Instantly share code, notes, and snippets.

@schmkr
Last active December 22, 2015 17:39
Show Gist options
  • Save schmkr/6507862 to your computer and use it in GitHub Desktop.
Save schmkr/6507862 to your computer and use it in GitHub Desktop.
Example of Composer Satis with a deep SVN structure

Example of output when running:

bin/satis build satis.json ./web -vvv

Current output

Executing command (CWD): git describe --exact-match --tags
Executing command (CWD): git branch --no-color --no-abbrev -v
Executing command (CWD): hg branch
Scanning packages
Executing command (CWD): svn ls --verbose --non-interactive  'http://composer-project-with-deep-svn-structure.googlecode.com/svn/devel/trunk/team/packages/'
Executing command (CWD): svn ls --verbose --non-interactive  'http://composer-project-with-deep-svn-structure.googlecode.com/svn/devel/branches/team/packages/package'
Executing command (CWD): svn ls --verbose --non-interactive  'http://composer-project-with-deep-svn-structure.googlecode.com/svn/devel/tags/team/packages/package'
Executing command (CWD): svn cat --non-interactive  'http://composer-project-with-deep-svn-structure.googlecode.com/svn/devel/trunk/team/packages/package/composer.json'
Executing command (CWD): svn info --non-interactive  'http://composer-project-with-deep-svn-structure.googlecode.com/svn/devel/trunk/team/packages/package/'
Writing /Users/username/.composer/cache/repo/http---composer-project-with-deep-svn-structure.googlecode.com-svn-devel/-trunk-team-packages-package-.json into cache
Reading /Users/username/.composer/cache/repo/http---composer-project-with-deep-svn-structure.googlecode.com-svn-devel/-trunk-team-packages-package-.json from cache
Reading composer.json of team/package (0.1)
Reading /Users/username/.composer/cache/repo/http---composer-project-with-deep-svn-structure.googlecode.com-svn-devel/-tags-team-packages-package-0.1--6-.json from cache
Importing tag 0.1 (0.1.0.0)
Reading composer.json of team/package (feature1)
Reading /Users/username/.composer/cache/repo/http---composer-project-with-deep-svn-structure.googlecode.com-svn-devel/-branches-team-packages-package-feature1--8-.json from cache
Importing branch feature1 (dev-feature1)
Selected team/package (0.1)
Selected team/package (dev-feature1)
Writing packages.json
Writing web view

Output with patch (see SvnDriver.diff):

Executing command (CWD): git describe --exact-match --tags
Executing command (CWD): git branch --no-color --no-abbrev -v
Executing command (CWD): hg branch
Scanning packages
Executing command (CWD): svn ls --verbose --non-interactive  'http://composer-project-with-deep-svn-structure.googlecode.com/svn/devel/trunk/team/packages/package'
Executing command (CWD): svn ls --verbose --non-interactive  'http://composer-project-with-deep-svn-structure.googlecode.com/svn/devel/branches/team/packages/package'
Executing command (CWD): svn ls --verbose --non-interactive  'http://composer-project-with-deep-svn-structure.googlecode.com/svn/devel/tags/team/packages/package'
Reading /Users/username/.composer/cache/repo/http---composer-project-with-deep-svn-structure.googlecode.com-svn-devel/-trunk-team-packages-package--7-.json from cache
Reading /Users/username/.composer/cache/repo/http---composer-project-with-deep-svn-structure.googlecode.com-svn-devel/-trunk-team-packages-package--7-.json from cache
Reading composer.json of team/package (0.1)
Reading /Users/username/.composer/cache/repo/http---composer-project-with-deep-svn-structure.googlecode.com-svn-devel/-tags-team-packages-package-0.1--6-.json from cache
Importing tag 0.1 (0.1.0.0)
Reading composer.json of team/package (trunk)
Reading /Users/username/.composer/cache/repo/http---composer-project-with-deep-svn-structure.googlecode.com-svn-devel/-trunk-team-packages-package--7-.json from cache
Importing branch trunk (dev-trunk)
Reading composer.json of team/package (feature1)
Reading /Users/username/.composer/cache/repo/http---composer-project-with-deep-svn-structure.googlecode.com-svn-devel/-branches-team-packages-package-feature1--8-.json from cache
Importing branch feature1 (dev-feature1)
Selected team/package (0.1)
Selected team/package (dev-trunk)
Selected team/package (dev-feature1)
Writing packages.json
Writing web view
{
"name": "Example Packages",
"description" : "Packages from our team",
"homepage": "http://packages.ourcompanydomain/",
"repositories": [
{
"type": "vcs",
"url": "http://composer-project-with-deep-svn-structure.googlecode.com/svn/devel",
"trunk-path" : "trunk/team/packages/package",
"branches-path": "branches/team/packages/package",
"tags-path": "tags/team/packages/package"
}
],
"require-all": true
}
diff --git a/src/Composer/Repository/Vcs/SvnDriver.php b/src/Composer/Repository/Vcs/SvnDriver.php
index c5a67b4..09cd60b 100644
--- a/src/Composer/Repository/Vcs/SvnDriver.php
+++ b/src/Composer/Repository/Vcs/SvnDriver.php
@@ -196,7 +196,7 @@ class SvnDriver extends VcsDriver
if (false === strpos($this->trunkPath, '/')) {
$trunkParent = $this->baseUrl . '/';
} else {
- $trunkParent = $this->baseUrl . '/' . dirname($this->trunkPath) . '/';
+ $trunkParent = $this->baseUrl . '/' . dirname($this->trunkPath) . '/' . basename($this->trunkPath);
}
$output = $this->execute('svn ls --verbose', $trunkParent);
@@ -204,12 +204,12 @@ class SvnDriver extends VcsDriver
foreach ($this->process->splitLines($output) as $line) {
$line = trim($line);
if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
- if (isset($match[1]) && isset($match[2]) && $match[2] === $this->trunkPath . '/') {
- $this->branches[$this->trunkPath] = $this->buildIdentifier(
+ if (isset($match[1]) && isset($match[2]) && $match[2] === 'composer.json') {
+ $this->branches['trunk'] = $this->buildIdentifier(
'/' . $this->trunkPath,
$match[1]
);
- $this->rootIdentifier = $this->branches[$this->trunkPath];
+ $this->rootIdentifier = $this->branches['trunk'];
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment