diff options
-rw-r--r-- | morphlib/builder.py | 5 | ||||
-rw-r--r-- | morphlib/morphology.py | 9 | ||||
-rw-r--r-- | morphlib/morphology_tests.py | 9 | ||||
-rwxr-xr-x | tests/build-chunk.script | 2 | ||||
-rwxr-xr-x | tests/build-stratum.script | 2 | ||||
-rwxr-xr-x | tests/build-system.script | 2 | ||||
-rwxr-xr-x | tests/missing-ref.script | 2 |
7 files changed, 21 insertions, 10 deletions
diff --git a/morphlib/builder.py b/morphlib/builder.py index 8284847d..dadfd558 100644 --- a/morphlib/builder.py +++ b/morphlib/builder.py @@ -392,7 +392,10 @@ class Builder(object): self.indent_more() self.msg('build %s|%s|%s' % (repo, ref, filename)) - repo = urlparse.urljoin(self.settings['git-base-url'], repo) + base_url = self.settings['git-base-url'] + if not base_url.endswith('/'): + base_url += '/' + repo = urlparse.urljoin(base_url, repo) morph = self.get_morph_from_git(repo, ref, filename) if morph.kind == 'chunk': diff --git a/morphlib/morphology.py b/morphlib/morphology.py index 4fe6344a..e8af7747 100644 --- a/morphlib/morphology.py +++ b/morphlib/morphology.py @@ -34,9 +34,9 @@ class Morphology(object): if self.kind == 'stratum': for source in self.sources: if 'repo' not in source: - source['repo'] = source['name'] + source[u'repo'] = source['name'] repo = self._join_with_baseurl(source['repo']) - source['repo'] = unicode(repo) + source[u'repo'] = unicode(repo) self.filename = self._fp.name @@ -105,7 +105,10 @@ class Morphology(object): if is_relative: if not url.endswith('/'): url += '/' - return self._baseurl + url + baseurl = self._baseurl + if baseurl and not baseurl.endswith('/'): + baseurl += '/' + return baseurl + url else: return url diff --git a/morphlib/morphology_tests.py b/morphlib/morphology_tests.py index d1e052a8..9a8517e1 100644 --- a/morphlib/morphology_tests.py +++ b/morphlib/morphology_tests.py @@ -106,12 +106,17 @@ class MorphologyTests(unittest.TestCase): "ref": "ref" } ] - }''')) + }'''), + baseurl='git://example.com') self.assertEqual(morph.kind, 'stratum') self.assertEqual(morph.filename, 'mockfile') self.assertEqual(morph.sources, [ - { 'name': 'foo', 'repo': 'foo/', 'ref': 'ref' }, + { + u'name': u'foo', + u'repo': u'git://example.com/foo/', + u'ref': u'ref' + }, ]) def test_accepts_valid_system_morphology(self): diff --git a/tests/build-chunk.script b/tests/build-chunk.script index 08adb176..8058edff 100755 --- a/tests/build-chunk.script +++ b/tests/build-chunk.script @@ -22,7 +22,7 @@ set -e cache="$DATADIR/build-chunk-cache" mkdir "$cache" ./morph --no-default-configs build repo farrokh hello.morph \ - --git-base-url "file://$DATADIR/" \ + --git-base-url="file://$DATADIR" \ --cachedir="$cache" --keep-path for chunk in "$cache/"*.chunk.* do diff --git a/tests/build-stratum.script b/tests/build-stratum.script index d0ef6da4..cdb4d016 100755 --- a/tests/build-stratum.script +++ b/tests/build-stratum.script @@ -22,7 +22,7 @@ set -e cache="$DATADIR/build-stratum-cache" mkdir "$cache" ./morph --no-default-configs build repo farrokh hello-stratum.morph \ - --git-base-url "file://$DATADIR/" \ + --git-base-url="file://$DATADIR" \ --cachedir="$cache" --keep-path tar -tf "$cache/"*.stratum.* | LC_ALL=C sort | sed '/^\.\/./s:^\./::' rm -rf "$cache" diff --git a/tests/build-system.script b/tests/build-system.script index 3a1c78b9..b1f36532 100755 --- a/tests/build-system.script +++ b/tests/build-system.script @@ -22,7 +22,7 @@ set -e cache="$DATADIR/build-system-cache" mkdir "$cache" ./morph --no-default-configs build repo farrokh hello-system.morph \ - --git-base-url "file://$DATADIR/" \ + --git-base-url="file://$DATADIR" \ --cachedir="$cache" --keep-path find "$cache" -name '*.system.*' -type f | wc -l rm -rf "$cache" diff --git a/tests/missing-ref.script b/tests/missing-ref.script index e11653ea..1a5dabca 100755 --- a/tests/missing-ref.script +++ b/tests/missing-ref.script @@ -22,7 +22,7 @@ set -e cache="$DATADIR/build-chunk-cache" mkdir "$cache" ./morph --no-default-configs build repo non-existent-branch hello.morph \ - --git-base-url "file://$DATADIR/" \ + --git-base-url="file://$DATADIR" \ --cachedir="$cache" --keep-path rm -rf "$cache" |