diff options
| author | Chris Larson <chris_larson@mentor.com> | 2010-04-11 17:03:55 -0700 |
|---|---|---|
| committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-07-02 15:41:33 +0100 |
| commit | 1180bab54e2879401f3586c91a48174191a1ee8b (patch) | |
| tree | a45aeee20eb5969cc1ac778fac47134929f4e021 /bitbake/lib/bb/fetch/perforce.py | |
| parent | 5b216c8000dbc3ed9f3e996242eb24269fcaf919 (diff) | |
| download | poky-1180bab54e2879401f3586c91a48174191a1ee8b.tar.gz | |
Apply some 2to3 transforms that don't cause issues in 2.6
(Bitbake rev: d39ab776e7ceaefc8361150151cf0892dcb70d9c)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/fetch/perforce.py')
| -rw-r--r-- | bitbake/lib/bb/fetch/perforce.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/bitbake/lib/bb/fetch/perforce.py b/bitbake/lib/bb/fetch/perforce.py index 67de6f59fa..5b6c601876 100644 --- a/bitbake/lib/bb/fetch/perforce.py +++ b/bitbake/lib/bb/fetch/perforce.py | |||
| @@ -35,15 +35,15 @@ class Perforce(Fetch): | |||
| 35 | def supports(self, url, ud, d): | 35 | def supports(self, url, ud, d): |
| 36 | return ud.type in ['p4'] | 36 | return ud.type in ['p4'] |
| 37 | 37 | ||
| 38 | def doparse(url,d): | 38 | def doparse(url, d): |
| 39 | parm = {} | 39 | parm = {} |
| 40 | path = url.split("://")[1] | 40 | path = url.split("://")[1] |
| 41 | delim = path.find("@"); | 41 | delim = path.find("@"); |
| 42 | if delim != -1: | 42 | if delim != -1: |
| 43 | (user,pswd,host,port) = path.split('@')[0].split(":") | 43 | (user, pswd, host, port) = path.split('@')[0].split(":") |
| 44 | path = path.split('@')[1] | 44 | path = path.split('@')[1] |
| 45 | else: | 45 | else: |
| 46 | (host,port) = data.getVar('P4PORT', d).split(':') | 46 | (host, port) = data.getVar('P4PORT', d).split(':') |
| 47 | user = "" | 47 | user = "" |
| 48 | pswd = "" | 48 | pswd = "" |
| 49 | 49 | ||
| @@ -53,19 +53,19 @@ class Perforce(Fetch): | |||
| 53 | plist = path.split(';') | 53 | plist = path.split(';') |
| 54 | for item in plist: | 54 | for item in plist: |
| 55 | if item.count('='): | 55 | if item.count('='): |
| 56 | (key,value) = item.split('=') | 56 | (key, value) = item.split('=') |
| 57 | keys.append(key) | 57 | keys.append(key) |
| 58 | values.append(value) | 58 | values.append(value) |
| 59 | 59 | ||
| 60 | parm = dict(zip(keys,values)) | 60 | parm = dict(zip(keys, values)) |
| 61 | path = "//" + path.split(';')[0] | 61 | path = "//" + path.split(';')[0] |
| 62 | host += ":%s" % (port) | 62 | host += ":%s" % (port) |
| 63 | parm["cset"] = Perforce.getcset(d, path, host, user, pswd, parm) | 63 | parm["cset"] = Perforce.getcset(d, path, host, user, pswd, parm) |
| 64 | 64 | ||
| 65 | return host,path,user,pswd,parm | 65 | return host, path, user, pswd, parm |
| 66 | doparse = staticmethod(doparse) | 66 | doparse = staticmethod(doparse) |
| 67 | 67 | ||
| 68 | def getcset(d, depot,host,user,pswd,parm): | 68 | def getcset(d, depot, host, user, pswd, parm): |
| 69 | p4opt = "" | 69 | p4opt = "" |
| 70 | if "cset" in parm: | 70 | if "cset" in parm: |
| 71 | return parm["cset"]; | 71 | return parm["cset"]; |
| @@ -97,7 +97,7 @@ class Perforce(Fetch): | |||
| 97 | 97 | ||
| 98 | def localpath(self, url, ud, d): | 98 | def localpath(self, url, ud, d): |
| 99 | 99 | ||
| 100 | (host,path,user,pswd,parm) = Perforce.doparse(url,d) | 100 | (host, path, user, pswd, parm) = Perforce.doparse(url, d) |
| 101 | 101 | ||
| 102 | # If a label is specified, we use that as our filename | 102 | # If a label is specified, we use that as our filename |
| 103 | 103 | ||
| @@ -115,7 +115,7 @@ class Perforce(Fetch): | |||
| 115 | 115 | ||
| 116 | cset = Perforce.getcset(d, path, host, user, pswd, parm) | 116 | cset = Perforce.getcset(d, path, host, user, pswd, parm) |
| 117 | 117 | ||
| 118 | ud.localfile = data.expand('%s+%s+%s.tar.gz' % (host,base.replace('/', '.'), cset), d) | 118 | ud.localfile = data.expand('%s+%s+%s.tar.gz' % (host, base.replace('/', '.'), cset), d) |
| 119 | 119 | ||
| 120 | return os.path.join(data.getVar("DL_DIR", d, 1), ud.localfile) | 120 | return os.path.join(data.getVar("DL_DIR", d, 1), ud.localfile) |
| 121 | 121 | ||
| @@ -124,7 +124,7 @@ class Perforce(Fetch): | |||
| 124 | Fetch urls | 124 | Fetch urls |
| 125 | """ | 125 | """ |
| 126 | 126 | ||
| 127 | (host,depot,user,pswd,parm) = Perforce.doparse(loc, d) | 127 | (host, depot, user, pswd, parm) = Perforce.doparse(loc, d) |
| 128 | 128 | ||
| 129 | if depot.find('/...') != -1: | 129 | if depot.find('/...') != -1: |
| 130 | path = depot[:depot.find('/...')] | 130 | path = depot[:depot.find('/...')] |
| @@ -164,10 +164,10 @@ class Perforce(Fetch): | |||
| 164 | raise FetchError(module) | 164 | raise FetchError(module) |
| 165 | 165 | ||
| 166 | if "label" in parm: | 166 | if "label" in parm: |
| 167 | depot = "%s@%s" % (depot,parm["label"]) | 167 | depot = "%s@%s" % (depot, parm["label"]) |
| 168 | else: | 168 | else: |
| 169 | cset = Perforce.getcset(d, depot, host, user, pswd, parm) | 169 | cset = Perforce.getcset(d, depot, host, user, pswd, parm) |
| 170 | depot = "%s@%s" % (depot,cset) | 170 | depot = "%s@%s" % (depot, cset) |
| 171 | 171 | ||
| 172 | os.chdir(tmpfile) | 172 | os.chdir(tmpfile) |
| 173 | bb.msg.note(1, bb.msg.domain.Fetcher, "Fetch " + loc) | 173 | bb.msg.note(1, bb.msg.domain.Fetcher, "Fetch " + loc) |
| @@ -189,7 +189,7 @@ class Perforce(Fetch): | |||
| 189 | dest = list[0][len(path)+1:] | 189 | dest = list[0][len(path)+1:] |
| 190 | where = dest.find("#") | 190 | where = dest.find("#") |
| 191 | 191 | ||
| 192 | os.system("%s%s print -o %s/%s %s" % (p4cmd, p4opt, module,dest[:where],list[0])) | 192 | os.system("%s%s print -o %s/%s %s" % (p4cmd, p4opt, module, dest[:where], list[0])) |
| 193 | count = count + 1 | 193 | count = count + 1 |
| 194 | 194 | ||
| 195 | if count == 0: | 195 | if count == 0: |
