summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-06-10 10:35:31 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2011-01-04 14:46:33 +0000
commitecc68fa4fbb579e97ea45156e79a293b073697a0 (patch)
tree6d08682e43476e37ccf48ee14c8d81e208d1c897 /bitbake/lib/bb/fetch
parentd3a45c7d41a88d79389fc40eb68816e4939fb6f9 (diff)
downloadpoky-ecc68fa4fbb579e97ea45156e79a293b073697a0.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 (Bitbake rev: 3b2c1fe5ca56daebb24073a9dd45723d3efd2a8d) 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')
-rw-r--r--bitbake/lib/bb/fetch/__init__.py35
-rw-r--r--bitbake/lib/bb/fetch/bzr.py13
-rw-r--r--bitbake/lib/bb/fetch/cvs.py13
-rw-r--r--bitbake/lib/bb/fetch/git.py9
-rw-r--r--bitbake/lib/bb/fetch/hg.py14
-rw-r--r--bitbake/lib/bb/fetch/local.py2
-rw-r--r--bitbake/lib/bb/fetch/osc.py11
-rw-r--r--bitbake/lib/bb/fetch/perforce.py18
-rw-r--r--bitbake/lib/bb/fetch/repo.py2
-rw-r--r--bitbake/lib/bb/fetch/svk.py10
-rw-r--r--bitbake/lib/bb/fetch/svn.py14
-rw-r--r--bitbake/lib/bb/fetch/wget.py13
12 files changed, 78 insertions, 76 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py
index 364bdffff1..40b0c699ab 100644
--- a/bitbake/lib/bb/fetch/__init__.py
+++ b/bitbake/lib/bb/fetch/__init__.py
@@ -27,10 +27,13 @@ BitBake build tools.
27from __future__ import absolute_import 27from __future__ import absolute_import
28from __future__ import print_function 28from __future__ import print_function
29import os, re 29import os, re
30import logging
30import bb 31import bb
31from bb import data 32from bb import data
32from bb import persist_data 33from bb import persist_data
33 34
35logger = logging.getLogger("BitBake.Fetch")
36
34class MalformedUrl(Exception): 37class MalformedUrl(Exception):
35 """Exception raised when encountering an invalid url""" 38 """Exception raised when encountering an invalid url"""
36 39
@@ -117,9 +120,8 @@ def encodeurl(decoded):
117 return url 120 return url
118 121
119def uri_replace(uri, uri_find, uri_replace, d): 122def uri_replace(uri, uri_find, uri_replace, d):
120# bb.msg.note(1, bb.msg.domain.Fetcher, "uri_replace: operating on %s" % uri)
121 if not uri or not uri_find or not uri_replace: 123 if not uri or not uri_find or not uri_replace:
122 bb.msg.debug(1, bb.msg.domain.Fetcher, "uri_replace: passed an undefined value, not replacing") 124 logger.debug(1, "uri_replace: passed an undefined value, not replacing")
123 uri_decoded = list(decodeurl(uri)) 125 uri_decoded = list(decodeurl(uri))
124 uri_find_decoded = list(decodeurl(uri_find)) 126 uri_find_decoded = list(decodeurl(uri_find))
125 uri_replace_decoded = list(decodeurl(uri_replace)) 127 uri_replace_decoded = list(decodeurl(uri_replace))
@@ -135,13 +137,8 @@ def uri_replace(uri, uri_find, uri_replace, d):
135 localfn = bb.fetch.localpath(uri, d) 137 localfn = bb.fetch.localpath(uri, d)
136 if localfn: 138 if localfn:
137 result_decoded[loc] = os.path.dirname(result_decoded[loc]) + "/" + os.path.basename(bb.fetch.localpath(uri, d)) 139 result_decoded[loc] = os.path.dirname(result_decoded[loc]) + "/" + os.path.basename(bb.fetch.localpath(uri, d))
138# bb.msg.note(1, bb.msg.domain.Fetcher, "uri_replace: matching %s against %s and replacing with %s" % (i, uri_decoded[loc], uri_replace_decoded[loc]))
139 else: 140 else:
140# bb.msg.note(1, bb.msg.domain.Fetcher, "uri_replace: no match")
141 return uri 141 return uri
142# else:
143# for j in i:
144# FIXME: apply replacements against options
145 return encodeurl(result_decoded) 142 return encodeurl(result_decoded)
146 143
147methods = [] 144methods = []
@@ -158,9 +155,9 @@ def fetcher_init(d):
158 # When to drop SCM head revisions controlled by user policy 155 # When to drop SCM head revisions controlled by user policy
159 srcrev_policy = bb.data.getVar('BB_SRCREV_POLICY', d, 1) or "clear" 156 srcrev_policy = bb.data.getVar('BB_SRCREV_POLICY', d, 1) or "clear"
160 if srcrev_policy == "cache": 157 if srcrev_policy == "cache":
161 bb.msg.debug(1, bb.msg.domain.Fetcher, "Keeping SRCREV cache due to cache policy of: %s" % srcrev_policy) 158 logger.debug(1, "Keeping SRCREV cache due to cache policy of: %s", srcrev_policy)
162 elif srcrev_policy == "clear": 159 elif srcrev_policy == "clear":
163 bb.msg.debug(1, bb.msg.domain.Fetcher, "Clearing SRCREV cache due to cache policy of: %s" % srcrev_policy) 160 logger.debug(1, "Clearing SRCREV cache due to cache policy of: %s", srcrev_policy)
164 try: 161 try:
165 bb.fetch.saved_headrevs = pd.getKeyValues("BB_URI_HEADREVS") 162 bb.fetch.saved_headrevs = pd.getKeyValues("BB_URI_HEADREVS")
166 except: 163 except:
@@ -190,11 +187,11 @@ def fetcher_compare_revisons(d):
190 changed = False 187 changed = False
191 for key in data: 188 for key in data:
192 if key not in data2 or data2[key] != data[key]: 189 if key not in data2 or data2[key] != data[key]:
193 bb.msg.debug(1, bb.msg.domain.Fetcher, "%s changed" % key) 190 logger.debug(1, "%s changed", key)
194 changed = True 191 changed = True
195 return True 192 return True
196 else: 193 else:
197 bb.msg.debug(2, bb.msg.domain.Fetcher, "%s did not change" % key) 194 logger.debug(2, "%s did not change", key)
198 return False 195 return False
199 196
200# Function call order is usually: 197# Function call order is usually:
@@ -334,7 +331,7 @@ def checkstatus(d, urls = None):
334 for u in urls: 331 for u in urls:
335 ud = urldata[u] 332 ud = urldata[u]
336 m = ud.method 333 m = ud.method
337 bb.msg.debug(1, bb.msg.domain.Fetcher, "Testing URL %s" % u) 334 logger.debug(1, "Testing URL %s" % u)
338 # First try checking uri, u, from PREMIRRORS 335 # First try checking uri, u, from PREMIRRORS
339 mirrors = mirror_from_string(bb.data.getVar('PREMIRRORS', d, True)) 336 mirrors = mirror_from_string(bb.data.getVar('PREMIRRORS', d, True))
340 ret = try_mirrors(d, u, mirrors, True) 337 ret = try_mirrors(d, u, mirrors, True)
@@ -398,7 +395,7 @@ def get_srcrev(d):
398 scms.append(u) 395 scms.append(u)
399 396
400 if len(scms) == 0: 397 if len(scms) == 0:
401 bb.msg.error(bb.msg.domain.Fetcher, "SRCREV was used yet no valid SCM was found in SRC_URI") 398 logger.error("SRCREV was used yet no valid SCM was found in SRC_URI")
402 raise ParameterError 399 raise ParameterError
403 400
404 if bb.data.getVar('BB_SRCREV_POLICY', d, True) != "cache": 401 if bb.data.getVar('BB_SRCREV_POLICY', d, True) != "cache":
@@ -412,7 +409,7 @@ def get_srcrev(d):
412 # 409 #
413 format = bb.data.getVar('SRCREV_FORMAT', d, 1) 410 format = bb.data.getVar('SRCREV_FORMAT', d, 1)
414 if not format: 411 if not format:
415 bb.msg.error(bb.msg.domain.Fetcher, "The SRCREV_FORMAT variable must be set when multiple SCMs are used.") 412 logger.error("The SRCREV_FORMAT variable must be set when multiple SCMs are used.")
416 raise ParameterError 413 raise ParameterError
417 414
418 for scm in scms: 415 for scm in scms:
@@ -454,7 +451,7 @@ def runfetchcmd(cmd, d, quiet = False):
454 if val: 451 if val:
455 cmd = 'export ' + var + '=\"%s\"; %s' % (val, cmd) 452 cmd = 'export ' + var + '=\"%s\"; %s' % (val, cmd)
456 453
457 bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % cmd) 454 logger.debug(1, "Running %s", cmd)
458 455
459 # redirect stderr to stdout 456 # redirect stderr to stdout
460 stdout_handle = os.popen(cmd + " 2>&1", "r") 457 stdout_handle = os.popen(cmd + " 2>&1", "r")
@@ -490,7 +487,7 @@ def try_mirrors(d, uri, mirrors, check = False, force = False):
490 """ 487 """
491 fpath = os.path.join(data.getVar("DL_DIR", d, 1), os.path.basename(uri)) 488 fpath = os.path.join(data.getVar("DL_DIR", d, 1), os.path.basename(uri))
492 if not check and os.access(fpath, os.R_OK) and not force: 489 if not check and os.access(fpath, os.R_OK) and not force:
493 bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists, skipping checkout." % fpath) 490 logger.debug(1, "%s already exists, skipping checkout." % fpath)
494 return fpath 491 return fpath
495 492
496 ld = d.createCopy() 493 ld = d.createCopy()
@@ -500,7 +497,7 @@ def try_mirrors(d, uri, mirrors, check = False, force = False):
500 try: 497 try:
501 ud = FetchData(newuri, ld) 498 ud = FetchData(newuri, ld)
502 except bb.fetch.NoMethodError: 499 except bb.fetch.NoMethodError:
503 bb.msg.debug(1, bb.msg.domain.Fetcher, "No method for %s" % uri) 500 logger.debug(1, "No method for %s", uri)
504 continue 501 continue
505 502
506 ud.setup_localpath(ld) 503 ud.setup_localpath(ld)
@@ -518,7 +515,7 @@ def try_mirrors(d, uri, mirrors, check = False, force = False):
518 bb.fetch.MD5SumError): 515 bb.fetch.MD5SumError):
519 import sys 516 import sys
520 (type, value, traceback) = sys.exc_info() 517 (type, value, traceback) = sys.exc_info()
521 bb.msg.debug(2, bb.msg.domain.Fetcher, "Mirror fetch failure: %s" % value) 518 logger.debug(2, "Mirror fetch failure: %s" % value)
522 removefile(ud.localpath) 519 removefile(ud.localpath)
523 continue 520 continue
524 return None 521 return None
@@ -654,7 +651,7 @@ class Fetch(object):
654 Check the status of a URL 651 Check the status of a URL
655 Assumes localpath was called first 652 Assumes localpath was called first
656 """ 653 """
657 bb.msg.note(1, bb.msg.domain.Fetcher, "URL %s could not be checked for status since no method exists." % url) 654 logger.info("URL %s could not be checked for status since no method exists.", url)
658 return True 655 return True
659 656
660 def getSRCDate(urldata, d): 657 def getSRCDate(urldata, d):
diff --git a/bitbake/lib/bb/fetch/bzr.py b/bitbake/lib/bb/fetch/bzr.py
index 813d7d8c80..8b0bd9ff3a 100644
--- a/bitbake/lib/bb/fetch/bzr.py
+++ b/bitbake/lib/bb/fetch/bzr.py
@@ -25,11 +25,10 @@ BitBake 'Fetch' implementation for bzr.
25 25
26import os 26import os
27import sys 27import sys
28import logging
28import bb 29import bb
29from bb import data 30from bb import data
30from bb.fetch import Fetch 31from bb.fetch import Fetch, FetchError, runfetchcmd, logger
31from bb.fetch import FetchError
32from bb.fetch import runfetchcmd
33 32
34class Bzr(Fetch): 33class Bzr(Fetch):
35 def supports(self, url, ud, d): 34 def supports(self, url, ud, d):
@@ -93,16 +92,16 @@ class Bzr(Fetch):
93 92
94 if os.access(os.path.join(ud.pkgdir, os.path.basename(ud.pkgdir), '.bzr'), os.R_OK): 93 if os.access(os.path.join(ud.pkgdir, os.path.basename(ud.pkgdir), '.bzr'), os.R_OK):
95 bzrcmd = self._buildbzrcommand(ud, d, "update") 94 bzrcmd = self._buildbzrcommand(ud, d, "update")
96 bb.msg.debug(1, bb.msg.domain.Fetcher, "BZR Update %s" % loc) 95 logger.debug(1, "BZR Update %s", loc)
97 os.chdir(os.path.join (ud.pkgdir, os.path.basename(ud.path))) 96 os.chdir(os.path.join (ud.pkgdir, os.path.basename(ud.path)))
98 runfetchcmd(bzrcmd, d) 97 runfetchcmd(bzrcmd, d)
99 else: 98 else:
100 os.system("rm -rf %s" % os.path.join(ud.pkgdir, os.path.basename(ud.pkgdir))) 99 os.system("rm -rf %s" % os.path.join(ud.pkgdir, os.path.basename(ud.pkgdir)))
101 bzrcmd = self._buildbzrcommand(ud, d, "fetch") 100 bzrcmd = self._buildbzrcommand(ud, d, "fetch")
102 bb.msg.debug(1, bb.msg.domain.Fetcher, "BZR Checkout %s" % loc) 101 logger.debug(1, "BZR Checkout %s", loc)
103 bb.mkdirhier(ud.pkgdir) 102 bb.mkdirhier(ud.pkgdir)
104 os.chdir(ud.pkgdir) 103 os.chdir(ud.pkgdir)
105 bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % bzrcmd) 104 logger.debug(1, "Running %s", bzrcmd)
106 runfetchcmd(bzrcmd, d) 105 runfetchcmd(bzrcmd, d)
107 106
108 os.chdir(ud.pkgdir) 107 os.chdir(ud.pkgdir)
@@ -130,7 +129,7 @@ class Bzr(Fetch):
130 """ 129 """
131 Return the latest upstream revision number 130 Return the latest upstream revision number
132 """ 131 """
133 bb.msg.debug(2, bb.msg.domain.Fetcher, "BZR fetcher hitting network for %s" % url) 132 logger.debug(2, "BZR fetcher hitting network for %s", url)
134 133
135 output = runfetchcmd(self._buildbzrcommand(ud, d, "revno"), d, True) 134 output = runfetchcmd(self._buildbzrcommand(ud, d, "revno"), d, True)
136 135
diff --git a/bitbake/lib/bb/fetch/cvs.py b/bitbake/lib/bb/fetch/cvs.py
index 61976f7ef4..1064b09e11 100644
--- a/bitbake/lib/bb/fetch/cvs.py
+++ b/bitbake/lib/bb/fetch/cvs.py
@@ -27,11 +27,10 @@ BitBake build tools.
27# 27#
28 28
29import os 29import os
30import logging
30import bb 31import bb
31from bb import data 32from bb import data
32from bb.fetch import Fetch 33from bb.fetch import Fetch, FetchError, MissingParameterError, logger
33from bb.fetch import FetchError
34from bb.fetch import MissingParameterError
35 34
36class Cvs(Fetch): 35class Cvs(Fetch):
37 """ 36 """
@@ -136,21 +135,21 @@ class Cvs(Fetch):
136 cvsupdatecmd = "CVS_RSH=\"%s\" %s" % (cvs_rsh, cvsupdatecmd) 135 cvsupdatecmd = "CVS_RSH=\"%s\" %s" % (cvs_rsh, cvsupdatecmd)
137 136
138 # create module directory 137 # create module directory
139 bb.msg.debug(2, bb.msg.domain.Fetcher, "Fetch: checking for module directory") 138 logger.debug(2, "Fetch: checking for module directory")
140 pkg = data.expand('${PN}', d) 139 pkg = data.expand('${PN}', d)
141 pkgdir = os.path.join(data.expand('${CVSDIR}', localdata), pkg) 140 pkgdir = os.path.join(data.expand('${CVSDIR}', localdata), pkg)
142 moddir = os.path.join(pkgdir, localdir) 141 moddir = os.path.join(pkgdir, localdir)
143 if os.access(os.path.join(moddir, 'CVS'), os.R_OK): 142 if os.access(os.path.join(moddir, 'CVS'), os.R_OK):
144 bb.msg.note(1, bb.msg.domain.Fetcher, "Update " + loc) 143 logger.info("Update " + loc)
145 # update sources there 144 # update sources there
146 os.chdir(moddir) 145 os.chdir(moddir)
147 myret = os.system(cvsupdatecmd) 146 myret = os.system(cvsupdatecmd)
148 else: 147 else:
149 bb.msg.note(1, bb.msg.domain.Fetcher, "Fetch " + loc) 148 logger.info("Fetch " + loc)
150 # check out sources there 149 # check out sources there
151 bb.mkdirhier(pkgdir) 150 bb.mkdirhier(pkgdir)
152 os.chdir(pkgdir) 151 os.chdir(pkgdir)
153 bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % cvscmd) 152 logger.debug(1, "Running %s", cvscmd)
154 myret = os.system(cvscmd) 153 myret = os.system(cvscmd)
155 154
156 if myret != 0 or not os.access(moddir, os.R_OK): 155 if myret != 0 or not os.access(moddir, os.R_OK):
diff --git a/bitbake/lib/bb/fetch/git.py b/bitbake/lib/bb/fetch/git.py
index 9bd447ff8b..57d758dcda 100644
--- a/bitbake/lib/bb/fetch/git.py
+++ b/bitbake/lib/bb/fetch/git.py
@@ -25,6 +25,7 @@ import bb
25from bb import data 25from bb import data
26from bb.fetch import Fetch 26from bb.fetch import Fetch
27from bb.fetch import runfetchcmd 27from bb.fetch import runfetchcmd
28from bb.fetch import logger
28 29
29class Git(Fetch): 30class Git(Fetch):
30 """Class to fetch a module or modules from git repositories""" 31 """Class to fetch a module or modules from git repositories"""
@@ -153,7 +154,7 @@ class Git(Fetch):
153 os.chdir(ud.clonedir) 154 os.chdir(ud.clonedir)
154 mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) 155 mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True)
155 if mirror_tarballs != "0" or 'fullclone' in ud.parm: 156 if mirror_tarballs != "0" or 'fullclone' in ud.parm:
156 bb.msg.note(1, bb.msg.domain.Fetcher, "Creating tarball of git repository") 157 logger.info("Creating tarball of git repository")
157 runfetchcmd("tar -czf %s %s" % (repofile, os.path.join(".", ".git", "*") ), d) 158 runfetchcmd("tar -czf %s %s" % (repofile, os.path.join(".", ".git", "*") ), d)
158 159
159 if 'fullclone' in ud.parm: 160 if 'fullclone' in ud.parm:
@@ -185,7 +186,7 @@ class Git(Fetch):
185 runfetchcmd("%s checkout-index -q -f --prefix=%s -a" % (ud.basecmd, coprefix), d) 186 runfetchcmd("%s checkout-index -q -f --prefix=%s -a" % (ud.basecmd, coprefix), d)
186 187
187 os.chdir(codir) 188 os.chdir(codir)
188 bb.msg.note(1, bb.msg.domain.Fetcher, "Creating tarball of git checkout") 189 logger.info("Creating tarball of git checkout")
189 runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d) 190 runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d)
190 191
191 os.chdir(ud.clonedir) 192 os.chdir(ud.clonedir)
@@ -238,7 +239,7 @@ class Git(Fetch):
238 print("no repo") 239 print("no repo")
239 self.go(None, ud, d) 240 self.go(None, ud, d)
240 if not os.path.exists(ud.clonedir): 241 if not os.path.exists(ud.clonedir):
241 bb.msg.error(bb.msg.domain.Fetcher, "GIT repository for %s doesn't exist in %s, cannot get sortable buildnumber, using old value" % (url, ud.clonedir)) 242 logger.error("GIT repository for %s doesn't exist in %s, cannot get sortable buildnumber, using old value", url, ud.clonedir)
242 return None 243 return None
243 244
244 245
@@ -250,5 +251,5 @@ class Git(Fetch):
250 os.chdir(cwd) 251 os.chdir(cwd)
251 252
252 buildindex = "%s" % output.split()[0] 253 buildindex = "%s" % output.split()[0]
253 bb.msg.debug(1, bb.msg.domain.Fetcher, "GIT repository for %s in %s is returning %s revisions in rev-list before %s" % (url, ud.clonedir, buildindex, rev)) 254 logger.debug(1, "GIT repository for %s in %s is returning %s revisions in rev-list before %s", url, ud.clonedir, buildindex, rev)
254 return buildindex 255 return buildindex
diff --git a/bitbake/lib/bb/fetch/hg.py b/bitbake/lib/bb/fetch/hg.py
index efb3b5c76d..ab00d43033 100644
--- a/bitbake/lib/bb/fetch/hg.py
+++ b/bitbake/lib/bb/fetch/hg.py
@@ -26,12 +26,14 @@ BitBake 'Fetch' implementation for mercurial DRCS (hg).
26 26
27import os 27import os
28import sys 28import sys
29import logging
29import bb 30import bb
30from bb import data 31from bb import data
31from bb.fetch import Fetch 32from bb.fetch import Fetch
32from bb.fetch import FetchError 33from bb.fetch import FetchError
33from bb.fetch import MissingParameterError 34from bb.fetch import MissingParameterError
34from bb.fetch import runfetchcmd 35from bb.fetch import runfetchcmd
36from bb.fetch import logger
35 37
36class Hg(Fetch): 38class Hg(Fetch):
37 """Class to fetch a from mercurial repositories""" 39 """Class to fetch a from mercurial repositories"""
@@ -116,29 +118,29 @@ class Hg(Fetch):
116 def go(self, loc, ud, d): 118 def go(self, loc, ud, d):
117 """Fetch url""" 119 """Fetch url"""
118 120
119 bb.msg.debug(2, bb.msg.domain.Fetcher, "Fetch: checking for module directory '" + ud.moddir + "'") 121 logger.debug(2, "Fetch: checking for module directory '" + ud.moddir + "'")
120 122
121 if os.access(os.path.join(ud.moddir, '.hg'), os.R_OK): 123 if os.access(os.path.join(ud.moddir, '.hg'), os.R_OK):
122 updatecmd = self._buildhgcommand(ud, d, "pull") 124 updatecmd = self._buildhgcommand(ud, d, "pull")
123 bb.msg.note(1, bb.msg.domain.Fetcher, "Update " + loc) 125 logger.info("Update " + loc)
124 # update sources there 126 # update sources there
125 os.chdir(ud.moddir) 127 os.chdir(ud.moddir)
126 bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % updatecmd) 128 logger.debug(1, "Running %s", updatecmd)
127 runfetchcmd(updatecmd, d) 129 runfetchcmd(updatecmd, d)
128 130
129 else: 131 else:
130 fetchcmd = self._buildhgcommand(ud, d, "fetch") 132 fetchcmd = self._buildhgcommand(ud, d, "fetch")
131 bb.msg.note(1, bb.msg.domain.Fetcher, "Fetch " + loc) 133 logger.info("Fetch " + loc)
132 # check out sources there 134 # check out sources there
133 bb.mkdirhier(ud.pkgdir) 135 bb.mkdirhier(ud.pkgdir)
134 os.chdir(ud.pkgdir) 136 os.chdir(ud.pkgdir)
135 bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % fetchcmd) 137 logger.debug(1, "Running %s", fetchcmd)
136 runfetchcmd(fetchcmd, d) 138 runfetchcmd(fetchcmd, d)
137 139
138 # Even when we clone (fetch), we still need to update as hg's clone 140 # Even when we clone (fetch), we still need to update as hg's clone
139 # won't checkout the specified revision if its on a branch 141 # won't checkout the specified revision if its on a branch
140 updatecmd = self._buildhgcommand(ud, d, "update") 142 updatecmd = self._buildhgcommand(ud, d, "update")
141 bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % updatecmd) 143 logger.debug(1, "Running %s", updatecmd)
142 runfetchcmd(updatecmd, d) 144 runfetchcmd(updatecmd, d)
143 145
144 os.chdir(ud.pkgdir) 146 os.chdir(ud.pkgdir)
diff --git a/bitbake/lib/bb/fetch/local.py b/bitbake/lib/bb/fetch/local.py
index 882a2c4602..6aa9e45768 100644
--- a/bitbake/lib/bb/fetch/local.py
+++ b/bitbake/lib/bb/fetch/local.py
@@ -66,7 +66,7 @@ class Local(Fetch):
66 Check the status of the url 66 Check the status of the url
67 """ 67 """
68 if urldata.localpath.find("*") != -1: 68 if urldata.localpath.find("*") != -1:
69 bb.msg.note(1, bb.msg.domain.Fetcher, "URL %s looks like a glob and was therefore not checked." % url) 69 logger.info("URL %s looks like a glob and was therefore not checked.", url)
70 return True 70 return True
71 if os.path.exists(urldata.localpath): 71 if os.path.exists(urldata.localpath):
72 return True 72 return True
diff --git a/bitbake/lib/bb/fetch/osc.py b/bitbake/lib/bb/fetch/osc.py
index ed773939b0..6fcb344ce0 100644
--- a/bitbake/lib/bb/fetch/osc.py
+++ b/bitbake/lib/bb/fetch/osc.py
@@ -8,6 +8,7 @@ Based on the svn "Fetch" implementation.
8 8
9import os 9import os
10import sys 10import sys
11import logging
11import bb 12import bb
12from bb import data 13from bb import data
13from bb.fetch import Fetch 14from bb.fetch import Fetch
@@ -91,22 +92,22 @@ class Osc(Fetch):
91 Fetch url 92 Fetch url
92 """ 93 """
93 94
94 bb.msg.debug(2, bb.msg.domain.Fetcher, "Fetch: checking for module directory '" + ud.moddir + "'") 95 logger.debug(2, "Fetch: checking for module directory '" + ud.moddir + "'")
95 96
96 if os.access(os.path.join(data.expand('${OSCDIR}', d), ud.path, ud.module), os.R_OK): 97 if os.access(os.path.join(data.expand('${OSCDIR}', d), ud.path, ud.module), os.R_OK):
97 oscupdatecmd = self._buildosccommand(ud, d, "update") 98 oscupdatecmd = self._buildosccommand(ud, d, "update")
98 bb.msg.note(1, bb.msg.domain.Fetcher, "Update "+ loc) 99 logger.info("Update "+ loc)
99 # update sources there 100 # update sources there
100 os.chdir(ud.moddir) 101 os.chdir(ud.moddir)
101 bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % oscupdatecmd) 102 logger.debug(1, "Running %s", oscupdatecmd)
102 runfetchcmd(oscupdatecmd, d) 103 runfetchcmd(oscupdatecmd, d)
103 else: 104 else:
104 oscfetchcmd = self._buildosccommand(ud, d, "fetch") 105 oscfetchcmd = self._buildosccommand(ud, d, "fetch")
105 bb.msg.note(1, bb.msg.domain.Fetcher, "Fetch " + loc) 106 logger.info("Fetch " + loc)
106 # check out sources there 107 # check out sources there
107 bb.mkdirhier(ud.pkgdir) 108 bb.mkdirhier(ud.pkgdir)
108 os.chdir(ud.pkgdir) 109 os.chdir(ud.pkgdir)
109 bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % oscfetchcmd) 110 logger.debug(1, "Running %s", oscfetchcmd)
110 runfetchcmd(oscfetchcmd, d) 111 runfetchcmd(oscfetchcmd, d)
111 112
112 os.chdir(os.path.join(ud.pkgdir + ud.path)) 113 os.chdir(os.path.join(ud.pkgdir + ud.path))
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
28from future_builtins import zip 28from future_builtins import zip
29import os 29import os
30import logging
30import bb 31import bb
31from bb import data 32from bb import data
32from bb.fetch import Fetch 33from bb.fetch import Fetch
33from bb.fetch import FetchError 34from bb.fetch import FetchError
35from bb.fetch import logger
34 36
35class Perforce(Fetch): 37class 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))
diff --git a/bitbake/lib/bb/fetch/repo.py b/bitbake/lib/bb/fetch/repo.py
index 883310b019..4794796814 100644
--- a/bitbake/lib/bb/fetch/repo.py
+++ b/bitbake/lib/bb/fetch/repo.py
@@ -72,7 +72,7 @@ class Repo(Fetch):
72 """Fetch url""" 72 """Fetch url"""
73 73
74 if os.access(os.path.join(data.getVar("DL_DIR", d, True), ud.localfile), os.R_OK): 74 if os.access(os.path.join(data.getVar("DL_DIR", d, True), ud.localfile), os.R_OK):
75 bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists (or was stashed). Skipping repo init / sync." % ud.localpath) 75 logger.debug(1, "%s already exists (or was stashed). Skipping repo init / sync.", ud.localpath)
76 return 76 return
77 77
78 gitsrcname = "%s%s" % (ud.host, ud.path.replace("/", ".")) 78 gitsrcname = "%s%s" % (ud.host, ud.path.replace("/", "."))
diff --git a/bitbake/lib/bb/fetch/svk.py b/bitbake/lib/bb/fetch/svk.py
index a17ac04d21..2754971eba 100644
--- a/bitbake/lib/bb/fetch/svk.py
+++ b/bitbake/lib/bb/fetch/svk.py
@@ -26,11 +26,13 @@ This implementation is for svk. It is based on the svn implementation
26# Based on functions from the base bb module, Copyright 2003 Holger Schurig 26# Based on functions from the base bb module, Copyright 2003 Holger Schurig
27 27
28import os 28import os
29import logging
29import bb 30import bb
30from bb import data 31from bb import data
31from bb.fetch import Fetch 32from bb.fetch import Fetch
32from bb.fetch import FetchError 33from bb.fetch import FetchError
33from bb.fetch import MissingParameterError 34from bb.fetch import MissingParameterError
35from bb.fetch import logger
34 36
35class Svk(Fetch): 37class Svk(Fetch):
36 """Class to fetch a module or modules from svk repositories""" 38 """Class to fetch a module or modules from svk repositories"""
@@ -72,19 +74,19 @@ class Svk(Fetch):
72 # create temp directory 74 # create temp directory
73 localdata = data.createCopy(d) 75 localdata = data.createCopy(d)
74 data.update_data(localdata) 76 data.update_data(localdata)
75 bb.msg.debug(2, bb.msg.domain.Fetcher, "Fetch: creating temporary directory") 77 logger.debug(2, "Fetch: creating temporary directory")
76 bb.mkdirhier(data.expand('${WORKDIR}', localdata)) 78 bb.mkdirhier(data.expand('${WORKDIR}', localdata))
77 data.setVar('TMPBASE', data.expand('${WORKDIR}/oesvk.XXXXXX', localdata), localdata) 79 data.setVar('TMPBASE', data.expand('${WORKDIR}/oesvk.XXXXXX', localdata), localdata)
78 tmppipe = os.popen(data.getVar('MKTEMPDIRCMD', localdata, 1) or "false") 80 tmppipe = os.popen(data.getVar('MKTEMPDIRCMD', localdata, 1) or "false")
79 tmpfile = tmppipe.readline().strip() 81 tmpfile = tmppipe.readline().strip()
80 if not tmpfile: 82 if not tmpfile:
81 bb.msg.error(bb.msg.domain.Fetcher, "Fetch: unable to create temporary directory.. make sure 'mktemp' is in the PATH.") 83 logger.error("Fetch: unable to create temporary directory.. make sure 'mktemp' is in the PATH.")
82 raise FetchError(ud.module) 84 raise FetchError(ud.module)
83 85
84 # check out sources there 86 # check out sources there
85 os.chdir(tmpfile) 87 os.chdir(tmpfile)
86 bb.msg.note(1, bb.msg.domain.Fetcher, "Fetch " + loc) 88 logger.info("Fetch " + loc)
87 bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % svkcmd) 89 logger.debug(1, "Running %s", svkcmd)
88 myret = os.system(svkcmd) 90 myret = os.system(svkcmd)
89 if myret != 0: 91 if myret != 0:
90 try: 92 try:
diff --git a/bitbake/lib/bb/fetch/svn.py b/bitbake/lib/bb/fetch/svn.py
index 375e8df055..34f8132257 100644
--- a/bitbake/lib/bb/fetch/svn.py
+++ b/bitbake/lib/bb/fetch/svn.py
@@ -25,12 +25,14 @@ BitBake 'Fetch' implementation for svn.
25 25
26import os 26import os
27import sys 27import sys
28import logging
28import bb 29import bb
29from bb import data 30from bb import data
30from bb.fetch import Fetch 31from bb.fetch import Fetch
31from bb.fetch import FetchError 32from bb.fetch import FetchError
32from bb.fetch import MissingParameterError 33from bb.fetch import MissingParameterError
33from bb.fetch import runfetchcmd 34from bb.fetch import runfetchcmd
35from bb.fetch import logger
34 36
35class Svn(Fetch): 37class Svn(Fetch):
36 """Class to fetch a module or modules from svn repositories""" 38 """Class to fetch a module or modules from svn repositories"""
@@ -136,22 +138,22 @@ class Svn(Fetch):
136 def go(self, loc, ud, d): 138 def go(self, loc, ud, d):
137 """Fetch url""" 139 """Fetch url"""
138 140
139 bb.msg.debug(2, bb.msg.domain.Fetcher, "Fetch: checking for module directory '" + ud.moddir + "'") 141 logger.debug(2, "Fetch: checking for module directory '" + ud.moddir + "'")
140 142
141 if os.access(os.path.join(ud.moddir, '.svn'), os.R_OK): 143 if os.access(os.path.join(ud.moddir, '.svn'), os.R_OK):
142 svnupdatecmd = self._buildsvncommand(ud, d, "update") 144 svnupdatecmd = self._buildsvncommand(ud, d, "update")
143 bb.msg.note(1, bb.msg.domain.Fetcher, "Update " + loc) 145 logger.info("Update " + loc)
144 # update sources there 146 # update sources there
145 os.chdir(ud.moddir) 147 os.chdir(ud.moddir)
146 bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % svnupdatecmd) 148 logger.debug(1, "Running %s", svnupdatecmd)
147 runfetchcmd(svnupdatecmd, d) 149 runfetchcmd(svnupdatecmd, d)
148 else: 150 else:
149 svnfetchcmd = self._buildsvncommand(ud, d, "fetch") 151 svnfetchcmd = self._buildsvncommand(ud, d, "fetch")
150 bb.msg.note(1, bb.msg.domain.Fetcher, "Fetch " + loc) 152 logger.info("Fetch " + loc)
151 # check out sources there 153 # check out sources there
152 bb.mkdirhier(ud.pkgdir) 154 bb.mkdirhier(ud.pkgdir)
153 os.chdir(ud.pkgdir) 155 os.chdir(ud.pkgdir)
154 bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % svnfetchcmd) 156 logger.debug(1, "Running %s", svnfetchcmd)
155 runfetchcmd(svnfetchcmd, d) 157 runfetchcmd(svnfetchcmd, d)
156 158
157 os.chdir(ud.pkgdir) 159 os.chdir(ud.pkgdir)
@@ -179,7 +181,7 @@ class Svn(Fetch):
179 """ 181 """
180 Return the latest upstream revision number 182 Return the latest upstream revision number
181 """ 183 """
182 bb.msg.debug(2, bb.msg.domain.Fetcher, "SVN fetcher hitting network for %s" % url) 184 logger.debug(2, "SVN fetcher hitting network for %s", url)
183 185
184 output = runfetchcmd("LANG=C LC_ALL=C " + self._buildsvncommand(ud, d, "info"), d, True) 186 output = runfetchcmd("LANG=C LC_ALL=C " + self._buildsvncommand(ud, d, "info"), d, True)
185 187
diff --git a/bitbake/lib/bb/fetch/wget.py b/bitbake/lib/bb/fetch/wget.py
index 18503a03f7..4d4bdfd493 100644
--- a/bitbake/lib/bb/fetch/wget.py
+++ b/bitbake/lib/bb/fetch/wget.py
@@ -26,13 +26,11 @@ BitBake build tools.
26# Based on functions from the base bb module, Copyright 2003 Holger Schurig 26# Based on functions from the base bb module, Copyright 2003 Holger Schurig
27 27
28import os 28import os
29import logging
29import bb 30import bb
30import urllib 31import urllib
31from bb import data 32from bb import data
32from bb.fetch import Fetch 33from bb.fetch import Fetch, FetchError, encodeurl, decodeurl, logger, runfetchcmd
33from bb.fetch import FetchError
34from bb.fetch import encodeurl, decodeurl
35from bb.fetch import runfetchcmd
36 34
37class Wget(Fetch): 35class Wget(Fetch):
38 """Class to fetch urls via 'wget'""" 36 """Class to fetch urls via 'wget'"""
@@ -69,15 +67,14 @@ class Wget(Fetch):
69 67
70 fetchcmd = fetchcmd.replace("${URI}", uri.split(";")[0]) 68 fetchcmd = fetchcmd.replace("${URI}", uri.split(";")[0])
71 fetchcmd = fetchcmd.replace("${FILE}", ud.basename) 69 fetchcmd = fetchcmd.replace("${FILE}", ud.basename)
72 70 logger.info("fetch " + uri)
73 bb.msg.note(1, bb.msg.domain.Fetcher, "fetch " + uri) 71 logger.debug(2, "executing " + fetchcmd)
74 bb.msg.debug(2, bb.msg.domain.Fetcher, "executing " + fetchcmd)
75 runfetchcmd(fetchcmd, d) 72 runfetchcmd(fetchcmd, d)
76 73
77 # Sanity check since wget can pretend it succeed when it didn't 74 # Sanity check since wget can pretend it succeed when it didn't
78 # Also, this used to happen if sourceforge sent us to the mirror page 75 # Also, this used to happen if sourceforge sent us to the mirror page
79 if not os.path.exists(ud.localpath) and not checkonly: 76 if not os.path.exists(ud.localpath) and not checkonly:
80 bb.msg.debug(2, bb.msg.domain.Fetcher, "The fetch command for %s returned success but %s doesn't exist?..." % (uri, ud.localpath)) 77 logger.debug(2, "The fetch command for %s returned success but %s doesn't exist?...", uri, ud.localpath)
81 return False 78 return False
82 79
83 return True 80 return True