diff options
Diffstat (limited to 'bitbake/lib/bb/fetch/perforce.py')
| -rw-r--r-- | bitbake/lib/bb/fetch/perforce.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/bitbake/lib/bb/fetch/perforce.py b/bitbake/lib/bb/fetch/perforce.py index 1c74cff349..6f68d85614 100644 --- a/bitbake/lib/bb/fetch/perforce.py +++ b/bitbake/lib/bb/fetch/perforce.py | |||
| @@ -27,10 +27,12 @@ BitBake build tools. | |||
| 27 | 27 | ||
| 28 | from future_builtins import zip | 28 | from future_builtins import zip |
| 29 | import os | 29 | import os |
| 30 | import logging | ||
| 30 | import bb | 31 | import bb |
| 31 | from bb import data | 32 | from bb import data |
| 32 | from bb.fetch import Fetch | 33 | from bb.fetch import Fetch |
| 33 | from bb.fetch import FetchError | 34 | from bb.fetch import FetchError |
| 35 | from bb.fetch import logger | ||
| 34 | 36 | ||
| 35 | class Perforce(Fetch): | 37 | class Perforce(Fetch): |
| 36 | def supports(self, url, ud, d): | 38 | def supports(self, url, ud, d): |
| @@ -86,10 +88,10 @@ class Perforce(Fetch): | |||
| 86 | depot += "@%s" % (p4date) | 88 | depot += "@%s" % (p4date) |
| 87 | 89 | ||
| 88 | p4cmd = data.getVar('FETCHCOMMAND_p4', d, 1) | 90 | p4cmd = data.getVar('FETCHCOMMAND_p4', d, 1) |
| 89 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s%s changes -m 1 %s" % (p4cmd, p4opt, depot)) | 91 | logger.debug(1, "Running %s%s changes -m 1 %s", p4cmd, p4opt, depot) |
| 90 | p4file = os.popen("%s%s changes -m 1 %s" % (p4cmd, p4opt, depot)) | 92 | p4file = os.popen("%s%s changes -m 1 %s" % (p4cmd, p4opt, depot)) |
| 91 | cset = p4file.readline().strip() | 93 | cset = p4file.readline().strip() |
| 92 | bb.msg.debug(1, bb.msg.domain.Fetcher, "READ %s" % (cset)) | 94 | logger.debug(1, "READ %s", cset) |
| 93 | if not cset: | 95 | if not cset: |
| 94 | return -1 | 96 | return -1 |
| 95 | 97 | ||
| @@ -155,13 +157,13 @@ class Perforce(Fetch): | |||
| 155 | p4cmd = data.getVar('FETCHCOMMAND', localdata, 1) | 157 | p4cmd = data.getVar('FETCHCOMMAND', localdata, 1) |
| 156 | 158 | ||
| 157 | # create temp directory | 159 | # create temp directory |
| 158 | bb.msg.debug(2, bb.msg.domain.Fetcher, "Fetch: creating temporary directory") | 160 | logger.debug(2, "Fetch: creating temporary directory") |
| 159 | bb.mkdirhier(data.expand('${WORKDIR}', localdata)) | 161 | bb.mkdirhier(data.expand('${WORKDIR}', localdata)) |
| 160 | data.setVar('TMPBASE', data.expand('${WORKDIR}/oep4.XXXXXX', localdata), localdata) | 162 | data.setVar('TMPBASE', data.expand('${WORKDIR}/oep4.XXXXXX', localdata), localdata) |
| 161 | tmppipe = os.popen(data.getVar('MKTEMPDIRCMD', localdata, 1) or "false") | 163 | tmppipe = os.popen(data.getVar('MKTEMPDIRCMD', localdata, 1) or "false") |
| 162 | tmpfile = tmppipe.readline().strip() | 164 | tmpfile = tmppipe.readline().strip() |
| 163 | if not tmpfile: | 165 | if not tmpfile: |
| 164 | bb.msg.error(bb.msg.domain.Fetcher, "Fetch: unable to create temporary directory.. make sure 'mktemp' is in the PATH.") | 166 | logger.error("Fetch: unable to create temporary directory.. make sure 'mktemp' is in the PATH.") |
| 165 | raise FetchError(module) | 167 | raise FetchError(module) |
| 166 | 168 | ||
| 167 | if "label" in parm: | 169 | if "label" in parm: |
| @@ -171,12 +173,12 @@ class Perforce(Fetch): | |||
| 171 | depot = "%s@%s" % (depot, cset) | 173 | depot = "%s@%s" % (depot, cset) |
| 172 | 174 | ||
| 173 | os.chdir(tmpfile) | 175 | os.chdir(tmpfile) |
| 174 | bb.msg.note(1, bb.msg.domain.Fetcher, "Fetch " + loc) | 176 | logger.info("Fetch " + loc) |
| 175 | bb.msg.note(1, bb.msg.domain.Fetcher, "%s%s files %s" % (p4cmd, p4opt, depot)) | 177 | logger.info("%s%s files %s", p4cmd, p4opt, depot) |
| 176 | p4file = os.popen("%s%s files %s" % (p4cmd, p4opt, depot)) | 178 | p4file = os.popen("%s%s files %s" % (p4cmd, p4opt, depot)) |
| 177 | 179 | ||
| 178 | if not p4file: | 180 | if not p4file: |
| 179 | bb.msg.error(bb.msg.domain.Fetcher, "Fetch: unable to get the P4 files from %s" % (depot)) | 181 | logger.error("Fetch: unable to get the P4 files from %s", depot) |
| 180 | raise FetchError(module) | 182 | raise FetchError(module) |
| 181 | 183 | ||
| 182 | count = 0 | 184 | count = 0 |
| @@ -194,7 +196,7 @@ class Perforce(Fetch): | |||
| 194 | count = count + 1 | 196 | count = count + 1 |
| 195 | 197 | ||
| 196 | if count == 0: | 198 | if count == 0: |
| 197 | bb.msg.error(bb.msg.domain.Fetcher, "Fetch: No files gathered from the P4 fetch") | 199 | logger.error("Fetch: No files gathered from the P4 fetch") |
| 198 | raise FetchError(module) | 200 | raise FetchError(module) |
| 199 | 201 | ||
| 200 | myret = os.system("tar -czf %s %s" % (ud.localpath, module)) | 202 | myret = os.system("tar -czf %s %s" % (ud.localpath, module)) |
