summaryrefslogtreecommitdiffstats
path: root/lib/bb/fetch/perforce.py
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-06-10 10:35:31 -0700
committerChris Larson <chris_larson@mentor.com>2010-09-03 18:51:54 -0700
commit3b2c1fe5ca56daebb24073a9dd45723d3efd2a8d (patch)
tree1f77ebed5e5f48fd786286a51dd697113cb7ea28 /lib/bb/fetch/perforce.py
parentc23c015cf8af1868faf293b19b80a5faf7e736a5 (diff)
downloadbitbake-3b2c1fe5ca56daebb24073a9dd45723d3efd2a8d.tar.gz
Switch bitbake internals to use logging directly rather than bb.msg
We use a custom Logger subclass for our loggers This logger provides: - 'debug' method which accepts a debug level - 'plain' method which bypasses log formatting - 'verbose' method which is more detail than info, but less than debug Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'lib/bb/fetch/perforce.py')
-rw-r--r--lib/bb/fetch/perforce.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/bb/fetch/perforce.py b/lib/bb/fetch/perforce.py
index 1c74cff34..6f68d8561 100644
--- a/lib/bb/fetch/perforce.py
+++ b/lib/bb/fetch/perforce.py
@@ -27,10 +27,12 @@ BitBake build tools.
from future_builtins import zip
import os
+import logging
import bb
from bb import data
from bb.fetch import Fetch
from bb.fetch import FetchError
+from bb.fetch import logger
class Perforce(Fetch):
def supports(self, url, ud, d):
@@ -86,10 +88,10 @@ class Perforce(Fetch):
depot += "@%s" % (p4date)
p4cmd = data.getVar('FETCHCOMMAND_p4', d, 1)
- bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s%s changes -m 1 %s" % (p4cmd, p4opt, depot))
+ logger.debug(1, "Running %s%s changes -m 1 %s", p4cmd, p4opt, depot)
p4file = os.popen("%s%s changes -m 1 %s" % (p4cmd, p4opt, depot))
cset = p4file.readline().strip()
- bb.msg.debug(1, bb.msg.domain.Fetcher, "READ %s" % (cset))
+ logger.debug(1, "READ %s", cset)
if not cset:
return -1
@@ -155,13 +157,13 @@ class Perforce(Fetch):
p4cmd = data.getVar('FETCHCOMMAND', localdata, 1)
# create temp directory
- bb.msg.debug(2, bb.msg.domain.Fetcher, "Fetch: creating temporary directory")
+ logger.debug(2, "Fetch: creating temporary directory")
bb.mkdirhier(data.expand('${WORKDIR}', localdata))
data.setVar('TMPBASE', data.expand('${WORKDIR}/oep4.XXXXXX', localdata), localdata)
tmppipe = os.popen(data.getVar('MKTEMPDIRCMD', localdata, 1) or "false")
tmpfile = tmppipe.readline().strip()
if not tmpfile:
- bb.msg.error(bb.msg.domain.Fetcher, "Fetch: unable to create temporary directory.. make sure 'mktemp' is in the PATH.")
+ logger.error("Fetch: unable to create temporary directory.. make sure 'mktemp' is in the PATH.")
raise FetchError(module)
if "label" in parm:
@@ -171,12 +173,12 @@ class Perforce(Fetch):
depot = "%s@%s" % (depot, cset)
os.chdir(tmpfile)
- bb.msg.note(1, bb.msg.domain.Fetcher, "Fetch " + loc)
- bb.msg.note(1, bb.msg.domain.Fetcher, "%s%s files %s" % (p4cmd, p4opt, depot))
+ logger.info("Fetch " + loc)
+ logger.info("%s%s files %s", p4cmd, p4opt, depot)
p4file = os.popen("%s%s files %s" % (p4cmd, p4opt, depot))
if not p4file:
- bb.msg.error(bb.msg.domain.Fetcher, "Fetch: unable to get the P4 files from %s" % (depot))
+ logger.error("Fetch: unable to get the P4 files from %s", depot)
raise FetchError(module)
count = 0
@@ -194,7 +196,7 @@ class Perforce(Fetch):
count = count + 1
if count == 0:
- bb.msg.error(bb.msg.domain.Fetcher, "Fetch: No files gathered from the P4 fetch")
+ logger.error("Fetch: No files gathered from the P4 fetch")
raise FetchError(module)
myret = os.system("tar -czf %s %s" % (ud.localpath, module))