blob: 4537a82307cc115347c881760f6b773a2fd717d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# parseuri.py; parses a SYNC uri, returning protocol/host_uri
# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#$Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/sync/parseuri.py,v 1.2 2005/07/13 05:51:35 ferringb Exp $
#sanitize this to use listdir
#~harring
import portage_const
def parseSyncUri(uri):
"""parse a SYNC uri, returning a tuple of protocol,host_uri"""
u=uri.lower()
if u.startswith("rsync") or len(u) == 0:
if len(u) <= 5:
return ('rsync',portage_const.RSYNC_HOST)
return ('rsync',u[8:])
elif u.startswith("cvs://"):
u=u[6:]
return ('cvs',u)
elif u.startswith("snapshot"):
if len(u)==8:
# the caller gets to randomly crapshoot a mirror for it.
return ('snapshot',None)
return ('snapshot',u[9:])
else:
return (None,None)
|