parse_remote(remote_url,
name,
pkg)
|
|
Sanity check our remote URL
>>> parse_remote("ssh://host/path/%(pkg)s", "origin", "package")
{'name': 'origin', 'url': 'ssh://host/path/package', 'host': 'host', 'base': '', 'pkg': 'package', 'port': None, 'dir': '/path/package'}
>>> parse_remote("ssh://host:22/path/repo.git", "origin", "package")
{'name': 'origin', 'url': 'ssh://host:22/path/repo.git', 'host': 'host', 'base': '', 'pkg': 'package', 'port': '22', 'dir': '/path/repo.git'}
>>> parse_remote("ssh://host:22/~/path/%(pkg)s.git", "origin", "package")
{'name': 'origin', 'url': 'ssh://host:22/~/path/package.git', 'host': 'host', 'base': '~/', 'pkg': 'package', 'port': '22', 'dir': 'path/package.git'}
>>> parse_remote("ssh://host:22/~user/path/%(pkg)s.git", "origin", "package")
{'name': 'origin', 'url': 'ssh://host:22/~user/path/package.git', 'host': 'host', 'base': '~user/', 'pkg': 'package', 'port': '22', 'dir': 'path/package.git'}
>>> parse_remote("git://host/repo.git", "origin", "package")
Traceback (most recent call last):
...
GbpError: Remote URL must use ssh protocol.
>>> parse_remote("ssh://host/path/repo", "origin", "package")
Traceback (most recent call last):
...
GbpError: Remote URL needs to contain either a repository name or '%(pkg)s'
>>> parse_remote("ssh://host:asdf/path/%(pkg)s.git", "origin", "package")
Traceback (most recent call last):
...
GbpError: Remote URL contains invalid port.
>>> parse_remote("ssh://host/~us er/path/%(pkg)s.git", "origin", "package")
Traceback (most recent call last):
...
GbpError: Remote URL contains invalid ~username expansion.
|